From 547c34132530a4dba841879595bd0762ef52a22d Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Tue, 18 Jun 2013 08:24:34 +0000 Subject: TNT fixes. Other blocks can be placed next to TNT. Explosions activate nearby TNT blocks. TNT doesn't destroy bedrock, obsidian and liquid blocks. Server doesn't crash when a TNT (or other entity) leaves the valid Y range. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1603 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Items/ItemLighter.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'source/Items/ItemLighter.h') diff --git a/source/Items/ItemLighter.h b/source/Items/ItemLighter.h index fe8cd1370..bcea8545f 100644 --- a/source/Items/ItemLighter.h +++ b/source/Items/ItemLighter.h @@ -4,6 +4,7 @@ #include "ItemHandler.h" #include "../World.h" #include "../Player.h" +#include "../TNTEntity.h" @@ -27,9 +28,25 @@ public: a_Player->UseEquippedItem(); - AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); - - a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 0); //0 -> new fire + switch (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ)) + { + case E_BLOCK_TNT: + { + // Activate the TNT: + a_World->BroadcastSoundEffect("random.fuse", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 0.5f, 0.6f); + cTNTEntity * TNT = new cTNTEntity(a_BlockX, a_BlockY, a_BlockZ, 4); // 4 seconds to boom + TNT->Initialize(a_World); + a_World->SetBlock(a_BlockX,a_BlockY,a_BlockZ, E_BLOCK_AIR, 0); + break; + } + default: + { + // Light a fire next to the block: + AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); + a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 0); + break; + } + } return false; } -- cgit v1.2.3