Add in chicken head code with additional pitch modifier

This commit is contained in:
jordan4ibanez 2021-04-25 20:08:45 -04:00
parent f57c4709ac
commit ac85230938
5 changed files with 24 additions and 2 deletions

View file

@ -393,6 +393,7 @@ function mobs:register_mob(name, def)
--this part controls the visual of the head
head_bone_pos_y = def.head_bone_pos_y or 3.6,
head_bone_pos_z = def.head_bone_pos_z or -0.6,
head_pitch_modifier = def.head_pitch_modifier or 0,
--these variables are switches in case the model
--moves the wrong way

View file

@ -97,6 +97,10 @@ mobs.do_head_logic = function(self,dtime)
head_pitch = minetest.dir_to_yaw(vector.new(vector.distance(vector.new(pos.x,0,pos.z),vector.new(look_at.x,0,look_at.z)),0,pos.y-look_at.y))+(math.pi/2)
end
if self.head_pitch_modifier then
head_pitch = head_pitch + self.head_pitch_modifier
end
if self.swap_y_with_x then
self.object:set_bone_position("head", bone_pos, vector_new(degrees(head_pitch),degrees(head_yaw),0))
else

View file

@ -108,8 +108,23 @@ mobs:register_mob("mobs_mc:chicken", {
gain = 1.0,
max_hear_distance = 16,
}, true)
end,
end,
--head code
has_head = true,
head_bone = "head",
swap_y_with_x = false,
reverse_head_yaw = false,
head_bone_pos_y = 1.675,
head_bone_pos_z = 0,
head_height_offset = 0.55,
head_direction_offset = 0.0925,
head_pitch_modifier = -math.pi/2,
--end head code
})
--spawn

View file

@ -97,6 +97,7 @@ local cow_def = {
head_height_offset = 1.0525,
head_direction_offset = 0.5,
head_pitch_modifier = 0,
--end head code
}

View file

@ -65,6 +65,7 @@ mobs:register_mob("mobs_mc:creeper", {
head_height_offset = 1.1,
head_direction_offset = 0,
head_pitch_modifier = 0,
--end head code
-- Force-ignite creeper with flint and steel and explode after 1.5 seconds.