diff options
-rw-r--r-- | GNUmakefile | 2 | ||||
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 11 | ||||
-rw-r--r-- | src/Bindings/AllToLua.pkg | 1 | ||||
-rw-r--r-- | src/Bindings/Bindings.cpp | 83 | ||||
-rw-r--r-- | src/Bindings/Bindings.h | 2 | ||||
-rw-r--r-- | src/Blocks/BlockFire.h | 13 | ||||
-rw-r--r-- | src/Entities/ExpOrb.cpp | 2 | ||||
-rw-r--r-- | src/Entities/TNTEntity.h | 8 | ||||
-rw-r--r-- | src/Mobs/Monster.cpp | 6 | ||||
-rw-r--r-- | src/OSSupport/IsThread.cpp | 2 |
10 files changed, 111 insertions, 19 deletions
diff --git a/GNUmakefile b/GNUmakefile index c8cdd35e1..d729268e7 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -88,7 +88,7 @@ CXX_OPTIONS += -Wall ################################################### # Fix Crypto++ warnings in clang -ifeq ($(shell $(CXX) --version 2>&1 | grep -i -c "clang version"),1) +ifeq ($(shell $(CXX) --version 2>&1 | grep -i -c "clang"),1) CC_OPTIONS += -DCRYPTOPP_DISABLE_ASM CXX_OPTIONS += -DCRYPTOPP_DISABLE_ASM endif diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 75d5c011f..b7dddec05 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1862,6 +1862,17 @@ end }, }, -- cServer + cTNTEntity = + { + Desc = "This class manages a TNT entity.", + Functions = + { + GetCounterTime = { Return = "number", Notes = "Returns the time until the entity explodes." }, + GetMaxFuseTime = { Return = "number", Notes = "Returns how long the fuse was." }, + }, + Inherits = "cEntity", + }, + cTracer = { Desc = [[ diff --git a/src/Bindings/AllToLua.pkg b/src/Bindings/AllToLua.pkg index 2a70efedf..6db7b2b0e 100644 --- a/src/Bindings/AllToLua.pkg +++ b/src/Bindings/AllToLua.pkg @@ -36,6 +36,7 @@ $cfile "../Entities/Pawn.h" $cfile "../Entities/Player.h" $cfile "../Entities/Pickup.h" $cfile "../Entities/ProjectileEntity.h" +$cfile "../Entities/TNTEntity.h" $cfile "../Server.h" $cfile "../World.h" $cfile "../Inventory.h" diff --git a/src/Bindings/Bindings.cpp b/src/Bindings/Bindings.cpp index aff8fb67a..090d8047a 100644 --- a/src/Bindings/Bindings.cpp +++ b/src/Bindings/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/11/13 12:34:21. +** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:45. */ #ifndef __cplusplus @@ -34,6 +34,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); #include "../Entities/Player.h" #include "../Entities/Pickup.h" #include "../Entities/ProjectileEntity.h" +#include "../Entities/TNTEntity.h" #include "../Server.h" #include "../World.h" #include "../Inventory.h" @@ -218,7 +219,7 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cItemGrid"); tolua_usertype(tolua_S,"cHTTPServer::cCallbacks"); tolua_usertype(tolua_S,"cLuaWindow"); - tolua_usertype(tolua_S,"cServer"); + tolua_usertype(tolua_S,"cInventory"); tolua_usertype(tolua_S,"cHopperEntity"); tolua_usertype(tolua_S,"std::vector<AString>"); tolua_usertype(tolua_S,"cBlockEntityWithItems"); @@ -226,15 +227,16 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cCraftingGrid"); tolua_usertype(tolua_S,"cBlockArea"); tolua_usertype(tolua_S,"cGroup"); - tolua_usertype(tolua_S,"cItem"); tolua_usertype(tolua_S,"cTracer"); + tolua_usertype(tolua_S,"cItem"); + tolua_usertype(tolua_S,"cBoundingBox"); tolua_usertype(tolua_S,"cArrowEntity"); tolua_usertype(tolua_S,"cDropSpenserEntity"); - tolua_usertype(tolua_S,"cBoundingBox"); tolua_usertype(tolua_S,"cCuboid"); tolua_usertype(tolua_S,"Vector3i"); - tolua_usertype(tolua_S,"cNoteEntity"); tolua_usertype(tolua_S,"Vector3d"); + tolua_usertype(tolua_S,"cNoteEntity"); + tolua_usertype(tolua_S,"cServer"); tolua_usertype(tolua_S,"cBlockEntity"); tolua_usertype(tolua_S,"cCriticalSection"); tolua_usertype(tolua_S,"HTTPTemplateRequest"); @@ -254,8 +256,8 @@ static void tolua_reg_types (lua_State* tolua_S) tolua_usertype(tolua_S,"cDropperEntity"); tolua_usertype(tolua_S,"cProjectileEntity"); tolua_usertype(tolua_S,"cItemGrid::cListener"); - tolua_usertype(tolua_S,"cInventory"); tolua_usertype(tolua_S,"cPlayer"); + tolua_usertype(tolua_S,"cTNTEntity"); } /* method: new of class cIniFile */ @@ -11518,6 +11520,70 @@ static int tolua_AllToLua_cArrowEntity_SetIsCritical00(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE +/* method: GetCounterTime of class cTNTEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTNTEntity_GetCounterTime00 +static int tolua_AllToLua_cTNTEntity_GetCounterTime00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cTNTEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cTNTEntity* self = (const cTNTEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCounterTime'", NULL); +#endif + { + double tolua_ret = (double) self->GetCounterTime(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetCounterTime'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxFuseTime of class cTNTEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTNTEntity_GetMaxFuseTime00 +static int tolua_AllToLua_cTNTEntity_GetMaxFuseTime00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cTNTEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cTNTEntity* self = (const cTNTEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxFuseTime'", NULL); +#endif + { + double tolua_ret = (double) self->GetMaxFuseTime(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxFuseTime'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + /* method: GetDescription of class cServer */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetDescription00 static int tolua_AllToLua_cServer_GetDescription00(lua_State* tolua_S) @@ -30993,6 +31059,11 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_cclass(tolua_S,"cFireChargeEntity","cFireChargeEntity","cProjectileEntity",NULL); tolua_beginmodule(tolua_S,"cFireChargeEntity"); tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cTNTEntity","cTNTEntity","cEntity",NULL); + tolua_beginmodule(tolua_S,"cTNTEntity"); + tolua_function(tolua_S,"GetCounterTime",tolua_AllToLua_cTNTEntity_GetCounterTime00); + tolua_function(tolua_S,"GetMaxFuseTime",tolua_AllToLua_cTNTEntity_GetMaxFuseTime00); + tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"cServer","cServer","",NULL); tolua_beginmodule(tolua_S,"cServer"); tolua_function(tolua_S,"GetDescription",tolua_AllToLua_cServer_GetDescription00); diff --git a/src/Bindings/Bindings.h b/src/Bindings/Bindings.h index c07c0588b..73cf3c7d8 100644 --- a/src/Bindings/Bindings.h +++ b/src/Bindings/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 12/11/13 12:34:22. +** Generated automatically by tolua++-1.0.92 on 12/14/13 16:22:46. */ /* Exported function */ diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index 46b56d7e0..a69fe2131 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -67,9 +67,8 @@ public: return 0; } - int newY = Y + 1; - - for (newY; newY < cChunkDef::Height; newY++) + + for (int newY = Y + 1; newY < cChunkDef::Height; newY++) { BLOCKTYPE Block = a_World->GetBlock(X, newY, Z); if ((Block == E_BLOCK_AIR) || (Block == E_BLOCK_FIRE)) @@ -155,7 +154,7 @@ public: { Dir = 1; // Set assumed direction (will change if portal turns out to be facing the other direction) bool FoundFrameXP = false, FoundFrameXM = false; - for (X1; ((a_World->GetBlock(X1, Y, Z) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X1, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X1++) // Check XP for obsidian blocks, exempting corners + for (; ((a_World->GetBlock(X1, Y, Z) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X1, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X1++) // Check XP for obsidian blocks, exempting corners { int Value = FindObsidianCeiling(X1, Y, Z, a_World, MaxY); int ValueTwo = FindObsidianCeiling(X1, Y + 1, Z, a_World, MaxY); // For corners without obsidian @@ -169,7 +168,7 @@ public: return false; // Not valid slice, no portal can be formed } } XZP = X1 - 1; // Set boundary of frame interior, note that for some reason, the loop of X and the loop of Z go to different numbers, hence -1 here and -2 there - for (X2; ((a_World->GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM) + for (; ((a_World->GetBlock(X2, Y, Z) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X2, Y + 1, Z) == E_BLOCK_OBSIDIAN)); X2--) // Go the other direction (XM) { int Value = FindObsidianCeiling(X2, Y, Z, a_World, MaxY); int ValueTwo = FindObsidianCeiling(X2, Y + 1, Z, a_World, MaxY); @@ -191,7 +190,7 @@ public: { Dir = 2; bool FoundFrameZP = false, FoundFrameZM = false; - for (Z1; ((a_World->GetBlock(X, Y, Z1) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X, Y + 1, Z1) == E_BLOCK_OBSIDIAN)); Z1++) + for (; ((a_World->GetBlock(X, Y, Z1) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X, Y + 1, Z1) == E_BLOCK_OBSIDIAN)); Z1++) { int Value = FindObsidianCeiling(X, Y, Z1, a_World, MaxY); int ValueTwo = FindObsidianCeiling(X, Y + 1, Z1, a_World, MaxY); @@ -205,7 +204,7 @@ public: return false; } } XZP = Z1 - 2; - for (Z2; ((a_World->GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X, Y + 1, Z2) == E_BLOCK_OBSIDIAN)); Z2--) + for (; ((a_World->GetBlock(X, Y, Z2) == E_BLOCK_OBSIDIAN) || (a_World->GetBlock(X, Y + 1, Z2) == E_BLOCK_OBSIDIAN)); Z2--) { int Value = FindObsidianCeiling(X, Y, Z2, a_World, MaxY); int ValueTwo = FindObsidianCeiling(X, Y + 1, Z2, a_World, MaxY); diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 27d34f6ed..248fb7278 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -49,8 +49,8 @@ void cExpOrb::Tick(float a_Dt, cChunk & a_Chunk) double Distance(a_Distance.Length()); if (Distance < 0.1f) { + LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward); a_ClosestPlayer->DeltaExperience(m_Reward); - a_ClosestPlayer->SendExperience(); Destroy(true); } a_Distance.Normalize(); diff --git a/src/Entities/TNTEntity.h b/src/Entities/TNTEntity.h index eb5040e8a..d1fcae766 100644 --- a/src/Entities/TNTEntity.h +++ b/src/Entities/TNTEntity.h @@ -6,13 +6,14 @@ - +// tolua_begin class cTNTEntity : public cEntity { typedef cEntity super; public: + // tolua_end CLASS_PROTODEF(cTNTEntity); cTNTEntity(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec); @@ -21,11 +22,14 @@ public: // cEntity overrides: virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void Tick(float a_Dt, cChunk & a_Chunk) override; + + double GetCounterTime(void) const { return m_Counter; } // tolua_export + double GetMaxFuseTime(void) const { return m_MaxFuseTime; } // tolua_export protected: double m_Counter; ///< How much time has elapsed since the object was created, in seconds double m_MaxFuseTime; ///< How long the fuse is, in seconds -}; +}; // tolua_export diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 091623c8a..0e2da942d 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -274,6 +274,7 @@ void cMonster::KilledBy(cEntity * a_Killer) case cMonster::mtWolf: { Reward = m_World->GetTickRandomNumber(2) + 1; + break; } // Monsters @@ -291,25 +292,30 @@ void cMonster::KilledBy(cEntity * a_Killer) case cMonster::mtMagmaCube: { Reward = 6 + (m_World->GetTickRandomNumber(2)); + break; } case cMonster::mtBlaze: { Reward = 10; + break; } // Bosses case cMonster::mtEnderDragon: { Reward = 12000; + break; } case cMonster::mtWither: { Reward = 50; + break; } default: { Reward = 0; + break; } } m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), Reward); diff --git a/src/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp index 4da9f9949..7eb114a82 100644 --- a/src/OSSupport/IsThread.cpp +++ b/src/OSSupport/IsThread.cpp @@ -124,7 +124,7 @@ void cIsThread::Stop(void) bool cIsThread::Wait(void) { - if (m_Handle == NULL) + if (m_Handle == NULL_HANDLE) { return true; } |