Reset boss arena on player respawn
This commit is contained in:
parent
39a66dee63
commit
c795422bdf
@ -376,3 +376,28 @@ sf_zones.register_zone("forest_shrine", {
|
||||
}},
|
||||
music = "crystal",
|
||||
})
|
||||
|
||||
-- Remove flyershooters and boss in boss arena if player
|
||||
-- respawns from boss arena.
|
||||
-- Done to reset the arena state properly so the player
|
||||
-- can start from a clean slate on a retry.
|
||||
minetest.register_on_respawnplayer(function(player)
|
||||
if not sf_zones.is_in_zone(player:get_pos(), "boss_arena") then
|
||||
return
|
||||
end
|
||||
local zone = sf_zones.get_zone("boss_arena")
|
||||
local objs = sf_zones.get_objects_in_zone(zone)
|
||||
for o=1, #objs do
|
||||
local lua = objs[o]:get_luaentity()
|
||||
if lua then
|
||||
if lua.name == "sf_mobs:shadow_orb" then
|
||||
minetest.log("action", "[sf_zones] Boss arena: Removing shadow orb at "..minetest.pos_to_string(objs[o]:get_pos()).." on player respawn")
|
||||
objs[o]:remove()
|
||||
elseif lua.name == "sf_mobs:flyershooter" then
|
||||
minetest.log("action", "[sf_zones] Boss arena: Removing flyershooter at "..minetest.pos_to_string(objs[o]:get_pos()).." on player respawn")
|
||||
objs[o]:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user