Stop cloning entity settings through MessagePack
This commit is contained in:
parent
b2721191a4
commit
c8832e147a
3 changed files with 11 additions and 5 deletions
|
|
@ -57,8 +57,7 @@ public static class EntitySerializer
|
|||
|
||||
public static Entity Unpack(ItemManager itemManager, Zone zone, EntityPack pack, bool instantiate = false)
|
||||
{
|
||||
pack.Settings ??= MessagePackSerializer.Deserialize<EntitySettings>(
|
||||
MessagePackSerializer.Serialize(itemManager.GameplaySettings.DefaultEntitySettings));
|
||||
pack.Settings ??= itemManager.GameplaySettings.DefaultEntitySettings.Copy();
|
||||
return pack switch
|
||||
{
|
||||
ShipPack shipPack => Unpack(itemManager, zone, shipPack, instantiate),
|
||||
|
|
|
|||
|
|
@ -6,4 +6,12 @@ public class EntitySettings
|
|||
{
|
||||
[Key(0)]
|
||||
public float ShutdownPerformance = .1f;
|
||||
}
|
||||
|
||||
public EntitySettings Copy()
|
||||
{
|
||||
return new EntitySettings
|
||||
{
|
||||
ShutdownPerformance = ShutdownPerformance
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue