2012-12-19 16:19:36 -05:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2013-05-25 07:59:13 -04:00
|
|
|
#include "BlockEntityWithItems.h"
|
2012-12-19 16:19:36 -05:00
|
|
|
#include "UI/WindowOwner.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Json
|
|
|
|
{
|
|
|
|
class Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
class cClientHandle;
|
|
|
|
class cServer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-25 07:59:13 -04:00
|
|
|
// tolua_begin
|
2012-12-19 16:19:36 -05:00
|
|
|
class cDispenserEntity :
|
2013-05-25 07:59:13 -04:00
|
|
|
public cBlockEntityWithItems,
|
2012-12-19 16:19:36 -05:00
|
|
|
public cBlockEntityWindowOwner
|
|
|
|
{
|
2013-05-25 07:59:13 -04:00
|
|
|
typedef cBlockEntityWithItems super;
|
|
|
|
|
2012-12-19 16:19:36 -05:00
|
|
|
public:
|
2013-05-25 07:59:13 -04:00
|
|
|
enum {
|
|
|
|
ContentsHeight = 3,
|
|
|
|
ContentsWidth = 3,
|
|
|
|
} ;
|
|
|
|
|
|
|
|
/// Constructor used while generating a chunk; sets m_World to NULL
|
|
|
|
cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ);
|
|
|
|
|
|
|
|
// tolua_end
|
|
|
|
|
|
|
|
/// Constructor used for normal operation
|
|
|
|
cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
|
2012-12-19 16:19:36 -05:00
|
|
|
virtual ~cDispenserEntity();
|
2013-05-25 07:59:13 -04:00
|
|
|
|
|
|
|
static const char * GetClassStatic(void) { return "cDispenserEntity"; }
|
2012-12-19 16:19:36 -05:00
|
|
|
|
2013-04-01 16:56:25 -04:00
|
|
|
bool LoadFromJson(const Json::Value & a_Value);
|
2012-12-19 16:19:36 -05:00
|
|
|
|
2013-04-01 16:56:25 -04:00
|
|
|
// cBlockEntity overrides:
|
|
|
|
virtual void SaveToJson(Json::Value & a_Value) override;
|
|
|
|
virtual void SendTo(cClientHandle & a_Client) override;
|
|
|
|
virtual bool Tick(float a_Dt) override;
|
|
|
|
virtual void UsedBy(cPlayer * a_Player) override;
|
2012-12-19 16:19:36 -05:00
|
|
|
|
2013-05-25 07:59:13 -04:00
|
|
|
// tolua_begin
|
2012-12-19 16:19:36 -05:00
|
|
|
|
2013-04-10 17:40:30 -04:00
|
|
|
/// Sets the dispenser to dispense an item in the next tick
|
|
|
|
void Activate(void);
|
|
|
|
|
2013-05-25 07:59:13 -04:00
|
|
|
// tolua_end
|
|
|
|
|
2012-12-19 16:19:36 -05:00
|
|
|
private:
|
2013-05-25 07:59:13 -04:00
|
|
|
bool m_ShouldDispense; ///< If true, the dispenser will dispense an item in the next tick
|
2012-12-26 12:16:33 -05:00
|
|
|
|
2013-04-10 17:40:30 -04:00
|
|
|
void Dispense(void);
|
2013-05-25 07:59:13 -04:00
|
|
|
} ; // tolua_export
|
2012-12-19 16:19:36 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|