Disable block placement in adventure mode (#4424)
This commit is contained in:
parent
2894ce3812
commit
5074527d2c
@ -1452,8 +1452,8 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
|
|||||||
World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
World->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||||
cBlockHandler * BlockHandler = cBlockInfo::GetHandler(BlockType);
|
cBlockHandler * BlockHandler = cBlockInfo::GetHandler(BlockType);
|
||||||
|
|
||||||
bool Placeable = ItemHandler->IsPlaceable() && !m_Player->IsGameModeSpectator();
|
bool Placeable = ItemHandler->IsPlaceable() && !m_Player->IsGameModeAdventure() && !m_Player->IsGameModeSpectator();
|
||||||
bool BlockUsable = BlockHandler->IsUseable() && (!m_Player->IsGameModeSpectator() || cBlockInfo::IsUseableBySpectator(BlockType));
|
bool BlockUsable = BlockHandler->IsUseable() && !m_Player->IsGameModeAdventure() && (!m_Player->IsGameModeSpectator() || cBlockInfo::IsUseableBySpectator(BlockType));
|
||||||
|
|
||||||
if (BlockUsable && !(m_Player->IsCrouched() && !HeldItem.IsEmpty()))
|
if (BlockUsable && !(m_Player->IsCrouched() && !HeldItem.IsEmpty()))
|
||||||
{
|
{
|
||||||
|
@ -46,6 +46,12 @@ public:
|
|||||||
|
|
||||||
bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
|
bool ScoopUpFluid(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace)
|
||||||
{
|
{
|
||||||
|
// Players can't pick up fluid while in adventure mode.
|
||||||
|
if (a_Player->IsGameModeAdventure())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (a_BlockFace != BLOCK_FACE_NONE)
|
if (a_BlockFace != BLOCK_FACE_NONE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -121,6 +127,12 @@ public:
|
|||||||
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock
|
int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
// Players can't place fluid while in adventure mode.
|
||||||
|
if (a_Player->IsGameModeAdventure())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (a_BlockFace != BLOCK_FACE_NONE)
|
if (a_BlockFace != BLOCK_FACE_NONE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -44,6 +44,12 @@ public:
|
|||||||
}
|
}
|
||||||
else if ((a_Item.m_ItemDamage == E_META_DYE_BROWN) && (a_BlockFace >= BLOCK_FACE_ZM) && (a_BlockFace <= BLOCK_FACE_XP))
|
else if ((a_Item.m_ItemDamage == E_META_DYE_BROWN) && (a_BlockFace >= BLOCK_FACE_ZM) && (a_BlockFace <= BLOCK_FACE_XP))
|
||||||
{
|
{
|
||||||
|
// Players can't place blocks while in adventure mode.
|
||||||
|
if (a_Player->IsGameModeAdventure())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Cocoa (brown dye) can be planted on jungle logs:
|
// Cocoa (brown dye) can be planted on jungle logs:
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
|
Loading…
Reference in New Issue
Block a user