From 1698cd05405af7d96242ed43c0bfb570a9e73dd5 Mon Sep 17 00:00:00 2001 From: Fernando Carmona Varo Date: Thu, 22 Oct 2015 20:28:56 +0200 Subject: Ghosts should be immortal now, even with bigger collisionbox --- ghost.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ghost.lua') diff --git a/ghost.lua b/ghost.lua index 228de59..4138e8f 100644 --- a/ghost.lua +++ b/ghost.lua @@ -26,10 +26,8 @@ for i in ipairs(ghosts) do "mypacman_"..itm.."f.png", "mypacman_"..itm.."s.png", }, - groups = {immortal = 1}, velocity = {x=math.random(-1,1), y=0, z=math.random(-1,1)}, - collisionbox = {-0.01, -0.5, -0.01, 0.01, -0.49, 0.01}, - --collisionbox = {-0.25, -1.0, -0.25, 0.25, 0.48, 0.25}, + collisionbox = {-0.25, -1.0, -0.25, 0.25, 0.48, 0.25}, is_visible = true, automatic_rotate = true, automatic_face_movement_dir = -90, -- set yaw direction in degrees, false to disable @@ -131,6 +129,7 @@ for i in ipairs(ghosts) do -- This function should load the saved state of the entity from a string on_activate = function(self, staticdata) + self.object:set_armor_groups({immortal=1}) if staticdata and staticdata ~= "" then local data = string.split(staticdata, ";") if #data == 2 then -- cgit v1.2.3 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