rework pathfinding
This commit is contained in:
parent
e672139dd8
commit
dd590460e8
@ -123,7 +123,7 @@ function wildcow.hq_meetmygirl(self,prty)
|
||||
if passangan == {} then return true end
|
||||
tpos = passangan:get_pos()
|
||||
--water_life.temp_show(tpos,5,5)
|
||||
if not water_life.gopath(self,tpos,nil,true) then
|
||||
if not water_life.gopath(self,tpos,nil,wildcow.fast_pf) then
|
||||
--minetest.chat_send_all("No way to there")
|
||||
return true
|
||||
end
|
||||
@ -205,7 +205,7 @@ function wildcow.hq_goto(self,prty,tpos)
|
||||
local func = function(self)
|
||||
if mobkit.is_queue_empty_low(self) and self.isonground then
|
||||
local pos = mobkit.get_stand_pos(self)
|
||||
if vector.distance(pos,tpos) >= 1.2 then --1.2
|
||||
if vector.distance(pos,tpos) >= 3 then --1.2
|
||||
wildcow.goto_next_waypoint(self,tpos)
|
||||
else
|
||||
return true
|
||||
@ -258,10 +258,10 @@ function wildcow.hq_find_food(self,prty,radius)
|
||||
|
||||
if mobkit.is_queue_empty_low(self) and self.isonground then
|
||||
|
||||
if vector.distance(pos,snack) > 2 then
|
||||
if vector.distance(pos,snack) > 1.5 then
|
||||
if init then
|
||||
--wildcow.hq_goto(self,prty+1,snack)
|
||||
water_life.hq_findpath(self,prty+1,snack, 2,0.5,true)
|
||||
water_life.hq_findpath(self,prty+1,snack, 1.5,0.5,wildcow.fast_pf)
|
||||
init=false
|
||||
end
|
||||
else
|
||||
|
2
calf.lua
2
calf.lua
@ -76,7 +76,7 @@ local function calf_brain(self)
|
||||
local boss = math.floor(vector.distance(pos,bosspos))
|
||||
--minetest.chat_send_all(dump(boss))
|
||||
if boss > 5 then
|
||||
water_life.hq_findpath(self,10,bosspos, 3,0.5,true)
|
||||
water_life.hq_findpath(self,10,bosspos, 3,0.5,wildcow.fast_pf)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -167,7 +167,7 @@ local function female_brain(self)
|
||||
local boss = math.floor(vector.distance(pos,bosspos))
|
||||
--minetest.chat_send_all(dump(boss))
|
||||
if boss > 10 then
|
||||
water_life.hq_findpath(self,5,bosspos, 7,0.5,true)
|
||||
water_life.hq_findpath(self,5,bosspos, 7,0.5,wildcow.fast_pf)
|
||||
end
|
||||
end
|
||||
|
||||
|
5
init.lua
5
init.lua
@ -11,9 +11,10 @@ local path = minetest.get_modpath(minetest.get_current_modname())
|
||||
wildcow = {}
|
||||
wildcow.spawnfreq = 30 -- spawn frequency
|
||||
wildcow.herdsize = 5 -- max member in a herd
|
||||
wildcow.ptime = 720 -- time in secs until baby is born
|
||||
wildcow.btime = 1440 -- time needed for a calf to grew up to an adult
|
||||
wildcow.ptime = 360 -- time in secs until baby is born
|
||||
wildcow.btime = 720 -- time needed for a calf to grew up to an adult
|
||||
wildcow.lifetime = (wildcow.btime+wildcow.ptime)*4 -- lifetime in seconds
|
||||
wildcow.fast_pf = false -- faster pathfinding (false is better but slower)
|
||||
wildcow.debug = false -- show debug
|
||||
|
||||
|
||||
|
4
male.lua
4
male.lua
@ -28,7 +28,7 @@ local function male_brain(self)
|
||||
local horny = water_life.horny(self)
|
||||
local hunger = water_life.hunger(self)
|
||||
|
||||
if prty < 30 and water_life.is_boss(self) == 1 and horny < 70 and hunger > horny then
|
||||
if prty < 30 and water_life.is_boss(self) == 1 and horny < 80 and hunger > horny then
|
||||
mobkit.clear_queue_high(self)
|
||||
wildcow.hq_meetmygirl(self,8)
|
||||
end
|
||||
@ -141,7 +141,7 @@ local function male_brain(self)
|
||||
local boss = math.floor(vector.distance(pos,bosspos))
|
||||
--minetest.chat_send_all(dump(boss))
|
||||
if boss > 10 then
|
||||
water_life.hq_findpath(self,5,bosspos, 7,0.5,true)
|
||||
water_life.hq_findpath(self,5,bosspos, 7,0.5,wildcow.fast_pf)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user