I was using the the hook
Code: Select all
self:triggerHook{"Actor:move", moved=moved, force=force, ox=ox, oy=oy}
Code: Select all
class:bindHook("Actor:move", function(self, data)
if data.moved and self:hasEffect(self.EFF_CRIMSON_FOG) then
local isInCrimsonFog = 0
game.logPlayer(self, "data.x: %s, data.y: %s",data.ox,data.oy)
for i, e in ipairs(game.level.map.effects) do
if e.damtype == DamageType.CRIMSON_FOG and e.grids[data.ox] and e.grids[data.ox][data.oy]
then isInCrimsonFog = 1 end
end
game.logPlayer(self, "isInCrimsonFog: %s",isInCrimsonFog)
if isInCrimsonFog == 0 then
self:removeEffect(self.EFF_CRIMSON_FOG)
game.logPlayer(self, "EFF_CRIMSON_FOG removed")
end
end
end)
I assumed, the hook is used to do stuff after the movement so the new position coordinates would be more helpful.
Cheers:)