This commit is contained in:
runs 2019-08-18 13:44:09 +02:00
parent b45715832f
commit 5f5718471c
7 changed files with 150 additions and 12 deletions

View File

@ -1,10 +1,8 @@
---
--- Models, icons and textures by runs.
---
Source code, models, icons and textures by runs.
The license applied for all of them is GPLv3.
Sounds have different licenses, see the sounds/LICENSE.MD file.
---
--- License:
---
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

View File

@ -54,6 +54,11 @@ petz.remove_owner = function(self)
end
end
petz.do_feed = function(self)
petz.set_affinity(self, true, 5)
self.fed = mobkit.remember(self, "fed", true)
end
--
--Feed/Tame Function
--

View File

@ -44,9 +44,7 @@ petz.on_rightclick = function(self, clicker)
--If feeded
elseif petz.feed_tame(self, clicker, wielded_item, wielded_item_name, 5, true) then
if petz.settings.tamagochi_mode == true and self.fed == false then
petz.set_affinity(self, true, 5)
self.fed = true
mobkit.remember(self, "fed", self.fed)
petz.do_feed(self)
end
petz.refill(self) --Refill wool, milk or nothing
if self.type == "wolf" and wielded_item_name == "petz:bone" then

View File

@ -70,6 +70,40 @@ function petz.herbivore_brain(self)
petz.ownthing(self)
end
end
if prty > 150 then --work in progress
local pos_front = mobkit.node_name_in(self, "front")
local node_front = minetest.get_node_or_nil(pos_front)
local pos_under = mobkit.node_name_in(self, "below")
local node_under = minetest.get_node_or_nil(pos_under)
local pos_top = mobkit.node_name_in(self, "top")
local node_top = minetest.get_node_or_nil(pos_top)
if node_front and minetest.registered_nodes[node_front.name]
and node_top and minetest.registered_nodes[node_top.name]
and node_top.name == "air"
and (minetest.registered_nodes[node_front.name].groups.wood
or minetest.registered_nodes[node_front.name].groups.leaves
or minetest.registered_nodes[node_front.name].groups.tree) then
if not(self.mov_status == "arboreal") then
petz.set_behaviour(self, "arboreal", "air")
end
else
if self.behaviour == "arboreal" then
if node_front and minetest.registered_nodes[node_front.name]
and (not(minetest.registered_nodes[node_front.name].groups.wood)
or not(minetest.registered_nodes[node_front.name].groups.tree)
or not(minetest.registered_nodes[node_front.name].groups.leaves))
then
self.object:set_acceleration({x = 0, y = 0, z = 0 })
petz.set_behaviour(self, "terrestrial", nil)
elseif node_top and minetest.registered_nodes[node_top.name]
and not(node_top.name == "air") then
self.object:set_acceleration({x = 0, y = 0, z = 0 })
petz.set_behaviour(self, "terrestrial", nil)
end
end
end
end
--Runaway from Player
if prty < 14 then
@ -136,8 +170,13 @@ function petz.herbivore_brain(self)
{"petz:pet_bowl"})
if #nearby_nodes >= 1 then
local tpos = nearby_nodes[1] --the first match
if vector.distance(pos, tpos) > 2 then
mobkit.hq_goto(self, 4, tpos)
local distance = vector.distance(pos, tpos)
if distance > 2 then
mobkit.hq_goto(self, 4, tpos)
elseif distance <=2 then
if (petz.settings.tamagochi_mode == true) and (self.fed == false) then
petz.do_feed(self)
end
end
end
end

View File

@ -0,0 +1,86 @@
--
--CHIMP
--
local S = ...
local pet_name = "chimp"
local scale_model = 0.85
petz.chimp = {}
local mesh = 'petz_chimp.b3d'
local textures = {"petz_chimp.png"}
local collisionbox = {-0.35, -0.75*scale_model, -0.28, 0.35, -0.3125, 0.28}
minetest.register_entity("petz:"..pet_name,{
--Petz specifics
type = "chimp",
init_tamagochi_timer = true,
is_pet = true,
has_affinity = true,
arboreal = true,
is_wild = false,
give_orders = true,
can_be_brushed = true,
capture_item = "lasso",
follow = petz.settings.calf_follow,
rotate = petz.settings.rotate,
physical = true,
stepheight = 0.1, --EVIL!
collide_with_objects = true,
collisionbox = collisionbox,
visual = petz.settings.visual,
mesh = mesh,
textures = textures,
visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model},
static_save = true,
get_staticdata = mobkit.statfunc,
-- api props
springiness= 0,
buoyancy = 0.5, -- portion of hitbox submerged
max_speed = 2,
jump_height = 5,
view_range = 10,
lung_capacity = 10, -- seconds
max_hp = 10,
makes_footstep_sound = true,
attack={range=0.5, damage_groups={fleshy=3}},
animation = {
walk={range={x=1, y=12}, speed=20, loop=true},
run={range={x=1, y=12}, speed=20, loop=true},
stand={
{range={x=12, y=24}, speed=5, loop=true},
{range={x=24, y=36}, speed=10, loop=true},
{range={x=36, y=48}, speed=10, loop=true},
},
sit = {range={x=51, y=60}, speed=5, loop=true},
hang = {range={x=63, y=75}, speed=5, loop=true},
climb= {range={x=78, y=90}, speed=5, loop=true},
},
sounds = {
misc = "petz_chimp_hoo",
moaning = "petz_chimp_moaning",
},
brainfunc = petz.herbivore_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
if self.init_tamagochi_timer == true then
petz.init_tamagochi_timer(self)
end
end,
})
petz:register_egg("petz:chimp", S("Chimp"), "petz_spawnegg_chimp.png", 0)

View File

@ -3,7 +3,7 @@
##Important: All the values separated by commas have to be without spaces.
##
petz_list = kitty,puppy,ducky,lamb,lion,calf,panda,grizzly,pony,parrot,chicken,piggy,wolf,elephant,elephant_female,pigeon,moth,camel,clownfish,bat,silkworm
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
##Type of model [mesh -or- cubic]
type_model = mesh
@ -71,6 +71,7 @@ moth_spawn = true
camel_spawn = true
bat_spawn = true
silkworm_spawn = true
chimp_spawn = true
##Air Damage
air_damage = 1
@ -244,3 +245,9 @@ silkworm_spawn_chance = 1.0
silkworm_spawn_nodes = default:pine_needles
silkworm_spawn_biome = default
silkworm_lay_egg_on_node = group:leaves
#Chimp Specific
chimp_follow = default:blueberries
chimp_spawn_chance = 1.0
chimp_spawn_nodes = default:dirt_with_rainforest_litter
chimp_spawn_biome = default

View File

@ -182,6 +182,11 @@ petz.settings.silkworm_spawn_chance = tonumber(settings:get("silkworm_spawn_chan
petz.settings.silkworm_spawn_nodes = settings:get("silkworm_spawn_nodes", "")
petz.settings.silkworm_spawn_biome = settings:get("silkworm_spawn_biome", "default")
petz.settings.silkworm_lay_egg_on_node = settings:get("silkworm_lay_egg_on_node", "")
petz.settings.chimp_spawn = settings:get_bool("chimp_spawn", true)
petz.settings.chimp_spawn_chance = tonumber(settings:get("chimp_spawn_chance"))
petz.settings.chimp_spawn_nodes = settings:get("chimp_spawn_nodes", "")
petz.settings.chimp_spawn_biome = settings:get("chimp_spawn_biome", "default")
petz.settings.chimp_follow = settings:get("chimp_follow", "")
if petz.settings.type_model == "mesh" then
petz.settings.visual = "mesh"