Skip to content
Snippets Groups Projects
Commit 3ccd8fae authored by dg's avatar dg
Browse files

Overriding/removing/.. complex traps will correctly remove them

git-svn-id: http://svn.net-core.org/repos/t-engine4@5313 51575b47-30f0-44d4-a5cc-537603b46e54
parent b083f4ef
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,8 @@ newEntity{ base = "TRAP_COMPLEX", ...@@ -114,6 +114,8 @@ newEntity{ base = "TRAP_COMPLEX",
canAct = false, canAct = false,
energy = {value=0}, energy = {value=0},
act = function(self) act = function(self)
if game.level.map(self.x, self.y, engine.Map.TRAP) ~= self then game.level:removeEntity(self, true) return end
local x, y = self.list[self.list.i].x, self.list[self.list.i].y local x, y = self.list[self.list.i].x, self.list[self.list.i].y
self.list.i = util.boundWrap(self.list.i + 1, 1, #self.list) self.list.i = util.boundWrap(self.list.i + 1, 1, #self.list)
...@@ -168,6 +170,8 @@ newEntity{ base = "TRAP_COMPLEX", ...@@ -168,6 +170,8 @@ newEntity{ base = "TRAP_COMPLEX",
self:useEnergy(game.energy_to_act * 7) self:useEnergy(game.energy_to_act * 7)
end, end,
act = function(self) act = function(self)
if game.level.map(self.x, self.y, engine.Map.TRAP) ~= self then game.level:removeEntity(self, true) return end
local ok = false local ok = false
local tg = {type="ball", radius=self.rad, friendlyfire=false} local tg = {type="ball", radius=self.rad, friendlyfire=false}
self:project(tg, self.x, self.y, function(px, py) self:project(tg, self.x, self.y, function(px, py)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment