1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-15 14:09:06 +00:00

Fix possible dangling pointer / crash in predatorytunicate script

This commit is contained in:
fgenesis 2014-12-29 00:36:00 +01:00
parent aab0dad1cb
commit b4906a3840

View file

@ -143,27 +143,28 @@ function update(me, dt)
entity_setState(me, STATE_IDLE) entity_setState(me, STATE_IDLE)
end end
]]-- ]]--
if entity_isState(me, STATE_TRAP) and v.trappedEnt ~= 0 then if v.trappedEnt ~= 0 then
entity_setPosition(v.trappedEnt, v.hx, v.hy, 0.1)
if entity_isDead(v.trappedEnt) then if entity_isDead(v.trappedEnt) then
v.trappedEnt = 0 v.trappedEnt = 0
entity_setState(me, STATE_IDLE) entity_setState(me, STATE_IDLE)
end elseif entity_isState(me, STATE_TRAP) then
elseif entity_isState(me, STATE_TRAPPED) and v.trappedEnt ~= 0 then entity_setPosition(v.trappedEnt, v.hx, v.hy, 0.1)
entity_setPosition(v.trappedEnt, v.hx, v.hy) elseif entity_isState(me, STATE_TRAPPED) then
v.hurtTimer = v.hurtTimer + dt entity_setPosition(v.trappedEnt, v.hx, v.hy)
if v.hurtTimer > 1 then v.hurtTimer = v.hurtTimer + dt
if entity_getEntityType(v.trappedEnt) == ET_ENEMY then if v.hurtTimer > 1 then
entity_damage(v.trappedEnt, me, 2, DT_ENEMY_TRAP) if entity_getEntityType(v.trappedEnt) == ET_ENEMY then
else entity_damage(v.trappedEnt, me, 2, DT_ENEMY_TRAP)
entity_damage(v.trappedEnt, me, 1, DT_ENEMY_TRAP) else
entity_damage(v.trappedEnt, me, 1, DT_ENEMY_TRAP)
end
if entity_isDead(v.trappedEnt) then
v.trappedEnt = 0
entity_setState(me, STATE_IDLE)
end
v.hurtTimer = 0
end end
if entity_isDead(v.trappedEnt) then
v.trappedEnt = 0
entity_setState(me, STATE_IDLE)
end
v.hurtTimer = 0
end end
end end
end end