From a10c4774f541028817c2a08dc6860fef252d0200 Mon Sep 17 00:00:00 2001 From: "luksor111@gmail.com" Date: Wed, 19 Dec 2012 09:29:53 +0000 Subject: Implemented double doors Implemented fence gate Updated g_BlockTransparent[] Doors can now only be opened by right clicking Doors will now drop when not supported by block git-svn-id: http://mc-server.googlecode.com/svn/trunk@1080 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Blocks/BlockDoor.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'source/Blocks/BlockDoor.cpp') diff --git a/source/Blocks/BlockDoor.cpp b/source/Blocks/BlockDoor.cpp index c0d616b37..1976e2f20 100644 --- a/source/Blocks/BlockDoor.cpp +++ b/source/Blocks/BlockDoor.cpp @@ -54,15 +54,6 @@ void cBlockDoorHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY -void cBlockDoorHandler::OnDigging(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) -{ - cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ); -} - - - - - void cBlockDoorHandler::OnUse(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) { cDoors::ChangeDoor(a_World, a_BlockX, a_BlockY, a_BlockZ); @@ -77,7 +68,24 @@ void cBlockDoorHandler::PlaceBlock(cWorld * a_World, cPlayer * a_Player, NIBBLET if (a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ) == E_BLOCK_AIR) { a_BlockMeta = cDoors::RotationToMetaData(a_Player->GetRotation()); - a_World->SetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_BlockMeta + 8); + char a_TopBlockMeta = 8; + if((a_BlockMeta == 0) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1) == m_BlockType)) + { + a_TopBlockMeta = 9; + } + else if((a_BlockMeta == 1) && (a_World->GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ) == m_BlockType)) + { + a_TopBlockMeta = 9; + } + else if((a_BlockMeta == 2) && (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1) == m_BlockType)) + { + a_TopBlockMeta = 9; + } + else if((a_BlockMeta == 3) && (a_World->GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ) == m_BlockType)) + { + a_TopBlockMeta = 9; + } + a_World->SetBlock(a_BlockX, a_BlockY + 1, a_BlockZ, m_BlockType, a_TopBlockMeta); a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, m_BlockType, a_BlockMeta); OnPlacedByPlayer(a_World, a_Player, a_BlockX, a_BlockY, a_BlockZ, a_Dir); } -- cgit v1.2.3