Reduce move allocs (#7437)
This commit is contained in:
@@ -48,8 +48,14 @@ public partial class InventorySystem : EntitySystem
|
||||
if (!_prototypeManager.TryIndex<InventoryTemplatePrototype>(inventory.TemplateId, out var templatePrototype))
|
||||
return false;
|
||||
|
||||
slotDefinition = templatePrototype.Slots.FirstOrDefault(x => x.Name == slot);
|
||||
return slotDefinition != default;
|
||||
foreach (var slotDef in templatePrototype.Slots)
|
||||
{
|
||||
if (!slotDef.Name.Equals(slot)) continue;
|
||||
slotDefinition = slotDef;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetContainerSlotEnumerator(EntityUid uid, out ContainerSlotEnumerator containerSlotEnumerator, InventoryComponent? component = null)
|
||||
|
||||
Reference in New Issue
Block a user