change files to support spectate

master
MisterE123 2021-02-17 13:37:36 -05:00
parent 21d6908b61
commit f8bcfd45b5
4 changed files with 7 additions and 7 deletions

View File

@ -14,7 +14,7 @@ minetest.register_globalstep(function(dtime)
for _,player in ipairs(minetest.get_connected_players()) do
local pl_name = player:get_player_name()
if arena_lib.is_player_in_arena(pl_name, "wormball") then
if arena_lib.is_player_in_arena(pl_name, "wormball") and not(arena_lib.is_player_spectating(pl_name)) then
local arena = arena_lib.get_arena_by_player(pl_name)
if not(arena.in_queue == true) and not (arena.in_loading == true) and not(arena.in_celebration == true) and arena.enabled == true then
local stats = arena.players[pl_name]
@ -50,7 +50,7 @@ minetest.register_globalstep(function(dtime)
local pl_name = player:get_player_name()
--only mess with stuff if they are in the wormball minigame
if arena_lib.is_player_in_arena(pl_name, "wormball") then
if arena_lib.is_player_in_arena(pl_name, "wormball") and not(arena_lib.is_player_spectating(pl_name)) then
local arena = arena_lib.get_arena_by_player(pl_name)

View File

@ -3,7 +3,9 @@ arena_lib.on_celebration('wormball', function(arena, winner_name)
--reset player textures back to the texture they were... (wormball sets player textures to clear)
for pl_name,stats in pairs(arena.players) do
wormball.detach(pl_name)
if not(arena_lib.is_player_spectating(pl_name)) then
wormball.detach(pl_name)
end
end

View File

@ -3,7 +3,7 @@
arena_lib.on_disconnect('wormball', function(arena, p_name)
local player = minetest.get_player_by_name(p_name)
if player then
if player and not(arena_lib.is_player_spectating(p_name)) then
player:set_properties({textures = wormball.player_texture_save[p_name]})
local att = player:get_attach()
player:set_detach()

View File

@ -12,7 +12,5 @@ arena_lib.on_eliminate('wormball', function(arena, p_name)
end
end
end)