Fix some creeper issues

- Fix fuse sound sometimes not playing
- Timer = 1.5s
- Distance behaviour like in MC
Wuzzy 2018-03-31 03:51:49 +02:00
parent d6228145c6
commit 8060928237
2 changed files with 13 additions and 9 deletions

@ -1850,10 +1850,10 @@ local do_states = function(self, dtime)
mob_sound(self, self.sounds.fuse) mob_sound(self, self.sounds.fuse)
-- print ("=== explosion timer started", self.explosion_timer) -- print ("=== explosion timer started", self.explosion_timer)
-- stop timer if out of blast radius or direct line of sight -- stop timer if out of reach or direct line of sight
elseif self.allow_fuse_reset elseif self.allow_fuse_reset
and self.v_start and self.v_start
and (dist > max(self.reach, entity_damage_radius) + 0.5 and (dist > self.reach
or not line_of_sight(self, s, p, 2)) then or not line_of_sight(self, s, p, 2)) then
self.v_start = false self.v_start = false
self.timer = 0 self.timer = 0

@ -28,20 +28,24 @@ mobs:register_mob("mobs_mc:creeper", {
visual_size = {x=3, y=3}, visual_size = {x=3, y=3},
sounds = { sounds = {
attack = "tnt_ignite", attack = "tnt_ignite",
death = "Creeperdeath", -- TODO: Replace --TODO: death = "",
damage = "Creeper4", -- TODO: Replce --TODO: damage = "",
war_cry = "tnt_ignite", fuse = "tnt_ignite",
explode = "tnt_explode", explode = "tnt_explode",
distance = 16, distance = 16,
}, },
makes_footstep_sound = true, makes_footstep_sound = true,
walk_velocity = 1.5, walk_velocity = 1.05,
run_velocity = 3, run_velocity = 2.1,
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" }, runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
attack_type = "explode", attack_type = "explode",
explosion_radius = 3, explosion_radius = 3,
explosion_fire = false, reach = 4,
explosion_damage_radius = 7,
explosion_timer = 1.5,
allow_fuse_reset = true,
stop_to_explode = true,
-- Force-ignite creeper with flint and steel and explode after 1.5 seconds. -- Force-ignite creeper with flint and steel and explode after 1.5 seconds.
-- TODO: Make creeper flash after doing this as well. -- TODO: Make creeper flash after doing this as well.
@ -62,7 +66,7 @@ mobs:register_mob("mobs_mc:creeper", {
end end
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end end
self._forced_explosion_countdown_timer = 1.5 self._forced_explosion_countdown_timer = self.explosion_timer
minetest.sound_play(self.sounds.attack, {pos = self.object:getpos(), gain = 1, max_hear_distance = 16}) minetest.sound_play(self.sounds.attack, {pos = self.object:getpos(), gain = 1, max_hear_distance = 16})
end end
end, end,