1
0

Lua seems to have trouble with a combination of overloaded functions and class inheritance, so I renamed TeleportTo( cEntity* ) to TeleportToEntity

/tp command should work again :)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@314 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth 2012-02-22 15:46:38 +00:00
parent 1d1b0fd00d
commit 41d55ef86b
5 changed files with 54 additions and 33 deletions

View File

@ -10,7 +10,7 @@ function HandleTPCommand( Split, Player )
elseif( OtherPlayer == Player ) then elseif( OtherPlayer == Player ) then
Player:SendMessage( cChatColor.Green .. "Already there :)" ) Player:SendMessage( cChatColor.Green .. "Already there :)" )
else else
Player:TeleportTo( OtherPlayer ) Player:TeleportToEntity( OtherPlayer )
Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" ) Player:SendMessage( cChatColor.Green .. "You teleported to "..OtherPlayer:GetName().."!" )
OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" ) OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName().." teleported to you!" )
end end

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 02/21/12 17:01:49. ** Generated automatically by tolua++-1.0.92 on 02/22/12 16:44:22.
*/ */
#ifndef __cplusplus #ifndef __cplusplus
@ -4357,9 +4357,9 @@ static int tolua_set_TakeDamageInfo_Instigator_ptr(lua_State* tolua_S)
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: TeleportTo of class cPawn */ /* method: TeleportToEntity of class cPawn */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPawn_TeleportTo00 #ifndef TOLUA_DISABLE_tolua_AllToLua_cPawn_TeleportToEntity00
static int tolua_AllToLua_cPawn_TeleportTo00(lua_State* tolua_S) static int tolua_AllToLua_cPawn_TeleportToEntity00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
tolua_Error tolua_err; tolua_Error tolua_err;
@ -4375,25 +4375,26 @@ static int tolua_AllToLua_cPawn_TeleportTo00(lua_State* tolua_S)
cPawn* self = (cPawn*) tolua_tousertype(tolua_S,1,0); cPawn* self = (cPawn*) tolua_tousertype(tolua_S,1,0);
cEntity* a_Entity = ((cEntity*) tolua_tousertype(tolua_S,2,0)); cEntity* a_Entity = ((cEntity*) tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TeleportTo'", NULL); if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TeleportToEntity'", NULL);
#endif #endif
{ {
self->TeleportTo(a_Entity); self->TeleportToEntity(a_Entity);
} }
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
tolua_lerror: tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'TeleportTo'.",&tolua_err); tolua_error(tolua_S,"#ferror in function 'TeleportToEntity'.",&tolua_err);
return 0; return 0;
#endif #endif
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: TeleportTo of class cPawn */ /* method: TeleportTo of class cPawn */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cPawn_TeleportTo01 #ifndef TOLUA_DISABLE_tolua_AllToLua_cPawn_TeleportTo00
static int tolua_AllToLua_cPawn_TeleportTo01(lua_State* tolua_S) static int tolua_AllToLua_cPawn_TeleportTo00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE
tolua_Error tolua_err; tolua_Error tolua_err;
if ( if (
!tolua_isusertype(tolua_S,1,"cPawn",0,&tolua_err) || !tolua_isusertype(tolua_S,1,"cPawn",0,&tolua_err) ||
@ -4404,6 +4405,7 @@ static int tolua_AllToLua_cPawn_TeleportTo01(lua_State* tolua_S)
) )
goto tolua_lerror; goto tolua_lerror;
else else
#endif
{ {
cPawn* self = (cPawn*) tolua_tousertype(tolua_S,1,0); cPawn* self = (cPawn*) tolua_tousertype(tolua_S,1,0);
const double a_PosX = ((const double) tolua_tonumber(tolua_S,2,0)); const double a_PosX = ((const double) tolua_tonumber(tolua_S,2,0));
@ -4420,8 +4422,11 @@ static int tolua_AllToLua_cPawn_TeleportTo01(lua_State* tolua_S)
} }
} }
return 3; return 3;
#ifndef TOLUA_RELEASE
tolua_lerror: tolua_lerror:
return tolua_AllToLua_cPawn_TeleportTo00(tolua_S); tolua_error(tolua_S,"#ferror in function 'TeleportTo'.",&tolua_err);
return 0;
#endif
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -4560,16 +4565,16 @@ static int tolua_AllToLua_cPawn_GetHealth00(lua_State* tolua_S)
class Lua__cPawn : public cPawn, public ToluaBase { class Lua__cPawn : public cPawn, public ToluaBase {
public: public:
void TeleportTo( cEntity* a_Entity) { void TeleportToEntity( cEntity* a_Entity) {
if (push_method("TeleportTo", tolua_AllToLua_cPawn_TeleportTo00)) { if (push_method("TeleportToEntity", tolua_AllToLua_cPawn_TeleportToEntity00)) {
tolua_pushusertype(lua_state, (void*)a_Entity, "cEntity"); tolua_pushusertype(lua_state, (void*)a_Entity, "cEntity");
ToluaBase::dbcall(lua_state, 2, 0); ToluaBase::dbcall(lua_state, 2, 0);
} else { } else {
return ( void ) cPawn:: TeleportTo(a_Entity); return ( void ) cPawn:: TeleportToEntity(a_Entity);
}; };
}; };
void TeleportTo( const double& a_PosX, const double& a_PosY, const double& a_PosZ) { void TeleportTo( const double& a_PosX, const double& a_PosY, const double& a_PosZ) {
if (push_method("TeleportTo", tolua_AllToLua_cPawn_TeleportTo01)) { if (push_method("TeleportTo", tolua_AllToLua_cPawn_TeleportTo00)) {
tolua_pushnumber(lua_state, (lua_Number)a_PosX); tolua_pushnumber(lua_state, (lua_Number)a_PosX);
tolua_pushnumber(lua_state, (lua_Number)a_PosY); tolua_pushnumber(lua_state, (lua_Number)a_PosY);
tolua_pushnumber(lua_state, (lua_Number)a_PosZ); tolua_pushnumber(lua_state, (lua_Number)a_PosZ);
@ -4649,8 +4654,8 @@ public:
}; };
}; };
void cPawn__TeleportTo( cEntity* a_Entity) { void cPawn__TeleportToEntity( cEntity* a_Entity) {
return ( void )cPawn::TeleportTo(a_Entity); return ( void )cPawn::TeleportToEntity(a_Entity);
}; };
void cPawn__TeleportTo( const double& a_PosX, const double& a_PosY, const double& a_PosZ) { void cPawn__TeleportTo( const double& a_PosX, const double& a_PosY, const double& a_PosZ) {
return ( void )cPawn::TeleportTo(a_PosX,a_PosY,a_PosZ); return ( void )cPawn::TeleportTo(a_PosX,a_PosY,a_PosZ);
@ -4708,9 +4713,9 @@ static int tolua_AllToLua_Lua__cPawn_tolua__set_instance00(lua_State* tolua_S)
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: cPawn__TeleportTo of class Lua__cPawn */ /* method: cPawn__TeleportToEntity of class Lua__cPawn */
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00 #ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPawn_cPawn__TeleportToEntity00
static int tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00(lua_State* tolua_S) static int tolua_AllToLua_Lua__cPawn_cPawn__TeleportToEntity00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
tolua_Error tolua_err; tolua_Error tolua_err;
@ -4726,25 +4731,26 @@ static int tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00(lua_State* tolua_S)
Lua__cPawn* self = (Lua__cPawn*) tolua_tousertype(tolua_S,1,0); Lua__cPawn* self = (Lua__cPawn*) tolua_tousertype(tolua_S,1,0);
cEntity* a_Entity = ((cEntity*) tolua_tousertype(tolua_S,2,0)); cEntity* a_Entity = ((cEntity*) tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPawn__TeleportTo'", NULL); if (!self) tolua_error(tolua_S,"invalid 'self' in function 'cPawn__TeleportToEntity'", NULL);
#endif #endif
{ {
self->cPawn__TeleportTo(a_Entity); self->cPawn__TeleportToEntity(a_Entity);
} }
} }
return 0; return 0;
#ifndef TOLUA_RELEASE #ifndef TOLUA_RELEASE
tolua_lerror: tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'cPawn__TeleportTo'.",&tolua_err); tolua_error(tolua_S,"#ferror in function 'cPawn__TeleportToEntity'.",&tolua_err);
return 0; return 0;
#endif #endif
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: cPawn__TeleportTo of class Lua__cPawn */ /* method: cPawn__TeleportTo of class Lua__cPawn */
#ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo01 #ifndef TOLUA_DISABLE_tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00
static int tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo01(lua_State* tolua_S) static int tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00(lua_State* tolua_S)
{ {
#ifndef TOLUA_RELEASE
tolua_Error tolua_err; tolua_Error tolua_err;
if ( if (
!tolua_isusertype(tolua_S,1,"Lua__cPawn",0,&tolua_err) || !tolua_isusertype(tolua_S,1,"Lua__cPawn",0,&tolua_err) ||
@ -4755,6 +4761,7 @@ static int tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo01(lua_State* tolua_S)
) )
goto tolua_lerror; goto tolua_lerror;
else else
#endif
{ {
Lua__cPawn* self = (Lua__cPawn*) tolua_tousertype(tolua_S,1,0); Lua__cPawn* self = (Lua__cPawn*) tolua_tousertype(tolua_S,1,0);
const double a_PosX = ((const double) tolua_tonumber(tolua_S,2,0)); const double a_PosX = ((const double) tolua_tonumber(tolua_S,2,0));
@ -4771,8 +4778,11 @@ static int tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo01(lua_State* tolua_S)
} }
} }
return 3; return 3;
#ifndef TOLUA_RELEASE
tolua_lerror: tolua_lerror:
return tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00(tolua_S); tolua_error(tolua_S,"#ferror in function 'cPawn__TeleportTo'.",&tolua_err);
return 0;
#endif
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
@ -5967,6 +5977,14 @@ public:
} else { } else {
return ( void ) cPlayer:: MoveTo(a_NewPos); return ( void ) cPlayer:: MoveTo(a_NewPos);
}; };
};
void TeleportToEntity( cEntity* a_Entity) {
if (push_method("TeleportToEntity", tolua_AllToLua_cPawn_TeleportToEntity00)) {
tolua_pushusertype(lua_state, (void*)a_Entity, "cEntity");
ToluaBase::dbcall(lua_state, 2, 0);
} else {
return ( void ) cPlayer:: TeleportToEntity(a_Entity);
};
}; };
void TakeDamage( int a_Damage, cEntity* a_Instigator) { void TakeDamage( int a_Damage, cEntity* a_Instigator) {
if (push_method("TakeDamage", tolua_AllToLua_cPawn_TakeDamage00)) { if (push_method("TakeDamage", tolua_AllToLua_cPawn_TakeDamage00)) {
@ -6039,6 +6057,9 @@ public:
}; };
void cPlayer__MoveTo( const Vector3d& a_NewPos) { void cPlayer__MoveTo( const Vector3d& a_NewPos) {
return ( void )cPlayer::MoveTo(a_NewPos); return ( void )cPlayer::MoveTo(a_NewPos);
};
void cPlayer__TeleportToEntity( cEntity* a_Entity) {
return ( void )cPlayer::TeleportToEntity(a_Entity);
}; };
void cPlayer__TakeDamage( int a_Damage, cEntity* a_Instigator) { void cPlayer__TakeDamage( int a_Damage, cEntity* a_Instigator) {
return ( void )cPlayer::TakeDamage(a_Damage,a_Instigator); return ( void )cPlayer::TakeDamage(a_Damage,a_Instigator);
@ -17365,8 +17386,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cPawn","cPawn","cEntity",NULL); tolua_cclass(tolua_S,"cPawn","cPawn","cEntity",NULL);
tolua_beginmodule(tolua_S,"cPawn"); tolua_beginmodule(tolua_S,"cPawn");
tolua_function(tolua_S,"TeleportToEntity",tolua_AllToLua_cPawn_TeleportToEntity00);
tolua_function(tolua_S,"TeleportTo",tolua_AllToLua_cPawn_TeleportTo00); tolua_function(tolua_S,"TeleportTo",tolua_AllToLua_cPawn_TeleportTo00);
tolua_function(tolua_S,"TeleportTo",tolua_AllToLua_cPawn_TeleportTo01);
tolua_function(tolua_S,"Heal",tolua_AllToLua_cPawn_Heal00); tolua_function(tolua_S,"Heal",tolua_AllToLua_cPawn_Heal00);
tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cPawn_TakeDamage00); tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cPawn_TakeDamage00);
tolua_function(tolua_S,"KilledBy",tolua_AllToLua_cPawn_KilledBy00); tolua_function(tolua_S,"KilledBy",tolua_AllToLua_cPawn_KilledBy00);
@ -17375,8 +17396,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_cclass(tolua_S,"Lua__cPawn","Lua__cPawn","cPawn",NULL); tolua_cclass(tolua_S,"Lua__cPawn","Lua__cPawn","cPawn",NULL);
tolua_beginmodule(tolua_S,"Lua__cPawn"); tolua_beginmodule(tolua_S,"Lua__cPawn");
tolua_function(tolua_S,"tolua__set_instance",tolua_AllToLua_Lua__cPawn_tolua__set_instance00); tolua_function(tolua_S,"tolua__set_instance",tolua_AllToLua_Lua__cPawn_tolua__set_instance00);
tolua_function(tolua_S,"cPawn__TeleportToEntity",tolua_AllToLua_Lua__cPawn_cPawn__TeleportToEntity00);
tolua_function(tolua_S,"cPawn__TeleportTo",tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00); tolua_function(tolua_S,"cPawn__TeleportTo",tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo00);
tolua_function(tolua_S,"cPawn__TeleportTo",tolua_AllToLua_Lua__cPawn_cPawn__TeleportTo01);
tolua_function(tolua_S,"cPawn__TakeDamage",tolua_AllToLua_Lua__cPawn_cPawn__TakeDamage00); tolua_function(tolua_S,"cPawn__TakeDamage",tolua_AllToLua_Lua__cPawn_cPawn__TakeDamage00);
tolua_function(tolua_S,"cPawn__KilledBy",tolua_AllToLua_Lua__cPawn_cPawn__KilledBy00); tolua_function(tolua_S,"cPawn__KilledBy",tolua_AllToLua_Lua__cPawn_cPawn__KilledBy00);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 02/16/12 18:16:17. ** Generated automatically by tolua++-1.0.92 on 02/22/12 16:44:22.
*/ */
/* Exported function */ /* Exported function */

View File

@ -111,7 +111,7 @@ void cPawn::KilledBy( cEntity* a_Killer )
void cPawn::TeleportTo( cEntity* a_Entity ) void cPawn::TeleportToEntity( cEntity* a_Entity )
{ {
TeleportTo( a_Entity->GetPosX(), a_Entity->GetPosY(), a_Entity->GetPosZ() ); TeleportTo( a_Entity->GetPosX(), a_Entity->GetPosY(), a_Entity->GetPosZ() );
} }

View File

@ -25,7 +25,7 @@ public:
cPawn(); cPawn();
virtual ~cPawn(); virtual ~cPawn();
virtual void TeleportTo( cEntity* a_Entity ); //tolua_export virtual void TeleportToEntity( cEntity* a_Entity ); //tolua_export
virtual void TeleportTo( const double & a_PosX, const double & a_PosY, const double & a_PosZ ); //tolua_export virtual void TeleportTo( const double & a_PosX, const double & a_PosY, const double & a_PosZ ); //tolua_export
virtual void Tick(float a_Dt) override; virtual void Tick(float a_Dt) override;