summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemBow.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h
index e7a77dcbc..fdc24689c 100644
--- a/src/Items/ItemBow.h
+++ b/src/Items/ItemBow.h
@@ -57,6 +57,12 @@ public:
}
Force = std::min(Force, 1.0);
+ // Does the player have an arrow?
+ if (!a_Player->IsGameModeCreative() && !a_Player->GetInventory().HasItems(cItem(E_ITEM_ARROW)))
+ {
+ return;
+ }
+
// Create the arrow entity:
cArrowEntity * Arrow = new cArrowEntity(*a_Player, Force * 2);
if (Arrow == NULL)
@@ -73,6 +79,10 @@ public:
a_Player->GetWorld()->BroadcastSoundEffect("random.bow", a_Player->GetPosX(), a_Player->GetPosY(), a_Player->GetPosZ(), 0.5, (float)Force);
if (!a_Player->IsGameModeCreative())
{
+ if (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchInfinity) == 0)
+ {
+ a_Player->GetInventory().RemoveItem(cItem(E_ITEM_ARROW));
+ }
a_Player->UseEquippedItem();
}
}