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); }