petz/petz/petz/lamb_mobkit.lua

121 lines
3.2 KiB
Lua
Raw Normal View History

2019-05-20 13:41:34 -07:00
--
--LAMB
--
local S = ...
local pet_name = "lamb"
2020-01-06 11:50:12 -08:00
local scale_model = 2.5
2019-07-16 18:55:05 -07:00
local scale_baby = 0.5
local visual_size = {x=petz.settings.visual_size.x*scale_model, y=petz.settings.visual_size.y*scale_model}
local visual_size_baby = {x=petz.settings.visual_size.x*scale_model*scale_baby, y=petz.settings.visual_size.y*scale_model*scale_baby}
local mesh = 'petz_lamb.b3d'
2019-07-17 04:41:29 -07:00
local skin_colors = {"white", "grey", "dark_grey", "brown", "vanilla"}
2019-07-15 15:00:06 -07:00
local textures = {}
2019-07-16 18:55:05 -07:00
for n = 1, #skin_colors do
textures[n] = "petz_"..pet_name.."_"..skin_colors[n]..".png"
2019-05-20 13:41:34 -07:00
end
2020-01-06 11:30:54 -08:00
local p1 = {x= -0.0625, y = -0.5, z = -0.125}
local p2 = {x= 0.125, y = -0.125, z = 0.1875}
local collisionbox, collisionbox_baby = petz.get_collisionbox(p1, p2, scale_model, scale_baby)
2019-05-20 13:41:34 -07:00
2020-02-18 03:40:21 -08:00
minetest.register_entity("petz:"..pet_name,{
--Petz specifics
type = "lamb",
init_tamagochi_timer = false,
2019-07-16 18:55:05 -07:00
is_pet = true,
2019-06-02 17:02:19 -07:00
has_affinity = false,
2019-07-16 18:55:05 -07:00
breed = true,
2019-05-20 13:41:34 -07:00
is_wild = false,
give_orders = false,
2020-05-02 10:04:14 -07:00
herd = true,
2019-06-02 17:02:19 -07:00
can_be_brushed = true,
2019-05-20 13:41:34 -07:00
capture_item = "lasso",
2019-11-28 16:02:46 -08:00
mutation = 1,
2019-06-02 17:02:19 -07:00
follow = petz.settings.lamb_follow,
2019-06-10 16:38:29 -07:00
drops = {
2019-07-13 17:24:43 -07:00
{name = "petz:mini_lamb_chop", chance = 1, min = 1, max = 1,},
2019-07-14 08:37:52 -07:00
{name = "petz:bone", chance = 5, min = 1, max = 1,},
2019-06-10 16:38:29 -07:00
},
2019-06-04 11:31:02 -07:00
replace_rate = 10,
replace_offset = 0,
replace_what = {
{"group:grass", "air", -1},
{"default:dirt_with_grass", "default:dirt", -2}
},
2020-01-31 15:54:38 -08:00
poop = true,
2019-05-20 13:41:34 -07:00
rotate = petz.settings.rotate,
physical = true,
2019-06-02 17:02:19 -07:00
stepheight = 0.1, --EVIL!
2019-05-20 13:41:34 -07:00
collide_with_objects = true,
collisionbox = collisionbox,
2019-07-16 18:55:05 -07:00
collisionbox_baby = collisionbox_baby,
2020-02-18 03:40:21 -08:00
visual = petz.settings.visual,
2019-05-20 13:41:34 -07:00
mesh = mesh,
textures = textures,
2019-07-16 18:55:05 -07:00
skin_colors = skin_colors,
visual_size = visual_size,
visual_size_baby = visual_size_baby,
2019-05-20 13:41:34 -07:00
static_save = true,
get_staticdata = mobkit.statfunc,
-- api props
2019-06-02 17:02:19 -07:00
springiness= 0,
buoyancy = 0.5, -- portion of hitbox submerged
2019-06-18 01:36:10 -07:00
max_speed = 2,
2019-08-12 16:56:42 -07:00
jump_height = 1.5,
2019-06-02 17:02:19 -07:00
view_range = 10,
2019-05-20 13:41:34 -07:00
lung_capacity = 10, -- seconds
2019-07-14 08:37:52 -07:00
max_hp = 8,
2020-02-18 03:40:21 -08:00
2020-05-30 12:36:26 -07:00
head = {
position = vector.new(-0.1939, 0.2908, 0),
rotation_origin = vector.new(-90, 90, 0), --in degrees, normally values are -90, 0, 90
2020-05-31 04:32:27 -07:00
eye_offset = -0.3,
2020-05-30 12:36:26 -07:00
},
2020-02-18 03:40:21 -08:00
attack={range=0.5, damage_groups={fleshy=3}},
2019-05-20 13:41:34 -07:00
animation = {
2020-02-20 10:23:23 -08:00
walk={range={x=1, y=12}, speed=25, loop=true},
run={range={x=13, y=25}, speed=25, loop=true},
2019-06-16 04:13:31 -07:00
stand={
{range={x=26, y=46}, speed=5, loop=true},
{range={x=47, y=59}, speed=5, loop=true},
2020-02-18 03:40:21 -08:00
{range={x=82, y=94}, speed=5, loop=true},
},
2019-06-02 17:02:19 -07:00
},
sounds = {
misc = "petz_lamb_bleat",
moaning = "petz_lamb_moaning",
2019-05-20 13:41:34 -07:00
},
2020-02-18 03:40:21 -08:00
2019-10-28 15:31:12 -07:00
logic = petz.herbivore_brain,
2020-02-18 03:40:21 -08:00
2019-06-10 16:38:29 -07:00
on_activate = function(self, staticdata, dtime_s) --on_activate, required
mobkit.actfunc(self, staticdata, dtime_s)
2019-07-01 09:03:04 -07:00
petz.set_initial_properties(self, staticdata, dtime_s)
2019-06-10 16:38:29 -07:00
end,
2020-02-18 03:40:21 -08:00
2021-01-06 11:16:48 -08:00
on_deactivate = function(self)
petz.on_deactivate(self)
end,
2020-02-18 03:40:21 -08:00
on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir)
2019-06-16 04:13:31 -07:00
petz.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
2019-05-20 13:41:34 -07:00
end,
2020-02-18 03:40:21 -08:00
2019-05-20 13:41:34 -07:00
on_rightclick = function(self, clicker)
petz.on_rightclick(self, clicker)
end,
2020-02-18 03:40:21 -08:00
on_replace = function(self, pos, oldnode, newnode)
2019-05-20 13:41:34 -07:00
petz.lamb_wool_regrow(self)
end,
2020-02-18 03:40:21 -08:00
on_step = function(self, dtime)
2019-10-24 14:45:04 -07:00
mobkit.stepfunc(self, dtime) -- required
2019-08-31 21:04:38 -07:00
petz.on_step(self, dtime)
2019-08-17 09:15:02 -07:00
end,
2020-02-18 03:40:21 -08:00
2019-05-20 13:41:34 -07:00
})
2019-06-02 17:02:19 -07:00
2019-10-27 10:07:05 -07:00
petz:register_egg("petz:lamb", S("Lamb"), "petz_spawnegg_lamb.png", true)