summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp319
-rw-r--r--source/Bindings.h2
-rw-r--r--source/Entity.cpp11
-rw-r--r--source/Entity.h4
-rw-r--r--source/FallingBlock.cpp2
-rw-r--r--source/FallingBlock.h2
-rw-r--r--source/Mobs/AggressiveMonster.cpp19
-rw-r--r--source/Mobs/AggressiveMonster.h6
-rw-r--r--source/Mobs/Cavespider.cpp4
-rw-r--r--source/Mobs/Cavespider.h2
-rw-r--r--source/Mobs/Enderman.cpp4
-rw-r--r--source/Mobs/Enderman.h2
-rw-r--r--source/Mobs/Monster.cpp96
-rw-r--r--source/Mobs/Monster.h16
-rw-r--r--source/Mobs/PassiveMonster.cpp9
-rw-r--r--source/Mobs/PassiveMonster.h2
-rw-r--r--source/Mobs/Skeleton.cpp4
-rw-r--r--source/Mobs/Skeleton.h2
-rw-r--r--source/Mobs/Squid.cpp4
-rw-r--r--source/Mobs/Squid.h2
-rw-r--r--source/Mobs/Zombie.cpp4
-rw-r--r--source/Mobs/Zombie.h2
-rw-r--r--source/Mobs/Zombiepigman.cpp4
-rw-r--r--source/Mobs/Zombiepigman.h2
-rw-r--r--source/Pawn.cpp2
-rw-r--r--source/Pawn.h4
-rw-r--r--source/Pickup.cpp22
-rw-r--r--source/Pickup.h6
-rw-r--r--source/Player.cpp7
-rw-r--r--source/Player.h2
-rw-r--r--source/World.cpp3
31 files changed, 404 insertions, 166 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index d21173aed..cff8943cf 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 12/21/12 21:44:41.
+** Generated automatically by tolua++-1.0.92 on 12/22/12 19:15:15.
*/
#ifndef __cplusplus
@@ -164,29 +164,30 @@ static void tolua_reg_types (lua_State* tolua_S)
{
tolua_usertype(tolua_S,"TakeDamageInfo");
tolua_usertype(tolua_S,"cCraftingRecipe");
- tolua_usertype(tolua_S,"cPlugin_NewLua");
+ tolua_usertype(tolua_S,"cPlugin");
tolua_usertype(tolua_S,"cStringMap");
tolua_usertype(tolua_S,"cBlockArea");
tolua_usertype(tolua_S,"cLuaItems");
+ tolua_usertype(tolua_S,"cCraftingGrid");
tolua_usertype(tolua_S,"cServer");
tolua_usertype(tolua_S,"cRoot");
- tolua_usertype(tolua_S,"cCraftingGrid");
- tolua_usertype(tolua_S,"cStairs");
+ tolua_usertype(tolua_S,"cTCPLink");
tolua_usertype(tolua_S,"cGroup");
+ tolua_usertype(tolua_S,"cTracer");
tolua_usertype(tolua_S,"cPlugin::CommandStruct");
tolua_usertype(tolua_S,"cPickup");
tolua_usertype(tolua_S,"cItems");
- tolua_usertype(tolua_S,"cTracer");
- tolua_usertype(tolua_S,"cClientHandle");
tolua_usertype(tolua_S,"cMCLogger");
- tolua_usertype(tolua_S,"cFurnaceRecipe");
+ tolua_usertype(tolua_S,"cClientHandle");
tolua_usertype(tolua_S,"cCuboid");
- tolua_usertype(tolua_S,"cChatColor");
+ tolua_usertype(tolua_S,"cFurnaceRecipe");
tolua_usertype(tolua_S,"Vector3i");
+ tolua_usertype(tolua_S,"cChatColor");
+ tolua_usertype(tolua_S,"cStairs");
tolua_usertype(tolua_S,"cLuaChunk");
tolua_usertype(tolua_S,"Lua__cWebPlugin");
tolua_usertype(tolua_S,"Lua__cPawn");
- tolua_usertype(tolua_S,"cTCPLink");
+ tolua_usertype(tolua_S,"Lua__cPickup");
tolua_usertype(tolua_S,"cItem");
tolua_usertype(tolua_S,"Vector3f");
tolua_usertype(tolua_S,"Lua__cTCPLink");
@@ -195,24 +196,24 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"cGroupManager");
tolua_usertype(tolua_S,"cChestEntity");
tolua_usertype(tolua_S,"cWebAdmin");
- tolua_usertype(tolua_S,"Lua__cPickup");
- tolua_usertype(tolua_S,"cBlockEntity");
tolua_usertype(tolua_S,"cWebPlugin");
- tolua_usertype(tolua_S,"cEntity");
+ tolua_usertype(tolua_S,"cBlockEntity");
+ tolua_usertype(tolua_S,"cInventory");
+ tolua_usertype(tolua_S,"HTTPFormData");
tolua_usertype(tolua_S,"Lua__cPlugin");
tolua_usertype(tolua_S,"cPluginManager");
- tolua_usertype(tolua_S,"HTTPFormData");
+ tolua_usertype(tolua_S,"cPlugin_NewLua");
tolua_usertype(tolua_S,"cLadder");
- tolua_usertype(tolua_S,"cWorld");
tolua_usertype(tolua_S,"Lua__cPlayer");
+ tolua_usertype(tolua_S,"MTRand");
tolua_usertype(tolua_S,"cIniFile");
- tolua_usertype(tolua_S,"cPlugin");
+ tolua_usertype(tolua_S,"cEntity");
tolua_usertype(tolua_S,"HTTPRequest");
tolua_usertype(tolua_S,"cVine");
tolua_usertype(tolua_S,"cPlayer");
tolua_usertype(tolua_S,"cTorch");
tolua_usertype(tolua_S,"cBlockEntityWindowOwner");
- tolua_usertype(tolua_S,"cInventory");
+ tolua_usertype(tolua_S,"cWorld");
tolua_usertype(tolua_S,"Lua__cChestEntity");
tolua_usertype(tolua_S,"cPawn");
tolua_usertype(tolua_S,"Lua__cEntity");
@@ -3939,6 +3940,79 @@ static int tolua_AllToLua_cClientHandle_GetUniqueID00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: new of class cEntity */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_new00
+static int tolua_AllToLua_cEntity_new00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cEntity",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cEntity::eEntityType a_EntityType = ((cEntity::eEntityType) (int) tolua_tonumber(tolua_S,2,0));
+ double a_X = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_Y = ((double) tolua_tonumber(tolua_S,4,0));
+ double a_Z = ((double) tolua_tonumber(tolua_S,5,0));
+ {
+ cEntity* tolua_ret = (cEntity*) Mtolua_new((cEntity)(a_EntityType,a_X,a_Y,a_Z));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEntity");
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new_local of class cEntity */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_new00_local
+static int tolua_AllToLua_cEntity_new00_local(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cEntity",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cEntity::eEntityType a_EntityType = ((cEntity::eEntityType) (int) tolua_tonumber(tolua_S,2,0));
+ double a_X = ((double) tolua_tonumber(tolua_S,3,0));
+ double a_Y = ((double) tolua_tonumber(tolua_S,4,0));
+ double a_Z = ((double) tolua_tonumber(tolua_S,5,0));
+ {
+ cEntity* tolua_ret = (cEntity*) Mtolua_new((cEntity)(a_EntityType,a_X,a_Y,a_Z));
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEntity");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: delete of class cEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_delete00
static int tolua_AllToLua_cEntity_delete00(lua_State* tolua_S)
@@ -5053,7 +5127,8 @@ static int tolua_AllToLua_cEntity_Tick00(lua_State* tolua_S)
if (
!tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
+ (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"MTRand",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
)
goto tolua_lerror;
else
@@ -5061,11 +5136,12 @@ static int tolua_AllToLua_cEntity_Tick00(lua_State* tolua_S)
{
cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0);
float a_Dt = ((float) tolua_tonumber(tolua_S,2,0));
+ MTRand* a_TickRandom = ((MTRand*) tolua_tousertype(tolua_S,3,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Tick'", NULL);
#endif
{
- self->Tick(a_Dt);
+ self->Tick(a_Dt,*a_TickRandom);
}
}
return 0;
@@ -5077,6 +5153,39 @@ static int tolua_AllToLua_cEntity_Tick00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: HandlePhysics of class cEntity */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_HandlePhysics00
+static int tolua_AllToLua_cEntity_HandlePhysics00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0);
+ float a_Dt = ((float) tolua_tonumber(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HandlePhysics'", NULL);
+#endif
+ {
+ self->HandlePhysics(a_Dt);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'HandlePhysics'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: SpawnOn of class cEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SpawnOn00
static int tolua_AllToLua_cEntity_SpawnOn00(lua_State* tolua_S)
@@ -5151,18 +5260,21 @@ public:
return ( const char* ) cEntity:: GetParentClass();
};
};
- void Tick( float a_Dt) {
+ void Tick( float a_Dt, MTRand& a_TickRandom) {
if (push_method("Tick", tolua_AllToLua_cEntity_Tick00)) {
tolua_pushnumber(lua_state, (lua_Number)a_Dt);
+ tolua_pushusertype(lua_state, (void*)&a_TickRandom, "MTRand");
+ ToluaBase::dbcall(lua_state, 3, 0);
+ } else {
+ return ( void ) cEntity:: Tick(a_Dt,a_TickRandom);
+ };
+ };
+ void HandlePhysics( float a_Dt) {
+ if (push_method("HandlePhysics", tolua_AllToLua_cEntity_HandlePhysics00)) {
+ tolua_pushnumber(lua_state, (lua_Number)a_Dt);
ToluaBase::dbcall(lua_state, 2, 0);
} else {
- if (lua_state)
- LOG("pure-virtual method cEntity::Tick not implemented.");
- else {
- LOG("pure-virtual method cEntity::Tick called with no lua_state. Aborting");
- ::abort();
- };
- return ( void )0;
+ return ( void ) cEntity:: HandlePhysics(a_Dt);
};
};
void SpawnOn( cClientHandle& a_Client) {
@@ -5186,6 +5298,12 @@ public:
const char* cEntity__GetParentClass( void ) {
return ( const char* )cEntity::GetParentClass();
};
+ void cEntity__Tick( float a_Dt, MTRand& a_TickRandom) {
+ return ( void )cEntity::Tick(a_Dt,a_TickRandom);
+ };
+ void cEntity__HandlePhysics( float a_Dt) {
+ return ( void )cEntity::HandlePhysics(a_Dt);
+ };
void cEntity__SpawnOn( cClientHandle& a_Client) {
return ( void )cEntity::SpawnOn(a_Client);
};
@@ -5356,6 +5474,74 @@ static int tolua_AllToLua_Lua__cEntity_cEntity__GetParentClass00(lua_State* tolu
}
#endif //#ifndef TOLUA_DISABLE
+/* method: cEntity__Tick of class Lua__cEntity */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cEntity_cEntity__Tick00
+static int tolua_AllToLua_Lua__cEntity_cEntity__Tick00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cEntity",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"MTRand",0,&tolua_err)) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cEntity* self = (Lua__cEntity*) tolua_tousertype(tolua_S,1,0);
+ float a_Dt = ((float) tolua_tonumber(tolua_S,2,0));
+ MTRand* a_TickRandom = ((MTRand*) tolua_tousertype(tolua_S,3,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cEntity__Tick'", NULL);
+#endif
+ {
+ self->cEntity__Tick(a_Dt,*a_TickRandom);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cEntity__Tick'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: cEntity__HandlePhysics of class Lua__cEntity */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cEntity_cEntity__HandlePhysics00
+static int tolua_AllToLua_Lua__cEntity_cEntity__HandlePhysics00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"Lua__cEntity",0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,3,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ Lua__cEntity* self = (Lua__cEntity*) tolua_tousertype(tolua_S,1,0);
+ float a_Dt = ((float) tolua_tonumber(tolua_S,2,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cEntity__HandlePhysics'", NULL);
+#endif
+ {
+ self->cEntity__HandlePhysics(a_Dt);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'cEntity__HandlePhysics'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: cEntity__SpawnOn of class Lua__cEntity */
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cEntity_cEntity__SpawnOn00
static int tolua_AllToLua_Lua__cEntity_cEntity__SpawnOn00(lua_State* tolua_S)
@@ -6433,18 +6619,21 @@ public:
return ( const char* ) cPawn:: GetParentClass();
};
};
- void Tick( float a_Dt) {
+ void Tick( float a_Dt, MTRand& a_TickRandom) {
if (push_method("Tick", tolua_AllToLua_cEntity_Tick00)) {
tolua_pushnumber(lua_state, (lua_Number)a_Dt);
+ tolua_pushusertype(lua_state, (void*)&a_TickRandom, "MTRand");
+ ToluaBase::dbcall(lua_state, 3, 0);
+ } else {
+ return ( void ) cPawn:: Tick(a_Dt,a_TickRandom);
+ };
+ };
+ void HandlePhysics( float a_Dt) {
+ if (push_method("HandlePhysics", tolua_AllToLua_cEntity_HandlePhysics00)) {
+ tolua_pushnumber(lua_state, (lua_Number)a_Dt);
ToluaBase::dbcall(lua_state, 2, 0);
} else {
- if (lua_state)
- LOG("pure-virtual method cPawn::Tick not implemented.");
- else {
- LOG("pure-virtual method cPawn::Tick called with no lua_state. Aborting");
- ::abort();
- };
- return ( void )0;
+ return ( void ) cPawn:: HandlePhysics(a_Dt);
};
};
void SpawnOn( cClientHandle& a_Client) {
@@ -6504,6 +6693,12 @@ public:
const char* cPawn__GetParentClass( void ) {
return ( const char* )cPawn::GetParentClass();
};
+ void cPawn__Tick( float a_Dt, MTRand& a_TickRandom) {
+ return ( void )cPawn::Tick(a_Dt,a_TickRandom);
+ };
+ void cPawn__HandlePhysics( float a_Dt) {
+ return ( void )cPawn::HandlePhysics(a_Dt);
+ };
void cPawn__SpawnOn( cClientHandle& a_Client) {
return ( void )cPawn::SpawnOn(a_Client);
};
@@ -8422,18 +8617,21 @@ public:
return ( const char* ) cPlayer:: GetParentClass();
};
};
- void Tick( float a_Dt) {
+ void Tick( float a_Dt, MTRand& a_TickRandom) {
if (push_method("Tick", tolua_AllToLua_cEntity_Tick00)) {
tolua_pushnumber(lua_state, (lua_Number)a_Dt);
+ tolua_pushusertype(lua_state, (void*)&a_TickRandom, "MTRand");
+ ToluaBase::dbcall(lua_state, 3, 0);
+ } else {
+ return ( void ) cPlayer:: Tick(a_Dt,a_TickRandom);
+ };
+ };
+ void HandlePhysics( float a_Dt) {
+ if (push_method("HandlePhysics", tolua_AllToLua_cEntity_HandlePhysics00)) {
+ tolua_pushnumber(lua_state, (lua_Number)a_Dt);
ToluaBase::dbcall(lua_state, 2, 0);
} else {
- if (lua_state)
- LOG("pure-virtual method cPlayer::Tick not implemented.");
- else {
- LOG("pure-virtual method cPlayer::Tick called with no lua_state. Aborting");
- ::abort();
- };
- return ( void )0;
+ return ( void ) cPlayer:: HandlePhysics(a_Dt);
};
};
void SpawnOn( cClientHandle& a_Client) {
@@ -8496,6 +8694,12 @@ public:
const char* cPlayer__GetParentClass( void ) {
return ( const char* )cPlayer::GetParentClass();
};
+ void cPlayer__Tick( float a_Dt, MTRand& a_TickRandom) {
+ return ( void )cPlayer::Tick(a_Dt,a_TickRandom);
+ };
+ void cPlayer__HandlePhysics( float a_Dt) {
+ return ( void )cPlayer::HandlePhysics(a_Dt);
+ };
void cPlayer__SpawnOn( cClientHandle& a_Client) {
return ( void )cPlayer::SpawnOn(a_Client);
};
@@ -16175,18 +16379,21 @@ public:
return ( const char* ) cPickup:: GetParentClass();
};
};
- void Tick( float a_Dt) {
+ void Tick( float a_Dt, MTRand& a_TickRandom) {
if (push_method("Tick", tolua_AllToLua_cEntity_Tick00)) {
tolua_pushnumber(lua_state, (lua_Number)a_Dt);
+ tolua_pushusertype(lua_state, (void*)&a_TickRandom, "MTRand");
+ ToluaBase::dbcall(lua_state, 3, 0);
+ } else {
+ return ( void ) cPickup:: Tick(a_Dt,a_TickRandom);
+ };
+ };
+ void HandlePhysics( float a_Dt) {
+ if (push_method("HandlePhysics", tolua_AllToLua_cEntity_HandlePhysics00)) {
+ tolua_pushnumber(lua_state, (lua_Number)a_Dt);
ToluaBase::dbcall(lua_state, 2, 0);
} else {
- if (lua_state)
- LOG("pure-virtual method cPickup::Tick not implemented.");
- else {
- LOG("pure-virtual method cPickup::Tick called with no lua_state. Aborting");
- ::abort();
- };
- return ( void )0;
+ return ( void ) cPickup:: HandlePhysics(a_Dt);
};
};
void SpawnOn( cClientHandle& a_Client) {
@@ -16213,6 +16420,12 @@ public:
const char* cPickup__GetParentClass( void ) {
return ( const char* )cPickup::GetParentClass();
};
+ void cPickup__Tick( float a_Dt, MTRand& a_TickRandom) {
+ return ( void )cPickup::Tick(a_Dt,a_TickRandom);
+ };
+ void cPickup__HandlePhysics( float a_Dt) {
+ return ( void )cPickup::HandlePhysics(a_Dt);
+ };
void cPickup__SpawnOn( cClientHandle& a_Client) {
return ( void )cPickup::SpawnOn(a_Client);
};
@@ -24025,6 +24238,9 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_constant(tolua_S,"eEntityType_Player",cEntity::eEntityType_Player);
tolua_constant(tolua_S,"eEntityType_Pickup",cEntity::eEntityType_Pickup);
tolua_constant(tolua_S,"eEntityType_Mob",cEntity::eEntityType_Mob);
+ tolua_function(tolua_S,"new",tolua_AllToLua_cEntity_new00);
+ tolua_function(tolua_S,"new_local",tolua_AllToLua_cEntity_new00_local);
+ tolua_function(tolua_S,".call",tolua_AllToLua_cEntity_new00_local);
tolua_function(tolua_S,"delete",tolua_AllToLua_cEntity_delete00);
tolua_function(tolua_S,"Initialize",tolua_AllToLua_cEntity_Initialize00);
tolua_function(tolua_S,"GetEntityType",tolua_AllToLua_cEntity_GetEntityType00);
@@ -24060,6 +24276,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"IsDestroyed",tolua_AllToLua_cEntity_IsDestroyed00);
tolua_function(tolua_S,"Destroy",tolua_AllToLua_cEntity_Destroy00);
tolua_function(tolua_S,"Tick",tolua_AllToLua_cEntity_Tick00);
+ tolua_function(tolua_S,"HandlePhysics",tolua_AllToLua_cEntity_HandlePhysics00);
tolua_function(tolua_S,"SpawnOn",tolua_AllToLua_cEntity_SpawnOn00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
@@ -24073,6 +24290,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"cEntity__IsA",tolua_AllToLua_Lua__cEntity_cEntity__IsA00);
tolua_function(tolua_S,"cEntity__GetClass",tolua_AllToLua_Lua__cEntity_cEntity__GetClass00);
tolua_function(tolua_S,"cEntity__GetParentClass",tolua_AllToLua_Lua__cEntity_cEntity__GetParentClass00);
+ tolua_function(tolua_S,"cEntity__Tick",tolua_AllToLua_Lua__cEntity_cEntity__Tick00);
+ tolua_function(tolua_S,"cEntity__HandlePhysics",tolua_AllToLua_Lua__cEntity_cEntity__HandlePhysics00);
tolua_function(tolua_S,"cEntity__SpawnOn",tolua_AllToLua_Lua__cEntity_cEntity__SpawnOn00);
tolua_function(tolua_S,"new",tolua_AllToLua_Lua__cEntity_new00);
tolua_function(tolua_S,"new_local",tolua_AllToLua_Lua__cEntity_new00_local);
diff --git a/source/Bindings.h b/source/Bindings.h
index 04e5cd8ec..e8bc37787 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 12/21/12 21:44:41.
+** Generated automatically by tolua++-1.0.92 on 12/22/12 19:15:16.
*/
/* Exported function */
diff --git a/source/Entity.cpp b/source/Entity.cpp
index 381a62e42..e3af6d4d3 100644
--- a/source/Entity.cpp
+++ b/source/Entity.cpp
@@ -197,6 +197,17 @@ void cEntity::RemoveFromChunk(void)
+void cEntity::Tick(float a_Dt, MTRand & a_TickRandom)
+{
+ UNUSED(a_TickRandom);
+
+ HandlePhysics(a_Dt);
+}
+
+
+
+
+
bool cEntity::IsA(const char * a_ClassName) const
{
return (strcmp(a_ClassName, "cEntity") == 0);
diff --git a/source/Entity.h b/source/Entity.h
index 132679db2..96ba1a1a1 100644
--- a/source/Entity.h
+++ b/source/Entity.h
@@ -58,6 +58,7 @@
class cWorld;
class cReferenceManager;
class cClientHandle;
+class MTRand;
@@ -145,7 +146,8 @@ public:
void Destroy(); //tolua_export
void RemoveFromChunk(void); // for internal use in cChunk
- virtual void Tick(float a_Dt) = 0; //tolua_export
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom); // tolua_export
+ virtual void HandlePhysics(float a_Dt) {} // tolua_export
/** Descendants override this function to send a command to the specified client to spawn the entity on the client.
To spawn on all eligible clients, use cChunkMap::BroadcastSpawnEntity()
diff --git a/source/FallingBlock.cpp b/source/FallingBlock.cpp
index 006acd6e2..1d6ce8959 100644
--- a/source/FallingBlock.cpp
+++ b/source/FallingBlock.cpp
@@ -39,7 +39,7 @@ void cFallingBlock::SpawnOn(cClientHandle & a_ClientHandle)
-void cFallingBlock::Tick(float a_Dt)
+void cFallingBlock::Tick(float a_Dt, MTRand & a_TickRandom)
{
float MilliDt = a_Dt * 0.001f;
m_SpeedY -= MilliDt * 9.8f;
diff --git a/source/FallingBlock.h b/source/FallingBlock.h
index f62b40a92..cdf1e1f04 100644
--- a/source/FallingBlock.h
+++ b/source/FallingBlock.h
@@ -27,7 +27,7 @@ public:
virtual void Initialize(cWorld * a_World) override;
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
private:
BLOCKTYPE m_BlockType;
diff --git a/source/Mobs/AggressiveMonster.cpp b/source/Mobs/AggressiveMonster.cpp
index f2e53ce00..14c3135be 100644
--- a/source/Mobs/AggressiveMonster.cpp
+++ b/source/Mobs/AggressiveMonster.cpp
@@ -23,9 +23,9 @@ cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, char a_Prot
// What to do if in Chasing State
-void cAggressiveMonster::InStateChasing(float a_Dt)
+void cAggressiveMonster::InStateChasing(float a_Dt, MTRand & a_TickRandom)
{
- super::InStateChasing(a_Dt);
+ super::InStateChasing(a_Dt, a_TickRandom);
m_ChaseTime += a_Dt;
if (m_Target != NULL)
{
@@ -58,9 +58,9 @@ void cAggressiveMonster::InStateChasing(float a_Dt)
-void cAggressiveMonster::EventSeePlayer(cEntity * a_Entity)
+void cAggressiveMonster::EventSeePlayer(cEntity * a_Entity, MTRand & a_TickRandom)
{
- super::EventSeePlayer(a_Entity);
+ super::EventSeePlayer(a_Entity, a_TickRandom);
m_EMState = CHASING;
}
@@ -68,27 +68,26 @@ void cAggressiveMonster::EventSeePlayer(cEntity * a_Entity)
-void cAggressiveMonster::Tick(float a_Dt)
+void cAggressiveMonster::Tick(float a_Dt, MTRand & a_TickRandom)
{
- super::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
m_SeePlayerInterval += a_Dt;
if (m_SeePlayerInterval > 1)
{
- MTRand r1;
- int rem = r1.randInt() % 3 + 1; // Check most of the time but miss occasionally
+ int rem = a_TickRandom.randInt() % 3 + 1; // Check most of the time but miss occasionally
m_SeePlayerInterval = 0.0;
if (rem >= 2)
{
if (m_EMState == CHASING)
{
- CheckEventLostPlayer();
+ CheckEventLostPlayer(a_TickRandom);
}
else
{
- CheckEventSeePlayer();
+ CheckEventSeePlayer(a_TickRandom);
}
}
}
diff --git a/source/Mobs/AggressiveMonster.h b/source/Mobs/AggressiveMonster.h
index f364d535d..a9303a975 100644
--- a/source/Mobs/AggressiveMonster.h
+++ b/source/Mobs/AggressiveMonster.h
@@ -15,10 +15,10 @@ class cAggressiveMonster :
public:
cAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath);
- virtual void Tick(float a_Dt) override;
- virtual void InStateChasing(float a_Dt) override;
+ virtual void Tick (float a_Dt, MTRand & a_TickRandom) override;
+ virtual void InStateChasing(float a_Dt, MTRand & a_TickRandom) override;
- virtual void EventSeePlayer(cEntity *) override;
+ virtual void EventSeePlayer(cEntity *, MTRand & a_TickRandom) override;
protected:
float m_ChaseTime;
diff --git a/source/Mobs/Cavespider.cpp b/source/Mobs/Cavespider.cpp
index b0dcd2eae..b63e28f1a 100644
--- a/source/Mobs/Cavespider.cpp
+++ b/source/Mobs/Cavespider.cpp
@@ -16,9 +16,9 @@ cCavespider::cCavespider(void) :
-void cCavespider::Tick(float a_Dt)
+void cCavespider::Tick(float a_Dt, MTRand & a_TickRandom)
{
- super::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
// TODO: Check vanilla if cavespiders really get passive during the day
m_EMPersonality = (GetWorld()->GetTimeOfDay() < (12000 + 1000)) ? PASSIVE : AGGRESSIVE;
diff --git a/source/Mobs/Cavespider.h b/source/Mobs/Cavespider.h
index 33f67b6f5..b02318a0f 100644
--- a/source/Mobs/Cavespider.h
+++ b/source/Mobs/Cavespider.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cCaveSpider);
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Enderman.cpp b/source/Mobs/Enderman.cpp
index 33aecc61d..d7bbaa144 100644
--- a/source/Mobs/Enderman.cpp
+++ b/source/Mobs/Enderman.cpp
@@ -16,9 +16,9 @@ cEnderman::cEnderman(void) :
-void cEnderman::Tick(float a_Dt)
+void cEnderman::Tick(float a_Dt, MTRand & a_TickRandom)
{
- cMonster::Tick(a_Dt);
+ cMonster::Tick(a_Dt, a_TickRandom);
// TODO Same as stated in cSkeleton
if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && (GetMetaData() != BURNING))
diff --git a/source/Mobs/Enderman.h b/source/Mobs/Enderman.h
index adcbe3b4b..0703ca25e 100644
--- a/source/Mobs/Enderman.h
+++ b/source/Mobs/Enderman.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cEnderman);
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp
index 49f11ebfd..224a16782 100644
--- a/source/Mobs/Monster.cpp
+++ b/source/Mobs/Monster.cpp
@@ -87,14 +87,15 @@ bool cMonster::ReachedDestination()
-void cMonster::Tick(float a_Dt)
+void cMonster::Tick(float a_Dt, MTRand & a_TickRandom)
{
- cPawn::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
- if( m_Health <= 0 )
+ if (m_Health <= 0)
{
- m_DestroyTimer += a_Dt/1000;
- if( m_DestroyTimer > 1 )
+ // The mob is dead, but we're still animating the "puff" they leave when they die
+ m_DestroyTimer += a_Dt / 1000;
+ if (m_DestroyTimer > 1)
{
Destroy();
}
@@ -103,7 +104,7 @@ void cMonster::Tick(float a_Dt)
a_Dt /= 1000;
- if( m_bMovingToDestination )
+ if (m_bMovingToDestination)
{
Vector3f Pos( m_Pos );
Vector3f Distance = m_Destination - Pos;
@@ -142,8 +143,6 @@ void cMonster::Tick(float a_Dt)
}
}
- HandlePhysics( a_Dt );
-
ReplicateMovement();
Vector3f Distance = m_Destination - Vector3f( m_Pos );
@@ -156,22 +155,28 @@ void cMonster::Tick(float a_Dt)
SetPitch( Pitch );
}
- if (m_EMState == IDLE)
+ switch (m_EMState)
{
- // If enemy passive we ignore checks for player visibility
- InStateIdle(a_Dt);
- }
+ case IDLE:
+ {
+ // If enemy passive we ignore checks for player visibility
+ InStateIdle(a_Dt, a_TickRandom);
+ break;
+ }
- if (m_EMState == CHASING)
- {
- // If we do not see a player anymore skip chasing action
- InStateChasing(a_Dt);
- }
+ case CHASING:
+ {
+ // If we do not see a player anymore skip chasing action
+ InStateChasing(a_Dt, a_TickRandom);
+ break;
+ }
- if (m_EMState == ESCAPING)
- {
- InStateEscaping(a_Dt);
- }
+ case ESCAPING:
+ {
+ InStateEscaping(a_Dt, a_TickRandom);
+ break;
+ }
+ } // switch (m_EMState)
}
@@ -366,13 +371,14 @@ void cMonster::SetState(const AString & a_State)
//Checks to see if EventSeePlayer should be fired
//monster sez: Do I see the player
-void cMonster::CheckEventSeePlayer()
+void cMonster::CheckEventSeePlayer(MTRand & a_TickRandom)
{
- cPlayer *Closest = FindClosestPlayer();
+ // TODO: Rewrite this to use cWorld's DoWithPlayers()
+ cPlayer * Closest = FindClosestPlayer();
- if (Closest)
+ if (Closest != NULL)
{
- EventSeePlayer(Closest);
+ EventSeePlayer(Closest, a_TickRandom);
}
}
@@ -380,8 +386,10 @@ void cMonster::CheckEventSeePlayer()
-void cMonster::CheckEventLostPlayer()
+void cMonster::CheckEventLostPlayer(MTRand & a_TickRandom)
{
+ UNUSED(a_TickRandom);
+
Vector3f pos;
cTracer LineOfSight(GetWorld());
@@ -405,8 +413,10 @@ void cMonster::CheckEventLostPlayer()
// What to do if player is seen
// default to change state to chasing
-void cMonster::EventSeePlayer(cEntity *a_SeenPlayer)
+void cMonster::EventSeePlayer(cEntity * a_SeenPlayer, MTRand & a_TickRandom)
{
+ UNUSED(a_TickRandom);
+
m_Target = a_SeenPlayer;
AddReference( m_Target );
}
@@ -415,7 +425,7 @@ void cMonster::EventSeePlayer(cEntity *a_SeenPlayer)
-void cMonster::EventLosePlayer()
+void cMonster::EventLosePlayer(void)
{
Dereference(m_Target);
m_Target = 0;
@@ -426,26 +436,25 @@ void cMonster::EventLosePlayer()
-//What to do if in Idle State
-void cMonster::InStateIdle(float a_Dt)
+// What to do if in Idle State
+void cMonster::InStateIdle(float a_Dt, MTRand & a_TickRandom)
{
idle_interval += a_Dt;
if (idle_interval > 1)
{
// at this interval the results are predictable
- MTRand r1;
- int rem = r1.randInt()%6 + 1;
+ int rem = (a_TickRandom.randInt() % 6) + 1;
// LOGD("Moving: int: %3.3f rem: %i",idle_interval,rem);
idle_interval -= 1; // So nothing gets dropped when the server hangs for a few seconds
Vector3f Dist;
- Dist.x = (float)((r1.randInt()%11)-5);
- Dist.z = (float)((r1.randInt()%11)-5);
- if( Dist.SqrLength() > 2 && rem >= 3)
+ Dist.x = (float)((a_TickRandom.randInt() % 11) - 5);
+ Dist.z = (float)((a_TickRandom.randInt() % 11) - 5);
+ if ((Dist.SqrLength() > 2) && (rem >= 3))
{
m_Destination.x = (float)(m_Pos.x + Dist.x);
m_Destination.z = (float)(m_Pos.z + Dist.z);
- m_Destination.y = (float)GetWorld()->GetHeight( (int)m_Destination.x, (int)m_Destination.z ) + 1.2f;
- MoveToPosition( m_Destination );
+ m_Destination.y = (float)GetWorld()->GetHeight((int)m_Destination.x, (int)m_Destination.z) + 1.2f;
+ MoveToPosition(m_Destination);
}
}
}
@@ -456,9 +465,10 @@ void cMonster::InStateIdle(float a_Dt)
// What to do if in Chasing State
// This state should always be defined in each child class
-void cMonster::InStateChasing(float a_Dt)
+void cMonster::InStateChasing(float a_Dt, MTRand & a_TickRandom)
{
UNUSED(a_Dt);
+ UNUSED(a_TickRandom);
}
@@ -466,10 +476,12 @@ void cMonster::InStateChasing(float a_Dt)
// What to do if in Escaping State
-void cMonster::InStateEscaping(float a_Dt)
+void cMonster::InStateEscaping(float a_Dt, MTRand & a_TickRandom)
{
- (void)a_Dt;
- if(m_Target)
+ UNUSED(a_Dt);
+ UNUSED(a_TickRandom);
+
+ if (m_Target != NULL)
{
Vector3d newloc = m_Pos;
newloc.x = (m_Target->GetPosition().x < newloc.x)? (newloc.x + m_SightDistance): (newloc.x - m_SightDistance);
@@ -478,7 +490,7 @@ void cMonster::InStateEscaping(float a_Dt)
}
else
{
- m_EMState = IDLE; //this shouldnt be required but just to be safe
+ m_EMState = IDLE; // This shouldnt be required but just to be safe
}
}
diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h
index 066f17495..5f789fa47 100644
--- a/source/Mobs/Monster.h
+++ b/source/Mobs/Monster.h
@@ -36,7 +36,7 @@ public:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
virtual void HandlePhysics(float a_Dt);
virtual void ReplicateMovement(void);
@@ -53,20 +53,20 @@ public:
const char * GetState();
void SetState(const AString & str);
- virtual void CheckEventSeePlayer();
- virtual void EventSeePlayer(cEntity *);
+ virtual void CheckEventSeePlayer(MTRand & a_TickRandom);
+ virtual void EventSeePlayer(cEntity *, MTRand & a_TickRandom);
float m_SightDistance;
virtual cPlayer * FindClosestPlayer(); // non static is easier. also virtual so other mobs can implement their own searching algo
/// Reads the monster configuration for the specified monster name and assigns it to this object.
void GetMonsterConfig(const AString & a_Name);
- virtual void EventLosePlayer();
- virtual void CheckEventLostPlayer();
+ virtual void EventLosePlayer(void);
+ virtual void CheckEventLostPlayer(MTRand & a_TickRandom);
- virtual void InStateIdle(float a_Dt);
- virtual void InStateChasing(float a_Dt);
- virtual void InStateEscaping(float a_Dt);
+ virtual void InStateIdle (float a_Dt, MTRand & a_TickRandom);
+ virtual void InStateChasing (float a_Dt, MTRand & a_TickRandom);
+ virtual void InStateEscaping(float a_Dt, MTRand & a_TickRandom);
virtual void Attack(float a_Dt);
int GetMobType() {return m_MobType;}
diff --git a/source/Mobs/PassiveMonster.cpp b/source/Mobs/PassiveMonster.cpp
index b11f7305d..aa2e6c118 100644
--- a/source/Mobs/PassiveMonster.cpp
+++ b/source/Mobs/PassiveMonster.cpp
@@ -31,23 +31,22 @@ void cPassiveMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cPassiveMonster::Tick(float a_Dt)
+void cPassiveMonster::Tick(float a_Dt, MTRand & a_TickRandom)
{
- super::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
m_SeePlayerInterval += a_Dt;
if (m_SeePlayerInterval > 1) // Check every second
{
- MTRand r1;
- int rem = r1.randInt() % 3 + 1; // Check most of the time but miss occasionally
+ int rem = a_TickRandom.randInt() % 3 + 1; // Check most of the time but miss occasionally
m_SeePlayerInterval = 0.0;
if (rem >= 2)
{
if (m_EMState == ESCAPING)
{
- CheckEventLostPlayer();
+ CheckEventLostPlayer(a_TickRandom);
}
}
}
diff --git a/source/Mobs/PassiveMonster.h b/source/Mobs/PassiveMonster.h
index d31510891..66e718ec3 100644
--- a/source/Mobs/PassiveMonster.h
+++ b/source/Mobs/PassiveMonster.h
@@ -15,7 +15,7 @@ class cPassiveMonster :
public:
cPassiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath);
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
/// When hit by someone, run away
virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
diff --git a/source/Mobs/Skeleton.cpp b/source/Mobs/Skeleton.cpp
index 76a7b6beb..785584fcd 100644
--- a/source/Mobs/Skeleton.cpp
+++ b/source/Mobs/Skeleton.cpp
@@ -16,9 +16,9 @@ cSkeleton::cSkeleton(void) :
-void cSkeleton::Tick(float a_Dt)
+void cSkeleton::Tick(float a_Dt, MTRand & a_TickRandom)
{
- cMonster::Tick(a_Dt);
+ cMonster::Tick(a_Dt, a_TickRandom);
// TODO Outsource
// TODO should do SkyLight check, mobs in the dark donīt burn
diff --git a/source/Mobs/Skeleton.h b/source/Mobs/Skeleton.h
index 476b438e5..a02d1b5a6 100644
--- a/source/Mobs/Skeleton.h
+++ b/source/Mobs/Skeleton.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cSkeleton);
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Squid.cpp b/source/Mobs/Squid.cpp
index e300deef0..808bd359e 100644
--- a/source/Mobs/Squid.cpp
+++ b/source/Mobs/Squid.cpp
@@ -27,9 +27,9 @@ void cSquid::GetDrops(cItems & a_Drops, cPawn * a_Killer)
-void cSquid::Tick(float a_Dt)
+void cSquid::Tick(float a_Dt, MTRand & a_TickRandom)
{
- super::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
Vector3d Pos = GetPosition();
diff --git a/source/Mobs/Squid.h b/source/Mobs/Squid.h
index 4a8de4d28..158fbea4a 100644
--- a/source/Mobs/Squid.h
+++ b/source/Mobs/Squid.h
@@ -15,7 +15,7 @@ class cSquid :
public:
cSquid();
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
CLASS_PROTODEF(cSquid);
diff --git a/source/Mobs/Zombie.cpp b/source/Mobs/Zombie.cpp
index bf630929a..8038c51f6 100644
--- a/source/Mobs/Zombie.cpp
+++ b/source/Mobs/Zombie.cpp
@@ -16,9 +16,9 @@ cZombie::cZombie(void) :
-void cZombie::Tick(float a_Dt)
+void cZombie::Tick(float a_Dt, MTRand & a_TickRandom)
{
- super::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
// TODO Same as in cSkeleton :D
if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && (GetMetaData() != BURNING))
diff --git a/source/Mobs/Zombie.h b/source/Mobs/Zombie.h
index 06bd9244a..c4988af72 100644
--- a/source/Mobs/Zombie.h
+++ b/source/Mobs/Zombie.h
@@ -16,7 +16,7 @@ public:
CLASS_PROTODEF(cZombie);
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Zombiepigman.cpp b/source/Mobs/Zombiepigman.cpp
index 0e618cbc2..a542723c4 100644
--- a/source/Mobs/Zombiepigman.cpp
+++ b/source/Mobs/Zombiepigman.cpp
@@ -16,9 +16,9 @@ cZombiepigman::cZombiepigman(void) :
-void cZombiepigman::Tick(float a_Dt)
+void cZombiepigman::Tick(float a_Dt, MTRand & a_TickRandom)
{
- super::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
// TODO Same as noticed in cSkeleton AND Do they really burn by sun?? :D In the neather is no sun :D
if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && (GetMetaData() != BURNING))
diff --git a/source/Mobs/Zombiepigman.h b/source/Mobs/Zombiepigman.h
index 929d03241..201416dbd 100644
--- a/source/Mobs/Zombiepigman.h
+++ b/source/Mobs/Zombiepigman.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cZombiepigman);
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
virtual void KilledBy(cPawn * a_Killer) override;
} ;
diff --git a/source/Pawn.cpp b/source/Pawn.cpp
index a26d80699..9e0736d38 100644
--- a/source/Pawn.cpp
+++ b/source/Pawn.cpp
@@ -292,7 +292,7 @@ void cPawn::TeleportTo(double a_PosX, double a_PosY, double a_PosZ)
-void cPawn::Tick(float a_Dt)
+void cPawn::Tick(float a_Dt, MTRand & a_TickRandom)
{
CheckMetaDataBurn(); // Check to see if pawn should burn based on block they are on
diff --git a/source/Pawn.h b/source/Pawn.h
index a8a25c04f..2e590f1f5 100644
--- a/source/Pawn.h
+++ b/source/Pawn.h
@@ -83,7 +83,7 @@ public:
cPawn(eEntityType a_EntityType);
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
// tolua_begin
@@ -150,7 +150,7 @@ public:
virtual void InStateBurning(float a_Dt);
- virtual void CheckMetaDataBurn();
+ virtual void CheckMetaDataBurn(void);
virtual void SetMaxHealth(short a_MaxHealth);
virtual short GetMaxHealth() { return m_MaxHealth; }
diff --git a/source/Pickup.cpp b/source/Pickup.cpp
index 3034e73de..f147434ab 100644
--- a/source/Pickup.cpp
+++ b/source/Pickup.cpp
@@ -67,36 +67,33 @@ void cPickup::SpawnOn(cClientHandle & a_Client)
-void cPickup::Tick(float a_Dt)
+void cPickup::Tick(float a_Dt, MTRand & a_TickRandom)
{
+ super::Tick(a_Dt, a_TickRandom);
+
m_Timer += a_Dt;
a_Dt = a_Dt / 1000.f;
- if(m_bCollected)
+ if (m_bCollected)
{
- if(m_Timer > 500.f) // 0.5 second
+ if (m_Timer > 500.f) // 0.5 second
{
Destroy();
return;
}
}
- if( m_Timer > 1000*60*5 ) // 5 minutes
+ if (m_Timer > 1000 * 60 * 5) // 5 minutes
{
Destroy();
return;
}
- if( m_Pos.y < 0 ) // Out of this world!
+ if (m_Pos.y < -8) // Out of this world and no more visible!
{
Destroy();
return;
}
- if (!m_bCollected)
- {
- HandlePhysics(a_Dt);
- }
-
if (!m_bReplicated || m_bDirtyPosition)
{
MoveToCorrectChunk();
@@ -229,7 +226,7 @@ void cPickup::HandlePhysics(float a_Dt)
-bool cPickup::CollectedBy( cPlayer* a_Dest )
+bool cPickup::CollectedBy(cPlayer * a_Dest)
{
if (m_bCollected)
{
@@ -252,7 +249,8 @@ bool cPickup::CollectedBy( cPlayer* a_Dest )
m_World->BroadcastCollectPickup(*this, *a_Dest);
m_bCollected = true;
m_Timer = 0;
- if( m_Item->m_ItemCount != 0 ) {
+ if (m_Item->m_ItemCount != 0)
+ {
cItems Pickup;
Pickup.push_back(cItem(*m_Item));
m_World->SpawnItemPickups(Pickup, m_Pos.x, m_Pos.y, m_Pos.z);
diff --git a/source/Pickup.h b/source/Pickup.h
index 88b1fc167..6c5979e13 100644
--- a/source/Pickup.h
+++ b/source/Pickup.h
@@ -33,10 +33,10 @@ public:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
- virtual bool CollectedBy( cPlayer* a_Dest ); //tolua_export
+ virtual bool CollectedBy(cPlayer * a_Dest); //tolua_export
- void Tick(float a_Dt);
- void HandlePhysics(float a_Dt);
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
+ virtual void HandlePhysics(float a_Dt) override;
const Vector3f & GetSpeed(void) const {return m_Speed; }
diff --git a/source/Player.cpp b/source/Player.cpp
index a5d915572..a99a44d12 100644
--- a/source/Player.cpp
+++ b/source/Player.cpp
@@ -60,9 +60,6 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
m_CurrentWindow = m_InventoryWindow;
m_InventoryWindow->OpenedByPlayer(*this);
- // DEBUG:
- LOGD("Inventory window for player %p is at %p", this, m_InventoryWindow);
-
SetMaxHealth(20);
m_MaxFoodLevel = 20;
@@ -159,7 +156,7 @@ void cPlayer::SpawnOn(cClientHandle & a_Client)
-void cPlayer::Tick(float a_Dt)
+void cPlayer::Tick(float a_Dt, MTRand & a_TickRandom)
{
if (!m_ClientHandle->IsPlaying())
{
@@ -167,7 +164,7 @@ void cPlayer::Tick(float a_Dt)
return;
}
- cPawn::Tick(a_Dt);
+ super::Tick(a_Dt, a_TickRandom);
if (m_bDirtyOrientation && !m_bDirtyPosition)
{
diff --git a/source/Player.h b/source/Player.h
index 66c1d1820..2d4680c86 100644
--- a/source/Player.h
+++ b/source/Player.h
@@ -39,7 +39,7 @@ public:
virtual void SpawnOn(cClientHandle & a_Client) override;
- virtual void Tick(float a_Dt) override;
+ virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
/// Returns the curently equipped weapon; empty item if none
virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
diff --git a/source/World.cpp b/source/World.cpp
index 9fb5519f2..0d4080f88 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -456,6 +456,7 @@ void cWorld::Tick(float a_Dt)
m_LastTimeUpdate = m_WorldAge;
}
+ // Remove entities scheduled for removal:
{
cCSLock Lock(m_CSEntities);
for (cEntityList::iterator itr = m_AllEntities.begin(); itr != m_AllEntities.end();)
@@ -468,7 +469,7 @@ void cWorld::Tick(float a_Dt)
m_RemoveEntityQueue.push_back( RemoveMe );
continue;
}
- (*itr)->Tick(a_Dt);
+ (*itr)->Tick(a_Dt, m_TickRand);
itr++;
}
}