summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Server/Plugins/APIDump/APIDesc.lua4
-rw-r--r--src/Bindings/ManualBindings.cpp32
-rw-r--r--src/Entities/Entity.h8
3 files changed, 36 insertions, 8 deletions
diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua
index 88ab8c5ba..8adda34a7 100644
--- a/Server/Plugins/APIDump/APIDesc.lua
+++ b/Server/Plugins/APIDump/APIDesc.lua
@@ -3138,12 +3138,12 @@ local Hash = cCryptoHash.sha1HexString("DataToHash")
Params =
{
{
- Name = "ShouldBroadcast",
+ Name = "ShouldBroadcast <b>(DEPRECATED)</b>",
Type = "boolean",
IsOptional = true,
},
},
- Notes = "Schedules the entity to be destroyed; if ShouldBroadcast is not present or set to true, broadcasts the DestroyEntity packet",
+ Notes = "Schedules the entity to be destroyed; broadcasts the DestroyEntity packet",
},
DoesPreventBlockPlacement =
{
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);
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index ecc94efc9..e51984225 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -289,14 +289,10 @@ public:
If this returns false, you must stop using the cEntity pointer you have. */
bool IsTicking(void) const;
+ // tolua_end
/** Destroys the entity, schedules it for memory freeing and broadcasts the DestroyEntity packet */
virtual void Destroy();
-
- OBSOLETE void Destroy(bool a_ShouldBroadcast)
- {
- LOGWARNING("cEntity:Destory(bool) is deprecated, use cEntity:Destroy() instead.");
- Destroy();
- }
+ // tolua_begin
/** Makes this pawn take damage from an attack by a_Attacker. Damage values are calculated automatically and DoTakeDamage() called */
void TakeDamage(cEntity & a_Attacker);