Fixed torch placement.

This is related to #127, but until we know more about the change, I'm not closing the issue.
master
madmaxoft 2013-09-08 22:40:50 +02:00
parent ab61b4193b
commit 641a1286c1
1 changed files with 17 additions and 7 deletions

View File

@ -106,13 +106,23 @@ public:
}
static bool CanBePlacedOn(BLOCKTYPE a_BlockType, char a_Direction)
static bool CanBePlacedOn(BLOCKTYPE a_BlockType, char a_BlockFace)
{
if ( g_BlockIsSolid[a_BlockType] ) {
return (a_Direction == 0x1); // allow only direction "standing on floor"
}
else {
return g_BlockIsSolid[a_BlockType];
switch (a_BlockType)
{
case E_BLOCK_GLASS:
case E_BLOCK_FENCE:
case E_BLOCK_NETHER_BRICK_FENCE:
case E_BLOCK_PISTON:
case E_BLOCK_WORKBENCH:
{
return (a_BlockFace == BLOCK_FACE_TOP); // allow only direction "standing on floor" on these blocks
}
default:
{
return g_BlockIsSolid[a_BlockType]; // Any placement on solid blocks
}
}
}
@ -121,7 +131,7 @@ public:
{
// TODO: If placing a torch from below, check all 4 XZ neighbors, place it on that neighbor instead
// How to propagate that change up?
// Simon: The easiest way is to calculate the position two times, shouldn<EFBFBD>t cost much cpu power :)
// Simon: The easiest way is to calculate the position two times, shouldn't cost much cpu power :)
if (a_BlockFace == BLOCK_FACE_BOTTOM)
{