1
0
Fork 0
cuberite-2a/src/BlockEntities/CommandBlockEntity.h

74 lines
1.5 KiB
C
Raw Permalink Normal View History

2014-01-18 13:16:47 +00:00
// CommandBlockEntity.h
// Declares the cCommandBlockEntity class representing a single command block in the world
#pragma once
2014-01-18 19:27:54 +00:00
#include "BlockEntity.h"
2014-01-18 13:16:47 +00:00
// tolua_begin
2014-07-17 20:50:58 +00:00
class cCommandBlockEntity :
public cBlockEntity
2014-01-18 13:16:47 +00:00
{
// tolua_end
2016-02-05 21:45:45 +00:00
2020-04-13 16:38:06 +00:00
using Super = cBlockEntity;
2014-01-18 13:16:47 +00:00
public: // tolua_export
2016-02-05 21:45:45 +00:00
2015-07-31 14:49:10 +00:00
/** Creates a new empty command block entity */
cCommandBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
2014-01-18 13:16:47 +00:00
2017-06-15 13:32:33 +00:00
// cBlockEntity overrides:
virtual void CopyFrom(const cBlockEntity & a_Src) override;
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
2014-01-18 13:16:47 +00:00
virtual void SendTo(cClientHandle & a_Client) override;
virtual bool UsedBy(cPlayer * a_Player) override;
2014-01-18 13:16:47 +00:00
2014-01-18 13:40:47 +00:00
void SetLastOutput(const AString & a_LastOut);
void SetResult(const NIBBLETYPE a_Result);
2014-01-18 13:16:47 +00:00
// tolua_begin
2015-07-31 14:49:10 +00:00
/** Sets the command block to execute a command in the next tick */
2014-01-18 13:16:47 +00:00
void Activate(void);
2016-02-05 21:45:45 +00:00
2015-07-31 14:49:10 +00:00
/** Sets the command */
2014-01-18 13:16:47 +00:00
void SetCommand(const AString & a_Cmd);
2015-07-31 14:49:10 +00:00
/** Retrieves stored command */
2014-01-18 13:16:47 +00:00
const AString & GetCommand(void) const;
2015-07-31 14:49:10 +00:00
/** Retrieves the last line of output generated by the command block */
2014-01-18 13:16:47 +00:00
const AString & GetLastOutput(void) const;
2014-01-18 13:40:47 +00:00
2015-07-31 14:49:10 +00:00
/** Retrieves the result (signal strength) of the last operation */
2014-01-18 13:40:47 +00:00
NIBBLETYPE GetResult(void) const;
2016-02-05 21:45:45 +00:00
2014-01-18 13:16:47 +00:00
// tolua_end
2016-02-05 21:45:45 +00:00
2014-01-18 13:16:47 +00:00
private:
2015-07-31 14:49:10 +00:00
/** Executes the associated command */
2014-01-18 13:16:47 +00:00
void Execute();
bool m_ShouldExecute;
2014-01-18 13:40:47 +00:00
AString m_Command;
AString m_LastOutput;
2014-01-18 13:16:47 +00:00
2014-01-18 13:40:47 +00:00
NIBBLETYPE m_Result;
2014-01-18 13:16:47 +00:00
} ; // tolua_export