2020-06-26 20:34:22 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ItemHandler.h"
|
|
|
|
|
2020-07-14 17:28:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-01 23:31:10 +00:00
|
|
|
class cSimplePlaceableItemHandler final:
|
2020-06-26 20:34:22 +00:00
|
|
|
public cItemHandler
|
|
|
|
{
|
|
|
|
using Super = cItemHandler;
|
|
|
|
|
|
|
|
public:
|
2020-07-14 17:28:06 +00:00
|
|
|
|
2021-12-01 23:31:10 +00:00
|
|
|
constexpr cSimplePlaceableItemHandler(int a_ItemType, BLOCKTYPE a_BlockType) :
|
2020-07-14 17:28:06 +00:00
|
|
|
Super(a_ItemType),
|
|
|
|
m_BlockType(a_BlockType)
|
2020-06-26 20:34:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-01 23:31:10 +00:00
|
|
|
virtual bool IsPlaceable(void) const override
|
2020-06-26 20:34:22 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-01 23:31:10 +00:00
|
|
|
virtual bool CommitPlacement(cPlayer & a_Player, const cItem & a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) const override
|
2020-06-26 20:34:22 +00:00
|
|
|
{
|
2021-05-05 13:25:10 +00:00
|
|
|
return a_Player.PlaceBlock(a_PlacePosition, m_BlockType, 0);
|
2020-06-26 20:34:22 +00:00
|
|
|
}
|
|
|
|
|
2020-07-14 17:28:06 +00:00
|
|
|
private:
|
|
|
|
|
2020-06-26 20:34:22 +00:00
|
|
|
BLOCKTYPE m_BlockType;
|
|
|
|
};
|