From 486959515ca13ba0d5756ba5d930ff43e9d135b5 Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Wed, 21 Apr 2021 10:20:31 -0400 Subject: [PATCH] Make creepers even more dangerous --- mods/ENTITIES/mcl_mobs/api/api.lua | 1 + .../api/mob_functions/attack_type_instructions.lua | 7 ++++++- mods/ENTITIES/mobs_mc/creeper.lua | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api/api.lua b/mods/ENTITIES/mcl_mobs/api/api.lua index fcec54177..756366bbe 100644 --- a/mods/ENTITIES/mcl_mobs/api/api.lua +++ b/mods/ENTITIES/mcl_mobs/api/api.lua @@ -346,6 +346,7 @@ function mobs:register_mob(name, def) fire_damage_resistant = def.fire_damage_resistant or false, ignited_by_sunlight = def.ignited_by_sunlight or false, eye_height = def.eye_height or 1.5, + defuse_reach = def.defuse_reach or 4, -- End of MCL2 extensions on_spawn = def.on_spawn, diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/attack_type_instructions.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/attack_type_instructions.lua index a532cd1eb..842b79192 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/attack_type_instructions.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/attack_type_instructions.lua @@ -23,8 +23,13 @@ mobs.explode_attack_walk = function(self,dtime) mobs.set_yaw_while_attacking(self) + local distance_from_attacking = vector_distance(self.object:get_pos(), self.attacking:get_pos()) + --make mob walk up to player within 2 nodes distance then start exploding - if vector_distance(self.object:get_pos(), self.attacking:get_pos()) >= self.reach then + if distance_from_attacking >= self.reach and + --don't allow explosion to cancel unless out of the reach boundary + not (self.explosion_animation ~= nil and self.explosion_animation > 0 and distance_from_attacking <= self.defuse_reach) then + mobs.set_velocity(self, self.run_velocity) mobs.set_mob_animation(self,"run") diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index ee5c7fcfe..fdc980a49 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -48,7 +48,8 @@ mobs:register_mob("mobs_mc:creeper", { explosion_radius = 4, explosion_damage_radius = 6, explosiontimer_reset_radius = 6, - reach = 3, + reach = 1.5, + defuse_reach = 4, explosion_timer = 0.3, allow_fuse_reset = true, stop_to_explode = true,