Fix for InvalidCastException when trying to send a ApplyStatusEffect network event

This commit is contained in:
Regalis
2016-05-01 18:56:42 +03:00
parent 3f22b2e4df
commit 9f30ecc1b7
@@ -95,7 +95,7 @@ namespace Barotrauma
if (Items[slotIndex] == null) return false;
//save the ID in a variable in case the statuseffect causes the item to be dropped/destroyed
int itemID = Items[slotIndex].ID;
ushort itemID = Items[slotIndex].ID;
Items[slotIndex].ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
new NetworkEvent(NetworkEventType.ApplyStatusEffect, character.ID, true, itemID);
@@ -132,6 +132,11 @@ namespace Barotrauma
return false;
}
public override bool CanBePut(Item item, int i)
{
return base.CanBePut(item, i) && item.AllowedSlots.Contains(limbSlots[i]);
}
/// <summary>
/// If there is room, puts the item in the inventory and returns true, otherwise returns false
/// </summary>