petz updated

master
root 2020-11-16 18:29:41 +01:00
parent cb63c3aba5
commit e2ffd75627
57 changed files with 4960 additions and 73 deletions

View File

@ -9,7 +9,9 @@ globals = {
"petz",
"stairs",
"farming",
"player_api"
"player_api",
"hunger_ng",
"dye"
}
read_globals = {

View File

@ -1,4 +1,4 @@
local modpath, modname, S = ...
local modpath, S = ...
local creative_mode = minetest.settings:get_bool("creative_mode")
@ -12,9 +12,9 @@ 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_capture.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_capture.lua"))(S)
assert(loadfile(modpath .. "/api/api_tamagochi.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_breed.lua"))(modpath, 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)
@ -29,15 +29,15 @@ 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_bees.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_bees.lua"))(S)
assert(loadfile(modpath .. "/api/api_throw.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_collisionbox.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_colorize.lua"))(modpath, S)
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_blood.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_blood.lua"))()
assert(loadfile(modpath .. "/api/api_poop.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_brush.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_brush.lua"))(S)
assert(loadfile(modpath .. "/api/api_bottled.lua"))(modpath, S)
assert(loadfile(modpath .. "/api/api_colors.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)

View File

@ -1,4 +1,4 @@
local modpath, S = ...
local S = ...
petz.set_infotext_behive = function(meta, honey_count, bee_count)
local total_bees = meta:get_int("total_bees") or petz.settings.max_bees_behive

View File

@ -1,5 +1,3 @@
local modpath, S = ...
function petz.blood(self)
if not(petz.settings.blood) or self.no_blood then
return

View File

@ -1,4 +1,4 @@
local modpath, S = ...
local S = ...
petz.breed = function(self, clicker, wielded_item, wielded_item_name)
if self.is_rut == false and self.is_pregnant == false then

View File

@ -1,4 +1,4 @@
local modpath, S = ...
local S = ...
petz.brush = function(self, wielded_item_name, pet_name)
if petz.settings.tamagochi_mode == true then

View File

@ -1,4 +1,4 @@
local modpath, S = ...
local S = ...
--
-- Register Egg
@ -41,7 +41,7 @@ function petz:register_egg(pet_name, desc, inv_img, tamed)
return
end
spawn_pos = petz.pos_to_spawn(pet_name, spawn_pos)
local ent = petz.create_pet(placer, itemstack, pet_name, spawn_pos)
petz.create_pet(placer, itemstack, pet_name, spawn_pos)
end
return itemstack
end,

View File

@ -1,5 +1,3 @@
local modpath, S = ...
petz.get_collisionbox = function(p1, p2, scale_model, scale_baby)
p1 = vector.multiply(p1, scale_model)
p2 = vector.multiply(p2, scale_model)

View File

@ -1,5 +1,3 @@
local modpath, S = ...
petz.get_color_group = function(item_name)
local color_name
local name

View File

@ -1,5 +1,3 @@
local modpath, S = ...
petz.colors = {}
petz.colors["green"] = "#3ADF00"
petz.colors["red"] = "#DF013A"

View File

@ -1,7 +1,7 @@
local modpath, S = ...
petz.increase_egg_count = function(self)
mobkit.remember(self, "eggs_count", self.eggs_count+1)
self.eggs_count = mobkit.remember(self, "eggs_count", self.eggs_count+1)
end
--Lay Egg

View File

@ -90,3 +90,14 @@ petz.tame_whip= function(self, hitter)
mokapi.make_sound("object", hitter, "petz_whip", petz.settings.max_hear_distance)
end
end
--Ants
petz_feed_queen_ant= function(self, clicker, player_name, wielded_item)
local creative_mode = minetest.settings:get_bool("creative_mode")
if creative_mode == false then -- if not in creative, take item
wielded_item:take_item()
clicker:set_wielded_item(wielded_item)
end
self.eggs_count = mobkit.remember(self, "eggs_count", 0)
minetest.chat_send_player(player_name, S("The Queen Ant will produce more eggs."))
end

View File

@ -7,6 +7,7 @@ local modpath, S = ...
petz.dyn_prop = {
accel = {type= "int", default = 1},
affinity = {type= "int", default = 100},
anthill_founded = {type= "boolean", default = false},
beaver_oil_applied = {type= "boolean", default = false},
behive = {type= "pos", default = false},
brushed = {type= "boolean", default = false},
@ -338,6 +339,12 @@ function petz.set_initial_properties(self, staticdata, dtime_s)
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)
if mobkit.is_alive(self.object) then
self.create_anthill = mobkit.remember(self, "create_anthill", true)
end
end, self)
end
if self.colorized then
if not(self.shaved) then

View File

@ -14,6 +14,7 @@ end)
--
petz.on_rightclick = function(self, clicker)
minetest.chat_send_all(tostring(petz.settings["kitty_spawn_chance"]))
if not(clicker:is_player()) then
return false
end
@ -79,6 +80,10 @@ petz.on_rightclick = function(self, clicker)
else
show_form = true
end
elseif self.type == "ant" and self.ant_type == "queen" then
if wielded_item_name == "farming:seed_wheat" then
petz_feed_queen_ant(self, clicker, player_name, wielded_item)
end
elseif self.milkable == true and wielded_item_name == "bucket:bucket_empty" and clicker:get_inventory() then
if not(self.milked) then
petz.milk_milk(self, clicker)

View File

@ -23,7 +23,7 @@ petz.on_step = function(self, dtime)
end
--Tamagochi
--Check the hungry
if petz.settings.tamagochi_mode == true and self.is_pet and petz.settings.tamagochi_hungry_warning > 0 and not(self.status=="sleep") then
if petz.settings.tamagochi_mode == true and self.owner and self.is_pet and petz.settings.tamagochi_hungry_warning > 0 and not(self.status=="sleep") then
if not(self.tmp_follow_texture) then
local items = string.split(petz.settings[self.type.."_follow"], ',')
local item = petz.str_remove_spaces(items[1]) --the first one

View File

@ -28,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, modname, S)
assert(loadfile(modpath .. "/api/api.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/mobkit.lua"))(modpath, S)
assert(loadfile(modpath .. "/misc/misc.lua"))(modpath, S)
assert(loadfile(modpath .. "/server/cron.lua"))(modname)

