From 45958b52f1443aaaad1bb7690f28c46a6272f6b7 Mon Sep 17 00:00:00 2001 From: AiTechEye <40591179+AiTechEye@users.noreply.github.com> Date: Wed, 14 Oct 2020 21:14:19 +0200 Subject: [PATCH] Add files via upload --- aliveai_threats/init.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/aliveai_threats/init.lua b/aliveai_threats/init.lua index 40a474f..dd511a0 100644 --- a/aliveai_threats/init.lua +++ b/aliveai_threats/init.lua @@ -1682,14 +1682,16 @@ aliveai.create_bot({ spawn_y=0, spawn=function(self) local pos=self.object:get_pos() - local opos=pos - for i=0,10,1 do - if aliveai.def({x=pos.x,y=pos.y-i,z=pos.z,},"walkable") and not minetest.is_protected(opos,"") then - minetest.set_node(opos,{name="aliveai_threats:killerplant"}) - aliveai.kill(self) - return + if pos then + local opos=pos + for i=0,10,1 do + if aliveai.def({x=pos.x,y=pos.y-i,z=pos.z,},"walkable") and not minetest.is_protected(opos,"") then + minetest.set_node(opos,{name="aliveai_threats:killerplant"}) + aliveai.kill(self) + return + end + opos={x=pos.x,y=pos.y-i,z=pos.z,} end - opos={x=pos.x,y=pos.y-i,z=pos.z,} end aliveai.kill(self) end,