parent
bac71cb513
commit
b4d9732fe9
@ -2196,6 +2196,7 @@ end
|
|||||||
GetObjective = { Params = "string", Return = "{{cObjective}}", Notes = "Returns the objective with the specified name." },
|
GetObjective = { Params = "string", Return = "{{cObjective}}", Notes = "Returns the objective with the specified name." },
|
||||||
GetObjectiveIn = { Params = "DisplaySlot", Return = "{{cObjective}}", Notes = "Returns the objective in the specified display slot. Can be nil." },
|
GetObjectiveIn = { Params = "DisplaySlot", Return = "{{cObjective}}", Notes = "Returns the objective in the specified display slot. Can be nil." },
|
||||||
GetTeam = { Params = "string", Return = "{{cTeam}}", Notes = "Returns the team with the specified name." },
|
GetTeam = { Params = "string", Return = "{{cTeam}}", Notes = "Returns the team with the specified name." },
|
||||||
|
GetTeamNames = { Params = "", Return = "array table of strings", Notes = "Returns the names of all teams" },
|
||||||
RegisterObjective = { Params = "Name, DisplayName, Type", Return = "{{cObjective}}", Notes = "Registers a new scoreboard objective. Returns the {{cObjective}} instance, nil on error." },
|
RegisterObjective = { Params = "Name, DisplayName, Type", Return = "{{cObjective}}", Notes = "Registers a new scoreboard objective. Returns the {{cObjective}} instance, nil on error." },
|
||||||
RegisterTeam = { Params = "Name, DisplayName, Prefix, Suffix", Return = "{{cTeam}}", Notes = "Registers a new team. Returns the {{cTeam}} instance, nil on error." },
|
RegisterTeam = { Params = "Name, DisplayName, Prefix, Suffix", Return = "{{cTeam}}", Notes = "Registers a new team. Returns the {{cTeam}} instance, nil on error." },
|
||||||
RemoveObjective = { Params = "string", Return = "bool", Notes = "Removes the objective with the specified name. Returns true if operation was successful." },
|
RemoveObjective = { Params = "string", Return = "bool", Notes = "Removes the objective with the specified name. Returns true if operation was successful." },
|
||||||
|
@ -2184,3 +2184,16 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function HandleTeamsCmd(a_Split, a_Player)
|
||||||
|
local Scoreboard = a_Player:GetWorld():GetScoreBoard()
|
||||||
|
|
||||||
|
a_Player:SendMessage("Teams: " .. table.concat(Scoreboard:GetTeamNames(), ", "))
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,6 +208,12 @@ g_PluginInfo =
|
|||||||
Handler = HandleBlkCmd,
|
Handler = HandleBlkCmd,
|
||||||
HelpString = "Gets info about the block you are looking at"
|
HelpString = "Gets info about the block you are looking at"
|
||||||
},
|
},
|
||||||
|
["/teams"] =
|
||||||
|
{
|
||||||
|
Permission = "debuggers",
|
||||||
|
Handler = HandleTeamsCmd,
|
||||||
|
HelpString = "List the teams"
|
||||||
|
},
|
||||||
}, -- Commands
|
}, -- Commands
|
||||||
|
|
||||||
ConsoleCommands =
|
ConsoleCommands =
|
||||||
|
@ -2756,6 +2756,30 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cScoreboard_GetTeamNames(lua_State * L)
|
||||||
|
{
|
||||||
|
cLuaState S(L);
|
||||||
|
if (
|
||||||
|
!S.CheckParamUserType(1, "cScoreboard") ||
|
||||||
|
!S.CheckParamEnd(2)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the groups:
|
||||||
|
cScoreboard * Scoreboard = reinterpret_cast<cScoreboard *>(tolua_tousertype(L, 1, nullptr));
|
||||||
|
AStringVector Teams = Scoreboard->GetTeamNames();
|
||||||
|
|
||||||
|
// Push the results:
|
||||||
|
S.Push(Teams);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S)
|
static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S)
|
||||||
{
|
{
|
||||||
// function cHopperEntity::GetOutputBlockPos()
|
// function cHopperEntity::GetOutputBlockPos()
|
||||||
@ -3532,6 +3556,7 @@ void cManualBindings::Bind(lua_State * tolua_S)
|
|||||||
tolua_beginmodule(tolua_S, "cScoreboard");
|
tolua_beginmodule(tolua_S, "cScoreboard");
|
||||||
tolua_function(tolua_S, "ForEachObjective", ForEach<cScoreboard, cObjective, &cScoreboard::ForEachObjective>);
|
tolua_function(tolua_S, "ForEachObjective", ForEach<cScoreboard, cObjective, &cScoreboard::ForEachObjective>);
|
||||||
tolua_function(tolua_S, "ForEachTeam", ForEach<cScoreboard, cTeam, &cScoreboard::ForEachTeam>);
|
tolua_function(tolua_S, "ForEachTeam", ForEach<cScoreboard, cTeam, &cScoreboard::ForEachTeam>);
|
||||||
|
tolua_function(tolua_S, "GetTeamNames", tolua_cScoreboard_GetTeamNames);
|
||||||
tolua_endmodule(tolua_S);
|
tolua_endmodule(tolua_S);
|
||||||
|
|
||||||
tolua_beginmodule(tolua_S, "cStringCompression");
|
tolua_beginmodule(tolua_S, "cStringCompression");
|
||||||
|
@ -416,6 +416,22 @@ cTeam * cScoreboard::GetTeam(const AString & a_Name)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
AStringVector cScoreboard::GetTeamNames()
|
||||||
|
{
|
||||||
|
AStringVector TeamNames;
|
||||||
|
|
||||||
|
for (const auto & Team: m_Teams)
|
||||||
|
{
|
||||||
|
TeamNames.push_back(Team.first);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TeamNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cTeam * cScoreboard::QueryPlayerTeam(const AString & a_Name)
|
cTeam * cScoreboard::QueryPlayerTeam(const AString & a_Name)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSTeams);
|
cCSLock Lock(m_CSTeams);
|
||||||
|
@ -256,6 +256,9 @@ public:
|
|||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
|
|
||||||
|
/** Retrieves the list of team names */
|
||||||
|
AStringVector GetTeamNames();
|
||||||
|
|
||||||
/** Send this scoreboard to the specified client */
|
/** Send this scoreboard to the specified client */
|
||||||
void SendTo(cClientHandle & a_Client);
|
void SendTo(cClientHandle & a_Client);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user