View File

@ -2,6 +2,14 @@
@1 at full health (@2)=@1 tem saúde plena (@2)
@1 has been tamed!=@1 foi domada!
Affinity=Afinidade
Ant=Formiga
Ant-bed=Cama de formigas
Ant Body=Corpo de formiga
Ant Egg=Ovo de formiga
Ant Head=Cabeça de formiga
Ant Helmet=Capacete de formiga
Ant Leg=Perna de formiga
Anthill Entrance=Entrada do formigueiro
Alight=Posse
A silk bobbin has been created!=Uma bobina de seda foi criada!
Amount=Quantidade
@ -79,6 +87,7 @@ Glass Syringe=Seringa de vidro
Glass Syringe with seed=Seringa com semente
Goat=Cabra
Guard=Guarda
Grain Packet=Pacote de grãos
Grizzly=Grizzly
had already been brushed.=já tinha sido escovado.
had already been spreaded with beaver oil.=já tinha sido manchado com óleo de castor.
@ -153,6 +162,7 @@ Pumpkin Hood=Capuz de abóbora
Puppy=Cachorro
Prince Crown=A coroa do príncipe
Prince of North Coat=Jaqueta do Príncipe do Norte
Queen Ant=Formiga Rainha
Queen Bee=Abelha Rainha
Rat=Rato
Raw Chicken=Frango cru
@ -218,7 +228,9 @@ Turtle=Tortuga
Turtle Shell=Carapaça de tartaruga
use to throw=usar para lançar
Vanilla Wool=Lã de baunilha
Warrior Ant=Formiga guerreira
Whip=Chicote
Worker Ant=Formiga trabalhadora
Worker Bee=Abelha trabalhadora
Pet Whistle=Assobio de animais
Wolf=Lobo

View File

@ -2,6 +2,14 @@
@1 at full health (@2)=@1 bei voller Gesundheit (@2)
@1 has been tamed!=@1 wurde gezähmt
Affinity=Verbundenheit
Ant=Ameise
Ant-bed=Ameisenbetten
Ant Body=Ameisenkörper
Ant Egg=Ameisen-Ei
Ant Head=Ameisenkopf
Ant Helmet=Ameisenhelm
Ant Leg=Ameisenbein
Anthill Entrance=Eingang zum Ameisenhügel
Alight=Absteigen
A silk bobbin has been created!=Eine Seidenspule wurde erstellt!
Amount=Amount
@ -79,6 +87,7 @@ Glass Syringe=Glasspritze
Glass Syringe with seed=Glasspritze mit Samen
Goat=Ziege
Guard=Bewachen
Grain Packet=Getreidepaket
Grizzly=Grizzlybär
had already been brushed.=wurde bereits gebürstet.
had already been spreaded with beaver oil.=wurde bereits mit Bieberöl eingeschmiert.
@ -153,6 +162,7 @@ Pumpkin Hood=Kürbishaube
Puppy=Hündchen
Prince Crown=Prinzenkrone
Prince of North Coat=Umhang des Prinz des Nordens
Queen Ant=Ameisenkönigin
Queen Bee=Bienenkönigin
Rat=Ratte
Raw Chicken=Rohes Hühnchen
@ -218,7 +228,9 @@ Turtle=Schildkröte
Turtle Shell=Schildkrötenpanzer
use to throw=benutzen zum Werfen
Vanilla Wool=Vanillewolle
Warrior Ant=Kriegerameise
Whip=Peitsche
Worker Ant=Arbeiterameise
Worker Bee=Arbeiterbiene
Pet Whistle=Haustierpfeife
Wolf=Wolf

View File

