Entity:loadList / Object Generation Question
Posted: Wed Jun 09, 2010 9:44 pm
I'm trying to auto-generate items based on material and type, such as:
as the equivalent of 9 newEntity blocks.
So I've modeled a Material and EquipType classes after the DamageType class. To have the classes be recognized at item generation time, I'm guessing that you'd have to add them here (line 238), in Entity:loadList, similar to the DamageType line:
I was thinking of redefining loadList in mod.class.Object. However, the loadList function references the entities_load_functions class local variable, so I can't think of a decent way to actually subclass it. Right now, the only solution I can think of is to copy over the entire Entity class, and every subclass as mod local classes, just to add one or two lines inside of that function. Can anybody else think of a better way?
Code: Select all
generate({"IRON", "STEEL", "MYTHRIL"}, {"KNIFE", "SWORD", "AXE"})
So I've modeled a Material and EquipType classes after the DamageType class. To have the classes be recognized at item generation time, I'm guessing that you'd have to add them here (line 238), in Entity:loadList, similar to the DamageType line:
Code: Select all
setfenv(f, setmetatable({
resolvers = resolvers,
DamageType = require "engine.DamageType",
newEntity = function(t)