Creature: callback fixes

This commit is contained in:
Van
2026-02-12 21:11:52 +03:00
parent f2af5e725a
commit 97292d6205

View File

@@ -55,7 +55,7 @@ function Creature:new(entityDef)
-- We rewrite the entity initialization function so that custom fields
-- 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 = {}
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 c.on_activate ~= nil then
onActivate(self, staticdata, dtime)
onActivate(luaEntity, staticdata, dtime)
end
end
@@ -83,7 +83,7 @@ function Creature:new(entityDef)
instance.entityDef = entityDef
instance.luantiDef = luantiDef
core.register_entity(s._name, luantiDef)
core.register_entity(':'..s._name, luantiDef)
return instance
end