Merge pull request #10 from bell07/pr_movement_bugfix

bugfix in movement - swimming in water without path did crashed the game
This commit is contained in:
bell07 2017-07-26 22:34:10 +02:00 committed by GitHub
commit 8ef499f5fc

View File

@ -199,7 +199,7 @@ function mvobj_proto:_do_movement_step(dtime)
if string.find(node[0].name, "^default:water") or
string.find(node[1].name, "^default:water") then
-- we are under water. sink if target bellow the current position. otherwise swim up
if not self._path[1] or self._path[1].y > self.pos.y then
if not self._path or not self._path[1] or self._path[1].y > self.pos.y then
self.velocity.y = 3
end
end