Merge pull request #635 from tonibm19/master
Exported Item:IsEnchantable and Monster:MoveToPosition to Lua API
This commit is contained in:
commit
0ceb0ef607
@ -1103,6 +1103,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins,
|
||||
GetMaxStackSize = { Params = "", Return = "number", Notes = "Returns the maximum stack size for this item." },
|
||||
IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" },
|
||||
IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" },
|
||||
IsEnchantable = { Params = "", Return = "bool", Notes = "Returns true if the item is enchantable" },
|
||||
IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage and enchantments)" },
|
||||
IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" },
|
||||
IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object. This is true even if the two items have different enchantments" },
|
||||
@ -1479,6 +1480,7 @@ a_Player:OpenWindow(Window);
|
||||
GetMobType = { Params = "", Return = "{{cMonster#MobType|MobType}}", Notes = "Returns the type of this mob ({{cMonster#MobType|mtXXX}} constant)" },
|
||||
GetSpawnDelay = { Params = "{{cMonster#MobFamily|MobFamily}}", Return = "number", Notes = "(STATIC) Returns the spawn delay - the number of game ticks between spawn attempts - for the specified mob family." },
|
||||
MobTypeToString = { Params = "{{cMonster#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{cMonster#MobType|mtXXX}} constant), or empty string if unknown type." },
|
||||
MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" },
|
||||
StringToMobType = { Params = "string", Return = "{{cMonster#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{cMonster#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." },
|
||||
},
|
||||
Constants =
|
||||
|
@ -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
|
||||
|
||||
|
@ -191,6 +191,18 @@ void cMonster::MoveToPosition(const Vector3f & a_Position)
|
||||
|
||||
|
||||
|
||||
|
||||
void cMonster::MoveToPosition(const Vector3d & a_Position)
|
||||
{
|
||||
FinishPathFinding();
|
||||
|
||||
m_FinalDestination = a_Position;
|
||||
m_bMovingToDestination = true;
|
||||
TickPathFinding();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool cMonster::IsCoordinateInTraversedList(Vector3i a_Coords)
|
||||
{
|
||||
for (std::vector<Vector3i>::const_iterator itr = m_TraversedCoordinates.begin(); itr != m_TraversedCoordinates.end(); ++itr)
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
void SendPlayerList(cPlayer * a_DestPlayer); // Sends playerlist to the player
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user