From 686e0c12e2fa1b8d8e0970306e57cbcfa247f5f5 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Tue, 26 Nov 2013 15:37:15 +0100 Subject: cWorld::SpawnExperienceOrb() now returns the entity ID of the spawned orb. Documented etExpOrb. --- source/Bindings.cpp | 7 ++++--- source/Bindings.h | 2 +- source/World.cpp | 3 ++- source/World.h | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'source') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 7bea672da..62a16b38b 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/25/13 21:47:32. +** Generated automatically by tolua++-1.0.92 on 11/26/13 15:29:19. */ #ifndef __cplusplus @@ -12616,10 +12616,11 @@ static int tolua_AllToLua_cWorld_SpawnExperienceOrb00(lua_State* tolua_S) if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnExperienceOrb'", NULL); #endif { - self->SpawnExperienceOrb(a_X,a_Y,a_Z,a_Reward); + int tolua_ret = (int) self->SpawnExperienceOrb(a_X,a_Y,a_Z,a_Reward); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); } } - return 0; + return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'SpawnExperienceOrb'.",&tolua_err); diff --git a/source/Bindings.h b/source/Bindings.h index 8d20bd0dc..240ceec30 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/25/13 21:47:33. +** Generated automatically by tolua++-1.0.92 on 11/26/13 15:29:20. */ /* Exported function */ diff --git a/source/World.cpp b/source/World.cpp index 432ab32e9..de64b1c20 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -1562,10 +1562,11 @@ void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double -void cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) +int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) { cExpOrb * ExpOrb = new cExpOrb(a_X, a_Y, a_Z, a_Reward); ExpOrb->Initialize(this); + return ExpOrb->GetUniqueID(); } diff --git a/source/World.h b/source/World.h index 9397f8b75..284e96bbb 100644 --- a/source/World.h +++ b/source/World.h @@ -353,8 +353,8 @@ public: /// Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified: void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false); - /// Spawns an experience orb at the given location with the given reward. - void SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward); + /// Spawns an experience orb at the given location with the given reward. It returns the UniqueID of the spawned experience orb. + int SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward); /// Spawns a new primed TNT entity at the specified block coords and specified fuse duration. Initial velocity is given based on the relative coefficient provided void SpawnPrimedTNT(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec, double a_InitialVelocityCoeff = 1); -- cgit v1.2.3