2012-09-23 18:09:57 -04:00
|
|
|
|
2012-07-15 16:36:34 -04:00
|
|
|
#pragma once
|
|
|
|
|
2012-09-23 18:09:57 -04:00
|
|
|
#include "ItemHandler.h"
|
|
|
|
#include "../World.h"
|
|
|
|
#include "../Player.h"
|
|
|
|
|
2012-09-29 09:59:32 -04:00
|
|
|
#include "../Blocks/BlockHandler.h"
|
2012-09-23 18:09:57 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-15 16:36:34 -04:00
|
|
|
|
|
|
|
class cItemShovelHandler : public cItemHandler
|
|
|
|
{
|
|
|
|
public:
|
2012-10-18 15:41:29 -04:00
|
|
|
cItemShovelHandler(int a_ItemType)
|
|
|
|
: cItemHandler(a_ItemType)
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-10-18 15:41:29 -04:00
|
|
|
virtual bool OnDiggingBlock(cWorld *a_World, cPlayer *a_Player, cItem *a_Item, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Dir) override
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
2012-10-18 15:41:29 -04:00
|
|
|
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
|
|
|
if (Block == E_BLOCK_SNOW)
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
2012-10-18 15:41:29 -04:00
|
|
|
BlockHandler(Block)->DropBlock(a_World, a_BlockX, a_BlockY, a_BlockZ);
|
2012-07-15 16:36:34 -04:00
|
|
|
|
2012-10-18 15:41:29 -04:00
|
|
|
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
|
2012-07-15 16:36:34 -04:00
|
|
|
a_Player->UseEquippedItem();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-10-03 04:52:11 -04:00
|
|
|
virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override
|
2012-07-15 16:36:34 -04:00
|
|
|
{
|
2012-10-18 15:41:29 -04:00
|
|
|
return (a_BlockType == E_BLOCK_SNOW);
|
2012-07-15 16:36:34 -04:00
|
|
|
}
|
|
|
|
};
|