1
0

Exported cBlockInfo

This commit is contained in:
andrew 2014-03-02 10:50:24 +02:00
parent d73cdba1f6
commit 3ca56b39bc
3 changed files with 41 additions and 3 deletions

View File

@ -290,6 +290,38 @@ g_APIDesc =
}, -- AdditionalInfo
}, -- cBlockArea
cBlockInfo =
{
Desc = [[
This class is used to query and register block properties.
]],
Functions =
{
FullyOccupiesVoxel = { Params = "ID", Return = "bool", Notes = "Returns whether the specified block fully occupies its voxel." },
GetById = { Params = "ID", Return = "{{cBlockInfo}}", Notes = "Returns the {{cBlockInfo}} structure for the block with the specified ID." },
GetLightValue = { Params = "ID", Return = "number", Notes = "Returns how much light the specified block emits on its own." },
GetSpreadLightFalloff = { Params = "ID", Return = "number", Notes = "Returns how much light the specified block consumes." },
IsOneHitDig = { Params = "ID", Return = "bool", Notes = "Returns whether the specified block will be destroyed after a single hit." },
IsPistonBreakable = { Params = "ID", Return = "bool", Notes = "Returns whether a piston can break the specified block." },
IsSnowable = { Params = "ID", Return = "bool", Notes = "Returns whether the specified block can hold snow atop." },
IsSolid = { Params = "ID", Return = "bool", Notes = "Returns whether the specified block is solid." },
IsTransparent = { Params = "ID", Return = "bool", Notes = "Returns whether the specified block is transparent." },
RequiresSpecialTool = { Params = "ID", Return = "bool", Notes = "Returns whether the specified block requires a special tool to drop." },
},
Variables =
{
m_FullyOccupiesVoxel = { Type = "bool", Notes = "Does this block fully occupy its voxel - is it a 'full' block?" },
m_IsSnowable = { Type = "bool", Notes = "Can this block hold snow atop?" },
m_IsSolid = { Type = "bool", Notes = "Is this block solid (player cannot walk through)?" },
m_LightValue = { Type = "number", Notes = "How much light do the blocks emit on their own?" },
m_OneHitDig = { Type = "bool", Notes = "Is a block destroyed after a single hit?" },
m_PistonBreakable = { Type = "bool", Notes = "Can a piston break this block?" },
m_RequiresSpecialTool = { Type = "bool", Notes = "Does this block require a tool to drop?" },
m_SpreadLightFalloff = { Type = "number", Notes = "How much light do the blocks consume?" },
m_Transparent = { Type = "bool", Notes = "Is a block completely transparent? (light doesn't get decreased(?))" },
},
}, -- cBlockInfo
cChatColor =
{
Desc = [[

View File

@ -26,6 +26,7 @@ $cfile "WebPlugin.h"
$cfile "LuaWindow.h"
$cfile "../BlockID.h"
$cfile "../BlockInfo.h"
$cfile "../StringUtils.h"
$cfile "../Defines.h"
$cfile "../ChatColor.h"

View File

@ -5,16 +5,19 @@
// tolua_begin
class cBlockInfo
{
public:
// tolua_end
cBlockInfo();
/** (Re-)Initializes the internal BlockInfo structures. */
static void Initialize(void);
// tolua_begin
/** Returns the associated BlockInfo structure. */
static cBlockInfo & GetById(unsigned int a_ID);
@ -43,7 +46,7 @@ public:
/** Is this block solid (player cannot walk through)? */
bool m_IsSolid;
/** Does this block fully occupy it's voxel - is it a 'full' block? */
/** Does this block fully occupy its voxel - is it a 'full' block? */
bool m_FullyOccupiesVoxel;
@ -57,6 +60,8 @@ public:
inline static bool IsSolid (unsigned int a_ID) { return GetById(a_ID).m_IsSolid; }
inline static bool FullyOccupiesVoxel (unsigned int a_ID) { return GetById(a_ID).m_FullyOccupiesVoxel; }
// tolua_end
protected:
@ -64,7 +69,7 @@ protected:
static cBlockInfo ms_Info[256];
};
}; // tolua_export