From 221cc4ec5cb6301743e947eaabed3fecedba796f Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 16 Oct 2019 10:06:34 +0200 Subject: Refactored block-to-pickup conversion. (#4417) --- src/Items/ItemShovel.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src/Items/ItemShovel.h') diff --git a/src/Items/ItemShovel.h b/src/Items/ItemShovel.h index 49ecf3348..0715f8d99 100644 --- a/src/Items/ItemShovel.h +++ b/src/Items/ItemShovel.h @@ -36,21 +36,7 @@ public: - virtual bool OnDiggingBlock(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_Dir) override - { - BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ); - if (Block == E_BLOCK_SNOW) - { - cChunkInterface ChunkInterface(a_World->GetChunkMap()); - cBlockInServerPluginInterface PluginInterface(*a_World); - BlockHandler(Block)->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ); - a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0); - a_Player->UseEquippedItem(cItemHandler::dlaBreakBlock); - return true; - } - return false; - } virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override { @@ -61,6 +47,10 @@ public: return super::CanHarvestBlock(a_BlockType); } + + + + virtual bool CanRepairWithRawMaterial(short a_ItemType) override { switch (m_ItemType) @@ -74,6 +64,10 @@ public: return false; } + + + + virtual float GetBlockBreakingStrength(BLOCKTYPE a_Block) override { switch (a_Block) @@ -101,9 +95,7 @@ public: } break; } - default: return super::GetBlockBreakingStrength(a_Block); } - ASSERT(!"Something is wrong here... Maybe they are shovels out of a new material?"); - return 1.0f; + return super::GetBlockBreakingStrength(a_Block); } }; -- cgit v1.2.3