Fix some creeper issues

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

View File

@ -1850,10 +1850,10 @@ local do_states = function(self, dtime)
mob_sound(self, self.sounds.fuse)
-- 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
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
self.v_start = false
self.timer = 0

View File

@ -28,20 +28,24 @@ mobs:register_mob("mobs_mc:creeper", {
visual_size = {x=3, y=3},
sounds = {
attack = "tnt_ignite",
death = "Creeperdeath", -- TODO: Replace
damage = "Creeper4", -- TODO: Replce
war_cry = "tnt_ignite",
--TODO: death = "",
--TODO: damage = "",
fuse = "tnt_ignite",
explode = "tnt_explode",
distance = 16,
},
makes_footstep_sound = true,
walk_velocity = 1.5,
run_velocity = 3,
walk_velocity = 1.05,
run_velocity = 2.1,
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
attack_type = "explode",
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.
-- TODO: Make creeper flash after doing this as well.
@ -62,7 +66,7 @@ mobs:register_mob("mobs_mc:creeper", {
end
clicker:set_wielded_item(item)
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})
end
end,