From cb3b3b92cc3a44e6e3b1420e16c87aa8dba0ad25 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 11 Sep 2022 19:17:55 +0200 Subject: [PATCH] Immobilize shulkers --- mods/ENTITIES/mcl_mobs/api.lua | 4 ++++ mods/ENTITIES/mobs_mc/shulker.lua | 26 +++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 438f7f4f2..b9e4c9e63 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -303,10 +303,13 @@ end -- set and return valid yaw local set_yaw = function(self, yaw, delay, dtime) + + if self.noyaw then return end if true then self.object:set_yaw(yaw) return yaw end + if not yaw or yaw ~= yaw then yaw = 0 end @@ -4069,6 +4072,7 @@ minetest.register_entity(name, { ignited_by_sunlight = def.ignited_by_sunlight or false, spawn_in_group = def.spawn_in_group, spawn_in_group_min = def.spawn_in_group_min, + noyaw = def.noyaw or false, -- End of MCL2 extensions on_spawn = def.on_spawn, diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 77273db2f..6e12146f2 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -44,15 +44,31 @@ mcl_mobs:register_mob("mobs_mc:shulker", { looting_factor = 0.0625}, }, animation = { - stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25, + stand_speed = 25, walk_speed = 0, run_speed = 50, punch_speed = 25, speed_normal = 25, speed_run = 50, - stand_start = 0, stand_end = 45, - walk_start = 0, walk_end = 45, - run_start = 0, run_end = 45, + stand_start = 0, stand_end = 25, + walk_start = 25, walk_end = 45, + run_start = 45, run_end = 85, punch_start = 80, punch_end = 100, }, view_range = 16, - fear_height = 4, + fear_height = 0, + noyaw = true, + do_custom = function(self,dtime) + if math.floor(self.object:get_yaw()) ~=0 then + self.object:set_yaw(0) + mcl_mobs:yaw(self, 0, 0, dtime) + end + if self.state == "walk" or self.state == "stand" then + self.state = "stand" + mcl_mobs:set_animation(self, "stand") + end + if self.state == "attack" then + mcl_mobs:set_animation(self, "punch") + end + self.path.way = false + self.look_at_players = false + end, }) -- bullet arrow (weapon)