From 0e97c356acfe9d5d46e348e01763b4ee1b67e2ea Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Mon, 5 Sep 2011 16:54:56 +0000 Subject: [PATCH] Running tries to avoid water git-svn-id: http://svn.net-core.org/repos/t-engine4@4331 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/Player.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index c7eba43d57..9a629a6b4b 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -582,6 +582,16 @@ function _M:mouseMove(tmx, tmy, force_move) -- Dont do traps local trap = game.level.map(x, y, Map.TRAP) if trap and trap:knownBy(self) and trap:canTrigger(x, y, self, true) then return false end + + -- Dont go where you cant breath + if not self:attr("no_breath") then + local air_level, air_condition = game.level.map:checkEntity(x, y, Map.TERRAIN, "air_level"), game.level.map:checkEntity(x, y, Map.TERRAIN, "air_condition") + if air_level then + if not air_condition or not self.can_breath[air_condition] or self.can_breath[air_condition] <= 0 then + return false + end + end + end return true end return engine.interface.PlayerMouse.mouseMove(self, tmx, tmy, spotHostiles, {recheck=true, astar_check=astar_check}, force_move) @@ -838,7 +848,7 @@ function _M:quickSwitchWeapons() elseif not mh1[1] and oh1[1] then names = oh1[1]:getName{do_color=true} end end - + self:playerCheckSustains() game.logPlayer(self, "You switch your weapons to: %s.", names) -- GitLab