fix clownfish bwhaviors

This commit is contained in:
Gundul 2023-05-21 13:17:25 +02:00
parent a0f1306cad
commit de92492902
4 changed files with 24 additions and 12 deletions

View File

@ -19,6 +19,7 @@ local function fish_brain(self)
end
end
if mobkit.timer(self,1) then
local prty = mobkit.get_queue_priority(self)
if not self.isinliquid then
mobkit.hurt(self,1)
end
@ -30,10 +31,13 @@ local function fish_brain(self)
if self.isinliquid and self.isinliquid =="default:river_water_source" then
water_life.hq_swimto(self,30,1,"default:water_source")
end
if mobkit.is_queue_empty_high(self) then
if mobkit.is_queue_empty_high(self) and self.isinliquid then
mobkit.animate(self,"def")
mobkit.hq_aqua_roam(self,10,0.5)
water_life.hq_aqua_roam(self,10,0.5,false,true)
end
if prty < 90 and not self.isinliquid then
water_life.hq_go2water(self,99,2)
end
end
end

View File

@ -5,6 +5,11 @@ water_life.urchinspawn = {
"default:coral_green",
"default:coral_pink",
"default:coral_orange",
"default:sand_with_kelp",
"water_life:kelpbrown",
"water_life:kelpgreen",
"water_life:seagrassgreen",
"water_life:seagrassred",
"water_life:coralmagenta",
"water_life:coralskyblue",
"seacoral:seacoralsandaqua",

View File

@ -260,7 +260,7 @@ function water_life.get_close_drops(self,name)
if #objs < 1 then return nil end
for i = #objs,1,-1 do
local entity = objs[i]:get_luaentity()
if not entity or not entity.name == "__builtin:item" then
if not entity or entity.name ~= "__builtin:item" then
table.remove(objs,i)
end
end
@ -299,11 +299,14 @@ function water_life.aqua_radar_dumb(pos,yaw,range,reverse,shallow)
local function okpos(p)
local node = mobkit.nodeatpos(p)
if node then
if node.drawtype == 'liquid' then
if node.drawtype == 'liquid' then
if shallow then
return true
end
local nodeu = mobkit.nodeatpos(mobkit.pos_shift(p,{y=1}))
local noded = mobkit.nodeatpos(mobkit.pos_shift(p,{y=-1}))
if ((nodeu and nodeu.drawtype == 'liquid') or (noded and
noded.drawtype == 'liquid')) or shallow then
noded.drawtype == 'liquid')) then
return true
else
return false

View File

@ -114,7 +114,7 @@ if not water_life.apionly then
on_place = function(itemstack, placer, pointed_thing)
if placer and not placer:is_player() then return itemstack end
if not pointed_thing then return itemstack end
if not pointed_thing.type == "node" then return itemstack end
if pointed_thing.type ~= "node" then return itemstack end
local pos = pointed_thing.above
local number = water_life.count_objects(pos)
if number.all > water_life.maxmobs or number.fish > 10 then return itemstack end
@ -140,7 +140,7 @@ if not water_life.apionly then
on_place = function(itemstack, placer, pointed_thing)
if placer and not placer:is_player() then return itemstack end
if not pointed_thing then return itemstack end
if not pointed_thing.type == "node" then return itemstack end
if pointed_thing.type ~= "node" then return itemstack end
local pos = pointed_thing.above
local number = water_life.count_objects(pos,nil,"water_life:piranha")
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
@ -165,7 +165,7 @@ if not water_life.apionly then
on_place = function(itemstack, placer, pointed_thing)
if placer and not placer:is_player() then return itemstack end
if not pointed_thing then return itemstack end
if not pointed_thing.type == "node" then return itemstack end
if pointed_thing.type ~= "node" then return itemstack end
local pos = pointed_thing.above
local number = water_life.count_objects(pos,nil,"water_life:coralfish_tamed")
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
@ -195,7 +195,7 @@ if not water_life.apionly then
on_place = function(itemstack, placer, pointed_thing)
if placer and not placer:is_player() then return itemstack end
if not pointed_thing then return itemstack end
if not pointed_thing.type == "node" then return itemstack end
if pointed_thing.type ~= "node" then return itemstack end
local pos = pointed_thing.above
local number = water_life.count_objects(pos,nil,"water_life:clownfish_tamed")
if number.all > water_life.maxmobs or number.name > 10 then
@ -223,7 +223,7 @@ if not water_life.apionly then
on_place = function(itemstack, placer, pointed_thing)
if placer and not placer:is_player() then return itemstack end
if not pointed_thing then return itemstack end
if not pointed_thing.type == "node" then return itemstack end
if pointed_thing.type ~= "node" then return itemstack end
local pos = pointed_thing.above
local number = water_life.count_objects(pos,10,"water_life:urchin")
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
@ -248,7 +248,7 @@ if not water_life.apionly then
on_place = function(itemstack, placer, pointed_thing)
if placer and not placer:is_player() then return itemstack end
if not pointed_thing then return itemstack end
if not pointed_thing.type == "node" then return itemstack end
if pointed_thing.type ~= "node" then return itemstack end
local pos = pointed_thing.above
local number = water_life.count_objects(pos,10,"water_life:jellyfish")
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
@ -272,7 +272,7 @@ if not water_life.apionly then
on_place = function(itemstack, placer, pointed_thing)
if placer and not placer:is_player() then return itemstack end
if not pointed_thing then return itemstack end
if not pointed_thing.type == "node" then return itemstack end
if pointed_thing.type ~= "node" then return itemstack end
local pos = pointed_thing.above
local number = water_life.count_objects(pos,water_life.abr * 16,"water_life:snake")
if number.all > water_life.maxmobs or number.name > 5 then return itemstack end