diff options
author | Alexander Harkness <me@bearbin.net> | 2020-03-31 13:39:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-31 13:39:23 +0200 |
commit | 9210501af5ab0b91e331e9b4d27ac7fd63888f48 (patch) | |
tree | 776120895f4335b28e3652d65f99dac5f98436e3 /src/Bindings | |
parent | Added a /boom command to Debuggers. (#4592) (diff) | |
download | cuberite-9210501af5ab0b91e331e9b4d27ac7fd63888f48.tar cuberite-9210501af5ab0b91e331e9b4d27ac7fd63888f48.tar.gz cuberite-9210501af5ab0b91e331e9b4d27ac7fd63888f48.tar.bz2 cuberite-9210501af5ab0b91e331e9b4d27ac7fd63888f48.tar.lz cuberite-9210501af5ab0b91e331e9b4d27ac7fd63888f48.tar.xz cuberite-9210501af5ab0b91e331e9b4d27ac7fd63888f48.tar.zst cuberite-9210501af5ab0b91e331e9b4d27ac7fd63888f48.zip |
Diffstat (limited to 'src/Bindings')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 1ab3cbaa0..bf53b8b7c 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -4081,6 +4081,37 @@ static int tolua_cCuboid_Move(lua_State * tolua_S) +static int tolua_cEntity_Destroy(lua_State * tolua_S) +{ + // Check the params: + cLuaState L(tolua_S); + if (!L.CheckParamSelf("cEntity")) + { + return 0; + } + + // Get the params: + cEntity * self = nullptr; + L.GetStackValue(1, self); + + if (lua_gettop(L) == 2) + { + LOGWARNING("cEntity:Destroy(bool) is deprecated, use cEntity:Destroy() instead."); + } + + if (self->IsPlayer()) + { + return L.ApiParamError("Cannot call cEntity:Destroy() on a cPlayer, use cClientHandle:Kick() instead."); + } + + self->Destroy(); + return 0; +} + + + + + static int tolua_cEntity_IsSubmerged(lua_State * tolua_S) { // Check the params: @@ -4256,6 +4287,7 @@ void cManualBindings::Bind(lua_State * tolua_S) tolua_beginmodule(tolua_S, "cEntity"); tolua_constant(tolua_S, "INVALID_ID", cEntity::INVALID_ID); + tolua_function(tolua_S, "Destroy", tolua_cEntity_Destroy); tolua_function(tolua_S, "IsSubmerged", tolua_cEntity_IsSubmerged); tolua_function(tolua_S, "IsSwimming", tolua_cEntity_IsSwimming); tolua_function(tolua_S, "GetPosition", tolua_cEntity_GetPosition); |