1
0

BlockBed.cpp: Fixed Multiple people in one bed.

OnUse in BlockBed.cpp now checks whether bit flag 0x4 in the Data values of the bed is set before somebody can try to sleep in the bed.
This commit is contained in:
TheJumper 2014-02-20 16:26:50 +01:00
parent ea2420e8b4
commit 8716263238

View File

@ -63,6 +63,12 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
if (a_WorldInterface.GetTimeOfDay() > 13000)
{
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if(Meta & 0x4)
{
a_Player->SendMessageFailure("This bed is occupied.");
}
else
{
if (Meta & 0x8)
{
// Is pillow
@ -77,6 +83,9 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface
a_WorldInterface.GetBroadcastManager().BroadcastUseBed(*a_Player, a_BlockX + Direction.x, a_BlockY, a_BlockZ + Direction.z);
}
}
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, (Meta | (1 << 2)));
}
} else {
a_Player->SendMessageFailure("You can only sleep at night");
}
@ -86,3 +95,5 @@ void cBlockBedHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface