Compare commits
5 Commits
1700701f53
...
5962ac0168
Author | SHA1 | Date |
---|---|---|
AiTechEye | 5962ac0168 | |
AiTechEye | 70f71a065b | |
AiTechEye | 11f491cc7d | |
AiTechEye | 4a62040eb0 | |
AiTechEye | 45958b52f1 |
|
@ -4,7 +4,7 @@
|
|||
|
||||
# License: code: LGPL-2.1, media: CC0
|
||||
|
||||
# Version 26.31
|
||||
# Version 26.32
|
||||
|
||||
# [Wiki](https://github.com/AiTechEye/aliveai/wiki)
|
||||
|
||||
|
|
|
@ -1351,6 +1351,10 @@ end
|
|||
|
||||
aliveai.jumping=function(self)
|
||||
local pos=self.object:get_pos()
|
||||
if not pos then
|
||||
return
|
||||
end
|
||||
|
||||
pos.y=pos.y-self.basey
|
||||
if minetest.get_node(pos)==nil then return end
|
||||
local test=minetest.registered_nodes[minetest.get_node(pos).name]
|
||||
|
@ -1543,7 +1547,7 @@ aliveai.pointat=function(self,d)
|
|||
end
|
||||
|
||||
aliveai.distance=function(pos1,pos2)
|
||||
if not (pos1 and pos2) then
|
||||
if not (pos1 and pos1.x and pos2 and pos2.x) then
|
||||
return 0
|
||||
end
|
||||
pos1 = type(pos1) == "userdata" and pos1:get_pos() or pos1.object and pos1.object:get_pos() or pos1
|
||||
|
@ -1558,7 +1562,7 @@ aliveai.visiable=function(pos1,pos2)
|
|||
pos1 = type(pos1) == "userdata" and pos1:get_pos() or pos1.object and pos1.object:get_pos() or pos1
|
||||
pos2 = type(pos2) == "userdata" and pos2:get_pos() or pos2
|
||||
|
||||
if not (pos1 and pos2) then
|
||||
if not (pos1 and pos1.x and pos2 and pos2.x) then
|
||||
return false
|
||||
end
|
||||
|
||||
|
|
|
@ -413,6 +413,10 @@ on_activate=function(self, staticdata)
|
|||
aliveai.max(self)
|
||||
|
||||
if self.old~=1 then
|
||||
if not self.object:get_pos() then
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
self.spawn(self)
|
||||
aliveai.showstatus(self,"new bot spawned")
|
||||
if self.type=="npc" and math.random(1, aliveai.get_random_stuff_chance)==1 then
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue