1
0

Exported cFallingBlock and cExpOrb (#3700)

This commit is contained in:
Lukas Pioch 2017-05-09 14:24:41 +02:00 committed by Mattes D
parent 3d5ee3e5c7
commit 7c4576a025
5 changed files with 108 additions and 6 deletions

View File

@ -6004,6 +6004,10 @@ local Hash = cCryptoHash.sha1HexString("DataToHash")
}, },
Constants = Constants =
{ {
INVALID_ID =
{
Notes = "Special value of an entity ID, indicating a failure. Used primarily in functions that create entities when the entity cannot be created.",
},
etBoat = etBoat =
{ {
Notes = "The entity is a {{cBoat}}", Notes = "The entity is a {{cBoat}}",
@ -10922,12 +10926,95 @@ a_Player:OpenWindow(Window);
}, },
Inherits = "cEntity", Inherits = "cEntity",
}, },
cExpOrb =
{
Desc = [[
This class represents an experience orb. This entity can be spawned by using {{cWorld#SpawnExperienceOrb_1|cWorld:SpawnExperienceOrb}}.
It's also spawned when a monster is killed or a player is mining coal. The default lifetime of an experience orb is 5 mins.
]],
Functions =
{
GetAge =
{
Returns =
{
{
Type = "number"
},
},
Notes = "Returns the number of ticks that this experience orb has existed.",
},
SetAge =
{
Params =
{
{
Type = "number",
},
},
Notes = "Sets the experience orb's age, in ticks.",
},
GetReward =
{
Returns =
{
{
Type = "number",
},
},
Notes = "Returns the experience amount.",
},
SetReward =
{
Params =
{
{
Type = "number",
},
},
Notes = "Sets the experience amount.",
},
},
Inherits = "cEntity",
},
cFallingBlock =
{
Desc = [[
This class represents a falling block. This entity can be spawned by using {{cWorld#SpawnFallingBlock_1|cWorld:SpawnFallingBlock}}.
]],
Functions =
{
GetBlockType =
{
Returns =
{
{
Name = "BlockType",
Type = "number",
}
},
Notes = "Returns the block type of the falling block.",
},
GetBlockMeta =
{
Returns =
{
{
Name = "BlockMeta",
Type = "number",
}
},
Notes = "Returns the block meta of the falling block.",
},
},
Inherits = "cEntity",
},
cPickup = cPickup =
{ {
Desc = [[ Desc = [[
This class represents a pickup entity (an item that the player or mobs can pick up). It is also This class represents a pickup entity (an item that the player or mobs can pick up). It is also
commonly known as "drops". With this class you could create your own "drop" or modify those commonly known as "drops". With this class you could create your own "drop" or modify those
created automatically. created automatically. The default lifetime of a pickup is 5 mins.
]], ]],
Functions = Functions =
{ {

View File

@ -75,6 +75,8 @@ $cfile "../Entities/ProjectileEntity.h"
$cfile "../Entities/ArrowEntity.h" $cfile "../Entities/ArrowEntity.h"
$cfile "../Entities/EntityEffect.h" $cfile "../Entities/EntityEffect.h"
$cfile "../Entities/ExpBottleEntity.h" $cfile "../Entities/ExpBottleEntity.h"
$cfile "../Entities/ExpOrb.h"
$cfile "../Entities/FallingBlock.h"
$cfile "../Entities/FireChargeEntity.h" $cfile "../Entities/FireChargeEntity.h"
$cfile "../Entities/FireworkEntity.h" $cfile "../Entities/FireworkEntity.h"
$cfile "../Entities/Floater.h" $cfile "../Entities/Floater.h"

View File

@ -94,8 +94,10 @@ set(BINDING_DEPENDENCIES
../Enchantments.h ../Enchantments.h
../Entities/ArrowEntity.h ../Entities/ArrowEntity.h
../Entities/Entity.h ../Entities/Entity.h
../Entities/ExpOrb.h
../Entities/EntityEffect.h ../Entities/EntityEffect.h
../Entities/ExpBottleEntity.h ../Entities/ExpBottleEntity.h
../Entities/FallingBlock.h
../Entities/FireChargeEntity.h ../Entities/FireChargeEntity.h
../Entities/FireworkEntity.h ../Entities/FireworkEntity.h
../Entities/Floater.h ../Entities/Floater.h

View File

@ -25,17 +25,21 @@ public:
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void SpawnOn(cClientHandle & a_Client) override; virtual void SpawnOn(cClientHandle & a_Client) override;
// tolua_begin
/** Returns the number of ticks that this entity has existed */ /** Returns the number of ticks that this entity has existed */
int GetAge(void) const { return std::chrono::duration_cast<cTickTime>(m_Timer).count(); } // tolua_export int GetAge(void) const { return std::chrono::duration_cast<cTickTime>(m_Timer).count(); }
/** Set the number of ticks that this entity has existed */ /** Set the number of ticks that this entity has existed */
void SetAge(int a_Age) { m_Timer = cTickTime(a_Age); } // tolua_export void SetAge(int a_Age) { m_Timer = cTickTime(a_Age); }
/** Get the exp amount */ /** Get the exp amount */
int GetReward(void) const { return m_Reward; } // tolua_export int GetReward(void) const { return m_Reward; }
/** Set the exp amount */ /** Set the exp amount */
void SetReward(int a_Reward) { m_Reward = a_Reward; } // tolua_export void SetReward(int a_Reward) { m_Reward = a_Reward; }
// tolua_end
protected: protected:
int m_Reward; int m_Reward;

View File

@ -13,6 +13,7 @@ class cItem;
// tolua_begin
class cFallingBlock : class cFallingBlock :
public cEntity public cEntity
@ -20,14 +21,20 @@ class cFallingBlock :
typedef cEntity super; typedef cEntity super;
public: public:
// tolua_end
CLASS_PROTODEF(cFallingBlock) CLASS_PROTODEF(cFallingBlock)
/** Creates a new falling block. a_BlockPosition is expected in world coords */ /** Creates a new falling block. a_BlockPosition is expected in world coords */
cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); cFallingBlock(const Vector3i & a_BlockPosition, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
// tolua_begin
BLOCKTYPE GetBlockType(void) const { return m_BlockType; } BLOCKTYPE GetBlockType(void) const { return m_BlockType; }
NIBBLETYPE GetBlockMeta(void) const { return m_BlockMeta; } NIBBLETYPE GetBlockMeta(void) const { return m_BlockMeta; }
// tolua_end
// cEntity overrides: // cEntity overrides:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override; virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
@ -36,7 +43,7 @@ private:
BLOCKTYPE m_BlockType; BLOCKTYPE m_BlockType;
NIBBLETYPE m_BlockMeta; NIBBLETYPE m_BlockMeta;
Vector3i m_OriginalPosition; // Position where the falling block has started, in world coords Vector3i m_OriginalPosition; // Position where the falling block has started, in world coords
} ; } ; // tolua_export