Added parties callbacks: invites now work only when they should
parent
0c2ba46fd4
commit
3ffa1a7f04
2
DOCS.md
2
DOCS.md
|
@ -58,7 +58,7 @@ The function calling the editor is
|
|||
`arena_lib.enter_editor(sender, mod, arena_name)`
|
||||
|
||||
#### 1.2.2 CLI
|
||||
If you don't want to rely on the hotbar, or you want both the editor and the commands via chat, here's how the commands work. Note that there actually is another parameter at the end of each of these functions named `in_editor` but, since it's solely used by the editor itself in order run less checks, I chose to odmit it (it's in `set_spawner` too).
|
||||
If you don't want to rely on the hotbar, or you want both the editor and the commands via chat, here's how the commands work. Note that there actually is another parameter at the end of each of these functions named `in_editor` but, since it's solely used by the editor itself in order to run less checks, I chose to odmit it (it's in `set_spawner` too).
|
||||
|
||||
##### 1.2.2.1 Players management
|
||||
`arena_lib.change_players_amount(sender, mod, arena_name, min_players, max_players)` changes the amount of players in a specific arena. It also works by specifying only one field (such as `([...] myarena, 3)` or `([...] myarena, nil, 6)`). It returns true if it succeeded.
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
if not minetest.get_modpath("parties") then return end
|
||||
|
||||
local S = minetest.get_translator("arena_lib")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
parties.register_on_pre_party_invite(function(sender, p_name)
|
||||
|
||||
-- se il party leader è in coda
|
||||
if arena_lib.is_player_in_queue(sender) then
|
||||
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] You can't perform this action while in queue!")))
|
||||
return false end
|
||||
|
||||
-- se il party leader è in gioco
|
||||
if arena_lib.is_player_in_arena(sender) then
|
||||
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] You can't perform this action while in game!")))
|
||||
return false end
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
|
||||
|
||||
parties.register_on_pre_party_join(function(party_leader, p_name)
|
||||
|
||||
-- se il party leader è in coda
|
||||
if arena_lib.is_player_in_queue(party_leader) then
|
||||
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] The party leader must not be in queue to perform this action!")))
|
||||
return false end
|
||||
|
||||
-- se il party leader è in gioco
|
||||
if arena_lib.is_player_in_arena(party_leader) then
|
||||
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] The party leader must not be in game to perform this action!")))
|
||||
return false end
|
||||
|
||||
local arena = arena_lib.get_arena_by_player(p_name)
|
||||
|
||||
if not arena then return true end
|
||||
|
||||
-- se l'invitato è in coda
|
||||
if arena.in_queue then
|
||||
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] You can't perform this action while in queue!")))
|
||||
return false end
|
||||
|
||||
-- se l'invitato è l'unico rimasto in partita ed è in celebrazione
|
||||
if arena.players_amount == 1 and arena.in_celebration then
|
||||
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] You can't perform this action if you're the only one left!")))
|
||||
return false end
|
||||
|
||||
return true
|
||||
end)
|
||||
|
||||
|
||||
|
||||
parties.register_on_party_join(function(party_leader, p_name)
|
||||
|
||||
--se è in arena, lo rimuovo
|
||||
if arena_lib.is_player_in_arena(p_name) then
|
||||
arena_lib.remove_player_from_arena(p_name, 3)
|
||||
end
|
||||
|
||||
end)
|
9
init.lua
9
init.lua
|
@ -1,21 +1,22 @@
|
|||
local version = "3.3.0"
|
||||
local version = "3.4.0-dev"
|
||||
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/api.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/callbacks.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/chat.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/commands.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/debug_utilities.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_hud/hud_main.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_hud/hud_waypoints.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/items.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/player_manager.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/privs.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/signs.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/utils.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_dependencies/parties.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_editor/editor_main.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_editor/editor_icons.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_editor/tools_players.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_editor/tools_sign.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_editor/tools_spawner.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_hud/hud_main.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/_hud/hud_waypoints.lua")
|
||||
|
||||
minetest.log("action", "[ARENA_LIB] Mod initialised, version " .. version)
|
||||
minetest.log("action", "[ARENA_LIB] Mod initialised, running version " .. version)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# version 3.3.0
|
||||
# version 3.4.0-dev
|
||||
# author(s): Zughy
|
||||
# reviewer(s):
|
||||
# textdomain: arena_lib
|
||||
|
@ -125,8 +125,11 @@ Get ready!=Preparati!
|
|||
[!] You must disable the arena first!=[!] Devi prima disabilitare l'arena!
|
||||
[!] There must be no one inside the editor of the arena to perform this command! (now inside: @1)=[!] Non deve esserci nessuno nell'editor dell'arena per poter eseguire questo comando! (attualmente dentro: @1)
|
||||
|
||||
# _hud/hud_waypoints.lua
|
||||
[!] Waypoints are not enabled!=[!] I waypoint non sono abilitati!
|
||||
# _dependencies/parties.lua
|
||||
[!] You can't perform this action while in queue!=[!] Non puoi eseguire quest'azione mentre sei in coda!
|
||||
[!] You can't perform this action while in game!=[!] Non puoi eseguire quest'azione mentre sei in partita!
|
||||
[!] The party leader must not be in queue to perform this action!=[!] Il capo gruppo non deve essere in coda per eseguire quest'azione!
|
||||
[!] The party leader must not be in game to perform this action!=[!] Il capo gruppo non deve essere in partita per eseguire quest'azione!
|
||||
|
||||
# _editor/editor_main.lua
|
||||
Arena_lib editor | Now editing: @1=Arena_lib editor | Stai modificando: @1
|
||||
|
@ -163,3 +166,6 @@ Delete all spawners of a team=Cancella tutti gli spawner della squadra
|
|||
Add sign=Aggiungi cartello
|
||||
Remove sign=Rimuovi cartello
|
||||
|
||||
# _hud/hud_waypoints.lua
|
||||
[!] Waypoints are not enabled!=[!] I waypoint non sono abilitati!
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# version 3.3.0
|
||||
# version 3.4.0-dev
|
||||
# author(s):
|
||||
# reviewer(s):
|
||||
# textdomain: arena_lib
|
||||
|
@ -125,8 +125,11 @@ Get ready!=
|
|||
[!] You must disable the arena first!=
|
||||
[!] There must be no one inside the editor of the arena to perform this command! (now inside: @1)=
|
||||
|
||||
# _hud/hud_waypoints.lua
|
||||
[!] Waypoints are not enabled!=
|
||||
# _dependencies/parties.lua
|
||||
[!] You can't perform this action while in queue!=
|
||||
[!] You can't perform this action while in game!=
|
||||
[!] The party leader must not be in queue to perform this action!=
|
||||
[!] The party leader must not be in game to perform this action!=
|
||||
|
||||
# _editor/editor_main.lua
|
||||
Arena_lib editor | Now editing: @1=
|
||||
|
@ -163,3 +166,5 @@ Delete all spawners of the team=
|
|||
Add sign=
|
||||
Remove sign=
|
||||
|
||||
# _hud/hud_waypoints.lua
|
||||
[!] Waypoints are not enabled!=
|
||||
|
|
Loading…
Reference in New Issue