From 506a69333959e40441f6de1e11683365a06538fe Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 16 Sep 2013 19:18:36 +0100 Subject: Torch fixes [SEE DESC] * Torches snap to neighbour when placed on bottom * CanBeAt takes into account cobblestone walls + Used more BLOCK_FACEs instead of numbers --- source/Blocks/BlockTorch.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/Blocks/BlockTorch.h b/source/Blocks/BlockTorch.h index b9e0dbf27..acacf3f9b 100644 --- a/source/Blocks/BlockTorch.h +++ b/source/Blocks/BlockTorch.h @@ -138,10 +138,6 @@ public: /// Finds a suitable face to place the torch, returning BLOCK_FACE_NONE on failure static char FindSuitableFace(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) { - // 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't cost much cpu power :) - for (int i = 0; i <= 5; i++) { AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, i, true); @@ -152,12 +148,12 @@ public: (BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)) && - (i = 1) + (i = BLOCK_FACE_TOP) ) { return i; } - else if ( g_BlockIsTorchPlaceable[BlockInQuestion] ) + else if ((g_BlockIsTorchPlaceable[BlockInQuestion]) && (i != BLOCK_FACE_BOTTOM)) { return i; } @@ -193,7 +189,12 @@ public: BLOCKTYPE BlockInQuestion; a_Chunk.UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, BlockInQuestion); - if ((BlockInQuestion == E_BLOCK_GLASS) || (BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE)) + if ( + (BlockInQuestion == E_BLOCK_GLASS) || + (BlockInQuestion == E_BLOCK_FENCE) || + (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || + (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL) + ) { // Torches can be placed on tops of glass and fences, despite them being 'untorcheable' // No need to check for upright orientation, it was done when the torch was placed -- cgit v1.2.3 From 9711fd797050d8956c10e5057287050022d085b6 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 16 Sep 2013 19:19:25 +0100 Subject: Fixed friction for entities Due to a misplaced else, other entities weren't getting friction --- source/Entities/Entity.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/Entities/Entity.cpp b/source/Entities/Entity.cpp index d9272b39d..dc3c7796e 100644 --- a/source/Entities/Entity.cpp +++ b/source/Entities/Entity.cpp @@ -651,21 +651,21 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) } } } - else + } + else + { + // Friction for non-minecarts + if (NextSpeed.SqrLength() > 0.0004f) { - // Friction - if (NextSpeed.SqrLength() > 0.0004f) + NextSpeed.x *= 0.7f / (1 + a_Dt); + if (fabs(NextSpeed.x) < 0.05) { - NextSpeed.x *= 0.7f / (1 + a_Dt); - if (fabs(NextSpeed.x) < 0.05) - { - NextSpeed.x = 0; - } - NextSpeed.z *= 0.7f / (1 + a_Dt); - if (fabs(NextSpeed.z) < 0.05) - { - NextSpeed.z = 0; - } + NextSpeed.x = 0; + } + NextSpeed.z *= 0.7f / (1 + a_Dt); + if (fabs(NextSpeed.z) < 0.05) + { + NextSpeed.z = 0; } } } -- cgit v1.2.3 From efe520727defa0d79092b121941313c9cd008260 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 16 Sep 2013 21:07:25 +0100 Subject: Fixed derpy comparison --- source/Blocks/BlockTorch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Blocks/BlockTorch.h b/source/Blocks/BlockTorch.h index acacf3f9b..a52b373cb 100644 --- a/source/Blocks/BlockTorch.h +++ b/source/Blocks/BlockTorch.h @@ -148,7 +148,7 @@ public: (BlockInQuestion == E_BLOCK_FENCE) || (BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) || (BlockInQuestion == E_BLOCK_COBBLESTONE_WALL)) && - (i = BLOCK_FACE_TOP) + (i == BLOCK_FACE_TOP) ) { return i; -- cgit v1.2.3