@@ -335,8 +335,21 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
|
||||
Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||
}
|
||||
}
|
||||
|
||||
a_Player->UseEquippedItem();
|
||||
|
||||
if (!cBlockInfo::IsOneHitDig(Block))
|
||||
{
|
||||
a_Player->UseEquippedItem(GetDurabilityLostWithThatAction(dlaBreakBlock));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cItemHandler::OnEntityAttack(cPlayer * a_Attacker, cEntity * a_AttackedEntity)
|
||||
{
|
||||
UNUSED(a_AttackedEntity);
|
||||
a_Attacker->UseEquippedItem(GetDurabilityLostWithThatAction(dlaAttackEntity));
|
||||
}
|
||||
|
||||
|
||||
@@ -354,6 +367,20 @@ void cItemHandler::OnFoodEaten(cWorld * a_World, cPlayer * a_Player, cItem * a_I
|
||||
|
||||
|
||||
|
||||
short cItemHandler::GetDurabilityLostWithThatAction(eDurabilityLostAction a_Action)
|
||||
{
|
||||
switch (a_Action)
|
||||
{
|
||||
case dlaAttackEntity: return 2;
|
||||
case dlaBreakBlock: return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char cItemHandler::GetMaxStackSize(void)
|
||||
{
|
||||
if (m_ItemType < 256)
|
||||
@@ -505,6 +532,7 @@ bool cItemHandler::IsPlaceable(void)
|
||||
|
||||
bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType)
|
||||
{
|
||||
UNUSED(a_ItemType);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user