Compare commits

...

5 Commits

Author SHA1 Message Date
AiTechEye 5962ac0168
Add files via upload 2021-02-05 21:22:21 +01:00
AiTechEye 70f71a065b
Update README.md 2020-10-14 22:03:26 +02:00
AiTechEye 11f491cc7d
Add files via upload 2020-10-14 22:02:35 +02:00
AiTechEye 4a62040eb0
Add files via upload 2020-10-14 21:59:49 +02:00
AiTechEye 45958b52f1
Add files via upload 2020-10-14 21:14:19 +02:00
4 changed files with 20 additions and 10 deletions

View File

@ -4,7 +4,7 @@
# License: code: LGPL-2.1, media: CC0
# Version 26.31
# Version 26.32
# [Wiki](https://github.com/AiTechEye/aliveai/wiki)

View File

@ -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

View File

@ -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

View File

@ -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,