From 0ec64189dc9530e30819cf058c58872645e3095f Mon Sep 17 00:00:00 2001 From: MysticTempest Date: Thu, 11 Feb 2021 17:27:55 -0600 Subject: [PATCH] Partial creeper explode distance fix, and fix to stop punching mobs into the air. --- mods/ENTITIES/mcl_mobs/api.lua | 7 ++++--- mods/ENTITIES/mcl_mobs/api.txt | 1 + mods/ENTITIES/mobs_mc/creeper.lua | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 00635861..07e2704f 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2501,7 +2501,7 @@ local do_states = function(self, dtime) -- stop timer if out of reach or direct line of sight elseif self.allow_fuse_reset and self.v_start - and (dist > self.reach + and (dist >= self.explosiontimer_reset_radius or not line_of_sight(self, s, p, 2)) then self.v_start = false self.timer = 0 @@ -2511,7 +2511,7 @@ local do_states = function(self, dtime) end -- walk right up to player unless the timer is active - if self.v_start and (self.stop_to_explode or dist < 1.5) then + if self.v_start and (self.stop_to_explode or dist < self.reach) then set_velocity(self, 0) else set_velocity(self, self.run_velocity) @@ -3068,7 +3068,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) local up = 2 -- if already in air then dont go up anymore when hit - if v.y > 0 + if v.y ~= 0 or self.fly then up = 0 end @@ -3789,6 +3789,7 @@ minetest.register_entity(name, { immune_to = def.immune_to or {}, explosion_radius = def.explosion_radius, -- LEGACY explosion_damage_radius = def.explosion_damage_radius, -- LEGACY + explosiontimer_reset_radius = def.explosiontimer_reset_radius, explosion_timer = def.explosion_timer or 3, allow_fuse_reset = def.allow_fuse_reset ~= false, stop_to_explode = def.stop_to_explode ~= false, diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index ee97489b..eda74aeb 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -108,6 +108,7 @@ functions needed for the mob to work properly which contains the following: 'explosion_timer' number of seconds before mob explodes while its target is still inside reach or explosion_damage_radius, defaults to 3. + 'explosiontimer_reset_radius' The distance you must travel before the timer will be reset. 'allow_fuse_reset' Allow 'explode' attack_type to reset fuse and resume chasing if target leaves the blast radius or line of sight. Defaults to true. diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index f1648525..a4ff3dd0 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -39,7 +39,10 @@ mobs:register_mob("mobs_mc:creeper", { attack_type = "explode", explosion_strength = 3, - reach = 4, + explosion_radius = 3.5, + explosion_damage_radius = 3.5, + explosiontimer_reset_radius = 6, + reach = 3, explosion_timer = 1.5, allow_fuse_reset = true, stop_to_explode = true,