Creature: callback fixes
This commit is contained in:
@@ -55,7 +55,7 @@ function Creature:new(entityDef)
|
|||||||
|
|
||||||
-- We rewrite the entity initialization function so that custom fields
|
-- We rewrite the entity initialization function so that custom fields
|
||||||
-- can be passed to it directly via `core.add_entity(pos, name, [staticdata])`.
|
-- can be passed to it directly via `core.add_entity(pos, name, [staticdata])`.
|
||||||
c.on_activate = function(self, staticdata, dtime)
|
c.on_activate = function(luaEntity, staticdata, dtime)
|
||||||
local initCustomFields = {}
|
local initCustomFields = {}
|
||||||
|
|
||||||
if staticdata and staticdata ~= '' then
|
if staticdata and staticdata ~= '' then
|
||||||
@@ -71,7 +71,7 @@ function Creature:new(entityDef)
|
|||||||
|
|
||||||
-- If an initialization callback was specified for the entity, then we call it.
|
-- If an initialization callback was specified for the entity, then we call it.
|
||||||
if c.on_activate ~= nil then
|
if c.on_activate ~= nil then
|
||||||
onActivate(self, staticdata, dtime)
|
onActivate(luaEntity, staticdata, dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ function Creature:new(entityDef)
|
|||||||
instance.entityDef = entityDef
|
instance.entityDef = entityDef
|
||||||
instance.luantiDef = luantiDef
|
instance.luantiDef = luantiDef
|
||||||
|
|
||||||
core.register_entity(s._name, luantiDef)
|
core.register_entity(':'..s._name, luantiDef)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user