diff --git a/behaviors.lua b/behaviors.lua index dcfe387..27de84f 100644 --- a/behaviors.lua +++ b/behaviors.lua @@ -135,7 +135,7 @@ function wildcow.hq_meetmygirl(self,prty) end end init = false - if passangan == {} then return true end + if passangan == {} or not mobkit.is_alive(passangan:get_luaentity()) then return true end tpos = passangan:get_pos() --water_life.temp_show(tpos,5,5) if not water_life.gopath(self,tpos,nil,wildcow.fast_pf) then @@ -145,6 +145,7 @@ function wildcow.hq_meetmygirl(self,prty) end if mobkit.is_queue_empty_low(self) and self.isonground then + if not mobkit.is_alive(passangan:get_luaentity()) then return true end pos = mobkit.get_stand_pos(self) tpos = passangan:get_pos() @@ -191,21 +192,24 @@ function wildcow.hq_stare(self,prty,target) if not mobkit.is_alive(target) then return true end if init then mobkit.animate(self,"headdown") - mobkit.make_sound(self,"angry") + if random(100) < 33 then + mobkit.make_sound(self,"angry") + end init = false end local pos = self.object:get_pos() local tyaw = water_life.get_yaw_to_object(self,target) local yaw = self.object:get_yaw() local tpos = target:get_pos() - local apos = mobkit.pos_translate2d(pos,tyaw,10) + local raypos = mobkit.pos_shift(pos,{y=1}) gethim = gethim - self.dtime + if mobkit.timer(self,1) and target:is_player() and water_life.find_collision(raypos,{x=tpos.x, y=tpos.y + 1.8, z= tpos.z},true,true) then return true end if water_life.dist2tgt(self,target) > 15 then return true end if water_life.dist2tgt(self,target) < 8 or gethim < 0 then - --mobkit.lq_dumbwalk(self,apos,2) water_life.hunger(self,-5) wildcow.hq_overrun(self,prty+1,target) + --return true end --minetest.chat_send_all(dump(yaw).." : "..dump(tyaw).." >> "..dump(abs(tyaw-yaw))) diff --git a/calf.lua b/calf.lua index 21cec69..f2fec0b 100644 --- a/calf.lua +++ b/calf.lua @@ -9,7 +9,7 @@ local function calf_brain(self) if self.hp <= 0 then mobkit.clear_queue_high(self) water_life.handle_drops(self) - mobkit.hq_die(self) + water_life.hq_die(self,"die") return end @@ -39,7 +39,7 @@ local function calf_brain(self) local name = "wildcow:auroch_female" if random(100) > 50 then name = "wildcow:auroch_male" end mobkit.clear_queue_high(self) - mobkit.hq_die(self) + water_life.hq_die(self,"die") --self.object:remove() local obj = minetest.add_entity(pos,name) if obj then @@ -118,12 +118,14 @@ minetest.register_entity("wildcow:auroch_calf",{ --hurt = 'deer_hurt', }, animation = { + def={range={x=31,y=74},speed=15,loop=true}, walk={range={x=216,y=231},speed=10,loop=true}, trot={range={x=85,y=114},speed=20,loop=true}, run={range={x=120,y=140},speed=30,loop=true}, stand={range={x=31,y=74},speed=15,loop=true}, eat={range={x=0,y=30},speed=15,loop=true}, attack={range={x=145,y=160},speed=20,loop=true}, + die={range={x=191,y=211},speed=10,loop=false}, }, drops = { {name = "default:diamond", chance = 50, min = 1, max = 1,}, @@ -141,6 +143,7 @@ minetest.register_entity("wildcow:auroch_calf",{ local hvel = vector.multiply(vector.normalize({x=dir.x,y=0,z=dir.z}),4) self.object:set_velocity({x=hvel.x,y=2,z=hvel.z}) mobkit.make_sound(self,'hurt') + if water_life.bloody then water_life.spilltheblood(self.object) end mobkit.hurt(self,tool_capabilities.damage_groups.fleshy or 1) end, diff --git a/female.lua b/female.lua index 6e68325..4d0bf89 100644 --- a/female.lua +++ b/female.lua @@ -9,7 +9,7 @@ local function female_brain(self) if self.hp <= 0 then mobkit.clear_queue_high(self) water_life.handle_drops(self) - mobkit.hq_die(self) + water_life.hq_die(self,"die") return end @@ -38,7 +38,7 @@ local function female_brain(self) if water_life.is_alive(self) < 0 then mobkit.clear_queue_high(self) - mobkit.hq_die(self) + water_life.hq_die(self,"die") return end @@ -92,7 +92,7 @@ local function female_brain(self) end local rnd = random(1000) - if rnd < 10 then + if rnd < 5 then mobkit.make_sound(self,"idle") end @@ -239,12 +239,14 @@ minetest.register_entity("wildcow:auroch_female",{ timeout = wildcow.lifetime, attack={range=0.5,damage_groups={fleshy=5}}, animation = { + def={range={x=31,y=74},speed=15,loop=true}, walk={range={x=216,y=231},speed=10,loop=true}, trot={range={x=85,y=114},speed=20,loop=true}, run={range={x=120,y=140},speed=30,loop=true}, stand={range={x=31,y=74},speed=15,loop=true}, eat={range={x=0,y=30},speed=15,loop=true}, attack={range={x=145,y=160},speed=20,loop=true}, + die={range={x=191,y=211},speed=10,loop=false}, }, drops = { {name = "default:diamond", chance = 20, min = 1, max = 3,}, @@ -267,9 +269,11 @@ minetest.register_entity("wildcow:auroch_female",{ local hvel = vector.multiply(vector.normalize({x=dir.x,y=0,z=dir.z}),4) self.object:set_velocity({x=hvel.x,y=2,z=hvel.z}) mobkit.make_sound(self,'hurt') + if water_life.bloody then water_life.spilltheblood(self.object) end mobkit.hurt(self,tool_capabilities.damage_groups.fleshy or 1) elseif not puncher:is_player() then mobkit.make_sound(self,'hurt') + if water_life.bloody then water_life.spilltheblood(self.object) end mobkit.hurt(self,self.attack.damage_groups.fleshy or 1) end end, diff --git a/male.lua b/male.lua index bbed8ee..ca257fd 100644 --- a/male.lua +++ b/male.lua @@ -3,6 +3,7 @@ local abs = math.abs local function male_brain(self) + local prty = mobkit.get_queue_priority(self) if self.tamed == nil then self.tamed = false end if mobkit.timer(self,1) then wildcow.node_dps_dmg(self) end mobkit.vitals(self) @@ -10,7 +11,7 @@ local function male_brain(self) if self.hp <= 0 then mobkit.clear_queue_high(self) water_life.handle_drops(self) - mobkit.hq_die(self) + water_life.hq_die(self,"die") return end @@ -24,7 +25,7 @@ local function male_brain(self) if mobkit.timer(self,10) then water_life.is_alive(self,-10) if water_life.hunger(self) < 10 then mobkit.hurt(self,5) end - local prty = mobkit.get_queue_priority(self) + local horny = water_life.horny(self) local hunger = water_life.hunger(self) @@ -36,11 +37,9 @@ local function male_brain(self) end if mobkit.timer(self,2) then - local prty = mobkit.get_queue_priority(self) - if water_life.is_alive(self) < 0 then mobkit.clear_queue_high(self) - mobkit.hq_die(self) + water_life.hq_die(self,"die") return end @@ -79,9 +78,9 @@ local function male_brain(self) end if mobkit.timer(self,1) then - local prty = mobkit.get_queue_priority(self) local obj = self.object local pos = self.object:get_pos() + local raypos = mobkit.pos_shift(pos,{y=1}) local bosspos = water_life.headpos(self) local rnd = random(1000) if rnd < 20 then @@ -118,8 +117,10 @@ local function male_brain(self) local plyr = mobkit.get_nearby_player(self) if plyr and vector.distance(pos,plyr:get_pos()) < 16 and not self.tamed then local pl_pos = plyr:get_pos() - --minetest.chat_send_all(dump(abs(pos.y - pl_pos.y))) - if abs(pos.y - pl_pos.y) < 1.99 then + local collide = water_life.find_collision(raypos,{x=pl_pos.x, y=pl_pos.y + 1.8, z= pl_pos.z},true,true) + + --minetest.chat_send_all(dump(abs(pos.y - pl_pos.y)).." : "..dump(collide)) + if abs(pos.y - pl_pos.y) < 1.99 and not collide then mobkit.clear_queue_high(self) wildcow.hq_stare(self,13,plyr) return @@ -182,6 +183,7 @@ minetest.register_entity("wildcow:auroch_male",{ timeout = wildcow.lifetime, attack={range=0.5,damage_groups={fleshy=10}}, animation = { + def={range={x=31,y=74},speed=15,loop=true}, walk={range={x=216,y=231},speed=10,loop=true}, trot={range={x=85,y=114},speed=20,loop=true}, run={range={x=120,y=140},speed=30,loop=true}, @@ -189,6 +191,7 @@ minetest.register_entity("wildcow:auroch_male",{ eat={range={x=0,y=30},speed=15,loop=true}, attack={range={x=145,y=160},speed=20,loop=true}, headdown={range={x=150,y=150},speed =0, loop=false}, + die={range={x=191,y=211},speed=10,loop=false}, }, drops = { {name = "default:diamond", chance = 20, min = 1, max = 3,}, @@ -218,9 +221,11 @@ minetest.register_entity("wildcow:auroch_male",{ local hvel = vector.multiply(vector.normalize({x=dir.x,y=0,z=dir.z}),4) self.object:set_velocity({x=hvel.x,y=2,z=hvel.z}) mobkit.make_sound(self,'hurt') + if water_life.bloody then water_life.spilltheblood(self.object) end mobkit.hurt(self,tool_capabilities.damage_groups.fleshy or 1) elseif not puncher:is_player() then mobkit.make_sound(self,'hurt') + if water_life.bloody then water_life.spilltheblood(self.object) end mobkit.hurt(self,self.attack.damage_groups.fleshy or 1) end end,