Deprecate get_spectate_entities and get_spectate_areas for the clearer get_spectatable* version
This commit is contained in:
parent
c3b33509a2
commit
4f7bc35cc6
4
DOCS.md
4
DOCS.md
@ -418,8 +418,8 @@ There are also some other functions which might turn useful. They are:
|
||||
* `arena_lib.get_target_spectators(mod, arena_name, type, t_name)`: returns a list containing all the spectators currently following `t_name`. Format `{sp_name = true}`. For players, consider using the next function instead
|
||||
* `arena_lib.get_player_spectators(p_name)`: Like `get_target_spectators(..)` but cleaner and just for players. It's cleaner since there can't be two players with the same name, contrary to areas and entities
|
||||
* `arena_lib.get_player_spectated(sp_name)`: returns the player `sp_name` is currently spectating, if any
|
||||
* `arena_lib.get_spectate_entities(mod, arena_name)`: returns a table containing all the spectatable entities of `arena_name`, if any. Format `{e_name = entity}`, where `e_name` is the name used to register the entity in `add_spectate_entity(..)` and `entity` the `luaentity` table
|
||||
* `arena_lib.get_spectate_areas(mod, arena_name)`: same as in `get_spectate_entities(..)` but for areas. Entities returned in the table are the dummy ObjectRef entities put at the area coordinates
|
||||
* `arena_lib.get_spectatable_entities(mod, arena_name)`: returns a table containing all the spectatable entities of `arena_name`, if any. Format `{e_name = entity}`, where `e_name` is the name used to register the entity in `add_spectate_entity(..)` and `entity` the `luaentity` table
|
||||
* `arena_lib.get_spectatable_areas(mod, arena_name)`: same as in `get_spectatable_entities(..)` but for areas. Entities returned in the table are the dummy ObjectRef entities put at the area coordinates
|
||||
* `arena_lib.get_player_in_edit_mode(arena_name)`: returns the name of the player who's editing `arena_name`, if any
|
||||
|
||||
### 1.10 Endless minigames
|
||||
|
@ -2051,4 +2051,20 @@ end
|
||||
function arena_lib.force_arena_ending(mod, arena, sender)
|
||||
minetest.log("warning", "[ARENA_LIB] force_arena_ending is deprecated. Please use force_end instead")
|
||||
arena_lib.force_end(sender, mod, arena)
|
||||
end
|
||||
|
||||
-- TODO
|
||||
--[[function arena_lib.get_player_spectated(sp_name)
|
||||
minetest.log("warning", "[ARENA_LIB] get_player_spectated is deprecated. Please use get_spectated_target instead")
|
||||
return arena_lib.get_spectated_target(sp_name)
|
||||
end]]
|
||||
|
||||
function arena_lib.get_spectate_entities(mod, arena_name)
|
||||
minetest.log("warning", "[ARENA_LIB] get_spectate_entities is deprecated. Please use get_spectatable_entities instead")
|
||||
return arena_lib.get_spectatable_entities(mod, arena_name)
|
||||
end
|
||||
|
||||
function arena_lib.get_spectate_areas(mod, arena_name)
|
||||
minetest.log("warning", "[ARENA_LIB] get_spectate_areas is deprecated. Please use get_spectatable_areas instead")
|
||||
return arena_lib.get_spectatable_areas(mod, arena_name)
|
||||
end
|
@ -169,7 +169,7 @@ function arena_lib.join_arena(mod, p_name, arena_ID, as_spectator)
|
||||
return end
|
||||
|
||||
-- se non c'è niente da seguire
|
||||
if arena.players_amount == 0 and not next(arena_lib.get_spectate_entities(mod, arena.name)) and not next(arena_lib.get_spectate_areas(mod, arena.name)) then
|
||||
if arena.players_amount == 0 and not next(arena_lib.get_spectatable_entities(mod, arena.name)) and not next(arena_lib.get_spectatable_areas(mod, arena.name)) then
|
||||
arena_lib.print_error(p_name, S("There is nothing to spectate!"))
|
||||
return end
|
||||
|
||||
|
@ -46,7 +46,7 @@ end
|
||||
|
||||
function arena_lib.unload_spectate_containers(mod, arena_name)
|
||||
-- rimuovo tutte le entità fantoccio delle aree
|
||||
for _, dummy_entity in pairs(arena_lib.get_spectate_areas(mod, arena_name)) do
|
||||
for _, dummy_entity in pairs(arena_lib.get_spectatable_areas(mod, arena_name)) do
|
||||
dummy_entity:remove()
|
||||
end
|
||||
|
||||
@ -581,13 +581,22 @@ end
|
||||
|
||||
|
||||
|
||||
function arena_lib.get_spectate_entities(mod, arena_name)
|
||||
-- TODO
|
||||
--[[function arena_lib.get_spectated_target(sp_name)
|
||||
if arena_lib.is_player_spectating(sp_name) then
|
||||
return players_in_spectate_mode[sp_name].spectating
|
||||
end
|
||||
end]]
|
||||
|
||||
|
||||
|
||||
function arena_lib.get_spectatable_entities(mod, arena_name)
|
||||
return entities_storage[mod][arena_name]
|
||||
end
|
||||
|
||||
|
||||
|
||||
function arena_lib.get_spectate_areas(mod, arena_name)
|
||||
function arena_lib.get_spectatable_areas(mod, arena_name)
|
||||
return areas_storage[mod][arena_name]
|
||||
end
|
||||
|
||||
|
@ -134,10 +134,10 @@ function arena_lib.print_arena_info(sender, mod, arena_name)
|
||||
local entities = ""
|
||||
local areas = ""
|
||||
if arena.in_game then
|
||||
for en_name, _ in pairs(arena_lib.get_spectate_entities(mod, arena_name)) do
|
||||
for en_name, _ in pairs(arena_lib.get_spectatable_entities(mod, arena_name)) do
|
||||
entities = entities .. en_name .. ", "
|
||||
end
|
||||
for ar_name, _ in pairs(arena_lib.get_spectate_areas(mod, arena_name)) do
|
||||
for ar_name, _ in pairs(arena_lib.get_spectatable_areas(mod, arena_name)) do
|
||||
areas = areas .. ar_name .. ", "
|
||||
end
|
||||
entities = entities:sub(1, -3)
|
||||
|
Loading…
x
Reference in New Issue
Block a user