luacheck
parent
bbe39d9dc8
commit
c359c5d85c
|
@ -1,4 +1,4 @@
|
|||
## Generic ignorable patterns and files
|
||||
*.obj
|
||||
*.blend1
|
||||
user.conf
|
||||
user.conf
|
|
@ -11,7 +11,11 @@ globals = {
|
|||
"farming",
|
||||
"player_api",
|
||||
"hunger_ng",
|
||||
"dye"
|
||||
"dye",
|
||||
"armor",
|
||||
"playerphysics",
|
||||
"player_monoids",
|
||||
"awards"
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
name = bale
|
||||
description = A bale of hay (wheat)
|
||||
depends = farming
|
||||
optional_depends =
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function mokapi.cron_clear(cron_time, modname)
|
||||
if cron_time > 0 then
|
||||
minetest.after(cron_time, function(cron_time, modname)
|
||||
minetest.after(cron_time, function()
|
||||
mokapi.cron_clear_mobs(cron_time, modname)
|
||||
end, cron_time, modname)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
name = mokapi
|
||||
description = A high level API for mobkit
|
||||
depends = mobkit
|
||||
optional_depends =
|
||||
version =
|
||||
|
|
|
@ -1,43 +1,41 @@
|
|||
local modpath, S = ...
|
||||
|
||||
local creative_mode = minetest.settings:get_bool("creative_mode")
|
||||
|
||||
assert(loadfile(modpath .. "/api/api_helper_functions.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_datetime.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_spawn.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_orders.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_init_prop.lua"))(modpath, S) --Load the init the properties for the entities
|
||||
assert(loadfile(modpath .. "/api/api_forms.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_on_rightclick.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_on_die.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_on_punch.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_feed_tame.lua"))(modpath, S, creative_mode)
|
||||
assert(loadfile(modpath .. "/api/api_helper_functions.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_datetime.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_spawn.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_orders.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_init_prop.lua"))() --Load the init the properties for the entities
|
||||
assert(loadfile(modpath .. "/api/api_forms.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_on_rightclick.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_on_die.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_on_punch.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_feed_tame.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_capture.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_tamagochi.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_tamagochi.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_breed.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_wool_milk.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_mount.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_dreamcatcher.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_eggs.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_squareball.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_convert.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_nametag.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_dam_beaver.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_particles.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_whistle.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_silk.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_on_step.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_sleep.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_env_damage.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_wool_milk.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_mount.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_dreamcatcher.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_eggs.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_squareball.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_convert.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_nametag.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_dam_beaver.lua"))(modpath)
|
||||
assert(loadfile(modpath .. "/api/api_particles.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_whistle.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_silk.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_on_step.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_sleep.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_env_damage.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_bees.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_throw.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_throw.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_collisionbox.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_colorize.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_horseshoes.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_horseshoes.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_blood.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_poop.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_poop.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_brush.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_bottled.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/api/api_colors.lua"))()
|
||||
assert(loadfile(modpath .. "/api/api_sell_buy.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_lifetime.lua"))(S)
|
||||
assert(loadfile(modpath .. "/api/api_lifetime.lua"))()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
petz.convert = function(self, player_name)
|
||||
local old_pet_name = petz.first_to_upper(self.type)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local modpath = ...
|
||||
|
||||
--
|
||||
--Create Dam Beaver Mechanics
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.get_os_month = function()
|
||||
local nowTable= os.date('*t')
|
||||
return nowTable.month
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
--
|
||||
-- Dreamcatcher (protector for Petz)
|
||||
|
@ -77,7 +77,7 @@ petz.create_form_list_by_owner_dreamcatcher = function(user_name, user_pos)
|
|||
return ''
|
||||
end
|
||||
local item_list = ""
|
||||
local text_color
|
||||
--local text_color
|
||||
for key, pet_table in ipairs(item_list_table) do
|
||||
local pet = pet_table.pet
|
||||
local pet_type
|
||||
|
@ -88,17 +88,17 @@ petz.create_form_list_by_owner_dreamcatcher = function(user_name, user_pos)
|
|||
pet_tag = pet.tag
|
||||
pet_type = pet.type
|
||||
pet_pos = pet.object:get_pos()
|
||||
text_color = petz.colors["green"]
|
||||
--text_color = petz.colors["green"]
|
||||
list_pet = true
|
||||
elseif pet_table.metadata.dreamcatcher == true then
|
||||
pet_tag = pet_table.metadata.tag
|
||||
pet_type = pet_table.metadata.type
|
||||
pet_pos = pet_table.metadata.last_pos
|
||||
text_color = petz.colors["red"]
|
||||
--text_color = petz.colors["red"]
|
||||
list_pet = true
|
||||
end
|
||||
if list_pet and pet_pos then
|
||||
local pet_type = pet.type:gsub("^%l", string.upper)
|
||||
pet_type = pet_type:gsub("^%l", string.upper)
|
||||
local distance, pet_pos_x, pet_pos_y, pet_pos_z
|
||||
distance = tostring(petz.round(vector.distance(user_pos, pet_pos)))
|
||||
pet_pos_x = tostring(math.floor(pet_pos.x+0.5))
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.increase_egg_count = function(self)
|
||||
self.eggs_count = mobkit.remember(self, "eggs_count", self.eggs_count+1)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--
|
||||
-- Enviromental Damage
|
||||
--
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S, creative_mode = ...
|
||||
local S= ...
|
||||
|
||||
petz.insert_tamed_by_owner = function(self)
|
||||
if not self.owner then
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
petz.create_form = function(player_name, context)
|
||||
local pet = petz.pet[player_name]
|
||||
local form_size = {w = 4, h = 3}
|
||||
local buttonexit_pos = {x = 1, y = 6}
|
||||
local hungrystuff_pos = {x= 0, y = 0}
|
||||
local form_title = ""
|
||||
local tamagochi_form_stuff = ''
|
||||
local hungrystuff_pos
|
||||
local form_title
|
||||
local tamagochi_form_stuff
|
||||
local affinity_stuff = ''
|
||||
local form_orders = ''
|
||||
local more_form_orders = ''
|
||||
local tab_form = ''
|
||||
local final_form = ''
|
||||
if not context then
|
||||
context = {}
|
||||
context.tab_id = 1
|
||||
|
@ -41,8 +40,8 @@ petz.create_form = function(player_name, context)
|
|||
"label[1.375,3;".. form_title .."]"..
|
||||
"image_button[".. (hungrystuff_pos.x+0.5) ..",".. (hungrystuff_pos.y +0.5)..";1,1;petz_pet_bowl_inv.png;btn_bowl;]"..
|
||||
affinity_stuff
|
||||
local hungry_label = ""
|
||||
local health_label = S("Health").." = "..tostring(pet.hp)
|
||||
local hungry_label
|
||||
if pet.fed == false then
|
||||
hungry_label = S("Hungry")
|
||||
else
|
||||
|
@ -73,7 +72,7 @@ petz.create_form = function(player_name, context)
|
|||
"checkbox[3.5,2.25;btn_show_tag;"..S("Show tag")..";"..petz.vartostring(pet.show_tag).."]"
|
||||
end
|
||||
if pet.breed == true then --Show the Gender
|
||||
local gender = ''
|
||||
local gender
|
||||
if pet.is_male == true then
|
||||
gender = S("Male")
|
||||
else
|
||||
|
@ -109,7 +108,7 @@ petz.create_form = function(player_name, context)
|
|||
"label["..(pregnant_text_x+0.375)..","..(pregnant_text_y+1)..";"..S("Pregnant").." ("..tostring(pregnant_remain_time).."s)]"
|
||||
elseif pet.is_male == false and pet.pregnant_count and pet.pregnant_count <= 0 then
|
||||
tamagochi_form_stuff = tamagochi_form_stuff..
|
||||
"label["..(pregnant_icon_x+0.5)..","..(infertile_text_y+1)..";"..S("Infertile").."]"
|
||||
"label["..(infertile_text_x+0.5)..","..(infertile_text_y+1)..";"..S("Infertile").."]"
|
||||
end
|
||||
if pet.is_baby == true then
|
||||
local growth_remain_time = petz.round(petz.settings.growth_time - pet.growth_time)
|
||||
|
@ -229,7 +228,7 @@ petz.create_form = function(player_name, context)
|
|||
end
|
||||
end
|
||||
--minetest.chat_send_player("singleplayer", tab_header)
|
||||
final_form =
|
||||
local final_form =
|
||||
"size["..(form_size.w+0.875)..","..(form_size.h+1)..";]"..
|
||||
"real_coordinates[true]"..
|
||||
"tabheader[0,0;tabheader;"..tab_header..";"..tostring(context.tab_id)..";true;false]"..
|
||||
|
@ -272,7 +271,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
mobkit.clear_queue_high(pet)
|
||||
pet.status = nil
|
||||
mobkit.hq_fly(pet, 0)
|
||||
minetest.after(2.5, function(pet)
|
||||
minetest.after(2.5, function()
|
||||
if mobkit.is_alive(pet) then
|
||||
mobkit.clear_queue_low(pet)
|
||||
pet.object:set_acceleration({ x = 0, y = 0, z = 0 })
|
||||
|
@ -290,7 +289,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end
|
||||
pet.object:set_attach(player, "Arm_Left", shoulder_pos, {x=0, y=0, z=180})
|
||||
pet.object:set_properties({physical = false,})
|
||||
minetest.after(120.0, function(pet)
|
||||
minetest.after(120.0, function()
|
||||
if mobkit.is_alive(pet) then
|
||||
pet.object:set_detach()
|
||||
pet.object:set_properties({physical = true,})
|
||||
|
@ -419,14 +418,13 @@ petz.create_food_form = function(self)
|
|||
items_desc = items_desc .. ", "
|
||||
end
|
||||
end
|
||||
local formspec = ""
|
||||
local form_size = {w= 3, h= 3}
|
||||
local button_exit = {x= 1, y= 2}
|
||||
if self.breed == true then
|
||||
form_size.h = form_size.h + 1
|
||||
button_exit.y = button_exit.y + 1
|
||||
end
|
||||
formspec =
|
||||
local formspec =
|
||||
"size["..form_size.w..","..form_size.h.."]"..
|
||||
"image[0,0;1,1;petz_spawnegg_"..self.type..".png]"..
|
||||
"label[1,0;"..S("Food").."]"..
|
||||
|
@ -450,7 +448,6 @@ petz.create_food_form = function(self)
|
|||
end
|
||||
|
||||
petz.create_affinity_form = function(self)
|
||||
local formspec = ""
|
||||
local form_size = {w= 3, h= 4}
|
||||
local button_exit = {x= 1, y= 3}
|
||||
local feed_status, feed_status_color
|
||||
|
@ -469,7 +466,7 @@ petz.create_affinity_form = function(self)
|
|||
brushing_status = S("Not brushed")..": " .. tostring(petz.calculate_affinity_change(-petz.settings.tamagochi_brush_rate))
|
||||
brushing_status_color = petz.colors["red"]
|
||||
end
|
||||
formspec =
|
||||
local formspec =
|
||||
"size["..form_size.w..","..form_size.h.."]"..
|
||||
"image[0,0;1,1;petz_affinity_heart.png]"..
|
||||
"label[1,0;"..S("Affinity").."]"..
|
||||
|
@ -487,6 +484,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
local player_name = player:get_player_name()
|
||||
local pet = petz.pet[player_name]
|
||||
if pet and (mobkit.is_alive(pet)) then
|
||||
local context = {}
|
||||
context.tab_id = 1
|
||||
minetest.show_formspec(player_name, "petz:form_orders", petz.create_form(player_name, context))
|
||||
end
|
||||
return true
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--
|
||||
--Helper Functions
|
||||
--
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
petz.put_horseshoe = function(self, clicker)
|
||||
if self.horseshoes >= 4 then
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--
|
||||
--'set_initial_properties' is call by 'on_activate' for each pet
|
||||
--
|
||||
|
@ -337,13 +335,13 @@ function petz.set_initial_properties(self, staticdata, dtime_s)
|
|||
petz.set_properties(self, {textures = {texture}})
|
||||
end
|
||||
if self.type == "bee" and self.queen then --delay to create beehive
|
||||
minetest.after(math.random(120, 150), function(self)
|
||||
minetest.after(math.random(120, 150), function()
|
||||
if mobkit.is_alive(self.object) then
|
||||
self.create_beehive = mobkit.remember(self, "create_beehive", true)
|
||||
end
|
||||
end, self)
|
||||
elseif self.type == "ant" and self.ant_type == "queen" then
|
||||
minetest.after(math.random(120, 150), function(self)
|
||||
minetest.after(math.random(120, 150), function()
|
||||
if mobkit.is_alive(self.object) then
|
||||
self.create_anthill = mobkit.remember(self, "create_anthill", true)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.check_lifetime = function(self)
|
||||
local pet_lifetime = petz.settings[self.type.."_lifetime"]
|
||||
--minetest.chat_send_all("test")
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--
|
||||
-- Mount Engine
|
||||
--
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.update_nametag = function(self)
|
||||
local name_tag
|
||||
if self.show_tag == true and self.tag and not(self.tag == "") then
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--
|
||||
--on_die event for all the mobs
|
||||
--
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.puncher_is_player = function(puncher)
|
||||
if type(puncher) == 'userdata' and puncher:is_player() then
|
||||
return true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
--Context
|
||||
--In this temporary table is saved the reference to an entity by its owner
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.on_step = function(self, dtime)
|
||||
local on_step_time = 1
|
||||
if mobkit.timer(self, on_step_time) and not(self.dead) then --Only check every 1 sec, not every step!
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.ownthing = function(self)
|
||||
self.status = mobkit.remember(self, "status", nil)
|
||||
if self.can_fly then
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--
|
||||
--Particle Effects
|
||||
--
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--
|
||||
--Poop Engine
|
||||
--
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
--Coocon
|
||||
minetest.register_node("petz:cocoon", {
|
||||
|
@ -28,8 +28,7 @@ minetest.register_node("petz:cocoon", {
|
|||
return
|
||||
end
|
||||
if pos and petz.is_night() == true then --only spawn at night, to it does not die
|
||||
local mob = minetest.add_entity(pos, "petz:moth")
|
||||
local ent = mob:get_luaentity()
|
||||
minetest.add_entity(pos, "petz:moth")
|
||||
minetest.set_node(pos, {name= "air"})
|
||||
return false
|
||||
end
|
||||
|
@ -163,7 +162,7 @@ minetest.register_craft({
|
|||
})
|
||||
|
||||
petz.init_convert_to_chrysalis = function(self)
|
||||
minetest.after(math.random(1200, 1500), function(self)
|
||||
minetest.after(math.random(1200, 1500), function()
|
||||
if not(mobkit.is_alive(self)) then
|
||||
return
|
||||
end
|
||||
|
@ -177,7 +176,7 @@ petz.init_convert_to_chrysalis = function(self)
|
|||
end
|
||||
|
||||
petz.init_lay_eggs = function(self)
|
||||
minetest.after(math.random(150, 240), function(self)
|
||||
minetest.after(math.random(150, 240), function()
|
||||
if not(mobkit.is_alive(self)) then
|
||||
return
|
||||
end
|
||||
|
@ -185,7 +184,7 @@ petz.init_lay_eggs = function(self)
|
|||
return
|
||||
end
|
||||
petz.alight(self)
|
||||
minetest.after(10.0, function(self)
|
||||
minetest.after(10.0, function()
|
||||
if not(mobkit.is_alive(self)) then
|
||||
return
|
||||
end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.calculate_sleep_times = function(self)
|
||||
if not petz.settings.sleeping then
|
||||
return
|
||||
|
@ -72,7 +70,7 @@ end
|
|||
|
||||
function mobkit.hq_sleep(self, prty, force)
|
||||
local timer = 2
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
timer = timer - self.dtime
|
||||
if timer < 0 then
|
||||
if not(force) then
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
petz.get_node_below = function(pos)
|
||||
local pos_below = {
|
||||
x = pos.x,
|
||||
|
@ -189,15 +187,17 @@ petz.spawn_mob = function(spawn_pos, limit_max_mobs, abr, liquidflag)
|
|||
else
|
||||
spawn_pos.z = spawn_pos.z - 2
|
||||
end
|
||||
--[[
|
||||
if i > 1 then
|
||||
local height, liquidflag = mobkit.get_terrain_height(spawn_pos, 32)
|
||||
if height or (liquidflag and ent.can_swin) then
|
||||
local node = petz.get_node_below(spawn_pos)
|
||||
if not(mokapi.item_in_itemlist(node.name, petz.settings[random_mob.."_spawn_nodes"])) then
|
||||
local height, liquidflag2 = mobkit.get_terrain_height(spawn_pos, 32)
|
||||
if height or (liquidflag2 and ent.can_swin) then
|
||||
local node_below = petz.get_node_below(spawn_pos)
|
||||
if not(mokapi.item_in_itemlist(node_below.name, petz.settings[random_mob.."_spawn_nodes"])) then
|
||||
spawn = false
|
||||
end
|
||||
end
|
||||
end
|
||||
]]
|
||||
if spawn == true then
|
||||
spawn_pos = petz.pos_to_spawn(random_mob_name, spawn_pos) --recalculate pos.y for bigger mobs
|
||||
minetest.add_entity(spawn_pos, random_mob_name)
|
||||
|
@ -213,7 +213,7 @@ minetest.register_globalstep(function(dtime)
|
|||
local abr = tonumber(minetest.get_mapgen_setting('active_block_range')) or 3
|
||||
local radius = abr * 16 --recommended
|
||||
local interval = petz.settings.spawn_interval
|
||||
local spawn_pos, liquidflag, cave = mobkit.get_spawn_pos_abr(dtime, interval, radius, petz.settings.spawn_chance, 0.2)
|
||||
local spawn_pos, liquidflag = mobkit.get_spawn_pos_abr(dtime, interval, radius, petz.settings.spawn_chance, 0.2)
|
||||
if spawn_pos then
|
||||
petz.spawn_mob(spawn_pos, true, abr, liquidflag)
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
--
|
||||
--Square Ball Game for the Puppy
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
--
|
||||
--The Tamagochi Mode
|
||||
|
@ -42,7 +42,7 @@ end
|
|||
--
|
||||
|
||||
petz.timer = function(self)
|
||||
minetest.after(petz.settings.tamagochi_check_time, function(self)
|
||||
minetest.after(petz.settings.tamagochi_check_time, function()
|
||||
if mobkit.is_alive(self) then
|
||||
if (not(minetest.is_singleplayer())) and (petz.settings.tamagochi_check_if_player_online == true) then
|
||||
if minetest.player_exists(self.owner) == false then --if pet owner is not online
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
--effects can be: fire
|
||||
|
||||
function petz.throw(self, dtime, damage, effect, particles, sound)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local S = ...
|
||||
|
||||
-- Whistle Item
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
local modpath, S = ...
|
||||
|
||||
---
|
||||
---Refill lamb or milk
|
||||
---
|
||||
|
|
|
@ -4,12 +4,12 @@ awards.register_trigger("milk", {
|
|||
auto_description = { "Do a foo", "Foo @1 times" },
|
||||
})
|
||||
|
||||
minetest.register_on_milk(function()
|
||||
for _, trigger in pairs(awards.on.milk) do
|
||||
--minetest.register_on_milk(function()
|
||||
--for _, trigger in pairs(awards.on.milk) do
|
||||
|
||||
|
||||
if condition then
|
||||
awards.unlock(trigger)
|
||||
end
|
||||
end
|
||||
end)
|
||||
--if condition then
|
||||
--awards.unlock(trigger)
|
||||
--end
|
||||
--end
|
||||
--end)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
local modname = "petz"
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
-- internationalization boilerplate
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
@ -29,7 +28,7 @@ assert(loadfile(modpath .. "/settings.lua"))(modpath) --Load the settings
|
|||
petz.tamed_by_owner = {} --a list of tamed petz with owner
|
||||
|
||||
assert(loadfile(modpath .. "/api/api.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/mobkit/mobkit.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/mobkit/mobkit.lua"))(modpath)
|
||||
assert(loadfile(modpath .. "/misc/misc.lua"))(modpath, S)
|
||||
assert(loadfile(modpath .. "/server/cron.lua"))(modname)
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ petz.force_detach = function(player)
|
|||
player:set_detach()
|
||||
player_api.player_attached[player:get_player_name()] = false
|
||||
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
minetest.after(0.25, function(player) --to avoid tiny player
|
||||
minetest.after(0.25, function() --to avoid tiny player
|
||||
if player then
|
||||
player:set_properties({
|
||||
visual_size = {x = 1.0, y = 1.0},
|
||||
|
@ -99,7 +99,7 @@ function petz.gallop(self, dtime)
|
|||
self.gallop = false
|
||||
self.gallop_time = 0
|
||||
self.gallop_exhausted = true
|
||||
minetest.after(petz.settings.gallop_recover_time, function(self)
|
||||
minetest.after(petz.settings.gallop_recover_time, function()
|
||||
if mobkit.is_alive(self) then
|
||||
self.gallop_exhausted = false
|
||||
end
|
||||
|
|
|
@ -373,12 +373,12 @@ minetest.register_node("petz:beehive", {
|
|||
if placer:is_player() then
|
||||
honey_count = 0
|
||||
bee_count = 0
|
||||
minetest.after(petz.settings.worker_bee_delay, function(beehive_pos)
|
||||
local node =minetest.get_node_or_nil(beehive_pos)
|
||||
minetest.after(petz.settings.worker_bee_delay, function()
|
||||
local node =minetest.get_node_or_nil(pos)
|
||||
if not(node and node.name == "petz:beehive") then
|
||||
return
|
||||
end
|
||||
meta = minetest.get_meta(beehive_pos)
|
||||
meta = minetest.get_meta(pos)
|
||||
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_behive
|
||||
if total_bees < petz.settings.max_bees_behive then
|
||||
bee_count = meta:get_int("bee_count")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
---
|
||||
|
||||
function mobkit.hq_aqua_jump(self, prty)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
local vel_impulse = 2.5
|
||||
local velocity = {
|
||||
x = self.max_speed * (vel_impulse/3),
|
||||
|
@ -14,7 +14,7 @@ function mobkit.hq_aqua_jump(self, prty)
|
|||
self.object:set_acceleration({x=1.0, y=vel_impulse, z=1.0})
|
||||
self.status = "jump"
|
||||
mokapi.make_sound("object", self.object, "petz_splash", petz.settings.max_hear_distance)
|
||||
minetest.after(0.5, function(self, velocity)
|
||||
minetest.after(0.5, function()
|
||||
if mobkit.is_alive(self.object) then
|
||||
self.status = nil
|
||||
mobkit.clear_queue_high(self)
|
||||
|
|
|
@ -50,7 +50,7 @@ function petz.bh_climb(self, pos, prty)
|
|||
end
|
||||
|
||||
function mobkit.hq_climb(self, prty)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
if not petz.check_tree(self) then
|
||||
self.status = nil
|
||||
mobkit.clear_queue_high(self)
|
||||
|
@ -66,7 +66,7 @@ function mobkit.hq_climb(self, prty)
|
|||
end
|
||||
|
||||
function mobkit.lq_climb(self)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
local pos = self.object:get_pos()
|
||||
pos.y = pos.y + 1
|
||||
local node_top = minetest.get_node_or_nil(pos)
|
||||
|
|
|
@ -47,7 +47,7 @@ function petz.bh_attack_player(self, pos, prty, player)
|
|||
end
|
||||
|
||||
function petz.hq_hunt(self,prty,tgtobj)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if not mobkit.is_alive(tgtobj) then return true end
|
||||
if mobkit.is_queue_empty_low(self) and self.isonground then
|
||||
local pos = mobkit.get_stand_pos(self)
|
||||
|
@ -75,7 +75,7 @@ function petz.is_pos_in_box(self, pos,bpos,box)
|
|||
end
|
||||
|
||||
function petz.hq_attack(self,prty,tgtobj)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if not mobkit.is_alive(tgtobj) then return true end
|
||||
if mobkit.is_queue_empty_low(self) then
|
||||
local pos = mobkit.get_stand_pos(self)
|
||||
|
@ -100,7 +100,7 @@ end
|
|||
|
||||
function petz.lq_jumpattack(self,height,target)
|
||||
local phase=1
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
if not mobkit.is_alive(target) then return true end
|
||||
if self.isonground then
|
||||
if phase==1 then -- collision bug workaround
|
||||
|
@ -148,7 +148,7 @@ end
|
|||
---
|
||||
|
||||
function mobkit.hq_flyhunt(self, prty, tgtobj)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if not mobkit.is_alive(tgtobj) then return true end
|
||||
if mobkit.is_queue_empty_low(self) then
|
||||
local pos = mobkit.get_stand_pos(self)
|
||||
|
@ -168,7 +168,7 @@ function mobkit.hq_flyhunt(self, prty, tgtobj)
|
|||
end
|
||||
|
||||
function mobkit.hq_flyattack(self, prty, tgtobj)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if not mobkit.is_alive(tgtobj) then
|
||||
return true
|
||||
end
|
||||
|
@ -187,7 +187,7 @@ function mobkit.hq_flyattack(self, prty, tgtobj)
|
|||
end
|
||||
|
||||
function mobkit.lq_flyattack(self, target)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if not mobkit.is_alive(target) then
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ function petz.bh_create_beehive(self, pos)
|
|||
end
|
||||
|
||||
function mobkit.hq_gotopollen(self, prty, tpos)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if self.pollen == true then
|
||||
--mobkit.clear_queue_low(self)
|
||||
--mobkit.clear_queue_high(self)
|
||||
|
@ -44,7 +44,7 @@ function mobkit.hq_gotopollen(self, prty, tpos)
|
|||
end
|
||||
|
||||
function mobkit.lq_search_flower(self, tpos)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
local pos = self.object:get_pos()
|
||||
if not(pos) or not(tpos) then
|
||||
return true
|
||||
|
@ -64,7 +64,7 @@ function mobkit.lq_search_flower(self, tpos)
|
|||
end
|
||||
|
||||
function mobkit.hq_gotobehive(self, prty, pos)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if self.pollen == false or not(self.behive) then
|
||||
return true
|
||||
end
|
||||
|
@ -75,7 +75,7 @@ function mobkit.hq_gotobehive(self, prty, pos)
|
|||
end
|
||||
|
||||
function mobkit.lq_search_behive(self)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
local tpos
|
||||
if self.behive then
|
||||
tpos = self.behive
|
||||
|
@ -105,7 +105,7 @@ function mobkit.lq_search_behive(self)
|
|||
end
|
||||
|
||||
function mobkit.hq_approach_behive(self, pos, prty)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if math.abs(pos.x - self.behive.x) <= (self.view_range / 2) or math.abs(pos.z - self.behive.z) <= (self.view_range / 2) then
|
||||
mobkit.clear_queue_low(self)
|
||||
mobkit.clear_queue_high(self)
|
||||
|
@ -117,7 +117,7 @@ function mobkit.hq_approach_behive(self, pos, prty)
|
|||
end
|
||||
|
||||
function mobkit.lq_approach_behive(self)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
local tpos
|
||||
if self.behive then
|
||||
tpos = self.behive
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
--
|
||||
|
||||
function mobkit.hq_wanderfly(self, prty)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
if mobkit.is_queue_empty_low(self) then
|
||||
mobkit.lq_dumbfly(self, 0.6)
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ end
|
|||
--than descend, cos this does the mobs stand on air, and climb mountains and trees.
|
||||
|
||||
function mobkit.lq_turn2yaw(self, yaw)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if mobkit.turn2yaw(self, yaw) then
|
||||
return true
|
||||
end
|
||||
|
@ -33,7 +33,7 @@ function mobkit.lq_dumbfly(self, speed_factor)
|
|||
local timer = petz.settings.fly_check_time
|
||||
local fly_status = "ascend"
|
||||
speed_factor = speed_factor or 1
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
timer = timer - self.dtime
|
||||
if timer < 0 then
|
||||
--minetest.chat_send_player("singleplayer", tostring(timer))
|
||||
|
@ -136,7 +136,7 @@ end
|
|||
--
|
||||
|
||||
function mobkit.hq_fly(self, prty)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
mobkit.animate(self, "fly")
|
||||
mobkit.lq_fly(self)
|
||||
mobkit.clear_queue_high(self)
|
||||
|
@ -145,7 +145,7 @@ function mobkit.hq_fly(self, prty)
|
|||
end
|
||||
|
||||
function mobkit.lq_fly(self)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
self.object:set_acceleration({ x = 0, y = 1, z = 0 })
|
||||
end
|
||||
mobkit.queue_low(self,func)
|
||||
|
@ -154,7 +154,7 @@ end
|
|||
-- Function to recover flying mobs from water
|
||||
|
||||
function mobkit.hq_liquid_recovery_flying(self, prty)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
self.object:set_acceleration({ x = 0.0, y = 0.125, z = 0.0 })
|
||||
self.object:set_velocity({ x = 1.0, y = 1.0, z = 1.0 })
|
||||
if not(petz.isinliquid(self)) then
|
||||
|
@ -170,7 +170,7 @@ end
|
|||
--
|
||||
|
||||
function mobkit.hq_alight(self, prty)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
local node_name = mobkit.node_name_in(self, "below")
|
||||
if node_name == "air" then
|
||||
mobkit.lq_alight(self)
|
||||
|
@ -189,7 +189,7 @@ function mobkit.hq_alight(self, prty)
|
|||
end
|
||||
|
||||
function mobkit.lq_alight(self)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
--minetest.chat_send_player("singleplayer", "alight")
|
||||
self.object:set_acceleration({ x = 0, y = -1, z = 0 })
|
||||
return true
|
||||
|
|
|
@ -43,7 +43,7 @@ end
|
|||
--
|
||||
|
||||
function mobkit.hq_followliquidair(self, prty, player)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
local pos = mobkit.get_stand_pos(self)
|
||||
local tpos = player:get_pos()
|
||||
if self.can_swin then
|
||||
|
@ -76,7 +76,7 @@ function mobkit.hq_followliquidair(self, prty, player)
|
|||
end
|
||||
|
||||
function mobkit.lq_followliquidair(self, target)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
mobkit.flyto(self, target)
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ function petz.bh_look_at(self, player_pos, prty)
|
|||
end
|
||||
|
||||
function petz.hq_look_at(self, player_pos, prty)
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if not(self.looking) then
|
||||
local random_time = math.random(1, 2)
|
||||
petz.move_head(self, player_pos)
|
||||
|
@ -18,7 +18,7 @@ function petz.hq_look_at(self, player_pos, prty)
|
|||
--self.object:set_yaw(body_yaw)
|
||||
--end
|
||||
mobkit.animate(self, "idle")
|
||||
minetest.after(random_time, function(self)
|
||||
minetest.after(random_time, function()
|
||||
if mobkit.is_alive(self) then
|
||||
mobkit.clear_queue_low(self)
|
||||
mobkit.clear_queue_high(self)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
petz.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "default:dirt"
|
||||
|
||||
--[[
|
||||
local node_ok = function(pos, fallback)
|
||||
fallback = fallback or petz.fallback_node
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
|
@ -33,6 +34,7 @@ local function node_is(pos)
|
|||
end
|
||||
return "other"
|
||||
end
|
||||
]]
|
||||
|
||||
local function get_sign(i)
|
||||
i = i or 0
|
||||
|
@ -54,7 +56,7 @@ local function get_v(v)
|
|||
end
|
||||
|
||||
function mobkit.hq_mountdriver(self, prty)
|
||||
local func=function(self)
|
||||
local func=function()
|
||||
if not(self.driver) then
|
||||
return true
|
||||
else
|
||||
|
@ -68,7 +70,7 @@ end
|
|||
|
||||
function mobkit.lq_mountdriver(self)
|
||||
local auto_drive = false
|
||||
local func = function(self)
|
||||
local func = function()
|
||||
if not(self.driver) then return true end
|
||||
local rot_view = 0
|
||||
if self.player_rotation.y == 90 then
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
-- for moths (not finished!!!)
|
||||
--
|
||||
|
||||
function mobkit.hq_approach_torch(self, prty, tpos)
|
||||
local func=function(self)
|
||||
local pos = self.object:get_pos()
|
||||
if pos and tpos then
|
||||
local distance = vector.distance(pos, tpos)
|
||||
if distance < self.view_range and (distance >= self.view_range) then
|
||||
--function mobkit.hq_approach_torch(self, prty, tpos)
|
||||
--local func=function()
|
||||
--local pos = self.object:get_pos()
|
||||
--if pos and tpos then
|
||||
--local distance = vector.distance(pos, tpos)
|
||||
--if distance < self.view_range and (distance >= self.view_range) then
|
||||
--if mobkit.is_queue_empty_low(self) then
|
||||
--mobkit.lq_followliquidair(self, target)
|
||||
--end
|
||||
elseif distance >= self.view_range then
|
||||
petz.ownthing(self)
|
||||
return true
|
||||
end
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
mobkit.queue_high(self, func, prty)
|
||||
end
|
||||
--elseif distance >= self.view_range then
|
||||
--petz.ownthing(self)
|
||||
--return true
|
||||
--end
|
||||
--else
|
||||
--return true
|
||||
--end
|
||||
--end
|
||||
--mobkit.queue_high(self, func, prty)
|
||||
--end
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@ function petz.monster_brain(self)
|
|||
return
|
||||
end
|
||||
|
||||
local pos = self.object:get_pos() --pos of the petz
|
||||
|
||||
local player = mobkit.get_nearby_player(self) --get the player close
|
||||
|
||||
if prty < 30 then
|
||||
|
|
|
@ -24,8 +24,6 @@ function petz.predator_brain(self)
|
|||
return
|
||||
end
|
||||
|
||||
local pos = self.object:get_pos() --pos of the petz
|
||||
|
||||
local player = mobkit.get_nearby_player(self) --get the player close
|
||||
|
||||
if prty < 30 then
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local modpath, S = ...
|
||||
local modpath= ...
|
||||
|
||||
assert(loadfile(modpath .. "/mobkit/bh_ant.lua"))(modpath)
|
||||
assert(loadfile(modpath .. "/mobkit/bh_aquatic.lua"))()
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
After Width: | Height: | Size: 74 B |
|
@ -47,7 +47,7 @@ for i=1, 3 do
|
|||
end
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.3125}
|
||||
local p2 = {x= 0.25, y = 0.0625, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name, {
|
||||
--Petz specifics
|
||||
|
|
|
@ -6,7 +6,7 @@ local mesh = 'petz_bat.b3d'
|
|||
local textures= {"petz_bat.png", "petz_bat2.png"}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.1875, y = 0.0, z = 0.125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -10,7 +10,7 @@ local mesh = 'petz_beaver.b3d'
|
|||
local textures= {"petz_beaver.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.1875}
|
||||
local p2 = {x= 0.1875, y = -0.0625, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -22,7 +22,7 @@ for i=1, 2 do
|
|||
local mesh = 'petz_bee.b3d'
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.3125}
|
||||
local p2 = {x= 0.25, y = 0.0625, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -6,7 +6,7 @@ local mesh = 'petz_butterfly.b3d'
|
|||
local textures= {"petz_butterfly.png","petz_butterfly2.png", "petz_butterfly3.png", "petz_butterfly4.png", "petz_butterfly5.png", "petz_butterfly6.png"}
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.0625}
|
||||
local p2 = {x= 0.25, y = 0.0, z = 0.0}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -15,7 +15,6 @@ local textures = {}
|
|||
for n = 1, #skin_colors do
|
||||
textures[n] = "petz_"..pet_name.."_"..skin_colors[n]..".png"
|
||||
end
|
||||
local textures_baby = {"petz_camel_baby.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.4375}
|
||||
local p2 = {x= 0.25, y = 0.375, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, scale_baby)
|
||||
|
|
|
@ -14,6 +14,7 @@ for i=1, 3 do
|
|||
local lay_eggs
|
||||
local parents
|
||||
local aggressive
|
||||
local is_baby
|
||||
if i == 1 then
|
||||
pet_name = "hen"
|
||||
description = "Hen"
|
||||
|
@ -29,6 +30,7 @@ for i=1, 3 do
|
|||
}
|
||||
parents = nil
|
||||
aggressive = false
|
||||
is_baby = false
|
||||
elseif i == 2 then
|
||||
pet_name = "rooster"
|
||||
description = "Rooster"
|
||||
|
@ -44,6 +46,7 @@ for i=1, 3 do
|
|||
}
|
||||
parents = nil
|
||||
aggressive = true
|
||||
is_baby = false
|
||||
else
|
||||
pet_name = "chicken"
|
||||
description = "Chicken"
|
||||
|
@ -59,8 +62,9 @@ for i=1, 3 do
|
|||
}
|
||||
parents = {"petz:hen", "petz:rooster"}
|
||||
aggressive = false
|
||||
is_baby = true
|
||||
end
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_chimp.b3d'
|
|||
local textures = {"petz_chimp.png"}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.1875, y = -0.125, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_clownfish.b3d'
|
|||
local textures= {"petz_clownfish.png"}
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.1875}
|
||||
local p2 = {x= 0.125, y = -0.25, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_dolphin.b3d'
|
|||
local textures= {"petz_dolphin_bottlenose.png"}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.3125}
|
||||
local p2 = {x= 0.1875, y = -0.125, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_ducky.b3d'
|
|||
local textures= {"petz_ducky.png", "petz_ducky2.png", "petz_ducky3.png"}
|
||||
local p1 = {x= -0.0625, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.125, y = -0.0625, z = 0.1875}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -13,7 +13,6 @@ for i=1, 2 do
|
|||
local textures = {}
|
||||
local is_male
|
||||
local mesh
|
||||
local collisionbox
|
||||
local description
|
||||
if i == 1 then --if male
|
||||
pet_name= "elephant"
|
||||
|
|
|
@ -10,7 +10,7 @@ local mesh = 'petz_foxy.b3d'
|
|||
local textures = {"petz_foxy.png"}
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.25}
|
||||
local p2 = {x= 0.1875, y = -0.0625, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_frog.b3d'
|
|||
local textures= {"petz_frog.png", "petz_frog2.png", "petz_frog3.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.25}
|
||||
local p2 = {x= 0.1875, y = -0.1875, z = 0.1875}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_goat.b3d'
|
|||
local textures= {"petz_goat.png", "petz_goat2.png", "petz_goat3.png"}
|
||||
local p1 = {x= -0.0625, y = -0.5, z = -0.4375}
|
||||
local p2 = {x= 0.125, y = 0.25, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -10,7 +10,7 @@ local mesh = 'petz_grizzly.b3d'
|
|||
local textures= {"petz_grizzly.png", "petz_grizzly2.png"}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.4375}
|
||||
local p2 = {x= 0.25, y = 0.25, z = 0.4375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_kitty.b3d'
|
|||
local textures= {"petz_kitty.png", "petz_kitty2.png", "petz_kitty3.png", "petz_kitty4.png", "petz_kitty5.png", "petz_kitty6.png"}
|
||||
local p1 = {x= -0.0625, y = -0.5, z = -0.3125}
|
||||
local p2 = {x= 0.125, y = -0.0625, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name, {
|
||||
--Petz specifics
|
||||
|
|
|
@ -7,12 +7,12 @@ local scale_model = 2.0
|
|||
local mesh = 'petz_leopard.b3d'
|
||||
local p1 = {x= -0.0625, y = -0.5, z = -0.375}
|
||||
local p2 = {x= 0.125, y = 0.0, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
for i=1, 2 do
|
||||
local type
|
||||
local description
|
||||
local textures = {}
|
||||
local textures
|
||||
if i == 1 then --if male
|
||||
type = "leopard"
|
||||
description = "Leopard"
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_lion.b3d'
|
|||
local textures = {"petz_lion.png"}
|
||||
local p1 = {x= -0.0625, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.125, y = 0.0, z = 0.25}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -6,7 +6,7 @@ local mesh = 'petz_moth.b3d'
|
|||
local textures= {"petz_moth.png"}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.4375}
|
||||
local p2 = {x= 0.3125, y = -0.1875, z = 0.1875}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -6,7 +6,7 @@ local mesh = 'petz_parrot.b3d'
|
|||
local textures= {"petz_parrot.png", "petz_parrot2.png", "petz_parrot3.png", "petz_parrot4.png", "petz_parrot5.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.0625, y = 0.125, z = 0.1875}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -6,7 +6,7 @@ local mesh = 'petz_penguin.b3d'
|
|||
local textures= {"petz_penguin.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.0625, y = 0.1875, z = 0.125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -10,7 +10,7 @@ local mesh = 'petz_pigeon.b3d'
|
|||
local textures= {"petz_pigeon.png", "petz_pigeon2.png", "petz_pigeon3.png"}
|
||||
local p1 = {x= -0.0625, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.125, y = -0.125, z = 0.125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_piggy.b3d'
|
|||
local textures = {"petz_piggy.png"}
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.4375}
|
||||
local p2 = {x= 0.1875, y = 0.375, z = 0.25}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -10,7 +10,7 @@ local mesh = 'petz_polar_bear.b3d'
|
|||
local textures= {"petz_polar_bear.png"}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.4375}
|
||||
local p2 = {x= 0.25, y = 0.125, z = 0.5}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -15,7 +15,6 @@ local textures = {}
|
|||
for n = 1, #skin_colors do
|
||||
textures[n] = "petz_"..pet_name.."_"..skin_colors[n]..".png"
|
||||
end
|
||||
local textures_baby = {"petz_pony_baby.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.25}
|
||||
local p2 = {x= 0.0625, y = 0.125, z = 0.25}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, scale_baby)
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_puppy.b3d'
|
|||
local textures= {"petz_puppy.png", "petz_puppy2.png", "petz_puppy3.png"}
|
||||
local p1 = {x= -0.0625, y = -0.5, z = -0.125}
|
||||
local p2 = {x= 0.125, y = -0.1875, z = 0.25}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name, {
|
||||
--Petz specifics
|
||||
|
|
|
@ -10,7 +10,7 @@ local mesh = 'petz_rat.b3d'
|
|||
local textures= {"petz_rat.png"}
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.25}
|
||||
local p2 = {x= 0.18755, y = -0.125, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_silkworm.b3d'
|
|||
local textures= {"petz_silkworm.png", "petz_silkworm2.png", "petz_silkworm3.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.3125}
|
||||
local p2 = {x= 0.0625, y = -0.25, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_squirrel.b3d'
|
|||
local textures = {"petz_squirrel.png", "petz_squirrel2.png", "petz_squirrel3.png"}
|
||||
local p1 = {x= -0.1875, y = -0.375, z = -0.125}
|
||||
local p2 = {x= 0.125, y = -0.0, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -10,7 +10,7 @@ local textures = {"petz_tarantula_orange.png", "petz_tarantula_black.png"}
|
|||
local visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model}
|
||||
local p1 = {x= -0.25, y = -0.5, z = -0.25}
|
||||
local p2 = {x= 0.3125, y = -0.25, z = 0.3125}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name, {
|
||||
--Petz specifics
|
||||
|
|
|
@ -6,7 +6,7 @@ local mesh = 'petz_toucan.b3d'
|
|||
local textures= {"petz_toucan.png", "petz_toucan2.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.25}
|
||||
local p2 = {x= 0.125, y = 0.3125, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -9,7 +9,7 @@ local mesh = 'petz_tropicalfish.b3d'
|
|||
local textures= {"petz_tropicalfish.png", "petz_tropicalfish2.png", "petz_tropicalfish3.png"}
|
||||
local p1 = {x= -0.125, y = -0.5, z = -0.1875}
|
||||
local p2 = {x= 0.1875, y = 0.1875, z = 0.375}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -10,7 +10,7 @@ local mesh = 'petz_turtle.b3d'
|
|||
local textures= {"petz_turtle.png", "petz_turtle2.png", "petz_turtle3.png",}
|
||||
local p1 = {x= -0.1875, y = -0.5, z = -0.1875}
|
||||
local p2 = {x= 0.1875, y = 0.01, z = 0.25}
|
||||
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
local collisionbox = petz.get_collisionbox(p1, p2, scale_model, nil)
|
||||
|
||||
minetest.register_entity("petz:"..pet_name,{
|
||||
--Petz specifics
|
||||
|
|
|
@ -418,6 +418,11 @@ local settings_def = {
|
|||
},
|
||||
}
|
||||
|
||||
--General Hardcoded Settings-->
|
||||
petz.settings.visual = "mesh"
|
||||
petz.settings.visual_size = {x=10, y=10}
|
||||
petz.settings.rotate = 0
|
||||
|
||||
for key, value in ipairs(settings_def) do
|
||||
if value.type == "string" then
|
||||
if not(value.default) then
|
||||
|
@ -501,7 +506,3 @@ for i = 1, #petz.settings["petz_list"] do --load the settings
|
|||
petz.settings[petz_type.."_lay_egg_on_node"] = user:get(petz_type.."_lay_egg_on_node") or settings:get(petz_type.."_lay_egg_on_node") or ""
|
||||
end
|
||||
end
|
||||
|
||||
petz.settings.visual = "mesh"
|
||||
petz.settings.visual_size = {x=10, y=10}
|
||||
petz.settings.rotate = 0
|
||||
|
|
Loading…
Reference in New Issue