From 46bf963d44f4374a4453236ec37c4d5127e9e820 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 8 Oct 2015 18:56:23 -0400 Subject: [PATCH] Fixes not being able to reload dropped guns w/ 0 ammo. --- .../game/arcade/game/games/minestrike/items/StrikeItem.java | 3 +++ .../game/games/minestrike/items/grenades/Grenade.java | 4 ++-- .../game/arcade/game/games/minestrike/items/guns/Gun.java | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java index 33848a071..aa16cc517 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/StrikeItem.java @@ -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) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java index d32d8d24a..cd9093026 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/grenades/Grenade.java @@ -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; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java index dfd1863e8..a01c65619 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/items/guns/Gun.java @@ -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()