Added arrow consuming on shooting
This commit is contained in:
parent
f5b71cc1f8
commit
434ea542e1
@ -57,6 +57,12 @@ public:
|
||||
}
|
||||
Force = std::min(Force, 1.0);
|
||||
|
||||
// Has the player a 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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user