Added Build info to the cRoot API.
This commit is contained in:
parent
649921f4a8
commit
99b182b4be
|
@ -2036,7 +2036,7 @@ a_Player:OpenWindow(Window);
|
||||||
BroadcastChat =
|
BroadcastChat =
|
||||||
{
|
{
|
||||||
{ Params = "MessageText, MessageType", Return = "", Notes = "Broadcasts a message to all players, with its message type set to MessageType (default: mtCustom)." },
|
{ Params = "MessageText, MessageType", Return = "", Notes = "Broadcasts a message to all players, with its message type set to MessageType (default: mtCustom)." },
|
||||||
{ Params = "{{cCompositeChat|CompositeChat}}", Return = "", Notes = "Broadcasts a {{cCompositeChat|composite chat message} to all players." },
|
{ Params = "{{cCompositeChat|CompositeChat}}", Return = "", Notes = "Broadcasts a {{cCompositeChat|composite chat message}} to all players." },
|
||||||
},
|
},
|
||||||
BroadcastChatDeath = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtDeath. Use for when a player has died." },
|
BroadcastChatDeath = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtDeath. Use for when a player has died." },
|
||||||
BroadcastChatFailure = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtFailure. Use for a command that failed to run because of insufficient permissions, etc." },
|
BroadcastChatFailure = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtFailure. Use for a command that failed to run because of insufficient permissions, etc." },
|
||||||
|
@ -2046,12 +2046,16 @@ a_Player:OpenWindow(Window);
|
||||||
BroadcastChatLeave = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtLeave. Use for players leaving the server." },
|
BroadcastChatLeave = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtLeave. Use for players leaving the server." },
|
||||||
BroadcastChatSuccess = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtSuccess. Use for success messages." },
|
BroadcastChatSuccess = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtSuccess. Use for success messages." },
|
||||||
BroadcastChatWarning = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc." },
|
BroadcastChatWarning = { Params = "MessageText", Return = "", Notes = "Broadcasts the specified message to all players, with its message type set to mtWarning. Use for concerning events, such as plugin reload etc." },
|
||||||
CreateAndInitializeWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Creates a new world and initializes it. If there is a world whith the same name it returns nil.<br><br><b>NOTE</b>This function is currently unsafe, do not use!" },
|
CreateAndInitializeWorld = { Params = "WorldName", Return = "{{cWorld|cWorld}}", Notes = "Creates a new world and initializes it. If there is a world whith the same name it returns nil.<br><br><b>NOTE:</b> This function is currently unsafe, do not use!" },
|
||||||
FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "Calls the given callback function for the player with the name best matching the name string provided.<br>This function is case-insensitive and will match partial names.<br>Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre>" },
|
FindAndDoWithPlayer = { Params = "PlayerName, CallbackFunction", Return = "bool", Notes = "Calls the given callback function for the player with the name best matching the name string provided.<br>This function is case-insensitive and will match partial names.<br>Returns false if player not found or there is ambiguity, true otherwise. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre>" },
|
||||||
DoWithPlayerByUUID = { Params = "PlayerUUID, CallbackFunction", Return = "bool", Notes = "If there is the player with the uuid, calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre> The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." },
|
DoWithPlayerByUUID = { Params = "PlayerUUID, CallbackFunction", Return = "bool", Notes = "If there is the player with the uuid, calls the CallbackFunction with the {{cPlayer}} parameter representing the player. The CallbackFunction has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|Player}})</pre> The function returns false if the player was not found, or whatever bool value the callback returned if the player was found." },
|
||||||
ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|cPlayer}})</pre>" },
|
ForEachPlayer = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each player. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cPlayer|cPlayer}})</pre>" },
|
||||||
ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cWorld|cWorld}})</pre>" },
|
ForEachWorld = { Params = "CallbackFunction", Return = "", Notes = "Calls the given callback function for each world. The callback function has the following signature: <pre class=\"prettyprint lang-lua\">function Callback({{cWorld|cWorld}})</pre>" },
|
||||||
Get = { Params = "", Return = "Root object", Notes = "(STATIC)This function returns the cRoot object." },
|
Get = { Params = "", Return = "Root object", Notes = "(STATIC) This function returns the cRoot object." },
|
||||||
|
GetBuildCommitID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the exact commit hash used for the build. For unofficial local builds, returns the approximate commit hash (since the true one cannot be determined), formatted as \"approx: <CommitHash>\"." },
|
||||||
|
GetBuildDateTime = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travic CI / Jenkins) it returns the date and time of the build. For unofficial local builds, returns the approximate datetime of the commit (since the true one cannot be determined), formatted as \"approx: <DateTime-iso8601>\"." },
|
||||||
|
GetBuildID = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the unique ID of the build, as recognized by the build system. For unofficial local builds, returns the string \"Unknown\"." },
|
||||||
|
GetBuildSeriesName = { Params = "", Return = "string", Notes = "(STATIC) For official builds (Travis CI / Jenkins) it returns the series name of the build (for example \"MCServer Windows x64 Master\"). For unofficial local builds, returns the string \"local build\"." },
|
||||||
GetCraftingRecipes = { Params = "", Return = "{{cCraftingRecipe|cCraftingRecipe}}", Notes = "Returns the CraftingRecipes object" },
|
GetCraftingRecipes = { Params = "", Return = "{{cCraftingRecipe|cCraftingRecipe}}", Notes = "Returns the CraftingRecipes object" },
|
||||||
GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." },
|
GetDefaultWorld = { Params = "", Return = "{{cWorld|cWorld}}", Notes = "Returns the world object from the default world." },
|
||||||
GetFurnaceFuelBurnTime = { Params = "{{cItem|Fuel}}", Return = "number", Notes = "(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel." },
|
GetFurnaceFuelBurnTime = { Params = "{{cItem|Fuel}}", Return = "number", Notes = "(STATIC) Returns the number of ticks for how long the item would fuel a furnace. Returns zero if not a fuel." },
|
||||||
|
|
|
@ -156,7 +156,10 @@ end
|
||||||
--- Returns the timestamp in HTML format
|
--- Returns the timestamp in HTML format
|
||||||
-- The timestamp will be inserted to all generated HTML files
|
-- The timestamp will be inserted to all generated HTML files
|
||||||
local function GetHtmlTimestamp()
|
local function GetHtmlTimestamp()
|
||||||
return string.format("<div id='timestamp'>Generated on %s</div>", os.date("%Y-%m-%d %H:%M:%S"))
|
return string.format("<div id='timestamp'>Generated on %s, Build ID %s, Commit %s</div>",
|
||||||
|
os.date("%Y-%m-%d %H:%M:%S"),
|
||||||
|
cRoot:GetBuildID(), cRoot:GetBuildCommitID()
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "../CompositeChat.h"
|
#include "../CompositeChat.h"
|
||||||
#include "../StringCompression.h"
|
#include "../StringCompression.h"
|
||||||
#include "../CommandOutput.h"
|
#include "../CommandOutput.h"
|
||||||
|
#include "../BuildInfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2079,6 +2080,50 @@ static int tolua_cLineBlockTracer_Trace(lua_State * tolua_S)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cRoot_GetBuildCommitID(lua_State * tolua_S)
|
||||||
|
{
|
||||||
|
cLuaState L(tolua_S);
|
||||||
|
L.Push(BUILD_COMMIT_ID);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cRoot_GetBuildDateTime(lua_State * tolua_S)
|
||||||
|
{
|
||||||
|
cLuaState L(tolua_S);
|
||||||
|
L.Push(BUILD_DATETIME);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cRoot_GetBuildID(lua_State * tolua_S)
|
||||||
|
{
|
||||||
|
cLuaState L(tolua_S);
|
||||||
|
L.Push(BUILD_ID);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cRoot_GetBuildSeriesName(lua_State * tolua_S)
|
||||||
|
{
|
||||||
|
cLuaState L(tolua_S);
|
||||||
|
L.Push(BUILD_SERIES_NAME);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
|
static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
|
||||||
{
|
{
|
||||||
cLuaState L(tolua_S);
|
cLuaState L(tolua_S);
|
||||||
|
@ -2092,7 +2137,8 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the input param:
|
// Check the input param:
|
||||||
cItem * Input = (cItem *)tolua_tousertype(L, 2, nullptr);
|
cItem * Input = nullptr;
|
||||||
|
L.GetStackValue(2, Input);
|
||||||
if (Input == nullptr)
|
if (Input == nullptr)
|
||||||
{
|
{
|
||||||
LOGWARNING("cRoot:GetFurnaceRecipe: the Input parameter is nil or missing.");
|
LOGWARNING("cRoot:GetFurnaceRecipe: the Input parameter is nil or missing.");
|
||||||
|
@ -2109,9 +2155,9 @@ static int tolua_cRoot_GetFurnaceRecipe(lua_State * tolua_S)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push the output, number of ticks and input as the three return values:
|
// Push the output, number of ticks and input as the three return values:
|
||||||
tolua_pushusertype(L, Recipe->Out, "const cItem");
|
L.Push(Recipe->Out);
|
||||||
tolua_pushnumber (L, (lua_Number)(Recipe->CookTime));
|
L.Push(Recipe->CookTime);
|
||||||
tolua_pushusertype(L, Recipe->In, "const cItem");
|
L.Push(Recipe->In);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2868,6 +2914,10 @@ void cManualBindings::Bind(lua_State * tolua_S)
|
||||||
tolua_function(tolua_S, "DoWithPlayerByUUID", DoWith <cRoot, cPlayer, &cRoot::DoWithPlayerByUUID>);
|
tolua_function(tolua_S, "DoWithPlayerByUUID", DoWith <cRoot, cPlayer, &cRoot::DoWithPlayerByUUID>);
|
||||||
tolua_function(tolua_S, "ForEachPlayer", ForEach<cRoot, cPlayer, &cRoot::ForEachPlayer>);
|
tolua_function(tolua_S, "ForEachPlayer", ForEach<cRoot, cPlayer, &cRoot::ForEachPlayer>);
|
||||||
tolua_function(tolua_S, "ForEachWorld", ForEach<cRoot, cWorld, &cRoot::ForEachWorld>);
|
tolua_function(tolua_S, "ForEachWorld", ForEach<cRoot, cWorld, &cRoot::ForEachWorld>);
|
||||||
|
tolua_function(tolua_S, "GetBuildCommitID", tolua_cRoot_GetBuildCommitID);
|
||||||
|
tolua_function(tolua_S, "GetBuildDateTime", tolua_cRoot_GetBuildDateTime);
|
||||||
|
tolua_function(tolua_S, "GetBuildID", tolua_cRoot_GetBuildID);
|
||||||
|
tolua_function(tolua_S, "GetBuildSeriesName", tolua_cRoot_GetBuildSeriesName);
|
||||||
tolua_function(tolua_S, "GetFurnaceRecipe", tolua_cRoot_GetFurnaceRecipe);
|
tolua_function(tolua_S, "GetFurnaceRecipe", tolua_cRoot_GetFurnaceRecipe);
|
||||||
tolua_endmodule(tolua_S);
|
tolua_endmodule(tolua_S);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user