fixes
parent
3353d3136c
commit
d01e12ed18
|
@ -1324,7 +1324,7 @@ function mobkit.hq_attack(self,prty,tgtobj)
|
|||
mobkit.queue_high(self,func,prty)
|
||||
end
|
||||
|
||||
function mobkit.hq_liquid_recovery(self,prty) -- scan for nearest land
|
||||
function mobkit.hq_liquid_recovery(self, prty) -- scan for nearest land
|
||||
local radius = 1
|
||||
local yaw = 0
|
||||
local func = function(self)
|
||||
|
|
|
@ -263,28 +263,6 @@ petz.check_if_climb = function(self)
|
|||
end
|
||||
end
|
||||
|
||||
petz.set_behaviour= function(self, behaviour, fly_in)
|
||||
if behaviour == "aquatic" then
|
||||
self.behaviour = "aquatic"
|
||||
self.fly = true
|
||||
self.fly_in = fly_in
|
||||
self.floats = 0
|
||||
self.animation = self.animation_aquatic
|
||||
elseif behaviour == "terrestrial" then
|
||||
self.behaviour = "terrestrial"
|
||||
self.fly = false -- make terrestrial
|
||||
self.floats = 1
|
||||
self.animation = self.animation_terrestrial
|
||||
elseif behaviour == "arboreal" then
|
||||
self.behaviour = "arboreal"
|
||||
self.fly = true
|
||||
self.fly_in = fly_in
|
||||
self.floats = 0
|
||||
self.animation = self.animation_arboreal
|
||||
self.object:set_acceleration({x = 0, y = 0.5, z = 0 })
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
--Predator Behaviour
|
||||
--
|
||||
|
@ -493,7 +471,60 @@ function petz.aquatic_brain(self)
|
|||
if random_number == 1 then
|
||||
--minetest.chat_send_player("singleplayer", "jump")
|
||||
mobkit.clear_queue_high(self)
|
||||
mobkit.hq_aqua_jump(self, 8, 2.5)
|
||||
mobkit.hq_aqua_jump(self, 8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Default Random Sound
|
||||
petz.random_mob_sound(self)
|
||||
|
||||
--Roam default
|
||||
if mobkit.is_queue_empty_high(self) and not(self.status== "jump") then
|
||||
mobkit.hq_aqua_roam(self, 0, self.max_speed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
--Semiaquatic beahaviour
|
||||
--for beaver and frog
|
||||
--
|
||||
|
||||
function petz.semiaquatic_brain(self)
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
-- Die Behaviour
|
||||
|
||||
if self.hp <= 0 then
|
||||
petz.on_die(self)
|
||||
return
|
||||
elseif not(petz.is_night()) and self.die_at_daylight == true then --it dies when sun rises up
|
||||
if minetest.get_node_light(self.object:get_pos(), minetest.get_timeofday()) >= self.max_daylight_level then
|
||||
petz.on_die(self)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if mobkit.timer(self, 1) then
|
||||
|
||||
local prty = mobkit.get_queue_priority(self)
|
||||
local player = mobkit.get_nearby_player(self)
|
||||
|
||||
if prty < 10 then
|
||||
if player then
|
||||
if (self.tamed == false) or (self.tamed == true and self.status == "guard" and player:get_player_name() ~= self.owner) then
|
||||
if vector.distance(pos, player:get_pos()) <= self.view_range then -- if player close
|
||||
if self.warn_attack == true then --attack player
|
||||
mobkit.clear_queue_high(self) -- abandon whatever they've been doing
|
||||
if self.isinliquid then
|
||||
mobkit.hq_aqua_attack(self, 10, puncher, 6) -- get revenge
|
||||
else
|
||||
mobkit.hq_warn(self, 10, player)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -501,59 +532,21 @@ function petz.aquatic_brain(self)
|
|||
-- Default Random Sound
|
||||
petz.random_mob_sound(self)
|
||||
|
||||
if self.petz_type == "beaver" then --beaver's dam
|
||||
petz.create_dam(self, pos)
|
||||
end
|
||||
|
||||
--Roam default
|
||||
if mobkit.is_queue_empty_high(self) and not(self.status== "jump") then
|
||||
mobkit.hq_aqua_roam(self, 0, 2.5)
|
||||
if mobkit.is_queue_empty_high(self) then
|
||||
if self.isinliquid then
|
||||
mobkit.hq_aqua_roam(self, 0, self.max_speed)
|
||||
else
|
||||
mobkit.hq_roam(self, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
--Semiaquatic beahaviour
|
||||
--for beaver and frog
|
||||
--
|
||||
|
||||
petz.semiaquatic_behaviour = function(self)
|
||||
local pos = self.object:get_pos() -- check the beaver pos to togle between aquatic-terrestrial
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if node and minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].groups.water then
|
||||
if not(self.behaviour == "aquatic") then
|
||||
petz.set_behaviour(self, "aquatic", node.name)
|
||||
end
|
||||
if self.petz_type == "beaver" then --beaver's dam
|
||||
petz.create_dam(self, pos)
|
||||
end
|
||||
else
|
||||
local pos_underwater = { --check if water below (when the mob is still terrestrial but float in the surface of the water)
|
||||
x = pos.x,
|
||||
y = pos.y - 3.5,
|
||||
z = pos.z,
|
||||
}
|
||||
node = minetest.get_node_or_nil(pos_underwater)
|
||||
if node and minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].groups.water
|
||||
and self.floats == false then
|
||||
local pos_below = {
|
||||
x = pos.x,
|
||||
y = pos.y - 2.0,
|
||||
z = pos.z,
|
||||
}
|
||||
self.object:move_to(pos_below, true) -- move the mob underwater
|
||||
if not(self.behaviour == "aquatic") then
|
||||
petz.set_behaviour(self, "aquatic", node.name)
|
||||
end
|
||||
if self.petz_type == "beaver" then --beaver's dam
|
||||
petz.create_dam(self, pos)
|
||||
end
|
||||
else
|
||||
if not(self.behaviour == "terrestrial") then
|
||||
petz.set_behaviour(self, "terrestrial", nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---
|
||||
---Arboreal Behaviour
|
||||
---
|
||||
|
|
|
@ -280,14 +280,14 @@ end
|
|||
---
|
||||
---Aquatic Brain
|
||||
---
|
||||
function mobkit.hq_aqua_jump(self, prty, speed_factor)
|
||||
function mobkit.hq_aqua_jump(self, prty)
|
||||
local func = function(self)
|
||||
--minetest.chat_send_player("singleplayer", "test")
|
||||
local vel_impulse = 5.0
|
||||
local vel_impulse = 4.0
|
||||
local velocity = {
|
||||
x = self.max_speed* speed_factor,
|
||||
y = self.max_speed* speed_factor * vel_impulse,
|
||||
z = self.max_speed* speed_factor,
|
||||
x = self.max_speed * (vel_impulse/3),
|
||||
y = self.max_speed * vel_impulse,
|
||||
z = self.max_speed * (vel_impulse/3),
|
||||
}
|
||||
mobkit.set_velocity(self, velocity)
|
||||
self.object:set_acceleration({x=1.0, y=vel_impulse, z=1.0})
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
##Important: All the values separated by commas have to be without spaces.
|
||||
##
|
||||
|
||||
petz_list = kitty,puppy,ducky,lamb,lion,calf,panda,grizzly,pony,parrot,chicken,piggy,wolf,elephant,elephant_female,pigeon,moth,camel,clownfish,bat,silkworm,chimp,hamster,dolphin,bee,tropicalfish
|
||||
petz_list = kitty,puppy,ducky,lamb,lion,calf,panda,grizzly,pony,parrot,chicken,piggy,wolf,elephant,elephant_female,pigeon,moth,camel,clownfish,bat,silkworm,chimp,hamster,dolphin,bee,tropicalfish,beaver,turtle,frog
|
||||
|
||||
##Type of model [mesh -or- cubic]
|
||||
type_model = mesh
|
||||
|
@ -63,7 +63,7 @@ parrot_spawn= true
|
|||
chicken_spawn = true
|
||||
chimp_spawn = true
|
||||
pigeon_spawn = true
|
||||
turtle_spawn = false
|
||||
turtle_spawn = true
|
||||
clownfish_spawn = true
|
||||
tropicalfish_spawn = true
|
||||
wolf_spawn = true
|
||||
|
@ -106,6 +106,7 @@ ducky_spawn_biome = default
|
|||
|
||||
##Beaver Specific
|
||||
beaver_follow = farming:wheat
|
||||
beaver_spawn_nodes = default:dirt_with_grass,default:river_water_source
|
||||
beaver_spawn_chance = 0.6
|
||||
beaver_create_dam = true
|
||||
beaver_spawn_biome = default
|
||||
|
@ -151,6 +152,7 @@ panda_copulation_distance = 2
|
|||
|
||||
##Frog Specific
|
||||
frog_follow = fireflies:firefly
|
||||
frog_spawn_nodes = default:dirt_with_grass,default:river_water_source
|
||||
frog_spawn_chance = 0.6
|
||||
frog_spawn_biome = default
|
||||
|
||||
|
@ -201,6 +203,7 @@ pigeon_spawn_biome = default
|
|||
|
||||
##Turtle Specific
|
||||
turtle_follow = default:sand_with_kelp
|
||||
turtle_spawn_nodes = default:dirt_with_grass,default:river_water_source,default:water_source
|
||||
turtle_spawn_chance = 0.6
|
||||
turtle_spawn_biome = default
|
||||
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
--
|
||||
--BEAVER
|
||||
--
|
||||
local S = ...
|
||||
|
||||
local pet_name = "beaver"
|
||||
local scale_model = 1.2
|
||||
petz.beaver = {}
|
||||
local mesh = 'petz_beaver.b3d'
|
||||
local textures= {"petz_beaver.png"}
|
||||
local collisionbox = {-0.35, -0.75*scale_model, -0.28, 0.35, -0.125, 0.28}
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
type = "beaver",
|
||||
is_pet = false,
|
||||
has_affinity = false,
|
||||
is_wild = false,
|
||||
attack_player = false,
|
||||
give_orders = false,
|
||||
can_be_brushed = false,
|
||||
capture_item = "lasso",
|
||||
follow = petz.settings.beaver_follow,
|
||||
drops = {
|
||||
{name = "petz:bone", chance = 5, min = 1, max = 1,},
|
||||
{name = "petz:beaver_fur", chance = 1, min = 1, max = 1,},
|
||||
},
|
||||
rotate = petz.settings.rotate,
|
||||
physical = true,
|
||||
stepheight = 0.1, --EVIL!
|
||||
collide_with_objects = true,
|
||||
collisionbox = collisionbox,
|
||||
visual = petz.settings.visual,
|
||||
mesh = mesh,
|
||||
textures = textures,
|
||||
visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model},
|
||||
static_save = true,
|
||||
get_staticdata = mobkit.statfunc,
|
||||
-- api props
|
||||
springiness= 0,
|
||||
buoyancy = 1.1, -- portion of hitbox submerged
|
||||
max_speed = 1.0,
|
||||
jump_height = 1.5,
|
||||
view_range = 10,
|
||||
max_hp = 15,
|
||||
|
||||
attack={range=0.5, damage_groups={fleshy=7}},
|
||||
animation = {
|
||||
walk={range={x=1, y=12}, speed=20, loop=true},
|
||||
run={range={x=13, y=25}, speed=20, loop=true},
|
||||
stand={
|
||||
{range={x=26, y=46}, speed=5, loop=true},
|
||||
{range={x=46, y=60}, speed=5, loop=true},
|
||||
{range={x=82, y=95}, speed=5, loop=true},
|
||||
},
|
||||
sit = {range={x=60, y=81}, speed=5, loop=false},
|
||||
swin = {range={x=96, y=116}, speed=25, loop=true},
|
||||
},
|
||||
sounds = {
|
||||
misc = "petz_beaver_sound",
|
||||
moaning = "petz_beaver_moaning",
|
||||
},
|
||||
|
||||
brainfunc = petz.semiaquatic_brain,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s) --on_activate, required
|
||||
mobkit.actfunc(self, staticdata, dtime_s)
|
||||
petz.set_initial_properties(self, staticdata, dtime_s)
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
petz.on_rightclick(self, clicker)
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
mobkit.stepfunc(self, dtime) -- required
|
||||
petz.on_step(self, dtime)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
petz:register_egg("petz:beaver", S("Beaver"), "petz_spawnegg_beaver.png", 0)
|
|
@ -38,10 +38,9 @@ minetest.register_entity("petz:"..pet_name,{
|
|||
-- api props
|
||||
springiness= 0,
|
||||
buoyancy = 1.1, -- portion of hitbox submerged
|
||||
max_speed = 0.5,
|
||||
max_speed = 1.5,
|
||||
jump_height = 2.0,
|
||||
view_range = 10,
|
||||
lung_capacity = 32767, -- seconds
|
||||
max_hp = 6,
|
||||
max_height = -2,
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ minetest.register_entity("petz:"..pet_name,{
|
|||
-- api props
|
||||
springiness= 0,
|
||||
buoyancy = 0.5, -- portion of hitbox submerged
|
||||
max_speed = 1.0,
|
||||
max_speed = 2.5,
|
||||
jump_height = 2.0,
|
||||
view_range = 10,
|
||||
lung_capacity = 32767, -- seconds
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
--
|
||||
--FROG
|
||||
--
|
||||
local S = ...
|
||||
|
||||
local pet_name = "frog"
|
||||
local scale_model = 0.8
|
||||
petz.frog = {}
|
||||
local mesh = 'petz_frog.b3d'
|
||||
local textures= {"petz_frog.png", "petz_frog2.png", "petz_frog3.png"}
|
||||
local collisionbox = {-0.35, -0.75*scale_model, -0.28, 0.35, -0.3125, 0.28}
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
type = "frog",
|
||||
is_pet = false,
|
||||
has_affinity = false,
|
||||
is_wild = false,
|
||||
attack_player = false,
|
||||
give_orders = false,
|
||||
can_be_brushed = false,
|
||||
capture_item = "net",
|
||||
follow = petz.settings.frog_follow,
|
||||
drops = {
|
||||
{name = "petz:frog_leg", chance = 1, min = 1, max = 1,},
|
||||
},
|
||||
rotate = petz.settings.rotate,
|
||||
physical = true,
|
||||
stepheight = 0.1, --EVIL!
|
||||
collide_with_objects = true,
|
||||
collisionbox = collisionbox,
|
||||
visual = petz.settings.visual,
|
||||
mesh = mesh,
|
||||
textures = textures,
|
||||
visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model},
|
||||
static_save = true,
|
||||
get_staticdata = mobkit.statfunc,
|
||||
-- api props
|
||||
springiness= 0,
|
||||
buoyancy = 1.1, -- portion of hitbox submerged
|
||||
max_speed = 1.0,
|
||||
jump_height = 3.0,
|
||||
view_range = 10,
|
||||
max_hp = 15,
|
||||
|
||||
attack={range=0.5, damage_groups={fleshy=7}},
|
||||
animation = {
|
||||
walk={range={x=26, y=38}, speed=20, loop=true},
|
||||
run={range={x=26, y=38}, speed=30, loop=true},
|
||||
stand={
|
||||
{range={x=0, y=12}, speed=5, loop=true},
|
||||
},
|
||||
swin = {range={x=39, y=51}, speed=15, loop=true},
|
||||
},
|
||||
sounds = {
|
||||
misc = "petz_frog_croak",
|
||||
},
|
||||
|
||||
brainfunc = petz.semiaquatic_brain,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s) --on_activate, required
|
||||
mobkit.actfunc(self, staticdata, dtime_s)
|
||||
petz.set_initial_properties(self, staticdata, dtime_s)
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
petz.on_rightclick(self, clicker)
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
mobkit.stepfunc(self, dtime) -- required
|
||||
petz.on_step(self, dtime)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
petz:register_egg("petz:frog", S("Frog"), "petz_spawnegg_frog.png", 0)
|
|
@ -35,7 +35,7 @@ minetest.register_entity("petz:"..pet_name, {
|
|||
springiness= 0,
|
||||
buoyancy = 0.5, -- portion of hitbox submerged
|
||||
max_speed = 2,
|
||||
jump_height = 2.0,
|
||||
jump_height = 3.0,
|
||||
view_range = 10,
|
||||
lung_capacity = 10, -- seconds
|
||||
max_hp = 10,
|
||||
|
|
|
@ -38,10 +38,9 @@ minetest.register_entity("petz:"..pet_name,{
|
|||
-- api props
|
||||
springiness= 0,
|
||||
buoyancy = 1.1, -- portion of hitbox submerged
|
||||
max_speed = 0.5,
|
||||
max_speed = 1.5,
|
||||
jump_height = 2.0,
|
||||
view_range = 10,
|
||||
lung_capacity = 32767, -- seconds
|
||||
max_hp = 4,
|
||||
max_height = -2,
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
--
|
||||
--TURTLE
|
||||
--
|
||||
local S = ...
|
||||
|
||||
local pet_name = "turtle"
|
||||
local scale_model = 1.3
|
||||
petz.turtle = {}
|
||||
local mesh = 'petz_turtle.b3d'
|
||||
local textures= {"petz_turtle.png", "petz_turtle2.png", "petz_turtle3.png",}
|
||||
local collisionbox = {-0.35, -0.75*scale_model, -0.28, 0.35, -0.5, 0.28}
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
type = "turtle",
|
||||
is_pet = false,
|
||||
has_affinity = false,
|
||||
is_wild = false,
|
||||
attack_player = false,
|
||||
give_orders = false,
|
||||
can_be_brushed = false,
|
||||
capture_item = "net",
|
||||
follow = petz.settings.turtle_follow,
|
||||
drops = {
|
||||
{name = "petz:turtle_shell", chance = 3, min = 1, max = 1,},
|
||||
},
|
||||
rotate = petz.settings.rotate,
|
||||
physical = true,
|
||||
stepheight = 0.1, --EVIL!
|
||||
collide_with_objects = true,
|
||||
collisionbox = collisionbox,
|
||||
visual = petz.settings.visual,
|
||||
mesh = mesh,
|
||||
textures = textures,
|
||||
visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model},
|
||||
static_save = true,
|
||||
get_staticdata = mobkit.statfunc,
|
||||
-- api props
|
||||
springiness= 0,
|
||||
buoyancy = 1.1, -- portion of hitbox submerged
|
||||
max_speed = 0.35,
|
||||
jump_height = 1.5,
|
||||
view_range = 10,
|
||||
max_hp = 25,
|
||||
|
||||
attack={range=0.5, damage_groups={fleshy=7}},
|
||||
animation = {
|
||||
walk={range={x=1, y=12}, speed=10, loop=true},
|
||||
run={range={x=13, y=25}, speed=20, loop=true},
|
||||
stand={
|
||||
{range={x=26, y=46}, speed=5, loop=true},
|
||||
{range={x=47, y=59}, speed=5, loop=true},
|
||||
},
|
||||
swin = {range={x=101, y=113}, speed=5, loop=true},
|
||||
},
|
||||
|
||||
brainfunc = petz.semiaquatic_brain,
|
||||
|
||||
on_activate = function(self, staticdata, dtime_s) --on_activate, required
|
||||
mobkit.actfunc(self, staticdata, dtime_s)
|
||||
petz.set_initial_properties(self, staticdata, dtime_s)
|
||||
end,
|
||||
|
||||
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
petz.on_rightclick(self, clicker)
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
mobkit.stepfunc(self, dtime) -- required
|
||||
petz.on_step(self, dtime)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
petz:register_egg("petz:turtle", S("Turtle"), "petz_spawnegg_turtle.png", 0)
|
Loading…
Reference in New Issue