Piston head, when removed, removes the associated piston body, too.
Fixes FS 388
This commit is contained in:
parent
7c9c51425b
commit
f89d6cc9af
@ -149,6 +149,7 @@ cBlockHandler * cBlockHandler::CreateBlockHandler(BLOCKTYPE a_BlockType)
|
|||||||
case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
case E_BLOCK_NETHER_BRICK_STAIRS: return new cBlockStairsHandler (a_BlockType);
|
||||||
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
|
case E_BLOCK_NOTE_BLOCK: return new cBlockNoteHandler (a_BlockType);
|
||||||
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
case E_BLOCK_PISTON: return new cBlockPistonHandler (a_BlockType);
|
||||||
|
case E_BLOCK_PISTON_EXTENSION: return new cBlockPistonHeadHandler ();
|
||||||
case E_BLOCK_PLANKS: return new cBlockWoodHandler (a_BlockType);
|
case E_BLOCK_PLANKS: return new cBlockWoodHandler (a_BlockType);
|
||||||
case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (a_BlockType);
|
case E_BLOCK_PUMPKIN_STEM: return new cBlockStemsHandler (a_BlockType);
|
||||||
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
|
case E_BLOCK_RAIL: return new cBlockRailHandler (a_BlockType);
|
||||||
|
@ -35,7 +35,7 @@ cBlockPistonHandler::cBlockPistonHandler(BLOCKTYPE a_BlockType)
|
|||||||
|
|
||||||
void cBlockPistonHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
|
void cBlockPistonHandler::OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
{
|
{
|
||||||
char OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
int newX = a_BlockX;
|
int newX = a_BlockX;
|
||||||
int newY = a_BlockY;
|
int newY = a_BlockY;
|
||||||
@ -67,3 +67,36 @@ bool cBlockPistonHandler::GetPlacementBlockTypeMeta(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// cBlockPistonHeadHandler:
|
||||||
|
|
||||||
|
cBlockPistonHeadHandler::cBlockPistonHeadHandler(void) :
|
||||||
|
super(E_BLOCK_PISTON_EXTENSION)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void cBlockPistonHeadHandler::OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ)
|
||||||
|
{
|
||||||
|
NIBBLETYPE OldMeta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
|
||||||
|
int newX = a_BlockX;
|
||||||
|
int newY = a_BlockY;
|
||||||
|
int newZ = a_BlockZ;
|
||||||
|
AddPistonDir(newX, newY, newZ, OldMeta & ~(8), -1);
|
||||||
|
|
||||||
|
BLOCKTYPE Block = a_World->GetBlock(newX, newY, newZ);
|
||||||
|
if ((Block == E_BLOCK_STICKY_PISTON) || (Block == E_BLOCK_PISTON))
|
||||||
|
{
|
||||||
|
a_World->DigBlock(newX, newY, newZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,3 +26,18 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class cBlockPistonHeadHandler :
|
||||||
|
public cBlockHandler
|
||||||
|
{
|
||||||
|
typedef cBlockHandler super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
cBlockPistonHeadHandler(void);
|
||||||
|
|
||||||
|
virtual void OnDestroyedByPlayer(cWorld * a_World, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) override;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user