Add zombie villagers and spiders to the head rotation function

This commit is contained in:
epCode 2022-06-08 15:51:04 -07:00
parent 761cb8b366
commit cbb4c93e0c
4 changed files with 28 additions and 8 deletions

View File

@ -3682,9 +3682,17 @@ local mob_step = function(self, dtime)
if (mob_yaw < -60 or mob_yaw > 60) and not self.attack then
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.multiply(oldr, 0.9))
elseif self.attack then
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.new(mob_pitch, mob_yaw, 0))
if self.head_yaw == "y" then
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.new(mob_pitch, mob_yaw, 0))
elseif self.head_yaw == "z" then
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.new(mob_pitch, 0, mob_yaw))
end
else
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, ((mob_yaw-oldr.y)*.3)+oldr.y, 0))
if self.head_yaw == "y" then
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, ((mob_yaw-oldr.y)*.3)+oldr.y, 0))
elseif self.head_yaw == "z" then
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, 0, -(((mob_yaw-oldr.y)*.3)+oldr.y)*3))
end
end
elseif not self._locked_object and math.abs(oldr.y) > 3 and math.abs(oldr.x) < 3 then
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,0), vector.multiply(oldr, 0.9))
@ -3937,6 +3945,7 @@ minetest.register_entity(name, {
head_yaw_offset = def.head_yaw_offset or 0, -- name of head bone
bone_eye_height = def.bone_eye_height or 1.4, -- mob eye height
curiosity = def.curiosity or 1, -- factor for staqring at players
head_yaw = def.head_yaw or "y", -- factor for staqring at players
stepheight = def.stepheight or 0.6,
name = name,
description = def.description,

View File

@ -33,6 +33,12 @@ local spider = {
textures = {
{"mobs_mc_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"},
},
--EXPERIMENTAL
head_swivel = "Head_Control",
bone_eye_height = 1,
curiosity = 10,
head_yaw="z",
-------------------------------
visual_size = {x=3, y=3},
makes_footstep_sound = false,
sounds = {

View File

@ -39,13 +39,18 @@ mcl_mobs:register_mob("mobs_mc:villager_zombie", {
visual = "mesh",
mesh = "mobs_mc_villager_zombie.b3d",
textures = {
{"mobs_mc_empty.png", "mobs_mc_zombie_butcher.png", "mobs_mc_empty.png"},
{"mobs_mc_empty.png", "mobs_mc_zombie_farmer.png", "mobs_mc_empty.png"},
{"mobs_mc_empty.png", "mobs_mc_zombie_librarian.png", "mobs_mc_empty.png"},
{"mobs_mc_empty.png", "mobs_mc_zombie_priest.png", "mobs_mc_empty.png"},
{"mobs_mc_empty.png", "mobs_mc_zombie_smith.png", "mobs_mc_empty.png"},
{"mobs_mc_empty.png", "mobs_mc_zombie_villager.png", "mobs_mc_empty.png"},
{"mobs_mc_zombie_butcher.png"},
{"mobs_mc_zombie_farmer.png"},
{"mobs_mc_zombie_librarian.png"},
{"mobs_mc_zombie_priest.png"},
{"mobs_mc_zombie_smith.png"},
{"mobs_mc_zombie_villager.png"},
},
--EXPERIMENTAL
head_swivel = "Head_Control",
bone_eye_height = 2.35,
curiosity = 2,
-------------------------------
visual_size = {x=2.75, y=2.75},
makes_footstep_sound = true,
damage = 3,