Skip to content
Snippets Groups Projects
Commit 6028979d authored by DarkGod's avatar DarkGod
Browse files

Fix random freeze/random stop at high run speed

parent 773e9837
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -1866,9 +1866,13 @@ do return end
for _, node in ipairs(seen) do
node.actor:addParticles(engine.Particles.new("notice_enemy", 1))
end
elseif not self.player:autoExplore() then
self.log("There is nowhere left to explore.")
self:triggerHook{"Player:autoExplore:nowhere"}
else
if not self.player:autoExplore() then
self.log("There is nowhere left to explore.")
self:triggerHook{"Player:autoExplore:nowhere"}
else
while self.player:enoughEnergy() and self.player:runStep() do end
end
end
end end
......@@ -1880,14 +1884,14 @@ do return end
end
end,
RUN_LEFT = function() self.player:runInit(4) end,
RUN_RIGHT = function() self.player:runInit(6) end,
RUN_UP = function() self.player:runInit(8) end,
RUN_DOWN = function() self.player:runInit(2) end,
RUN_LEFT_UP = function() self.player:runInit(7) end,
RUN_LEFT_DOWN = function() self.player:runInit(1) end,
RUN_RIGHT_UP = function() self.player:runInit(9) end,
RUN_RIGHT_DOWN = function() self.player:runInit(3) end,
RUN_LEFT = function() self.player:runInit(4) while self.player:enoughEnergy() and self.player:runStep() do end end,
RUN_RIGHT = function() self.player:runInit(6) while self.player:enoughEnergy() and self.player:runStep() do end end,
RUN_UP = function() self.player:runInit(8) while self.player:enoughEnergy() and self.player:runStep() do end end,
RUN_DOWN = function() self.player:runInit(2) while self.player:enoughEnergy() and self.player:runStep() do end end,
RUN_LEFT_UP = function() self.player:runInit(7) while self.player:enoughEnergy() and self.player:runStep() do end end,
RUN_LEFT_DOWN = function() self.player:runInit(1) while self.player:enoughEnergy() and self.player:runStep() do end end,
RUN_RIGHT_UP = function() self.player:runInit(9) while self.player:enoughEnergy() and self.player:runStep() do end end,
RUN_RIGHT_DOWN = function() self.player:runInit(3) while self.player:enoughEnergy() and self.player:runStep() do end end,
ATTACK_OR_MOVE_LEFT = function() self.player:attackOrMoveDir(4) end,
ATTACK_OR_MOVE_RIGHT = function() self.player:attackOrMoveDir(6) end,
......
......@@ -385,10 +385,12 @@ function _M:act()
-- Resting ? Running ? Otherwise pause
if self.player and self:enoughEnergy() then
if self:restStep() then
while self:enoughEnergy() do self:restStep() end
while self:enoughEnergy() and self:restStep() do end
elseif self:runStep() then
while self:enoughEnergy() do self:runStep() end
else
while self:enoughEnergy() and self:runStep() do end
end
if self:enoughEnergy() then
game.paused = true
if game.uiset.logdisplay:getNewestLine() ~= "" then game.log("") end
end
......
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