Adjust bones, animations slightly from b3d data.

Initialize bones on spawn.
This commit is contained in:
kno10 2024-11-19 21:48:21 +01:00
parent b84c06b9c2
commit fae4d4a132
12 changed files with 25 additions and 13 deletions

View File

@ -399,7 +399,7 @@ function mob_class:check_head_swivel(dtime)
end
-- 0.02 is about 1.14 degrees tolerance, to update less often
if math.abs(oldr.x-newr.x) + math.abs(oldr.y-newr.y) + math.abs(oldr.z-newr.z) < 0.02 and vector.equals(oldp, vector.zero()) then return end
if math.abs(oldr.x-newr.x) + math.abs(oldr.y-newr.y) + math.abs(oldr.z-newr.z) < 0.02 then return end
if self.object.get_bone_override then -- minetest >= 5.9
self.object:set_bone_override(self.head_swivel, {

View File

@ -701,7 +701,19 @@ function mcl_mobs.spawn(pos,id)
local def = minetest.registered_entities[id] or minetest.registered_entities["mobs_mc:"..id] or minetest.registered_entities["extra_mobs:"..id]
if not def or not def.is_mob or (def.can_spawn and not def.can_spawn(pos)) then return false end
if not has_room(def, pos) then return false end
return minetest.add_entity(pos, def.name)
local ent = minetest.add_entity(pos, def.name)
-- initialize head bone
if def.head_swivel and def.head_bone_position then
if ent and ent.get_bone_override then -- minetest >= 5.9
ent:set_bone_override(def.head_swivel, {
position = { vec = def.head_bone_position, absolute = true },
rotation = { vec = vector.zero(), absolute = true }
})
else -- minetest < 5.9
self.object:set_bone_position(def.head_swivel, def.head_bone_position, vector.zero)
end
end
return ent
end
local function spawn_group(p,mob,spawn_on,amount_to_spawn)

View File

@ -32,7 +32,7 @@ mcl_mobs.register_mob("mobs_mc:blaze", {
mesh = "mobs_mc_blaze.b3d",
head_swivel = "head.control",
head_eye_height = 1.4,
head_bone_position = vector.new( 0, 4, 0 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 3.9, 0 ), -- for minetest <= 5.8
curiosity = 10,
head_pitch_multiplier=-1,
textures = {

View File

@ -22,7 +22,7 @@ mcl_mobs.register_mob("mobs_mc:chicken", {
floats = 1,
head_swivel = "head.control",
head_eye_height = 0.5,
head_bone_position = vector.new(0, 4, -.3), -- for minetest <= 5.8
head_bone_position = vector.new(0, 3.7, -.48), -- for minetest <= 5.8
curiosity = 10,
head_yaw="z",
visual_size = {x=1,y=1},

View File

@ -23,7 +23,7 @@ local cow_def = {
}, },
head_swivel = "head.control",
head_eye_height = 1.1,
head_bone_position = vector.new( 0, 10, 0 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 9.5, -3.76 ), -- for minetest <= 5.8
curiosity = 2,
head_yaw="z",
makes_footstep_sound = true,

View File

@ -62,7 +62,7 @@ mcl_mobs.register_mob("mobs_mc:llama", {
head_swivel = "head.control",
head_eye_height = 1.5,
head_yaw = "z",
head_bone_position = vector.new( 0, 11, 0 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 10.6, 0 ), -- for minetest <= 5.8
curiosity = 60,
hp_min = 15,

View File

@ -38,7 +38,7 @@ local ocelot = {
xp_max = 3,
head_swivel = "head.control",
head_eye_height = 0.4,
head_bone_position = vector.new( 0, 6.2, 0 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 6.44, -0.42 ), -- for minetest <= 5.8
head_yaw="z",
curiosity = 4,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 0.69, 0.3},

View File

@ -165,8 +165,8 @@ mcl_mobs.register_mob("mobs_mc:parrot", {
fly_speed = 50,
stand_start = 0,
stand_end = 0,
fly_start = 30,
fly_end = 45,
fly_start = 60,
fly_end = 120,
walk_start = 0,
walk_end = 20,
-- TODO: actual walk animation

View File

@ -21,7 +21,7 @@ mcl_mobs.register_mob("mobs_mc:pig", {
}},
head_swivel = "head.control",
head_eye_height = 0.7,
head_bone_position = vector.new( 0, 7.5, -1 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 7.23, -1 ), -- for minetest <= 5.8
curiosity = 3,
head_yaw="z",
makes_footstep_sound = true,

View File

@ -252,7 +252,7 @@ local zombified_piglin = {
damage = 9,
reach = 2,
head_swivel = "head.control",
head_bone_position = vector.new( 0, 2.4, 0 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 2.417, 0 ), -- for minetest <= 5.8
head_eye_height = 1.4,
curiosity = 15,
collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.94, 0.3}, -- same

View File

@ -26,7 +26,7 @@ mcl_mobs.register_mob("mobs_mc:polar_bear", {
},
head_swivel = "head.control",
head_eye_height = 1,
head_bone_position = vector.new( 0, 2.6, 0 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 2.396, 0 ), -- for minetest <= 5.8
curiosity = 20,
head_yaw="z",
visual_size = {x=3.0, y=3.0},

View File

@ -66,7 +66,7 @@ mcl_mobs.register_mob("mobs_mc:sheep", {
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.29, 0.45},
head_swivel = "head.control",
head_eye_height = 1.0,
head_bone_position = vector.new( 0, 3.3, -.7 ), -- for minetest <= 5.8
head_bone_position = vector.new( 0, 3.7, -.9 ), -- for minetest <= 5.8
curiosity = 6,
head_yaw="z",
visual = "mesh",