1
0
Fork 0

Partial creeper explode distance fix, and fix to stop punching mobs into the air.

This commit is contained in:
MysticTempest 2021-02-11 17:27:55 -06:00
parent d7cfe54eb4
commit 0ec64189dc
3 changed files with 9 additions and 4 deletions

View File

@ -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,

View File

@ -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.

View File

@ -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,