Merge pull request 'Add big head support to all babies' (#2686) from big_heads into master

Reviewed-on: MineClone2/MineClone2#2686
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-09-29 21:26:30 +00:00
commit d666493e59
22 changed files with 101 additions and 105 deletions

View File

@ -1459,6 +1459,11 @@ local breed = function(self)
z = 0
})
end
self.animation = nil
local anim = self._current_animation
self._current_animation = nil -- Mobs Redo does nothing otherwise
mcl_mobs.set_animation(self, anim)
end
return
@ -3583,18 +3588,23 @@ local mob_activate = function(self, staticdata, def, dtime)
if not self.nametag then
self.nametag = def.nametag
end
if not self.custom_visual_size and not self.child then
if not self.custom_visual_size then
-- Remove saved visual_size on old existing entites.
-- Old entities were 3 now it's 1.
self.visual_size = nil
self.object:set_properties({visual_size = self.visual_size})
self.base_size = self.visual_size
if self.child then
self.visual_size = {
x = self.visual_size.x * 0.5,
y = self.visual_size.y * 0.5,
}
end
end
-- set anything changed above
self.object:set_properties(self)
set_yaw(self, (random(0, 360) - 180) / 180 * pi, 6)
update_tag(self)
self._current_animation = nil
set_animation(self, "stand")
-- run on_spawn function if found
@ -4059,6 +4069,7 @@ minetest.register_entity(name, {
texture_mods = {},
shoot_arrow = def.shoot_arrow,
sounds_child = def.sounds_child,
_child_animations = def.child_animations,
pick_up = def.pick_up,
explosion_strength = def.explosion_strength,
suffocation_timer = 0,
@ -4508,6 +4519,10 @@ function mcl_mobs:spawn_child(pos, mob_type)
ent.base_selbox[6] * .5,
},
})
ent.animation = ent._child_animations
ent._current_animation = nil
set_animation(ent, "stand")
return child
end

View File

