diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 9f558f58c..6545c1f9f 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -769,6 +769,7 @@ end { etBoat = { Notes = "The entity is a {{cBoat}}" }, etEntity = { Notes = "No further specialization available" }, + etExpOrb = { Notes = "The entity is a {{cExpOrb}}" }, etFallingBlock = { Notes = "The entity is a {{cFallingBlock}}" }, etMob = { Notes = "The entity is a {{cMonster}} descendant" }, etMonster = { Notes = "The entity is a {{cMonster}} descendant" }, @@ -2075,7 +2076,7 @@ end { Params = "{{cItems|Pickups}}, X, Y, Z, SpeedX, SpeedY, SpeedZ", Return = "", Notes = "Spawns the specified pickups at the position specified. All the pickups fly away from the spawn position using the specified speed." }, }, SpawnMob = { Params = "X, Y, Z, {{cMonster|MonsterType}}", Return = "EntityID", Notes = "Spawns the specified type of mob at the specified coords. Returns the EntityID of the creates entity, or -1 on failure. " }, - SpawnExperienceOrb = { Params = "X, Y, Z, Reward", Return = "", Notes = "Spawns an {{cExpOrb|experience orb at the specified coords, with the given reward" }, + SpawnExperienceOrb = { Params = "X, Y, Z, Reward", Return = "EntityID", Notes = "Spawns an {{cExpOrb|experience orb}} at the specified coords, with the given reward" }, SpawnPrimedTNT = { Params = "X, Y, Z, FuseTimeSecs, InitialVelocityCoeff", Return = "", Notes = "Spawns a {{cTNTEntity|primed TNT entity}} at the specified coords, with the given fuse time. The entity gets a random speed multiplied by the InitialVelocityCoeff, 1 being the default value." }, TryGetHeight = { Params = "BlockX, BlockZ", Return = "IsValid, Height", Notes = "Returns true and height of the highest non-air block if the chunk is loaded, or false otherwise." }, UnloadUnusedChunks = { Params = "", Return = "", Notes = "Unloads chunks that are no longer needed, and are saved. NOTE: This API is deprecated and will be removed soon." }, 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);