1
0
Fork 0

Exporded World:FindClosestPlayer, Item:IsEnchantable and Monster:MoveToPosition to Lua API

This commit is contained in:
tonibm19 2014-02-03 20:52:11 +01:00
parent 2450d0467f
commit c2e7dd34d9
6 changed files with 13 additions and 3 deletions

View File

@ -158,6 +158,7 @@ public:
double GetHeight (void) const { return m_Height; }
double GetMass (void) const { return m_Mass; }
const Vector3d & GetPosition (void) const { return m_Pos; }
const Vector3d & GetPosition (void) const { return m_Pos; }
double GetPosX (void) const { return m_Pos.x; }
double GetPosY (void) const { return m_Pos.y; }
double GetPosZ (void) const { return m_Pos.z; }

View File

@ -167,7 +167,7 @@ public:
void FromJson(const Json::Value & a_Value);
/// Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements)
static bool IsEnchantable(short a_ItemType);
static bool IsEnchantable(short a_ItemType); // tolua_export
// tolua_begin

View File

@ -188,6 +188,14 @@ void cMonster::MoveToPosition(const Vector3f & a_Position)
TickPathFinding();
}
void cMonster::MoveToPosition(const Vector3d & a_Position)
{
FinishPathFinding();
m_FinalDestination = a_Position;
m_bMovingToDestination = true;
TickPathFinding();
}

View File

@ -91,6 +91,7 @@ public:
virtual void KilledBy(cEntity * a_Killer) override;
virtual void MoveToPosition(const Vector3f & a_Position);
virtual void MoveToPosition(const Vector3d & a_Position); // tolua_export
virtual bool ReachedDestination(void);
// tolua_begin

View File

@ -2339,7 +2339,7 @@ bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCa
// TODO: This interface is dangerous!
cPlayer * cWorld::FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit, bool a_CheckLineOfSight)
cPlayer * cWorld::FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight)
{
cTracer LineOfSight(this);

View File

@ -248,7 +248,7 @@ public:
bool FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback); // >> EXPORTED IN MANUALBINDINGS <<
// TODO: This interface is dangerous - rewrite to DoWithClosestPlayer(pos, sight, action)
cPlayer * FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit, bool a_CheckLineOfSight = true);
cPlayer * FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit, bool a_CheckLineOfSight = true); // tolua_export
void SendPlayerList(cPlayer * a_DestPlayer); // Sends playerlist to the player