@ -25,7 +25,6 @@ mcl_mobs:register_mob("mobs_mc:chicken", {
textures = {
{"mobs_mc_chicken.png"},
},
visual_size = {x=2.2, y=2.2},
makes_footstep_sound = true,
walk_velocity = 1,
@ -58,12 +57,15 @@ mcl_mobs:register_mob("mobs_mc:chicken", {
distance = 16,
},
animation = {
stand_speed = 25, walk_speed = 25, run_speed = 50,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 20, walk_speed = 25,
run_start = 0, run_end = 20, run_speed = 50,
},
child_animations = {
stand_start = 31, stand_end = 31,
walk_start = 31, walk_end = 51, walk_speed = 37,
run_start = 31, run_end = 51, run_speed = 75,
},
follow = {
"mcl_farming:wheat_seeds",
"mcl_farming:melon_seeds",

View File

@ -17,7 +17,6 @@ local cow_def = {
"mobs_mc_cow.png",
"blank.png",
}, },
visual_size = {x=2.8, y=2.8},
makes_footstep_sound = true,
walk_velocity = 1,
drops = {
@ -41,11 +40,14 @@ local cow_def = {
distance = 16,
},
animation = {
stand_speed = 25, walk_speed = 40,
run_speed = 60, stand_start = 0,
stand_end = 0, walk_start = 0,
walk_end = 40, run_start = 0,
run_end = 40,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 30,
run_start = 0, run_end = 40, run_speed = 40,
},
child_animations = {
stand_start = 41, stand_end = 41,
walk_start = 41, walk_end = 81, walk_speed = 45,
run_start = 41, run_end = 81, run_speed = 60,
},
on_rightclick = function(self, clicker)
if mcl_mobs:feed_tame(self, clicker, 1, true, false) then return end
@ -82,7 +84,6 @@ mcl_mobs:register_mob("mobs_mc:cow", cow_def)
-- Mooshroom
local mooshroom_def = table.copy(cow_def)
mooshroom_def.description = S("Mooshroom")
mooshroom_def.mesh = "mobs_mc_cow.b3d"
mooshroom_def.spawn_in_group_min = 4
mooshroom_def.spawn_in_group = 8
mooshroom_def.textures = { {"mobs_mc_mooshroom.png", "mobs_mc_mushroom_red.png"}, {"mobs_mc_mooshroom_brown.png", "mobs_mc_mushroom_brown.png" } }

View File

@ -1 +0,0 @@
mcl_mobs

View File

@ -40,7 +40,6 @@ local ocelot = {
visual = "mesh",
mesh = "mobs_mc_cat.b3d",
textures = {"mobs_mc_cat_ocelot.png"},
visual_size = {x=2.0, y=2.0},
makes_footstep_sound = true,
walk_chance = default_walk_chance,
walk_velocity = 1,
@ -57,14 +56,16 @@ local ocelot = {
distance = 16,
},
animation = {
speed_normal = 25,
run_speed = 50,
stand_start = 0,
stand_end = 0,
walk_start = 0,
walk_end = 40,
run_start = 0,
run_end = 40,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 40,
run_start = 0, run_end = 40, run_speed = 50,
sit_start = 50, sit_end = 50,
},
child_animations = {
stand_start = 51, stand_end = 51,
walk_start = 51, walk_end = 91, walk_speed = 60,
run_start = 51, run_end = 91, run_speed = 75,
sit_start = 101, sit_end = 101,
},
follow = follow,
view_range = 12,

View File

@ -15,11 +15,9 @@ mcl_mobs:register_mob("mobs_mc:pig", {
visual = "mesh",
mesh = "mobs_mc_pig.b3d",
textures = {{
"blank.png", -- baby
"mobs_mc_pig.png", -- base
"blank.png", -- saddle
}},
visual_size = {x=2.5, y=2.5},
makes_footstep_sound = true,
walk_velocity = 1,
run_velocity = 3,
@ -40,15 +38,14 @@ mcl_mobs:register_mob("mobs_mc:pig", {
distance = 16,
},
animation = {
stand_speed = 40,
walk_speed = 40,
run_speed = 90,
stand_start = 0,
stand_end = 0,
walk_start = 0,
walk_end = 40,
run_start = 0,
run_end = 40,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 60,
run_start = 0, run_end = 40, run_speed = 90,
},
child_animations = {
stand_start = 41, stand_end = 41,
walk_start = 41, walk_end = 81, walk_speed = 90,
run_start = 41, run_end = 81, run_speed = 135,
},
follow = {
"mcl_farming:potato_item",
@ -60,15 +57,17 @@ mcl_mobs:register_mob("mobs_mc:pig", {
do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
if not self.v3 then
self.v3 = 0
self.max_speed_forward = 4
self.max_speed_reverse = 2
self.accel = 4
self.terrain_type = 3
self.driver_attach_at = {x = 0.0, y = 2.75, z = -1.5}
self.driver_attach_at = {x = 0.0, y = 6.5, z = -3.75}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_scale = {x = 1/self.visual_size.x, y = 1/self.visual_size.y}
self.base_texture = self.texture_list[1]
self.object:set_properties({textures = self.base_texture})
end
-- if driver present allow control of horse
@ -111,7 +110,6 @@ mcl_mobs:register_mob("mobs_mc:pig", {
local item = clicker:get_wielded_item()
if item:get_name() == "mcl_mobitems:saddle" and self.saddle ~= "yes" then
self.base_texture = {
"blank.png", -- baby
"mobs_mc_pig.png", -- base
"mobs_mc_pig_saddle.png", -- saddle
}

View File

@ -26,7 +26,6 @@ local rabbit = {
{"mobs_mc_rabbit_salt.png"},
{"mobs_mc_rabbit_black.png"},
},
visual_size = {x=1.5, y=1.5},
sounds = {
random = "mobs_mc_rabbit_random",
damage = "mobs_mc_rabbit_hurt",
@ -49,10 +48,14 @@ local rabbit = {
},
fear_height = 4,
animation = {
speed_normal = 25, speed_run = 50,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 20,
run_start = 0, run_end = 20,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 20, walk_speed = 20,
run_start = 0, run_end = 20, run_speed = 30,
},
child_animations = {
stand_start = 21, stand_end = 21,
walk_start = 21, walk_end = 41, walk_speed = 30,
run_start = 21, run_end = 41, run_speed = 45,
},
-- Follow (yellow) dangelions, carrots and golden carrots
follow = {

View File

@ -63,7 +63,6 @@ mcl_mobs:register_mob("mobs_mc:sheep", {
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.29, 0.45},
visual = "mesh",
visual_size = {x=3, y=3},
mesh = "mobs_mc_sheepfur.b3d",
textures = { sheep_texture("unicolor_white") },
gotten_texture = gotten_texture,
@ -93,10 +92,14 @@ mcl_mobs:register_mob("mobs_mc:sheep", {
distance = 16,
},
animation = {
speed_normal = 25, run_speed = 65,
stand_start = 40, stand_end = 80,
walk_start = 0, walk_end = 40,
run_start = 0, run_end = 40,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 30,
run_start = 0, run_end = 40, run_speed = 40,
},
child_animations = {
stand_start = 81, stand_end = 81,
walk_start = 81, walk_end = 121, walk_speed = 45,
run_start = 81, run_end = 121, run_speed = 60,
},
follow = { "mcl_farming:wheat_item" },
view_range = 12,

View File

@ -1282,7 +1282,6 @@ mcl_mobs:register_mob("mobs_mc:villager", {
"mobs_mc_villager.png",
"mobs_mc_villager.png", --hat
},
visual_size = {x=2.75, y=2.75},
makes_footstep_sound = true,
walk_velocity = 1.2,
run_velocity = 2.4,
@ -1295,21 +1294,18 @@ mcl_mobs:register_mob("mobs_mc:villager", {
distance = 10,
},
animation = {
stand_speed = 25,
stand_start = 40,
stand_end = 59,
walk_speed = 25,
walk_start = 0,
walk_end = 40,
run_speed = 25,
run_start = 0,
run_end = 40,
head_shake_start = 210,
head_shake_end = 220,
head_shake_loop = false,
head_nod_start = 210,
head_nod_end = 220,
head_nod_loop = false,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 25,
run_start = 0, run_end = 40, run_speed = 25,
head_shake_start = 60, head_shake_end = 70, head_shake_loop = false,
head_nod_start = 50, head_nod_end = 60, head_nod_loop = false,
},
child_animations = {
stand_start = 71, stand_end = 71,
walk_start = 71, walk_end = 111, walk_speed = 37,
run_start = 71, run_end = 111, run_speed = 37,
head_shake_start = 131, head_shake_end = 141, head_shake_loop = false,
head_nod_start = 121, head_nod_end = 131, head_nod_loop = false,
},
follow = pick_up,
nofollow = true,

View File

@ -29,7 +29,6 @@ mcl_mobs:register_mob("mobs_mc:evoker", {
"blank.png", --no hat
-- TODO: Attack glow
} },
visual_size = {x=2.75, y=2.75},
makes_footstep_sound = true,
damage = 6,
walk_velocity = 0.2,
@ -65,19 +64,10 @@ mcl_mobs:register_mob("mobs_mc:evoker", {
},
-- TODO: sounds
animation = {
stand_speed = 25,
stand_start = 40,
stand_end = 59,
walk_speed = 25,
walk_start = 0,
walk_end = 40,
run_speed = 25,
shoot_start = 120, --magic arm swinging
shoot_end = 140,
die_speed = 15,
die_start = 190,
die_end = 200,
die_loop = false,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 6,
run_start = 0, run_end = 40, run_speed = 24,
shoot_start = 142, shoot_end = 152, -- Magic arm swinging
},
view_range = 16,
fear_height = 4,

View File

@ -25,7 +25,6 @@ local wolf = {
textures = {
{"mobs_mc_wolf.png"},
},
visual_size = {x=3, y=3},
makes_footstep_sound = true,
sounds = {
attack = "mobs_mc_wolf_bark",
@ -78,11 +77,16 @@ local wolf = {
end
end,
animation = {
speed_normal = 50, speed_run = 100,
stand_start = 0, stand_end = 40,
walk_start = 40, walk_end = 80,
run_start = 80, run_end = 120,
sit_start = 121, sit_end = 140,
stand_start = 0, stand_end = 0,
walk_start = 0, walk_end = 40, walk_speed = 50,
run_start = 0, run_end = 40, run_speed = 100,
sit_start = 45, sit_end = 45,
},
child_animations = {
stand_start = 46, stand_end = 46,
walk_start = 46, walk_end = 86, walk_speed = 75,
run_start = 46, run_end = 86, run_speed = 150,
sit_start = 91, sit_end = 91,
},
jump = true,
attacks_monsters = true,

View File

@ -140,24 +140,8 @@ local function egg_on_step(self, dtime)
-- FIXME: Chicks have a quite good chance to spawn in walls
local r = math.random(1,8)
-- Turn given object into a child
local function make_child(object)
local ent = object:get_luaentity()
object:set_properties({
visual_size = { x = ent.base_size.x/2, y = ent.base_size.y/2 },
collisionbox = {
ent.base_colbox[1]/2,
ent.base_colbox[2]/2,
ent.base_colbox[3]/2,
ent.base_colbox[4]/2,
ent.base_colbox[5]/2,
ent.base_colbox[6]/2,
}
})
ent.child = true
end
if r == 1 then
make_child(minetest.add_entity(self._lastpos, "mobs_mc:chicken"))
mcl_mobs:spawn_child(self._lastpos, "mobs_mc:chicken")
-- BONUS ROUND: 1/32 chance to spawn 3 additional chicks
local r = math.random(1,32)
@ -169,7 +153,7 @@ local function egg_on_step(self, dtime)
}
for o=1, 3 do
local pos = vector.add(self._lastpos, offsets[o])
make_child(minetest.add_entity(pos, "mobs_mc:chicken"))
mcl_mobs:spawn_child(pos, "mobs_mc:chicken")
end
end
end