diff options
author | x12xx12x <44411062+12xx12@users.noreply.github.com> | 2022-05-07 01:26:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-07 01:26:13 +0200 |
commit | 63b63c5d844e8702fce2ae0181ee4397b8954d92 (patch) | |
tree | 53bcb25743271beb6b5e51b2346847ed50c6f925 /src/Bindings/ManualBindings.cpp | |
parent | Implement ranged attack for snow golems. Fix failed assertion (#5417) (diff) | |
download | cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.gz cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.bz2 cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.lz cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.xz cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.tar.zst cuberite-63b63c5d844e8702fce2ae0181ee4397b8954d92.zip |
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 2d92c1d3b..f5517dc84 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -3889,6 +3889,44 @@ static int tolua_cCompositeChat_new_local(lua_State * a_LuaState) +static int tolua_cCompositeChat_AddShowAchievementPart(lua_State * tolua_S) +{ + // function cCompositeChat:AddShowAchievementPart(PlayerName, Achievement, [Style]) + // Exported manually to support call-chaining (return *this) + + // Check params: + cLuaState L(tolua_S); + if ( + !L.CheckParamUserType(1, "cCompositeChat") || + !L.CheckParamString(2, 3) + ) + { + return 0; + } + + cCompositeChat * self = static_cast<cCompositeChat *>(tolua_tousertype(tolua_S, 1, nullptr)); + if (self == nullptr) + { + tolua_error(tolua_S, "invalid 'self' in function call cCompositeChat::AddShowAchievementPart(string, string, string) const.", nullptr); + return 0; + } + + // Add the part: + AString PlayerName, Achievement, Style; + L.GetStackValues(2, PlayerName); + L.GetStackValues(3, Achievement); + L.GetStackValues(4, Style); + self->AddShowAchievementPart(PlayerName, Achievement, Style); + + // Cut away everything from the stack except for the cCompositeChat instance; return that: + lua_settop(tolua_S, 1); + return 1; +} + + + + + static int tolua_cCompositeChat_AddRunCommandPart(lua_State * tolua_S) { // function cCompositeChat:AddRunCommandPart(Message, Command, [Style]) @@ -4529,17 +4567,18 @@ void cManualBindings::Bind(lua_State * tolua_S) tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cCompositeChat"); - tolua_function(tolua_S, "new", tolua_cCompositeChat_new); - tolua_function(tolua_S, "new_local", tolua_cCompositeChat_new_local); - tolua_function(tolua_S, ".call", tolua_cCompositeChat_new_local); - tolua_function(tolua_S, "AddRunCommandPart", tolua_cCompositeChat_AddRunCommandPart); - tolua_function(tolua_S, "AddSuggestCommandPart", tolua_cCompositeChat_AddSuggestCommandPart); - tolua_function(tolua_S, "AddTextPart", tolua_cCompositeChat_AddTextPart); - tolua_function(tolua_S, "AddUrlPart", tolua_cCompositeChat_AddUrlPart); - tolua_function(tolua_S, "Clear", tolua_cCompositeChat_Clear); - tolua_function(tolua_S, "ParseText", tolua_cCompositeChat_ParseText); - tolua_function(tolua_S, "SetMessageType", tolua_cCompositeChat_SetMessageType); - tolua_function(tolua_S, "UnderlineUrls", tolua_cCompositeChat_UnderlineUrls); + tolua_function(tolua_S, "new", tolua_cCompositeChat_new); + tolua_function(tolua_S, "new_local", tolua_cCompositeChat_new_local); + tolua_function(tolua_S, ".call", tolua_cCompositeChat_new_local); + tolua_function(tolua_S, "AddShowAchievementPart", tolua_cCompositeChat_AddShowAchievementPart); + tolua_function(tolua_S, "AddRunCommandPart", tolua_cCompositeChat_AddRunCommandPart); + tolua_function(tolua_S, "AddSuggestCommandPart", tolua_cCompositeChat_AddSuggestCommandPart); + tolua_function(tolua_S, "AddTextPart", tolua_cCompositeChat_AddTextPart); + tolua_function(tolua_S, "AddUrlPart", tolua_cCompositeChat_AddUrlPart); + tolua_function(tolua_S, "Clear", tolua_cCompositeChat_Clear); + tolua_function(tolua_S, "ParseText", tolua_cCompositeChat_ParseText); + tolua_function(tolua_S, "SetMessageType", tolua_cCompositeChat_SetMessageType); + tolua_function(tolua_S, "UnderlineUrls", tolua_cCompositeChat_UnderlineUrls); tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cCryptoHash"); |