From 8c3836ce502a6d545eb987691295eac70d03aab2 Mon Sep 17 00:00:00 2001 From: Allanis <allanis@saracraft.net> Date: Wed, 21 May 2014 00:23:41 +0100 Subject: [PATCH] [Change] Mkay, escorts should properly hang if they have no target to escort. --- scripts/ai/tpl/escort.lua | 2 +- src/ai.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/ai/tpl/escort.lua b/scripts/ai/tpl/escort.lua index 55f725f..36c7b21 100644 --- a/scripts/ai/tpl/escort.lua +++ b/scripts/ai/tpl/escort.lua @@ -20,7 +20,7 @@ function escort() target = mem.escort -- Will just float without a target to escort. - if target == nil then + if not ai.exists(target) then return end diff --git a/src/ai.c b/src/ai.c index 14de13a..009474b 100644 --- a/src/ai.c +++ b/src/ai.c @@ -266,9 +266,13 @@ static void ai_setMemory(void) { L = cur_pilot->ai->L; lua_getglobal(L, "pilotmem"); + /* pilotmem */ lua_pushnumber(L, cur_pilot->id); + /* pilotmem, id */ lua_gettable(L, -2); + /* pilotmem, table */ lua_setglobal(L, "mem"); + /* pilotmem */ lua_pop(L, 1); }