- ItemContainers whose bodies are disabled don't set the positions of the contained items each frame (only once when the item is placed in the container)
- ItemContainers maintain a list of statuseffects that need to be applied on the contained items instead of constantly rechecking each item - deactivating ItemContainers if they have no body and there are no statuseffects to apply
This commit is contained in:
@@ -44,6 +44,27 @@ namespace Barotrauma
|
||||
return (item!=null && Items[i]==null && container.CanBeContained(item));
|
||||
}
|
||||
|
||||
public override bool TryPutItem(Item item, System.Collections.Generic.List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
{
|
||||
bool wasPut = base.TryPutItem(item, allowedSlots, createNetworkEvent);
|
||||
|
||||
if (wasPut)
|
||||
{
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
if (!c.HasSelectedItem(item)) continue;
|
||||
|
||||
item.Unequip(c);
|
||||
break;
|
||||
}
|
||||
|
||||
container.IsActive = true;
|
||||
container.OnItemContained(item);
|
||||
}
|
||||
|
||||
return wasPut;
|
||||
}
|
||||
|
||||
public override bool TryPutItem(Item item, int i, bool allowSwapping, bool createNetworkEvent)
|
||||
{
|
||||
bool wasPut = base.TryPutItem(item, i, allowSwapping, createNetworkEvent);
|
||||
@@ -57,11 +78,18 @@ namespace Barotrauma
|
||||
item.Unequip(c);
|
||||
break;
|
||||
}
|
||||
//item.Container = container.Item;
|
||||
|
||||
container.IsActive = true;
|
||||
container.OnItemContained(item);
|
||||
}
|
||||
|
||||
return wasPut;
|
||||
}
|
||||
|
||||
public override void RemoveItem(Item item)
|
||||
{
|
||||
base.RemoveItem(item);
|
||||
container.OnItemRemoved(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user