@ -2,6 +2,14 @@
@1 at full health (@2)=@1 tiene la salud llena (@2)
@1 has been tamed!=¡@1 ha sido domesticado!
Affinity=Afinidad
Ant=Hormiga
Ant-bed=Lecho de hormiguero
Ant Body=Torso de hormiga
Ant Egg=Huevo de hormiga
Ant Head=Cabeza de hormiga
Ant Helmet=Casco de hormiga
Ant Leg=Pata de hormiga
Anthill Entrance=Entrada al hormiguero
Alight=Posarse
A silk bobbin has been created!=¡Se ha creado una bobina de seda!
Amount=Cantidad
@ -79,6 +87,7 @@ Glass Syringe=Jeringuilla de cristal
Glass Syringe with seed=Jeringuilla con semilla
Goat=Cabra
Guard=Guardia
Grain Packet=Paquete de granos
Grizzly=Grizzly
had already been brushed.=ya había sido cepillado.
had already been spreaded with beaver oil.=ya había sido untado con aceite de castor.
@ -153,6 +162,7 @@ Pumpkin Hood=Capucha de calabaza
Puppy=Cachorrito
Prince Crown=Corona de príncipe
Prince of North Coat=Casaca del Príncipe del Norte
Queen Ant=Hormiga reina
Queen Bee=Abeja reina
Rat=Rata
Raw Chicken=Pollo crudo
@ -218,7 +228,9 @@ Turtle=Tortuga
Turtle Shell=Caparazón de tortuga
use to throw=úsala para lanzar
Vanilla Wool=Lana vainilla
Warrior Ant=Hormiga guerrero
Whip=Látigo
Worker Ant=Hormiga obrera
Worker Bee=Abeja obrera
Pet Whistle=Silbato para mascota
Wolf=Lobo

View File

@ -2,6 +2,14 @@
@1 at full health=L'animal @1 au maximum de sa forme (@2)
@1 has been tamed!=L'animal: @1; a été apprivoisé!
Affinity=Affinité
Ant=Fourmi
Ant-bed=Fourmilière
Ant Body=Torse de fourmi
Ant Egg=Oeuf de fourmi
Ant Head=Tête de fourmi
Ant Helmet=Casque de fourmi
Ant Leg=Patte de fourmi
Anthill Entrance=Entrée de la fourmilière
Alight=Pied à terre
A silk bobbin has been created!=Une bobine de soie a été créée!
Amount=Montant
@ -79,6 +87,7 @@ Glass Syringe=Seringue
Glass Syringe with seed=Seringue ensemencée.
Goat=Chèvre
Guard=Garde
Grain Packet=Paquet de graines
Grizzly=Grizzly
had already been brushed.=a déjà été brossé.
had already been spreaded with beaver oil.=a déjà été enduit d'huile de castor.
@ -153,6 +162,7 @@ Pumpkin Hood=Capuche en citrouille
Puppy=Chien
Prince Crown=Couronne de Prince.
Prince of North Coat=Prince de la côte nord
Queen Ant=Fourmi reine
Queen Bee=Abeille reine
Rat=Rat
Raw Chicken=Poulet cru
@ -218,7 +228,9 @@ Turtle=Tortue
Turtle Shell=Caparace de tortue
use to throw=utiliser pour lancer
Vanilla Wool=Laine vanille
Warrior Ant=Fourmi guerrière
Whip=Fouet
Worker Ant=Fourmi ouvrière
Worker Bee=Abeille ouvrière
Pet Whistle=Sifflet pour animaux
Wolf=Loup

View File

@ -2,7 +2,15 @@
@1 at full health (@2)=@1 при хорошем здоровье (@2)
@1 has been tamed!=@1 has been tamed!
Affinity=Отношения
Alight= Свет
Ant=Муравейник
Ant-bed=Муравьиная кровать
Ant Body=Муравьиное тело
Ant Egg=Муравьиное яйцо
Ant Head=Муравьиная голова
Ant Helmet=муравьиный шлем
Ant Leg=PМуравьиная нога
Anthill Entrance=Вход в муравейник
Alight=Свет
A silk bobbin has been created!=Шелковая катушка была создана!
Amount=Amount
Bat=Летучая мышь
@ -79,6 +87,7 @@ Glass Syringe=Стеклянный шприц
Glass Syringe with seed=Стеклянный шприц с семенами
Goat=Козёл
Guard=Сохранить
Grain Packet=Зерновой пакет
Grizzly=Grizzly
had already been brushed.=уже расчесывали.
had already been spreaded with beaver oil.=уже были смазаны бобровым жиром.
@ -153,6 +162,7 @@ Pumpkin Hood=Тыквенный голова
Puppy=Щенок
Prince Crown=Королевская корона
Prince of North Coat=Принц Северного плаща
Queen Ant=Королева муравей
Queen Bee=Королева пчел
Rat=Крыса
Raw Chicken=Сырая курица
@ -218,7 +228,9 @@ Turtle=Черепаха
Turtle Shell=Панцирь черепахи
Vanilla Wool=Ванильная шерсть
use to throw=для того чтобы бросить
Warrior Ant=Муравей Воитель
Whip=Кнут
Worker Ant=Муравей-рабочий
Worker Bee=Пчела-рабочий
Pet Whistle=Домашний свисток
Wolf=Волк

View File

