summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemBow.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemBow.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/Items/ItemBow.h b/src/Items/ItemBow.h
index e7a77dcbc..f29cc5d59 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)
@@ -69,12 +75,26 @@ public:
Arrow = NULL;
return;
}
-
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));
+ }
+ else
+ {
+ Arrow->SetPickupState(cArrowEntity::psNoPickup);
+ }
+
+
a_Player->UseEquippedItem();
}
+
+ if (a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchFlame) > 0)
+ {
+ Arrow->StartBurning(100);
+ }
}
} ;