MTRand reference is now passed as a Tick() parameter so that it isn't created and destroyed over and over again. All entities will handle physics (empty callback for now)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1096 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
aebe130299
commit
b29af701b9
@ -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)
|
||||
@ -5048,6 +5122,41 @@ static int tolua_AllToLua_cEntity_Destroy00(lua_State* tolua_S)
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_Tick00
|
||||
static int tolua_AllToLua_cEntity_Tick00(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_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
|
||||
{
|
||||
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,*a_TickRandom);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'Tick'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#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 (
|
||||
@ -5062,16 +5171,16 @@ 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));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Tick'", NULL);
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HandlePhysics'", NULL);
|
||||
#endif
|
||||
{
|
||||
self->Tick(a_Dt);
|
||||
self->HandlePhysics(a_Dt);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'Tick'.",&tolua_err);
|
||||
tolua_error(tolua_S,"#ferror in function 'HandlePhysics'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
@ -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) {
|
||||
@ -5185,6 +5297,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) {
|
||||
@ -6503,6 +6692,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) {
|
||||
@ -8495,6 +8693,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) {
|
||||
@ -16212,6 +16419,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);
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
} ;
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
} ;
|
||||
|
||||
|
@ -87,12 +87,13 @@ 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)
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
case IDLE:
|
||||
{
|
||||
// If enemy passive we ignore checks for player visibility
|
||||
InStateIdle(a_Dt);
|
||||
InStateIdle(a_Dt, a_TickRandom);
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_EMState == CHASING)
|
||||
case CHASING:
|
||||
{
|
||||
// If we do not see a player anymore skip chasing action
|
||||
InStateChasing(a_Dt);
|
||||
InStateChasing(a_Dt, a_TickRandom);
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_EMState == ESCAPING)
|
||||
case ESCAPING:
|
||||
{
|
||||
InStateEscaping(a_Dt);
|
||||
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)
|
||||
{
|
||||
// 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;
|
||||
@ -427,20 +437,19 @@ void cMonster::EventLosePlayer()
|
||||
|
||||
|
||||
// What to do if in Idle State
|
||||
void cMonster::InStateIdle(float a_Dt)
|
||||
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);
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
} ;
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
} ;
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
} ;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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; }
|
||||
|
@ -67,8 +67,10 @@ 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)
|
||||
@ -86,17 +88,12 @@ void cPickup::Tick(float a_Dt)
|
||||
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();
|
||||
@ -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);
|
||||
|
@ -35,8 +35,8 @@ public:
|
||||
|
||||
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; }
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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(); }
|
||||
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user