Fixes not being able to reload dropped guns w/ 0 ammo.

This commit is contained in:
Mysticate 2015-10-08 18:56:23 -04:00
parent 979e68dcc7
commit 46bf963d44
3 changed files with 11 additions and 2 deletions

View File

@ -107,6 +107,9 @@ public abstract class StrikeItem
if (this instanceof Gun)
{
//Fixes it so it stops reloading when dropped. Allows other players to reload when it's dropped if its ammo is 0.
((Gun) this).forceCancelReload(player);
game.deregisterGun((Gun)this);
if (!onlyDeregisterAndRemove)

View File

@ -95,7 +95,7 @@ public abstract class Grenade extends StrikeItem
if (alreadyHas >= _limit)
return false;
if ((player.getInventory().getItem(i) == null || UtilInv.IsItem(player.getInventory().getItem(i), Material.AIR, (byte) -1)) && bestSlot == -1)
if ((player.getInventory().getItem(i) == null || isStack(player.getInventory().getItem(i))) && bestSlot == -1)
bestSlot = i;
}
@ -119,7 +119,7 @@ public abstract class Grenade extends StrikeItem
if (alreadyHas >= _limit)
return false;
if ((player.getInventory().getItem(i) == null || UtilInv.IsItem(player.getInventory().getItem(i), Material.AIR, (byte) -1)) && bestSlot == -1)
if ((player.getInventory().getItem(i) == null || isStack(player.getInventory().getItem(i))) && bestSlot == -1)
bestSlot = i;
}

View File

@ -269,6 +269,12 @@ public class Gun extends StrikeItem
_reloading = true;
}
public void forceCancelReload(Player player)
{
_reloading = false;
Recharge.Instance.recharge(player, getName() + " Reload");
}
@Override
public void fixStackName()