1
0
Fork 0
cuberite-2a/src/BlockInfo.h

77 lines
2.1 KiB
C
Raw Normal View History

#pragma once
2014-03-02 08:50:24 +00:00
// tolua_begin
2014-03-01 19:34:19 +00:00
class cBlockInfo
{
public:
2014-03-02 08:50:24 +00:00
// tolua_end
2014-03-01 19:34:19 +00:00
cBlockInfo();
/** (Re-)Initializes the internal BlockInfo structures. */
static void Initialize(void);
2014-03-02 08:50:24 +00:00
// tolua_begin
/** Returns the associated BlockInfo structure. */
2014-03-02 14:24:09 +00:00
static cBlockInfo & Get(BLOCKTYPE a_Type);
2014-03-01 19:34:19 +00:00
/** How much light do the blocks emit on their own? */
NIBBLETYPE m_LightValue;
2014-03-01 19:34:19 +00:00
/** How much light do the blocks consume? */
NIBBLETYPE m_SpreadLightFalloff;
2014-03-01 19:34:19 +00:00
/** Is a block completely transparent? (light doesn't get decreased(?)) */
bool m_Transparent;
2014-03-01 19:34:19 +00:00
/** Is a block destroyed after a single hit? */
bool m_OneHitDig;
2014-03-01 19:34:19 +00:00
/** Can a piston break this block? */
bool m_PistonBreakable;
2014-03-01 19:34:19 +00:00
/** Can this block hold snow atop? */
bool m_IsSnowable;
2014-03-01 19:34:19 +00:00
/** Does this block require a tool to drop? */
bool m_RequiresSpecialTool;
2014-03-01 19:34:19 +00:00
/** Is this block solid (player cannot walk through)? */
bool m_IsSolid;
2014-03-01 19:34:19 +00:00
2014-03-02 08:50:24 +00:00
/** Does this block fully occupy its voxel - is it a 'full' block? */
bool m_FullyOccupiesVoxel;
2014-03-02 14:24:09 +00:00
inline static NIBBLETYPE GetLightValue (BLOCKTYPE a_Type) { return Get(a_Type).m_LightValue; }
inline static NIBBLETYPE GetSpreadLightFalloff(BLOCKTYPE a_Type) { return Get(a_Type).m_SpreadLightFalloff; }
inline static bool IsTransparent (BLOCKTYPE a_Type) { return Get(a_Type).m_Transparent; }
inline static bool IsOneHitDig (BLOCKTYPE a_Type) { return Get(a_Type).m_OneHitDig; }
inline static bool IsPistonBreakable (BLOCKTYPE a_Type) { return Get(a_Type).m_PistonBreakable; }
inline static bool IsSnowable (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSnowable; }
inline static bool RequiresSpecialTool (BLOCKTYPE a_Type) { return Get(a_Type).m_RequiresSpecialTool; }
inline static bool IsSolid (BLOCKTYPE a_Type) { return Get(a_Type).m_IsSolid; }
inline static bool FullyOccupiesVoxel (BLOCKTYPE a_Type) { return Get(a_Type).m_FullyOccupiesVoxel; }
2014-03-02 08:50:24 +00:00
// tolua_end
protected:
// TODO xdot: Change to std::vector to support dynamic block IDs
2014-03-01 19:34:19 +00:00
static cBlockInfo ms_Info[256];
2014-03-02 08:50:24 +00:00
}; // tolua_export