From e6ddc03d3c87bd99571d1494b90f301b7ee7d51c Mon Sep 17 00:00:00 2001 From: Bakawun Date: Tue, 7 Nov 2023 17:18:21 +0000 Subject: [PATCH 01/14] Shulker: lower shoot interval to 1 second In this video we can see the shulkers are shooting at a rate of once per second. https://youtube.com/shorts/8tUFaSZ4b7I?si=sszp4cnyXR4dXg9B The wiki confirms this but mentions a range of 1 to 5.5 seconds. I think this range is caused by the shulker closing and stopping shots for a few seconds but no longer than the max interval of 5.5 https://minecraft.fandom.com/wiki/Shulker#:~:text=The%20shulker%20continues%20firing%20every,unaffected%20by%20Levitation%20when%20hit --- mods/ENTITIES/mobs_mc/shulker.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index ecf60debd..62be949f3 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -35,7 +35,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { type = "monster", spawn_class = "hostile", attack_type = "shoot", - shoot_interval = 0.5, + shoot_interval = 1.0, arrow = "mobs_mc:shulkerbullet", shoot_offset = 0.5, passive = false, From 8d34ff2a9a222338624c3f61f563786e9ee000d3 Mon Sep 17 00:00:00 2001 From: Bakawun Date: Mon, 13 Nov 2023 15:13:52 +0000 Subject: [PATCH 02/14] Shulker: Make shulker peek periodically Adjust walk and animation settings so the shulker peeks out randomly. --- mods/ENTITIES/mobs_mc/shulker.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 62be949f3..b468be175 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -51,7 +51,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { -- TODO: sounds -- TODO: Make shulker dye-able visual_size = {x=3, y=3}, - walk_chance = 0, + walk_chance = 10, knock_back = false, jump = false, can_despawn = false, @@ -65,15 +65,17 @@ mcl_mobs.register_mob("mobs_mc:shulker", { looting_factor = 0.0625}, }, animation = { - stand_speed = 25, walk_speed = 0, run_speed = 50, punch_speed = 25, + stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25, speed_normal = 25, speed_run = 50, stand_start = 0, stand_end = 25, - walk_start = 25, walk_end = 45, - run_start = 45, run_end = 85, + walk_start = 65, walk_end = 65, + run_start = 65, run_end = 85, punch_start = 80, punch_end = 100, }, view_range = 16, fear_height = 0, + walk_velocity = 0, + run_velocity = 0, noyaw = true, do_custom = function(self,dtime) local pos = self.object:get_pos() @@ -81,10 +83,6 @@ mcl_mobs.register_mob("mobs_mc:shulker", { 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" - self:set_animation("stand") - end if self.state == "attack" then self:set_animation("punch") end From 26cfdf0b7cb2d1915bb11406883fabbf0c405951 Mon Sep 17 00:00:00 2001 From: Bakawun Date: Tue, 14 Nov 2023 10:52:09 +0000 Subject: [PATCH 03/14] Shulker: randomize shoot interval Randomize shoot interval to between 1 and 5.5 seconds and set default shoot interval to 5.5 --- mods/ENTITIES/mobs_mc/shulker.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index b468be175..f1c723d01 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -35,7 +35,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { type = "monster", spawn_class = "hostile", attack_type = "shoot", - shoot_interval = 1.0, + shoot_interval = 5.5, arrow = "mobs_mc:shulkerbullet", shoot_offset = 0.5, passive = false, @@ -79,6 +79,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { noyaw = true, do_custom = function(self,dtime) local pos = self.object:get_pos() + self.shoot_interval = math.random(1, 5.5) if math.floor(self.object:get_yaw()) ~=0 then self.object:set_yaw(0) mcl_mobs:yaw(self, 0, 0, dtime) From b02a3deec7b59b3f27581669820121a612b31ccf Mon Sep 17 00:00:00 2001 From: Bakawun Date: Tue, 14 Nov 2023 13:57:56 +0000 Subject: [PATCH 04/14] Shulker; fix attack open animation, improve peek --- mods/ENTITIES/mobs_mc/shulker.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index f1c723d01..d1137cfe3 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -68,8 +68,10 @@ mcl_mobs.register_mob("mobs_mc:shulker", { stand_speed = 25, walk_speed = 25, run_speed = 50, punch_speed = 25, speed_normal = 25, speed_run = 50, stand_start = 0, stand_end = 25, - walk_start = 65, walk_end = 65, + walk_start = 45, walk_end = 65, + walk_loop = false, run_start = 65, run_end = 85, + run_loop punch_start = 80, punch_end = 100, }, view_range = 16, @@ -85,7 +87,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { mcl_mobs:yaw(self, 0, 0, dtime) end if self.state == "attack" then - self:set_animation("punch") + self:set_animation("run") end self.path.way = false self.look_at_players = false From b4511fb8c70d4f8542c0bdc37b663abf383bee33 Mon Sep 17 00:00:00 2001 From: Bakawun Date: Tue, 14 Nov 2023 14:47:24 +0000 Subject: [PATCH 05/14] Shulker, add missing false statement --- mods/ENTITIES/mobs_mc/shulker.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index d1137cfe3..2b29fdcd6 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -71,7 +71,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { walk_start = 45, walk_end = 65, walk_loop = false, run_start = 65, run_end = 85, - run_loop + run_loop = false, punch_start = 80, punch_end = 100, }, view_range = 16, From f5079f15680583a824bca0d4a069af5321780343 Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 15 Nov 2023 18:59:46 +0100 Subject: [PATCH 06/14] Add an option for mob arrows to be "homing" --- mods/ENTITIES/mcl_mobs/combat.lua | 3 +++ mods/ENTITIES/mcl_mobs/init.lua | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 4396f3265..c7f8d3e84 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -1231,6 +1231,9 @@ function mob_class:do_states_attack (dtime) -- important for mcl_shields ent._shooter = self.object ent._saved_shooter_pos = self.object:get_pos() + if ent.homing then + ent._target = self.attack + end end local amount = (vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) ^ 0.5 diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index b0fc73d6e..69bd7ebf4 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -350,6 +350,7 @@ function mcl_mobs.register_arrow(name, def) hit_node = def.hit_node, hit_mob = def.hit_mob, hit_object = def.hit_object, + homing = def.homing, drop = def.drop or false, -- drops arrow as registered item when true collisionbox = {0, 0, 0, 0, 0, 0}, -- remove box around arrows timer = 0, @@ -422,6 +423,17 @@ function mcl_mobs.register_arrow(name, def) end end + if self.homing and self._target then + local p = self._target:get_pos() + if p then + if minetest.line_of_sight(self.object:get_pos(), p) then + self.object:set_velocity(vector.direction(self.object:get_pos(), p) * self.velocity) + end + else + self.target = nil + end + end + if self.hit_player or self.hit_mob or self.hit_object then for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do From 58bb26a7eff8d3055af6e5fbc735dbc610c82f8b Mon Sep 17 00:00:00 2001 From: cora Date: Wed, 15 Nov 2023 19:00:01 +0100 Subject: [PATCH 07/14] Make shulker bullets homing --- mods/ENTITIES/mobs_mc/shulker.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 2b29fdcd6..95ca7df1a 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -158,7 +158,7 @@ mcl_mobs.register_arrow("mobs_mc:shulkerbullet", { visual_size = {x = 0.25, y = 0.25}, textures = {"mobs_mc_shulkerbullet.png"}, velocity = 6, - + homing = true, hit_player = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, From 55fe71d73b4d29b2c3dd5808b47212e3d090178e Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 26 Oct 2023 21:32:50 +0200 Subject: [PATCH 08/14] Add a get_arrow_hit_func function to mcl_mobs reason for this is that player:punch used by most mobs ignores armor worn by player --- mods/ENTITIES/mcl_mobs/init.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index 69bd7ebf4..cd79fed6f 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -334,6 +334,13 @@ function mcl_mobs.register_mob(name, def) end -- END mcl_mobs.register_mob function +function mcl_mobs.get_arrow_damage_func(damage, typ) + local typ = mcl_damage.types[typ] and typ or "arrow" + return function(projectile, object) + return mcl_util.deal_damage(object, damage, {type = typ}) + end +end + -- register arrow for shoot attack function mcl_mobs.register_arrow(name, def) From cf51c60527acdf9a9583f4cd48698fe700326369 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 26 Oct 2023 21:35:13 +0200 Subject: [PATCH 09/14] Fix shulker bullets ignoring armor --- mods/ENTITIES/mobs_mc/shulker.lua | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 95ca7df1a..bbc7eb0dc 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -159,25 +159,10 @@ mcl_mobs.register_arrow("mobs_mc:shulkerbullet", { textures = {"mobs_mc_shulkerbullet.png"}, velocity = 6, homing = true, - hit_player = function(self, player) - player:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 4}, - }, nil) - end, - - hit_mob = function(self, mob) - mob:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 4}, - }, nil) - end, - - hit_node = function(self, pos, node) - end + hit_player = mcl_mobs.get_arrow_damage_func(4), + hit_mob = mcl_mobs.get_arrow_damage_func(4), }) - mcl_mobs.register_egg("mobs_mc:shulker", S("Shulker"), "#946694", "#4d3852", 0) mcl_mobs:non_spawn_specific("mobs_mc:shulker","overworld",0,minetest.LIGHT_MAX+1) --[[ From 789c9a9a6d2cc73274584ff60d1610d41c18deb2 Mon Sep 17 00:00:00 2001 From: bakawun Date: Thu, 16 Nov 2023 11:21:25 +0100 Subject: [PATCH 10/14] Shulker: make bullet speed match mc speed is 5 according to https://www.gmbinder.com/share/-MelLRYIg8yCfuAqQ82g#:~:text=After%20doing%20some%20experimentation%20I,~5%20blocks%2Fsecond). --- mods/ENTITIES/mobs_mc/shulker.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index bbc7eb0dc..ed0732001 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -157,7 +157,7 @@ mcl_mobs.register_arrow("mobs_mc:shulkerbullet", { visual = "sprite", visual_size = {x = 0.25, y = 0.25}, textures = {"mobs_mc_shulkerbullet.png"}, - velocity = 6, + velocity = 5, homing = true, hit_player = mcl_mobs.get_arrow_damage_func(4), hit_mob = mcl_mobs.get_arrow_damage_func(4), From 686646b86d1d37826957e7b6a2e8849b391f91df Mon Sep 17 00:00:00 2001 From: bakawun Date: Thu, 16 Nov 2023 18:27:54 +0100 Subject: [PATCH 11/14] Shulker: align armor value with mc and set it to 0 when opened --- mods/ENTITIES/mobs_mc/shulker.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index ed0732001..1b25dd53b 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -43,7 +43,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { hp_max = 30, xp_min = 5, xp_max = 5, - armor = 150, + armor = 20, collisionbox = {-0.5, -0.01, -0.5, 0.5, 0.99, 0.5}, visual = "mesh", mesh = "mobs_mc_shulker.b3d", @@ -77,7 +77,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { view_range = 16, fear_height = 0, walk_velocity = 0, - run_velocity = 0, + run_velocity = 0, noyaw = true, do_custom = function(self,dtime) local pos = self.object:get_pos() @@ -88,6 +88,11 @@ mcl_mobs.register_mob("mobs_mc:shulker", { end if self.state == "attack" then self:set_animation("run") + self:armor = 0 + if self.state == "stand" then + self.armor = 20 + if self.state == "walk" or self.state == "run" then + self.armor = 0 end self.path.way = false self.look_at_players = false From 69903aa4eccb1700fc9881e15680b115b3a2b607 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Sat, 25 Nov 2023 02:55:06 +0100 Subject: [PATCH 12/14] Fixed crashes --- mods/ENTITIES/mobs_mc/shulker.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 1b25dd53b..136652548 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -88,10 +88,10 @@ mcl_mobs.register_mob("mobs_mc:shulker", { end if self.state == "attack" then self:set_animation("run") - self:armor = 0 - if self.state == "stand" then + self.armor = 0 + elseif self.state == "stand" then self.armor = 20 - if self.state == "walk" or self.state == "run" then + elseif self.state == "walk" or self.state == "run" then self.armor = 0 end self.path.way = false From bc101314df221c61334fe2990d78c1a8c83018c5 Mon Sep 17 00:00:00 2001 From: bakawun Date: Mon, 11 Dec 2023 09:36:03 +0100 Subject: [PATCH 13/14] mobs:shulker:use on_attack to set shoot interval to between 1 and 6 seconds --- mods/ENTITIES/mobs_mc/shulker.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/shulker.lua b/mods/ENTITIES/mobs_mc/shulker.lua index 136652548..78959b717 100644 --- a/mods/ENTITIES/mobs_mc/shulker.lua +++ b/mods/ENTITIES/mobs_mc/shulker.lua @@ -35,7 +35,7 @@ mcl_mobs.register_mob("mobs_mc:shulker", { type = "monster", spawn_class = "hostile", attack_type = "shoot", - shoot_interval = 5.5, + shoot_interval = 6, arrow = "mobs_mc:shulkerbullet", shoot_offset = 0.5, passive = false, @@ -81,7 +81,6 @@ mcl_mobs.register_mob("mobs_mc:shulker", { noyaw = true, do_custom = function(self,dtime) local pos = self.object:get_pos() - self.shoot_interval = math.random(1, 5.5) if math.floor(self.object:get_yaw()) ~=0 then self.object:set_yaw(0) mcl_mobs:yaw(self, 0, 0, dtime) @@ -155,6 +154,9 @@ mcl_mobs.register_mob("mobs_mc:shulker", { end end end, + on_attack = function(self, dtime) + self.shoot_interval = math.random(1, 6) + end, }) -- bullet arrow (weapon) From cee5bbc206e507eca4cf36fab0240eb000fc469d Mon Sep 17 00:00:00 2001 From: bakawun Date: Thu, 14 Dec 2023 16:50:23 +0100 Subject: [PATCH 14/14] mobs:fix typo in homing function --- mods/ENTITIES/mcl_mobs/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/init.lua b/mods/ENTITIES/mcl_mobs/init.lua index cd79fed6f..f4322bd31 100644 --- a/mods/ENTITIES/mcl_mobs/init.lua +++ b/mods/ENTITIES/mcl_mobs/init.lua @@ -437,7 +437,7 @@ function mcl_mobs.register_arrow(name, def) self.object:set_velocity(vector.direction(self.object:get_pos(), p) * self.velocity) end else - self.target = nil + self._target = nil end end