master
runs 2019-07-19 23:46:41 +02:00
parent 034feb3f91
commit d1c1915805
35 changed files with 480 additions and 241 deletions

View File

@ -1,31 +1,25 @@
local modpath, S = ...
local modpath, modname, S = ...
petz = {}
local creative_mode = minetest.settings:get_bool("creative_mode")
petz.register_cubic = function(node_name, fixed, tiles)
minetest.register_node(node_name, {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = fixed,
},
tiles = tiles,
paramtype = "light",
paramtype2 = "facedir",
groups = {not_in_creative_inventory = 1},
})
end
--
--The Petz
--
petz.petz_list = {"kitty", "puppy", "ducky", "lamb", "lion", "calf", "panda", --A table with all the petz names
"grizzly", "pony", "parrot", "chicken", "piggy", "wolf"}
--
--Settings
--
petz.settings = {}
petz.settings.mesh = nil
petz.settings.visual_size = {}
petz.settings.rotate = 0
petz.settings.tamagochi_safe_nodes = {} --Table with safe nodes for tamagochi mode
petz.mobs_list = {} --A table with all the petz names
--
--Form Dialog
--
@ -126,7 +120,7 @@ petz.create_form = function(player_name)
end
if pet.is_male == false and pet.is_pregnant == true then
tamagochi_form_stuff = tamagochi_form_stuff..
"image["..pregnant_icon_x..","..pregnant_icon_y..";1,1;petz_pony_pregnant_icon.png]"..
"image["..pregnant_icon_x..","..pregnant_icon_y..";1,1;petz_"..pet.type.."_pregnant_icon.png]"..
"label["..pregnant_text_x..","..pregnant_text_y..";"..S("Pregnant").."]"
elseif pet.is_male == false and pet.pregnant_count <= 0 then
tamagochi_form_stuff = tamagochi_form_stuff..
@ -178,24 +172,41 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if pet and pet.object then
--brewing.magic_sound("to_player", player, "brewing_select")
if fields.btn_followme then
mobkit.clear_queue_low(pet)
mobkit.hq_follow(pet, 15, player)
if not(pet.can_fly) then
mobkit.clear_queue_low(pet)
mobkit.hq_follow(pet, 15, player)
end
elseif fields.btn_standhere then
mobkit.lq_idle(pet, 2400)
mobkit.clear_queue_high(pet)
petz.stand(pet)
mobkit.lq_idle(pet, 2400)
if pet.can_fly == true then
if mobkit.node_name_in(pet, "below") == "air" then
mobkit.animate(pet, "fly")
else
mobkit.animate(pet, "stand")
end
end
elseif fields.btn_ownthing then
mobkit.clear_queue_low(pet)
mobkit.clear_queue_low(pet)
petz.ownthing(pet)
elseif fields.btn_alight then
pet.object:set_acceleration({ x = 0, y = -1, z = 0 })
mobkit.animate(pet, "stand")
elseif fields.btn_fly then
pet.object:set_acceleration({ x = 0, y = 1, z = 0 })
mobkit.animate(pet, "fly")
mobkit.clear_queue_low(pet)
mobkit.clear_queue_high(pet)
if not(mobkit.node_name_in(pet, "below") == "air") then
mobkit.animate(pet, "fly")
end
mobkit.hq_alight(pet, 0)
elseif fields.btn_fly then
mobkit.clear_queue_low(pet)
mobkit.clear_queue_high(pet)
pet.mov_status = "free"
mobkit.hq_fly(pet, 0)
minetest.after(2.5, function(pet)
mobkit.clear_queue_low(pet)
pet.object:set_acceleration({ x = 0, y = 0, z = 0 })
pet.object:set_velocity({ x = 0, y = 0, z = 0 })
petz.ownthing(pet)
end, pet)
end, pet)
elseif fields.btn_perch_shoulder then
pet.object:set_attach(player, "Arm_Left", {x=0.5,y=-6.25,z=0}, {x=0,y=0,z=180})
mobkit.animate(pet, "stand")
@ -217,11 +228,19 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end)
petz.ownthing= function(self)
petz.ownthing = function(self)
self.mov_status = "free"
mobkit.hq_roam(self, 0)
mobkit.clear_queue_high(self)
end
petz.stand = function(self)
self.mov_status = "stand"
self.object:set_velocity({ x = 0, y = 0, z = 0 })
self.object:set_acceleration({ x = 0, y = 0, z = 0 })
mobkit.clear_queue_high(self)
end
--
--Misc Functions
--
@ -986,9 +1005,12 @@ function petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, d
mobkit.hurt(self,tool_capabilities.damage_groups.fleshy or 1)
petz.update_nametag(self)
self.was_killed_by_player = petz.was_killed_by_player(self, puncher)
end
end
petz.kick_back(self, dir) -- kickback
petz.do_sound_effect("object", self.object, "petz_default_punch")
petz.do_sound_effect("object", self.object, "petz_default_punch")
if self.hp <= 0 and self.driver then --important for ponies!
petz.force_detach(self.driver)
end
end
end
@ -1140,7 +1162,7 @@ petz.on_rightclick = function(self, clicker)
petz.pony_breed(self, clicker, wielded_item, wielded_item_name)
end
--Else open the Form
elseif (self.tamed == true) and (self.is_pet == true) then
elseif (self.tamed == true) and (self.is_pet == true) and (self.owner == player_name) then
show_form = true
end
if show_form == true then
@ -1218,7 +1240,7 @@ petz.pony_breed = function(self, clicker, wielded_item, wielded_item_name)
local max_speed_reverse = meta:get_int("max_speed_reverse")
local accel = meta:get_int("accel")
petz.init_pony_pregnancy(self, max_speed_forward, max_speed_reverse, accel)
petz.do_particles_effect(self.object, self.object:get_pos(), "pregnant")
petz.do_particles_effect(self.object, self.object:get_pos(), "pregnant".."_"..self.type)
end
clicker:set_wielded_item("petz:glass_syringe")
end
@ -1318,15 +1340,12 @@ end
--on_die event for all the mobs
--
petz.on_die = function(self)
petz.on_die = function(self)
--Specific of each mob
if self.type == "pony" then
if self.saddle then -- drop saddle when horse is killed while riding
minetest.add_item(self.object:get_pos(), "petz:saddle")
end
if self.driver then -- also detach from horse properly
--petz.force_detach(self.driver)
end
elseif self.type == "puppy" then
if self.square_ball_attached == true and self.attached_squared_ball then
self.attached_squared_ball.object:set_detach()
@ -1388,11 +1407,16 @@ petz.do_particles_effect = function(obj, pos, particle_type)
particles_amount = 10
min_size = 1.0
max_size = 1.5
elseif particle_type == "pregnant" then
elseif particle_type == "pregnant_pony" then
texture_name = "petz_pony_pregnant_icon.png"
particles_amount = 10
min_size = 5.0
max_size = 6.0
elseif particle_type == "pregnant_lamb" then
texture_name = "petz_lamb_pregnant_icon.png"
particles_amount = 10
min_size = 5.0
max_size = 6.0
end
minetest.add_particlespawner({
--attached = obj,

View File

@ -8,11 +8,9 @@ function petz.herbivore_brain(self)
-- Die Behaviour
if self.hp <= 0 then
if self.hp <= 0 then
petz.on_die(self)
return
elseif self.type == "pony" and self.driver then
return
end
if mobkit.timer(self, 1) then
@ -109,7 +107,7 @@ function petz.herbivore_brain(self)
mobkit.remember(couple, "is_rut", couple.is_rut)
couple.is_pregnant = true
mobkit.remember(couple, "is_pregnant", couple.is_pregnant)
petz.do_particles_effect(couple.object, couple.object:get_pos(), "pregnant")
petz.do_particles_effect(couple.object, couple.object:get_pos(), "pregnant".."_"..couple.type)
petz.init_pregnancy(couple, self)
end
end
@ -145,8 +143,8 @@ function petz.herbivore_brain(self)
petz.random_mob_sound(self)
--Roam default
if mobkit.is_queue_empty_high(self) then
if not(self.fly) then
if mobkit.is_queue_empty_high(self) and not(self.mov_status == "stand") then
if not(self.can_fly) then
mobkit.hq_roam(self, 0)
else
mobkit.hq_wanderfly(self, 0)

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "calf"
table.insert(petz.mobs_list, pet_name)
local scale_model = 3.0
petz.calf = {}
local mesh = 'petz_calf.b3d'

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "chicken"
table.insert(petz.mobs_list, pet_name)
local scale_model = 1.4
local mesh = 'petz_chicken.b3d'
local textures= {"petz_chicken.png", "petz_chicken2.png", "petz_chicken3.png"}

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "ducky"
table.insert(petz.mobs_list, pet_name)
local scale_model = 1.3
local mesh = 'petz_ducky.b3d'
local textures= {"petz_ducky.png", "petz_ducky2.png", "petz_ducky3.png"}

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "grizzly"
table.insert(petz.mobs_list, pet_name)
local scale_model = 2.0
petz.grizzly = {}
local mesh = 'petz_grizzly.b3d'

View File

@ -10,7 +10,7 @@ local mg_name = minetest.get_mapgen_setting("mg_name")
-- internationalization boilerplate
local S = minetest.get_translator(minetest.get_current_modname())
assert(loadfile(modpath .. "/api.lua"))(modpath, S)
assert(loadfile(modpath .. "/api.lua"))(modpath, modname, S)
assert(loadfile(modpath .. "/mobkit.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit_plus.lua"))(modpath, S)
assert(loadfile(modpath .. "/behaviours.lua"))(modpath, S)
@ -21,63 +21,8 @@ assert(loadfile(modpath .. "/food.lua"))(modpath, S) --Load the food items
assert(loadfile(modpath .. "/spawn.lua"))(modpath, S) --Load the spawn engine
assert(loadfile(modpath .. "/mount.lua"))(modpath, S) --Load the mount engine
if petz.settings.kitty_spawn then
assert(loadfile(modpath .. "/kitty_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.puppy_spawn then
assert(loadfile(modpath .. "/puppy_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.ducky_spawn then
assert(loadfile(modpath .. "/ducky_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.beaver_spawn then
assert(loadfile(modpath .. "/beaver_"..petz.settings.type_api..".lua"))(S, modpath, mg_name)
end
if petz.settings.lamb_spawn then
assert(loadfile(modpath .. "/lamb_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.lion_spawn then
assert(loadfile(modpath .. "/lion_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.calf_spawn then
assert(loadfile(modpath .. "/calf_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.panda_spawn then
assert(loadfile(modpath .. "/panda_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.frog_spawn then
assert(loadfile(modpath .. "/frog_"..petz.settings.type_api..".lua"))(S, modpath, mg_name)
end
if petz.settings.grizzly_spawn then
assert(loadfile(modpath .. "/grizzly_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.pony_spawn then
assert(loadfile(modpath .. "/pony_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.parrot_spawn then
--assert(loadfile(modpath .. "/parrot_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.chicken_spawn then
assert(loadfile(modpath .. "/chicken_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.chimp_spawn then
assert(loadfile(modpath .. "/chimp_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.piggy_spawn then
assert(loadfile(modpath .. "/piggy_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.pigeon_spawn then
assert(loadfile(modpath .. "/pigeon_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.turtle_spawn then
assert(loadfile(modpath .. "/turtle_"..petz.settings.type_api..".lua"))(S, modpath, mg_name)
end
if petz.settings.clownfish_spawn then
assert(loadfile(modpath .. "/clownfish_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.tropicalfish_spawn then
assert(loadfile(modpath .. "/tropicalfish_"..petz.settings.type_api..".lua"))(S)
end
if petz.settings.wolf_spawn then
assert(loadfile(modpath .. "/wolf_"..petz.settings.type_api..".lua"))(S)
end
for i = 1, #petz.petz_list do --load all the petz.lua files
if petz.settings[petz.petz_list[i].."_spawn"] then
assert(loadfile(modpath .. "/"..petz.petz_list[i].."_"..petz.settings.type_api..".lua"))(S)
end
end

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "kitty"
table.insert(petz.mobs_list, pet_name)
local scale_model = 1.0
local mesh = 'petz_kitty.b3d'
local textures= {"petz_kitty.png", "petz_kitty2.png", "petz_kitty3.png"}

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "lamb"
table.insert(petz.mobs_list, pet_name)
local scale_model = 1.7
local scale_baby = 0.5
local visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model}

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "lion"
table.insert(petz.mobs_list, pet_name)
local scale_model = 2.3
petz.lion = {}
local mesh = 'petz_lion.b3d'

View File

@ -21,110 +21,191 @@ function mobkit.hq_wanderfly(self, prty)
mobkit.queue_high(self,func,prty)
end
function mobkit.dumbstepfly(self, tpos)
function mobkit.hq_alight(self, prty)
local func=function(self)
local node_name = mobkit.node_name_in(self, "below")
if node_name == "air" then
mobkit.lq_alight(self)
elseif minetest.get_item_group(node_name, "water") > 1 then
mobkit.hq_wanderfly(self, 0)
return true
else
minetest.chat_send_player("singleplayer", "on ground")
mobkit.animate(self, "stand")
mobkit.lq_idle(self, 2400)
self.mov_status = "stand"
return true
end
end
mobkit.queue_high(self, func, prty)
end
function mobkit.lq_alight(self)
local func=function(self)
minetest.chat_send_player("singleplayer", "alight")
self.object:set_acceleration({ x = 0, y = -1, z = 0 })
return true
end
mobkit.queue_low(self, func)
end
function mobkit.lq_fly(self)
local func=function(self)
self.object:set_acceleration({ x = 0, y = 1, z = 0 })
end
mobkit.queue_low(self,func)
end
function mobkit.hq_fly(self, prty)
local func=function(self)
mobkit.animate(self, "fly")
mobkit.lq_fly(self)
mobkit.clear_queue_high(self)
end
mobkit.queue_high(self, func, prty)
end
function mobkit.dumbstepfly(self)
--mobkit.set_velocity(self, {x=1, y=0, z=1})
if mobkit.node_name_in(self, "front") ~= "air" then
local yaw = self.object:get_yaw()
if yaw then
local rotation_integer = math.random(0, 5)
local rotation_decimals = math.random()
local new_yaw = yaw + rotation_integer + rotation_decimals
self.object:set_yaw(new_yaw)
mobkit.set_velocity(self, self.object:getvelocity())
end
end
mobkit.lq_dumbfly(self, 0.3)
mobkit.lq_idle(self, math.random(1,6))
end
function mobkit.node_name_in(self, where)
local pos = self.object:get_pos()
local yaw = self.object:get_yaw()
local dir_x = -math.sin(yaw) + 0.5
local dir_z = math.cos(yaw) + 0.5
if where == "front" then
local pos= {
x = pos.x + dir_x + 0.5,
y = pos.y + 0.5,
z = pos.z + dir_z + 0.5,
}
elseif where == "top" then
local pos= {
x = pos.x,
y = pos.y + 0.5,
z = pos.z,
}
else
return nil
end
local node = minetest.get_node_or_nil(pos)
if node and minetest.registered_nodes[node.name] then
return node.name
if yaw then
local dir_x = -math.sin(yaw)
local dir_z = math.cos(yaw)
local pos2
if where == "front" then
pos2 = {
x = pos.x +dir_x,
y = pos.y,
z = pos.z + dir_z,
}
elseif where == "top" then
pos2= {
x = pos.x,
y = pos.y + 0.5,
z = pos.z,
}
elseif where == "below" then
pos2= {
x = pos.x,
y = pos.y - 0.75,
z = pos.z,
}
end
local node = minetest.get_node_or_nil(pos2)
if node and minetest.registered_nodes[node.name] then
--minetest.chat_send_player("singleplayer", node.name)
return node.name
else
return nil
end
else
return nil
end
end
function mobkit.set_velocity(self, velocity)
local yaw = self.object:get_yaw() or 0
self.object:set_velocity({
x = (math.sin(yaw) * -velocity.x),
y = velocity.y,
z = (math.cos(yaw) * velocity.z),
})
end
function mobkit.lq_dumbfly(self, speed_factor)
--local timer = 3 -- failsafe
local func=function(self)
local random_num = math.random(1, 500)
if random_num <= 1 then
local yaw = self.object:get_yaw() or 0
yaw = self.object:set_yaw(yaw + 1.35, 8)
if yaw then
local x = math.sin(yaw) * -1
local z = math.cos(yaw) * 1
local y = self.object:get_velocity().y
self.object:set_velocity({
x = x,
y = y,
z = z,
})
end
minetest.chat_send_player("singleplayer", "test")
end
mobkit.animate(self, 'fly')
--local node_name_in_front = mobkit.node_name_in(self, "front")
local timer = 3
speed_factor = speed_factor or 1
local func = function(self)
timer = timer - self.dtime
local vel = self.object:getvelocity()
local mob = self.object
local pos = mob:getpos()
local status
local random_num
if status == "stand" then -- stand
self.object:setvelocity({
x= vel.x,
mobkit.animate(self, 'fly')
random_num = math.random(1, 300)
if random_num <= 1 then
local yaw = self.object:get_yaw()
if yaw then
local rotation_integer = math.random(0, 5)
local rotation_decimals = math.random()
local new_yaw = yaw + rotation_integer + rotation_decimals
self.object:set_yaw(new_yaw)
mobkit.set_velocity(self, self.object:getvelocity())
end
end
if mobkit.check_height(self) == false then
random_num = math.random(1, 100)
if random_num < 70 then
status = "descend"
else
status = "stand"
end
end
--local node_name_in_front = mobkit.node_name_in(self, "front")
if status == "stand" and timer < 0 then -- stand
local velocity = {
x= vel.x*self.max_speed* speed_factor,
y= 0,
z= vel.z,
})
z= vel.z*self.max_speed* speed_factor,
}
mobkit.set_velocity(self, velocity)
random_num = math.random(1, 100)
if random_num < 10 and mobkit.check_height(self) == false then
status = "ascend"
elseif random_num < 20 then
status = "descend"
status = "descend"
elseif random_num < 60 then
status = "ascend"
end
elseif status == "descend" then -- descend
--minetest.chat_send_player("singleplayer", "stand")
return true
elseif status == "descend" and timer < 0 then -- descend
local y
y = -self.max_speed * speed_factor
self.object:setvelocity({
local velocity = {
x = self.max_speed* speed_factor,
y = y,
z = self.max_speed* speed_factor,
})
}
mobkit.set_velocity(self, velocity)
random_num = math.random(1, 100)
if random_num < 10 then
status = "ascend"
elseif random_num < 30 then
status = "stand"
end
else --ascend
if random_num < 20 then
status = "stand"
elseif random_num < 60 then
status = "ascend"
end
--minetest.chat_send_player("singleplayer", "descend")
return true
elseif timer < 0 then --ascend
local y
if mobkit.check_height(self) then
y = self.max_speed * speed_factor
status = "ascend"
else
y = 0
random_num = math.random(1, 100)
if random_num < 50 then
status = "descend"
else
status = "stand"
end
end
self.object:setvelocity({
x = self.max_speed* speed_factor,
y = self.max_speed * speed_factor * 2
status = "ascend"
local velocity ={
x = self.max_speed* speed_factor,
y = y,
z = self.max_speed* speed_factor,
})
}
--minetest.chat_send_player("singleplayer", tostring(velocity.x))
mobkit.set_velocity(self, velocity)
--minetest.chat_send_player("singleplayer", "ascend")
return true
end
if timer < 0 then
timer = 3
end
end
mobkit.queue_low(self,func)

View File

@ -0,0 +1,199 @@
mtllib pet_elephant.mtl
o converted_out
v 0.125 -0.3125 -0.1875
v 0.125 -0.3125 -0.0624999
v 0.125 -0.0625 -0.0624999
v 0.125 -0.0625 -0.1875
v -0.0625 -0.3125 -0.1875
v -0.0625 -0.3125 -0.0624999
v -0.0625 -0.0625 -0.0624999
v -0.0625 -0.0625 -0.1875
v 0.1875 -0.5 -0.0625
v 0.1875 -0.5 0.0625
v 0.1875 -0.375 0.0625
v 0.1875 -0.375 -0.0625
v 0.0625 -0.5 -0.0625
v 0.0625 -0.5 0.0625
v 0.0625 -0.375 0.0625
v 0.0625 -0.375 -0.0625
v -0 -0.5 -0.0625
v -0 -0.5 0.0625
v -0 -0.375 0.0625
v -0 -0.375 -0.0625
v -0.125 -0.5 -0.0625
v -0.125 -0.5 0.0625
v -0.125 -0.375 0.0625
v -0.125 -0.375 -0.0625
v -0 -0.5 0.1875
v -0 -0.5 0.3125
v -0 -0.375 0.3125
v -0 -0.375 0.1875
v -0.125 -0.5 0.1875
v -0.125 -0.5 0.3125
v -0.125 -0.375 0.3125
v -0.125 -0.375 0.1875
v 0.1875 -0.5 0.1875
v 0.1875 -0.5 0.3125
v 0.1875 -0.375 0.3125
v 0.1875 -0.375 0.1875
v 0.0624998 -0.5 0.1875
v 0.0624998 -0.5 0.3125
v 0.0624998 -0.375 0.3125
v 0.0624998 -0.375 0.1875
v 0.1875 -0.375 -0.0625
v 0.1875 -0.375 0.3125
v 0.1875 -0.0625 0.3125
v 0.1875 -0.0625 -0.0625
v -0.125 -0.375 -0.0625
v -0.125 -0.375 0.3125
v -0.125 -0.0625 0.3125
v -0.125 -0.0625 -0.0625
v 0.25 -0.3125 -0.125
v 0.25 -0.3125 -0.0625
v 0.25 -0.125 -0.0625
v 0.25 -0.125 -0.125
v 0.125 -0.3125 -0.125
v 0.125 -0.3125 -0.0625
v 0.125 -0.125 -0.0625
v 0.125 -0.125 -0.125
v -0.0625 -0.3125 -0.125
v -0.0625 -0.3125 -0.0625
v -0.0625 -0.125 -0.0625
v -0.0625 -0.125 -0.125
v -0.1875 -0.3125 -0.125
v -0.1875 -0.3125 -0.0625
v -0.1875 -0.125 -0.0625
v -0.1875 -0.125 -0.125
v 0.0625 -0.375 -0.25
v 0.0625 -0.375 -0.1875
v 0.0625 -0.1875 -0.1875
v 0.0625 -0.1875 -0.25
v -5.58794e-09 -0.375 -0.25
v -5.58794e-09 -0.375 -0.1875
v -5.58794e-09 -0.1875 -0.1875
v -5.58794e-09 -0.1875 -0.25
v 0.0625 -0.4375 -0.3125
v 0.0625 -0.4375 -0.1875
v 0.0625 -0.375 -0.1875
v 0.0625 -0.375 -0.3125
v 5.58794e-09 -0.4375 -0.3125
v 5.58794e-09 -0.4375 -0.1875
v 5.58794e-09 -0.375 -0.1875
v 5.58794e-09 -0.375 -0.3125
v 0.125 -0.375 -0.25
v 0.125 -0.375 -0.0625
v 0.125 -0.3125 -0.0625
v 0.125 -0.3125 -0.25
v 0.0625 -0.375 -0.25
v 0.0625 -0.375 -0.0625
v 0.0625 -0.3125 -0.0625
v 0.0625 -0.3125 -0.25
v -0 -0.375 -0.25
v -0 -0.375 -0.0625
v -0 -0.3125 -0.0625
v -0 -0.3125 -0.25
v -0.0625 -0.375 -0.25
v -0.0625 -0.375 -0.0625
v -0.0625 -0.3125 -0.0625
v -0.0625 -0.3125 -0.25
v 0.0625 -0.25 0.3125
v 0.0625 -0.25 0.375
v 0.0625 -0.1875 0.375
v 0.0625 -0.1875 0.3125
v 5.58794e-09 -0.25 0.3125
v 5.58794e-09 -0.25 0.375
v 5.58794e-09 -0.1875 0.375
v 5.58794e-09 -0.1875 0.3125
usemtl none
s off
g head
f 1 2 3 4
f 5 6 7 8
f 1 4 8 5
f 2 3 7 6
f 1 2 6 5
f 4 3 7 8
g front_right_leg
f 9 10 11 12
f 13 14 15 16
f 9 12 16 13
f 10 11 15 14
f 9 10 14 13
f 12 11 15 16
g front_left_leg
f 17 18 19 20
f 21 22 23 24
f 17 20 24 21
f 18 19 23 22
f 17 18 22 21
f 20 19 23 24
g back_left_leg
f 25 26 27 28
f 29 30 31 32
f 25 28 32 29
f 26 27 31 30
f 25 26 30 29
f 28 27 31 32
g back_right_leg
f 33 34 35 36
f 37 38 39 40
f 33 36 40 37
f 34 35 39 38
f 33 34 38 37
f 36 35 39 40
g body
f 41 42 43 44
f 45 46 47 48
f 41 44 48 45
f 42 43 47 46
f 41 42 46 45
f 44 43 47 48
g right_ear
f 49 50 51 52
f 53 54 55 56
f 49 52 56 53
f 50 51 55 54
f 49 50 54 53
f 52 51 55 56
g left_ear
f 57 58 59 60
f 61 62 63 64
f 57 60 64 61
f 58 59 63 62
f 57 58 62 61
f 60 59 63 64
g top_trunk
f 65 66 67 68
f 69 70 71 72
f 65 68 72 69
f 66 67 71 70
f 65 66 70 69
f 68 67 71 72
g bottom_trunk
f 73 74 75 76
f 77 78 79 80
f 73 76 80 77
f 74 75 79 78
f 73 74 78 77
f 76 75 79 80
g right_tusk
f 81 82 83 84
f 85 86 87 88
f 81 84 88 85
f 82 83 87 86
f 81 82 86 85
f 84 83 87 88
g left_tusk
f 89 90 91 92
f 93 94 95 96
f 89 92 96 93
f 90 91 95 94
f 89 90 94 93
f 92 91 95 96
g tail
f 97 98 99 100
f 101 102 103 104
f 97 100 104 101
f 98 99 103 102
f 97 98 102 101
f 100 99 103 104

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "panda"
table.insert(petz.mobs_list, pet_name)
local scale_model = 1.0
local mesh = 'petz_panda.b3d'
local textures= {"petz_panda.png"}

View File

@ -1,7 +1,6 @@
local S = ...
local pet_name = "parrot"
table.insert(petz.mobs_list, pet_name)
local scale_model = 0.7
local mesh = 'petz_parrot.b3d'
local textures= {"petz_parrot.png", "petz_parrot2.png", "petz_parrot3.png"}
@ -12,7 +11,7 @@ minetest.register_entity("petz:"..pet_name,{
type = "parrot",
init_timer = true,
is_pet = true,
fly = true,
can_fly = true,
max_height = 5,
has_affinity = true,
is_wild = false,
@ -23,7 +22,7 @@ minetest.register_entity("petz:"..pet_name,{
drops = {
{name = "petz:raw_parrot", chance = 3, min = 1, max = 1,},
},
automatic_face_movement_dir = 0.0,
--automatic_face_movement_dir = 0.0,
rotate = petz.settings.rotate,
physical = true,
stepheight = 0.1, --EVIL!
@ -78,7 +77,7 @@ minetest.register_entity("petz:"..pet_name,{
end,
on_step = function(self, dtime)
mobkit.stepfunc(self, dtime) -- required
mobkit.stepfunc(self, dtime) -- required
petz.init_timer(self)
end,

View File

@ -18,7 +18,7 @@ rob_mobs = false
##Spawn Engine
## The interval is avg spawn attempt interval for every player
spawn_interval = 10
spawn_interval = 20
## Max number of mobs in abr
max_mobs = 30
@ -145,7 +145,8 @@ pony_spawn_biome = default
##Parrot Specific
parrot_follow = farming:seed_wheat
parrot_spawn_chance = 0.6
parrot_spawn_chance = 1.0
pony_spawn_nodes = default:dirt_with_rainforest_litter
parrot_spawn_biome = default
##Chicken Specific

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "piggy"
table.insert(petz.mobs_list, "piggy")
local scale_model = 0.85
petz.piggy = {}
local mesh = 'petz_piggy.b3d'

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "pony"
table.insert(petz.mobs_list, pet_name)
local scale_model = 2.2
local visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model}
local scale_baby = 0.5
@ -23,6 +22,7 @@ local collisionbox_baby = {-0.5*scale_baby, -0.75*scale_model*scale_baby, -0.25,
minetest.register_entity("petz:"..pet_name, {
--Petz specifics
type = pet_name,
is_mountable = true,
init_timer = true,
is_pet = true,
has_affinity = true,
@ -91,12 +91,8 @@ minetest.register_entity("petz:"..pet_name, {
petz.set_initial_properties(self, staticdata, dtime_s)
end,
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
if not(self.driver) then
petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
else
petz.force_detach(self.driver)
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)

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name= "puppy"
table.insert(petz.mobs_list, pet_name)
local scale_model = 1.5
local mesh = nil
local textures = {}

View File

@ -6,11 +6,40 @@ minetest.register_globalstep(function(dtime)
local radius = abr * 16 --recommended
local interval = petz.settings.spawn_interval
local spawn_pos = mobkit.get_spawn_pos_abr(dtime, interval, radius, 0.3, 0.2)
local spawn_pos = mobkit.get_spawn_pos_abr(dtime, interval, radius, 0.3, 0.2)
if spawn_pos then
local random_mob = petz.mobs_list[math.random(1, #petz.mobs_list)] --Get a random mob from the list of petz mobs
local pos_below = {
x = spawn_pos.x,
y = spawn_pos.y - 1.0,
z = spawn_pos.z,
}
local node = minetest.get_node(pos_below) --the node below the spawn pos
local candidates_list = {} --Create a sublist of the petz with the same node to spawn
for i = 1, #petz.petz_list do
local spawn_nodes_list = petz.settings[petz.petz_list[i].."_spawn_nodes"]
if spawn_nodes_list then
local spawn_nodes = spawn_nodes_list:split(", ")
for j = 1, #spawn_nodes do --loop thru all spawn nodes
--minetest.chat_send_player("singleplayer", "spawn node="..spawn_nodes[j])
--minetest.chat_send_player("singleplayer", "node name="..node.name)
if spawn_nodes[j] == node.name then
table.insert(candidates_list, petz.petz_list[i])
break
end
end
end
end --end for
--minetest.chat_send_player("singleplayer", minetest.serialize(candidates_list))
if #candidates_list < 1 then --if no candidates, then return
return
end
local random_mob = candidates_list[math.random(1, #candidates_list)] --Get a random mob from the list of candidates
local spawn_chance = petz.settings[random_mob.."_spawn_chance"]
--minetest.chat_send_player("singleplayer", random_mob)
if spawn_chance < 0 then
spawn_chance = 0
elseif spawn_chance > 1 then
@ -40,44 +69,22 @@ minetest.register_globalstep(function(dtime)
end
end
--minetest.chat_send_player("singleplayer", tostring(mob_count))
if mob_count < petz.settings.max_mobs then
local do_spawn = false
local pos_below = {
if mob_count < petz.settings.max_mobs then
--check for bigger mobs:
pos_below = {
x = spawn_pos.x,
y = spawn_pos.y - 1.0,
y = spawn_pos.y - 0.5,
z = spawn_pos.z,
}
local node = minetest.get_node(pos_below)
--minetest.chat_send_player("singleplayer", random_mob)
local spawn_nodes_list = petz.settings[random_mob.."_spawn_nodes"]
if spawn_nodes_list then
local spawn_nodes = spawn_nodes_list:split(", ")
for i = 1, #spawn_nodes do --loop thru all spawn nodes
--minetest.chat_send_player("singleplayer", "spawn node="..spawn_nodes[i])
--minetest.chat_send_player("singleplayer", "node name="..node.name)
if spawn_nodes[i] == node.name then
do_spawn = true
break
end
end
if do_spawn == true then
--check for bigger mobs:
pos_below = {
x = spawn_pos.x,
y = spawn_pos.y - 0.5,
z = spawn_pos.z,
}
if minetest.get_node(pos_below).name ~= "air" then
spawn_pos = {
x = spawn_pos.x,
y = spawn_pos.y + 1.0,
z = spawn_pos.z,
}
end
minetest.add_entity(spawn_pos, "petz:"..random_mob)
--minetest.chat_send_player("singleplayer", "spawned!!!")
end
}
if minetest.get_node(pos_below).name ~= "air" then
spawn_pos = {
x = spawn_pos.x,
y = spawn_pos.y + 1.0,
z = spawn_pos.z,
}
end
minetest.add_entity(spawn_pos, "petz:"..random_mob)
--minetest.chat_send_player("singleplayer", "spawned!!!")
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

View File

@ -4,7 +4,6 @@
local S = ...
local pet_name = "wolf"
table.insert(petz.mobs_list, pet_name)
local scale_model = 1.8
petz.wolf = {}
local mesh = 'petz_wolf.b3d'