summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemArmor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Items/ItemArmor.h')
-rw-r--r--src/Items/ItemArmor.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/Items/ItemArmor.h b/src/Items/ItemArmor.h
index d218c22b3..d91888d5b 100644
--- a/src/Items/ItemArmor.h
+++ b/src/Items/ItemArmor.h
@@ -8,43 +8,52 @@
-class cItemArmorHandler :
+class cItemArmorHandler:
public cItemHandler
{
+ using Super = cItemHandler;
+
public:
- cItemArmorHandler(int a_ItemType) :
- cItemHandler(a_ItemType)
+
+ cItemArmorHandler(int a_ItemType):
+ Super(a_ItemType)
{
}
+
+
/** Move the armor to the armor slot of the player's inventory */
virtual bool OnItemUse(
- cWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,
- int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace
+ cWorld * a_World,
+ cPlayer * a_Player,
+ cBlockPluginInterface & a_PluginInterface,
+ const cItem & a_HeldItem,
+ const Vector3i a_ClickedBlockPos,
+ eBlockFace a_ClickedBlockFace
) override
{
int SlotNum;
- if (ItemCategory::IsHelmet(a_Item.m_ItemType))
+ if (ItemCategory::IsHelmet(a_HeldItem.m_ItemType))
{
SlotNum = 0;
}
- else if (ItemCategory::IsChestPlate(a_Item.m_ItemType))
+ else if (ItemCategory::IsChestPlate(a_HeldItem.m_ItemType))
{
SlotNum = 1;
}
- else if (ItemCategory::IsLeggings(a_Item.m_ItemType))
+ else if (ItemCategory::IsLeggings(a_HeldItem.m_ItemType))
{
SlotNum = 2;
}
- else if (ItemCategory::IsBoots(a_Item.m_ItemType))
+ else if (ItemCategory::IsBoots(a_HeldItem.m_ItemType))
{
SlotNum = 3;
}
else
{
- LOGWARNING("Used unknown armor: %i", a_Item.m_ItemType);
+ LOGWARNING("Used unknown armor: %i", a_HeldItem.m_ItemType);
return false;
}
@@ -53,9 +62,9 @@ public:
return false;
}
- a_Player->GetInventory().SetArmorSlot(SlotNum, a_Item.CopyOne());
+ a_Player->GetInventory().SetArmorSlot(SlotNum, a_HeldItem.CopyOne());
- cItem Item(a_Item);
+ cItem Item(a_HeldItem);
Item.m_ItemCount--;
if (Item.m_ItemCount <= 0)
{
@@ -67,6 +76,8 @@ public:
+
+
virtual bool CanRepairWithRawMaterial(short a_ItemType) override
{
switch (m_ItemType)