From 1a89f9a8e8e2dd95a1dccb70c10892b604ab434c Mon Sep 17 00:00:00 2001 From: Fernando Carmona Varo Date: Thu, 22 Oct 2015 20:44:07 +0200 Subject: Stop ghosts when the player leaves --- ghost.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ghost.lua') diff --git a/ghost.lua b/ghost.lua index 4138e8f..a4bd46d 100644 --- a/ghost.lua +++ b/ghost.lua @@ -69,6 +69,12 @@ for i in ipairs(ghosts) do end local player = self.target + -- If there's no player just stop + if not player then + self.set_velocity(self, 0) + return + end + local s = self.object:getpos() -- ghost local p = player:getpos() -- player -- cgit v1.2.3