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))
|
if (!_prototypeManager.TryIndex<InventoryTemplatePrototype>(inventory.TemplateId, out var templatePrototype))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
slotDefinition = templatePrototype.Slots.FirstOrDefault(x => x.Name == slot);
|
foreach (var slotDef in templatePrototype.Slots)
|
||||||
return slotDefinition != default;
|
{
|
||||||
|
if (!slotDef.Name.Equals(slot)) continue;
|
||||||
|
slotDefinition = slotDef;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetContainerSlotEnumerator(EntityUid uid, out ContainerSlotEnumerator containerSlotEnumerator, InventoryComponent? component = null)
|
public bool TryGetContainerSlotEnumerator(EntityUid uid, out ContainerSlotEnumerator containerSlotEnumerator, InventoryComponent? component = null)
|
||||||
|
|||||||
Reference in New Issue
Block a user