@ -157,3 +157,31 @@ minetest.register_craft({
{"group:leather", "wool:blue", "group:leather"},
},
})
--
--THE ANT HELMET
--
armor:register_armor("petz:ant_helmet", {
description = S("Ant Helmet"),
inventory_image = "petz_ant_helmet_inv.png",
texture = "petz_ant_helmet.png",
preview = "petz_ant_helmet_preview.png",
groups = {armor_head=1, armor_use=250, flammable=0},
armor_groups = {fleshy=7, radiation=10},
damage_groups = {cracky=3, snappy=3, choppy=3, crumbly=3, level=1},
reciprocate_damage = true,
on_destroy = function(player, index, stack)
petz.armor_destroy("brewing_break_armor_sound", player)
end,
})
minetest.register_craft({
output = "petz:ant_helmet",
type = "shaped",
recipe = {
{"petz:ant_head", "petz:ant_head", "petz:ant_head"},
{"petz:ant_head", "", "petz:ant_head"},
{"", "", ""},
},
})

View File

@ -139,6 +139,15 @@ minetest.register_craftitem("petz:chicken_legs_bucket", {
groups = {flammable = 2, food = 2, food_meat = 1},
})
minetest.register_craft({
type = "shapeless",
output = "petz:roasted_chicken_legs 3",
recipe = {"petz:chicken_legs_bucket"},
replacements = {
{"petz:chicken_legs_bucket", "bucket:bucket_empty"}
},
})
minetest.register_craft({
type = "shapeless",
output = "petz:chicken_legs_bucket",

View File

@ -569,6 +569,23 @@ minetest.register_craftitem("petz:snow_leopard_skin", {
inventory_image = "petz_snow_leopard_skin.png",
})
--Ant Drops
minetest.register_craftitem("petz:ant_head", {
description = S("Ant Head"),
inventory_image = "petz_ant_head.png",
})
minetest.register_craftitem("petz:ant_body", {
description = S("Ant Body"),
inventory_image = "petz_ant_body.png",
})
minetest.register_craftitem("petz:ant_leg", {
description = S("Ant Leg"),
inventory_image = "petz_ant_leg.png",
})
--minetest.register_node("petz:squirrel_cage", {
--description = S("Squirrel Cage"),
--drawtype = "glasslike_framed",

View File

@ -1,5 +1,12 @@
local modpath, S = ...
local tree = minetest.serialize_schematic(modpath .. "/schematics/petz_anthill.mts", "lua", {})
local file = io.open(modpath .. "/schematics/petz_anthill.lua", "w")
if file then
file:write(tree)
file:close()
end
--Material for Pet's House
minetest.register_node("petz:red_gables", {
@ -706,3 +713,166 @@ minetest.register_node("petz:honey_block", {
light_source = default.LIGHT_MAX - 1,
sounds = default.node_sound_glass_defaults(),
})
--Ant Nodes
minetest.register_node("petz:antbed", {
description = S("Ant-bed"),
tiles = {"petz_antbed.png"},
is_ground_content = false,
groups = {crumbly = 3},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_craft({
type = "shaped",
output = "petz:antbed",
recipe = {
{"farming:wheat", "group:leaves", "farming:wheat"},
{"farming:cotton", "farming:seed_wheat", "farming:cotton"},
{"farming:wheat", "group:leaves", "farming:wheat"},
}
})
minetest.register_node("petz:anthill_entrance", {
description = S("Anthill Entrance"),
tiles = {"petz_anthill_entrance.png", "petz_anthill_entrance.png", "petz_antbed.png"},
is_ground_content = false,
groups = {crumbly = 3},
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
timer:start(5) --check to defend the anthill entrance each 5 seconds
end,
on_timer = function(pos) --check the entrance to defend it
pos_top = {
x = pos.x,
y = pos.y + 0.5,
z = pos.z,
}
local node = minetest.get_node_or_nil(pos_top)
if node and minetest.registered_nodes[node.name] and node.name == "air" then
local chance_worker = math.random(1, 240) --once a day a worker ant arises
if chance_worker == 1 then
if not minetest.registered_entities["petz:ant"] then
return true
end
minetest.add_entity(pos_top, "petz:ant")
end
--Check if player near (on a radius of 7) to spawn a warrior ant to defend the anthill
local nearby_objects = minetest.get_objects_inside_radius(pos, 7)
local player_near = false
for _, obj in ipairs(nearby_objects) do
if obj:is_player() and mobkit.is_alive(obj) then
player_near = true
break
end
end
if player_near then
if not minetest.registered_entities["petz:warrior_ant"] then
return true
end
minetest.add_entity(pos_top, "petz:warrior_ant")
end
end
return true --always do the check again
end
})
minetest.register_node("petz:antegg", {
description = S("Ant Egg"),
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.0, 0.25},
}
},
tiles = {"petz_antegg.png"},
walkable = true,
groups = {snappy = 2, },
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
param2 = 50,
sunlight_propagates = true,
use_texture_alpha = true,
light_source = default.LIGHT_MAX - 10,
sounds = default.node_sound_leaves_defaults(),
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
local lay_antegg_timing = petz.settings.lay_antegg_timing
timer:start(math.random(lay_antegg_timing - (lay_antegg_timing*0.2), lay_antegg_timing + (lay_antegg_timing*0.2)))
end,
on_timer = function(pos)
local entity
local chance = math.random(1, 100) --for the type of ant
if chance >= 20 then
entity ="petz:ant"
elseif chance >= 4 and chance < 20 then
entity ="petz:warrior_ant"
else
entity ="petz:queen_ant"
end
if not minetest.registered_entities[entity] then
return true
end
minetest.add_entity(pos, entity) --spawn the warrior ant
minetest.set_node(pos, {name= "air"}) --remove the node
return false
end
})
minetest.register_node("petz:grain_packet", {
description = S("Grain Packet"),
tiles = {"petz_grain_packet.png"},
is_ground_content = false,
groups = {snappy = 3, flammable = 2},
sounds = default.node_sound_leaves_defaults(),
drop = {
max_items = 15,
items = {
{
items = {'farming:seed_wheat 5'}
},
{
items = {'farming:seed_cotton'},
rarity = 5,
},
{
items = {'default:apple'},
rarity = 15,
},
{
items = {'default:blueberries'},
rarity = 20,
},
{
items = {'default:iron_lump'},
rarity = 25,
},
{
items = {'default:gold_lump'},
rarity = 40,
},
{
items = {'default:diamond'},
rarity = 80,
},
}
},
})
minetest.register_craft({
type = "shapeless",
output = "petz:grain_packet",
recipe = {
"farming:seed_wheat", "farming:seed_wheat", "farming:seed_wheat",
"farming:seed_wheat", "farming:seed_wheat", "farming:seed_wheat",
"farming:seed_wheat", "farming:seed_wheat", "farming:seed_wheat"
}
})

View File

@ -0,0 +1,58 @@
local modpath = ...
---
--- Ant Behaviours
---
function petz.bh_create_anthill(self, pos)
--Do anthill close to coasts (to avoid mountains)
if not self.create_anthill or pos.y > 8 then
return false
end
local node_name = mobkit.node_name_in(self, "below")
--Only construct on 'soil' or 'sand' nodes
if minetest.get_item_group(node_name, "soil") > 0 or minetest.get_item_group(node_name, "sand") > 0 then
local minp = {
x = pos.x - 50,
y = pos.y - 50,
z = pos.z - 50,
}
local maxp = {
x = pos.x + 50,
y = pos.y + 50,
z = pos.z + 50,
}
if #minetest.find_nodes_in_area(minp, maxp, {"petz:antbed"}) < 1 then
minetest.place_schematic({x = pos.x-6, y = pos.y-25, z = pos.z-6}, modpath.."/schematics/petz_anthill.mts", "0", nil, true)
--replace the entrance node to the same to trigger the on_construct event of the node (because is not triggered for schematics)-->
local node_entrance, pos_entrance = mobkit.node_name_in(self, "below")
if node_entrance == "petz:anthill_entrance" then
minetest.set_node(pos_entrance, {name = node_entrance})
end
self.anthill_founded = mobkit.remember(self, "anthill_founded", true) --Mark the foundation
pos.y = pos.y - 24 --y offset for place the queen inside the anthill
self.object:move_to(pos) --place the queen
return true
else
return false
end
else
return false
end
end
function petz.bh_lay_antegg(self, pos)
if self.eggs_count >= petz.settings.max_laid_anteggs then --the limit for laying eggs
return
end
--Lay in front (air node) and above a Ant Bed Node
local node_name_front, egg_pos = mobkit.node_name_in(self, "front")
local node_name_front_below = mobkit.node_name_in(self, "front_below")
if node_name_front == "air" and node_name_front_below == "petz:antbed" then
minetest.place_node(egg_pos, {name="petz:antegg"})
petz.increase_egg_count(self)
return true
else
return false
end
end

View File

@ -0,0 +1,20 @@
function petz.bh_hunt(self, prty)
if self.tamed == true then
return
end
local preys_list = petz.settings[self.type.."_preys"]
if preys_list then
preys_list = petz.str_remove_spaces(preys_list)
local preys = string.split(preys_list, ',')
for i = 1, #preys do --loop thru all preys
--minetest.chat_send_player("singleplayer", "preys list="..preys[i])
--minetest.chat_send_player("singleplayer", "node name="..node.name)
local prey = mobkit.get_closest_entity(self, preys[i]) -- look for prey
if prey then
--minetest.chat_send_player("singleplayer", "got it")
petz.hq_hunt(self, prty, prey) -- and chase it
return
end
end
end
end

View File

@ -1,5 +1,3 @@
local modpath, S = ...
---
--- DRIVER MOUNT
---
@ -77,14 +75,11 @@ function mobkit.lq_mountdriver(self)
rot_steer, rot_view = 0, math.pi/2
end
local acce_y = 0
local velo
if velo == nil then
velo= {
x= self.max_speed_forward/3,
y= 0,
z= self.max_speed_forward/3,
}
end
local velo= {
x= self.max_speed_forward/3,
y= 0,
z= self.max_speed_forward/3,
}
local velocity = get_v(velo)
--minetest.chat_send_player("singleplayer", tostring(velocity))
-- process controls
@ -112,7 +107,6 @@ function mobkit.lq_mountdriver(self)
velo.y = velo.y + (self.jump_height)*4
acce_y = acce_y *1.5
else --stand
velocity = 0
mobkit.animate(self, "stand")
return
end

View File

@ -0,0 +1,85 @@
--
-- ANT BRAIN
--
function petz.ant_brain(self)
local pos = self.object:get_pos() --pos of the petz
mobkit.vitals(self)
if self.hp <= 0 then
petz.on_die(self) -- Die Behaviour
return
end
mobkit.check_ground_suffocation(self, pos)
local timer_timing = 1
if mobkit.timer(self, timer_timing) then
if not(self.ant_type == "queen") then --hardcoded lifetime for worker and warrior ants
petz.lifetime_timer(self, petz.settings.lay_antegg_timing, timer_timing) --each second
end
local prty = mobkit.get_queue_priority(self)
if prty < 40 and self.isinliquid then
mobkit.hq_liquid_recovery(self, 40)
return
end
local player = mobkit.get_nearby_player(self)
if prty < 30 then
petz.env_damage(self, pos, 30) --enviromental damage: lava, fire...
end
-- hunt a prey (another queen in the case of a queen)
if prty < 20 and self.ant_type == "queen" then
petz.bh_hunt(self, 20)
end
if prty < 13 and self.ant_type == "queen" and not(self.anthill_founded) then --if queen, try to create a colony (anthill)
if mobkit.timer(self, 10) then --try to create an anthill every 10 seconds
if petz.bh_create_anthill(self, pos) then
return
end
end
end
if prty < 10 then
if player then
if petz.bh_attack_player(self, pos, 10, player) == true then
return
end
end
end
if prty < 8 and self.ant_type == "queen" and not(self.anthill_founded) then --if queen try to create a colony (beehive)
if petz.bh_create_anthill(self, pos) then
return
end
end
if prty < 6 and self.lay_eggs then
local lay_antegg_timing= petz.settings.lay_antegg_timing
if self.eggs_count <= petz.settings.ant_population then --quick laid in the beginning
lay_antegg_timing= lay_antegg_timing / petz.settings.ant_population
end
if mobkit.timer(self, lay_antegg_timing) then
petz.bh_lay_antegg(self, pos)
end
end
-- Default Random Sound
mokapi.make_misc_sound(self, petz.settings.misc_sound_chance, petz.settings.max_hear_distance)
--Roam default
if mobkit.is_queue_empty_high(self) and not(self.status) then
mobkit.hq_roam(self, 0)
end
end
end

View File

@ -49,23 +49,7 @@ function petz.predator_brain(self)
-- hunt a prey
if prty < 12 then -- if not busy with anything important
if self.tamed == false then
local preys_list = petz.settings[self.type.."_preys"]
if preys_list then
preys_list = petz.str_remove_spaces(preys_list)
local preys = string.split(preys_list, ',')
for i = 1, #preys do --loop thru all preys
--minetest.chat_send_player("singleplayer", "preys list="..preys[i])
--minetest.chat_send_player("singleplayer", "node name="..node.name)
local prey = mobkit.get_closest_entity(self, preys[i]) -- look for prey
if prey then
--minetest.chat_send_player("singleplayer", "got it")
petz.hq_hunt(self, 12, prey) -- and chase it
return
end
end
end
end
petz.bh_hunt(self, 12)
end
if prty < 10 then

View File

@ -181,6 +181,12 @@ function mobkit.node_name_in(self, where)
y = pos.y + 1,
z = pos.z + dir_z,
}
elseif where == "front_below" then
pos2= {
x = pos.x + dir_x,
y = pos.y - 1,
z = pos.z + dir_z,
}
end
local node = minetest.get_node_or_nil(pos2)
if node and minetest.registered_nodes[node.name] then

View File

@ -1,5 +1,6 @@
local modpath, S = ...
assert(loadfile(modpath .. "/mobkit/bh_ant.lua"))(modpath)
assert(loadfile(modpath .. "/mobkit/bh_aquatic.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_arboreal.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_attack.lua"))(modpath, S)
@ -8,11 +9,13 @@ assert(loadfile(modpath .. "/mobkit/bh_breed.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_fly.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_follow.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_herding.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_mount.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_hunt.lua"))()
assert(loadfile(modpath .. "/mobkit/bh_mount.lua"))()
assert(loadfile(modpath .. "/mobkit/bh_replace.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_runaway.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_teleport.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/bh_torch.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/br_ant.lua"))()
assert(loadfile(modpath .. "/mobkit/br_aquatic.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/br_bee.lua"))(modpath, S)
assert(loadfile(modpath .. "/mobkit/br_herbivore.lua"))(modpath, S)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
# WARNING: Do NOT change the Petz Mod preferences here
# Do create a 'user.conf' with your favourite preferences instead of.
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,tropicalfish,beaver,turtle,frog,toucan,bee,queen_bee,mr_pumpkin,foxy,penguin,polar_bear,santa_killer,werewolf,tarantula,butterfly,rat,goat,squirrel,leopard,snow_leopard
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,tropicalfish,beaver,turtle,frog,toucan,bee,queen_bee,mr_pumpkin,foxy,penguin,polar_bear,santa_killer,werewolf,tarantula,butterfly,rat,goat,squirrel,leopard,snow_leopard,ant,warrior_ant,queen_ant
##Tamagochi Mode (Take care of your pet: fed it...)
tamagochi_mode = true
@ -48,6 +48,8 @@ spawn_peaceful_monsters_ratio = 0.7
###Add the type name of the petz plus "_disable_spawn"
###Normal bees should not spam!!!
bee_disable_spawn = true
ant_disable_spawn = true
warrior_ant_disable_spawn = true
## The interval is avg spawn attempt interval (seconds) for every player
spawn_interval = 30
@ -112,6 +114,11 @@ poop = true
poop_rate = 600
poop_decay = 1200
##Ant
lay_antegg_timing = 1200
max_laid_anteggs = 500
ant_population = 5
##Lay Eggs
#Default = 90000
lay_egg_chance = 90000
@ -474,3 +481,12 @@ snow_leopard_spawn_nodes = default:snowblock,default:ice
snow_leopard_spawn_min_height = 20
snow_leopard_preys = petz:lamb,petz:calf,petz:pony,petz:piggy,petz:camel,petz:goat
snow_leopard_spawn_biome = default
##Ant Specific
ant_preys = petz:queen_ant
##Queen Ant Specific
queen_ant_spawn_chance = 0.4
queen_ant_spawn_nodes = default:dirt_with_grass,default:desert_sand
queen_ant_preys = petz:queen_ant
queen_ant_spawn_biome = default

View File

@ -0,0 +1,129 @@
local S = ...
for i=1, 3 do
local pet_name
local ant_type
local scale_model
local description
local mesh
local textures
local attack_player
local lay_eggs
local drops
if i == 1 then
pet_name = "ant"
ant_type = "worker"
description = "Worker Ant"
mesh = 'petz_ant.b3d'
scale_model = 0.375
textures= {"petz_ant.png"}
attack_player = false
lay_eggs = false
drops = {}
elseif i == 2 then
pet_name = "warrior_ant"
ant_type = "warrior"
description = "Warrior Ant"
mesh = 'petz_ant_warrior.b3d'
scale_model = 0.575
textures= {"petz_warrior_ant.png"}
attack_player = true
lay_eggs = false
drops = {}
else
pet_name = "queen_ant"
ant_type = "queen"
description = "Queen Ant"
mesh = 'petz_ant.b3d'
scale_model = 0.875
textures= {"petz_queen_ant.png"}
attack_player = false
lay_eggs = true
drops = {
{name = "petz:ant_head", chance = 3, min = 1, max = 1,},
{name = "petz:ant_body", chance = 3, min = 1, max = 1,},
{name = "petz:ant_leag", chance = 3, min = 1, max = 6,},
}
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)
minetest.register_entity("petz:"..pet_name, {
--Petz specifics
type = "ant",
ant_type = ant_type,
init_tamagochi_timer = false,
is_pet = false,
description = description,
can_fly = false,
lay_eggs = lay_eggs,
lay_eggs_in_nest = false,
type_of_egg = "node",
max_height = 5,
has_affinity = false,
give_orders = false,
can_be_brushed = false,
capture_item = "net",
is_wild = true,
attack_player = attack_player,
avoid_player = false,
follow = petz.settings.ant_follow,
--automatic_face_movement_dir = 0.0,
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,
springiness= 0,
buoyancy = 0.5, -- portion of hitbox submerged
max_speed = 3.5,
jump_height = 2.0,
view_range = 10,
lung_capacity = 10, -- seconds
max_hp = 2,
attack={range=0.5, damage_groups={fleshy=3}},
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=47, y=59}, speed=5, loop=true},
{range={x=60, y=70}, speed=5, loop=true},
{range={x=71, y=91}, speed=5, loop=true},
},
fly={range={x=92, y=98}, speed=30, loop=true},
stand_fly={range={x=92, y=98}, speed=30, loop=true},
},
drops = drops,
logic = petz.ant_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:"..pet_name, S(description), "petz_spawnegg_"..pet_name..".png", false)
end

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -229,7 +229,7 @@ local settings_def = {
type = "boolean",
default = false,
},
--Blood
--Poop
{
name = "poop",
type = "boolean",
@ -245,6 +245,22 @@ local settings_def = {
type = "number",
default = 1200,
},
--Ants
{
name = "lay_antegg_timing",
type = "number",
default = 1200,
},
{
name = "max_laid_anteggs",
type = "number",
default = 500,
},
{
name = "ant_population",
type = "number",
default = 5,
},
--Smoke particles when die
{
name = "death_effect",
@ -408,7 +424,12 @@ for key, value in ipairs(settings_def) do
if not(value.default) then
value.default = false
end
petz.settings[value.name] = user:get_bool(value.name) or settings:get_bool(value.name, value.default)
local bool_value = user:get_bool(value.name) --can return true/false or nil
if bool_value == nil then
petz.settings[value.name] = settings:get_bool(value.name, value.default)
else
petz.settings[value.name] = bool_value
end
end
end
@ -427,27 +448,40 @@ end
--Mobs Specific
for i = 1, #petz.settings["petz_list"] do --load the settings
local petz_type = petz.settings["petz_list"][i]
petz.settings[petz_type.."_spawn"] = user:get_bool(petz_type.."_spawn", false) or settings:get_bool(petz_type.."_spawn", false)
petz.settings[petz_type.."_spawn"] = user:get_bool(petz_type.."_spawn")
if petz.settings[petz_type.."_spawn"] == nil then
petz.settings[petz_type.."_spawn"] = settings:get_bool(petz_type.."_spawn", false)
end
petz.settings[petz_type.."_spawn_chance"] = tonumber(user:get(petz_type.."_spawn_chance") or settings:get(petz_type.."_spawn_chance")) or 0.0
petz.settings[petz_type.."_spawn_nodes"] = user:get(petz_type.."_spawn_nodes", "") or settings:get(petz_type.."_spawn_nodes", "")
petz.settings[petz_type.."_spawn_biome"] = user:get(petz_type.."_spawn_biome", "default") or settings:get(petz_type.."_spawn_biome", "default")
petz.settings[petz_type.."_spawn_nodes"] = user:get(petz_type.."_spawn_nodes") or settings:get(petz_type.."_spawn_nodes") or ""
petz.settings[petz_type.."_spawn_biome"] = user:get(petz_type.."_spawn_biome") or settings:get(petz_type.."_spawn_biome") or "default"
petz.settings[petz_type.."_spawn_herd"] = tonumber(user:get(petz_type.."_spawn_herd") or settings:get(petz_type.."_spawn_herd")) or 1
petz.settings[petz_type.."_seasonal"] = user:get(petz_type.."_seasonal", "") or settings:get(petz_type.."_seasonal", "")
petz.settings[petz_type.."_follow"] = user:get(petz_type.."_follow", "") or settings:get(petz_type.."_follow", "")
petz.settings[petz_type.."_breed"] = user:get(petz_type.."_breed", "") or settings:get(petz_type.."_breed", "")
petz.settings[petz_type.."_predators"] = user:get(petz_type.."_predators", "") or settings:get(petz_type.."_predators", "")
petz.settings[petz_type.."_preys"] = user:get(petz_type.."_preys", "") or settings:get(petz_type.."_preys", "")
petz.settings[petz_type.."_colorized"] = user:get_bool(petz_type.."_colorized", false) or settings:get_bool(petz_type.."_colorized", false)
petz.settings[petz_type.."_seasonal"] = user:get(petz_type.."_seasonal") or settings:get(petz_type.."_seasonal") or ""
petz.settings[petz_type.."_follow"] = user:get(petz_type.."_follow") or settings:get(petz_type.."_follow") or ""
petz.settings[petz_type.."_breed"] = user:get(petz_type.."_breed") or settings:get(petz_type.."_breed") or ""
petz.settings[petz_type.."_predators"] = user:get(petz_type.."_predators") or settings:get(petz_type.."_predators") or ""
petz.settings[petz_type.."_preys"] = user:get(petz_type.."_preys") or settings:get(petz_type.."_preys") or ""
petz.settings[petz_type.."_colorized"] = user:get_bool(petz_type.."_colorized")
if petz.settings[petz_type.."_colorized"] == nil then
petz.settings[petz_type.."_colorized"] = settings:get_bool(petz_type.."_colorized", false)
end
petz.settings[petz_type.."_copulation_distance"] = tonumber(user:get(petz_type.."_copulation_distance") or settings:get(petz_type.."_copulation_distance")) or 0.0
petz.settings[petz_type.."_convert"] = user:get(petz_type.."_convert", nil) or settings:get(petz_type.."_convert", nil)
petz.settings[petz_type.."_convert_to"] = user:get(petz_type.."_convert_to", nil) or settings:get(petz_type.."_convert_to", nil)
petz.settings[petz_type.."_convert"] = user:get(petz_type.."_convert") or settings:get(petz_type.."_convert") or nil
petz.settings[petz_type.."_convert_to"] = user:get(petz_type.."_convert_to") or settings:get(petz_type.."_convert_to") or nil
petz.settings[petz_type.."_convert_count"] = tonumber(user:get(petz_type.."_convert_count") or settings:get(petz_type.."_convert_count")) or nil
petz.settings[petz_type.."_lifetime"] = tonumber(user:get(petz_type.."_lifetime") or settings:get(petz_type.."_lifetime")) or nil
petz.settings[petz_type.."_disable_spawn"] = tonumber(user:get(petz_type.."_disable_spawn") or settings:get(petz_type.."_disable_spawn")) or false
petz.settings[petz_type.."_disable_spawn"] = user:get_bool(petz_type.."_disable_spawn")
if petz.settings[petz_type.."_disable_spawn"] == nil then
petz.settings[petz_type.."_disable_spawn"] = settings:get_bool(petz_type.."_disable_spawn", false)
end
if petz_type == "beaver" then
petz.settings[petz_type.."_create_dam"] = user:get_bool(petz_type.."_create_dam", false) or settings:get_bool(petz_type.."_create_dam", false)
petz.settings[petz_type.."_create_dam"] = user:get_bool(petz_type.."_create_dam")
if petz.settings[petz_type.."_create_dam"] == nil then
petz.settings[petz_type.."_create_dam"] = settings:get_bool(petz_type.."_create_dam", false)
end
settings:get_bool(petz_type.."_create_dam", false)
elseif petz_type == "silkworm" then
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", "")
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB