Chests don't open if obstructed
* Fixes FS383
This commit is contained in:
parent
ede0f13b51
commit
b2bf466122
@ -122,6 +122,13 @@ void cChestEntity::UsedBy(cPlayer * a_Player)
|
|||||||
|
|
||||||
void cChestEntity::OpenNewWindow(void)
|
void cChestEntity::OpenNewWindow(void)
|
||||||
{
|
{
|
||||||
|
// TODO: cats are an obstruction
|
||||||
|
if ((GetPosY() + 1 < cChunkDef::Height) && cBlockInfo::IsSolid(GetWorld()->GetBlock(GetPosX(), GetPosY() + 1, GetPosZ())))
|
||||||
|
{
|
||||||
|
// Obstruction, don't open
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Callback for opening together with neighbor chest:
|
// Callback for opening together with neighbor chest:
|
||||||
class cOpenDouble :
|
class cOpenDouble :
|
||||||
public cChestCallback
|
public cChestCallback
|
||||||
@ -135,6 +142,12 @@ void cChestEntity::OpenNewWindow(void)
|
|||||||
|
|
||||||
virtual bool Item(cChestEntity * a_Chest) override
|
virtual bool Item(cChestEntity * a_Chest) override
|
||||||
{
|
{
|
||||||
|
if ((a_Chest->GetPosY() + 1 < cChunkDef::Height) && cBlockInfo::IsSolid(a_Chest->GetWorld()->GetBlock(a_Chest->GetPosX(), a_Chest->GetPosY() + 1, a_Chest->GetPosZ())))
|
||||||
|
{
|
||||||
|
// Obstruction, don't open
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// The primary chest should eb the one with lesser X or Z coord:
|
// The primary chest should eb the one with lesser X or Z coord:
|
||||||
cChestEntity * Primary = a_Chest;
|
cChestEntity * Primary = a_Chest;
|
||||||
cChestEntity * Secondary = m_ThisChest;
|
cChestEntity * Secondary = m_ThisChest;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user