Add unit test asserting that saving, loading & saving the map produces identical output. (#348)
Also fixed PowerProvider violating this.
This commit is contained in:
committed by
GitHub
parent
6c97b63e59
commit
35e88ea62c
@@ -32,6 +32,8 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool SaveLoad => true;
|
||||
|
||||
/// <summary>
|
||||
/// The method of draw we will try to use to place our load set via component parameter, defaults to using power providers
|
||||
/// </summary>
|
||||
@@ -191,8 +193,12 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _drawType, "drawtype", DrawTypes.Provider);
|
||||
serializer.DataField(ref _load, "load", 100);
|
||||
serializer.DataField(ref _priority, "priority", Powernet.Priority.Medium);
|
||||
|
||||
if (SaveLoad)
|
||||
{
|
||||
serializer.DataField(ref _load, "load", 100);
|
||||
}
|
||||
}
|
||||
|
||||
void IExamine.Examine(FormattedMessage message)
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
/// <inheritdoc />
|
||||
public override DrawTypes DrawType { get; protected set; } = DrawTypes.Node;
|
||||
|
||||
protected override bool SaveLoad => false;
|
||||
|
||||
/// <summary>
|
||||
/// Variable that determines the range that the power provider will try to supply power to
|
||||
/// </summary>
|
||||
@@ -280,7 +282,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
// Stops an APC from trying to connect to itself
|
||||
if (this == device)
|
||||
return false;
|
||||
|
||||
|
||||
return (device.Owner.Transform.WorldPosition - Owner.Transform.WorldPosition).LengthSquared <= _range;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user