virtual bool Item(cChestEntity * a_Chest) override { // The primary chest should eb the one with lesser X or Z coord: cChestEntity * Primary = a_Chest; cChestEntity * Secondary = m_ThisChest; if ( (Primary->GetPosX() > Secondary->GetPosX()) || (Primary->GetPosZ() > Secondary->GetPosZ()) ) { std::swap(Primary, Secondary); } m_ThisChest->OpenWindow(new cChestWindow(Primary, Secondary)); return false; }
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: cChestEntity * Primary = a_Chest; cChestEntity * Secondary = m_ThisChest; if ( (Primary->GetPosX() > Secondary->GetPosX()) || (Primary->GetPosZ() > Secondary->GetPosZ()) ) { std::swap(Primary, Secondary); } m_ThisChest->OpenWindow(new cChestWindow(Primary, Secondary)); return false; }