Unstable 0.1400.8.0

This commit is contained in:
Markus Isberg
2021-08-13 17:52:45 +09:00
parent 47707c824a
commit 27dd9e6022
38 changed files with 183 additions and 113 deletions
@@ -132,17 +132,17 @@ namespace Barotrauma
return false;
}
public override bool CanBePut(Item item, int i, bool ignoreCondition = false)
public override bool CanBePutInSlot(Item item, int i, bool ignoreCondition = false)
{
return
base.CanBePut(item, i, ignoreCondition) && item.AllowedSlots.Any(s => s.HasFlag(SlotTypes[i])) &&
base.CanBePutInSlot(item, i, ignoreCondition) && item.AllowedSlots.Any(s => s.HasFlag(SlotTypes[i])) &&
(SlotTypes[i] == InvSlotType.Any || slots[i].ItemCount < 1);
}
public override bool CanBePut(ItemPrefab itemPrefab, int i, float? condition)
public override bool CanBePutInSlot(ItemPrefab itemPrefab, int i, float? condition)
{
return
base.CanBePut(itemPrefab, i, condition) &&
base.CanBePutInSlot(itemPrefab, i, condition) &&
(SlotTypes[i] == InvSlotType.Any || slots[i].ItemCount < 1);
}
@@ -261,7 +261,7 @@ namespace Barotrauma
/// <summary>
/// If there is room, puts the item in the inventory and returns true, otherwise returns false
/// </summary>
public override bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
public override bool TryPutItem(Item item, Character user, IEnumerable<InvSlotType> allowedSlots = null, bool createNetworkEvent = true, bool ignoreCondition = false)
{
if (allowedSlots == null || !allowedSlots.Any()) { return false; }
if (item == null)
@@ -326,7 +326,7 @@ namespace Barotrauma
#if CLIENT
if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; }
#endif
if (!slots[i].First().AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(slots[i].FirstOrDefault(), character, new List<InvSlotType> { InvSlotType.Any }, true))
if (!slots[i].First().AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(slots[i].FirstOrDefault(), character, new List<InvSlotType> { InvSlotType.Any }, true, ignoreCondition))
{
free = false;
#if CLIENT
@@ -371,7 +371,7 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++)
{
if (SlotTypes[i] != InvSlotType.Any) { continue; }
if (!slots[i].Empty() && CanBePut(item, i))
if (!slots[i].Empty() && CanBePutInSlot(item, i))
{
return i;
}
@@ -387,7 +387,7 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++)
{
if (SlotTypes[i] != InvSlotType.Any) { continue; }
if (CanBePut(item, i))
if (CanBePutInSlot(item, i))
{
return i;
}
@@ -402,14 +402,14 @@ namespace Barotrauma
}
else
{
if (!CanBePut(item, i)) { continue; }
if (!CanBePutInSlot(item, i)) { continue; }
}
return i;
}
return -1;
}
public override bool TryPutItem(Item item, int index, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true)
public override bool TryPutItem(Item item, int index, bool allowSwapping, bool allowCombine, Character user, bool createNetworkEvent = true, bool ignoreCondition = false)
{
if (index < 0 || index >= slots.Length)
{
@@ -424,7 +424,7 @@ namespace Barotrauma
if (slots[index].Any())
{
if (slots[index].Contains(item)) { return false; }
return base.TryPutItem(item, index, allowSwapping, allowCombine, user, createNetworkEvent);
return base.TryPutItem(item, index, allowSwapping, allowCombine, user, createNetworkEvent, ignoreCondition);
}
if (SlotTypes[index] == InvSlotType.Any)
@@ -460,7 +460,7 @@ namespace Barotrauma
if (!slotsFree) { return false; }
return TryPutItem(item, user, new List<InvSlotType>() { placeToSlots }, createNetworkEvent);
return TryPutItem(item, user, new List<InvSlotType>() { placeToSlots }, createNetworkEvent, ignoreCondition);
}
}
}