Fix warnings and code cleanup/fixes (#13570)

This commit is contained in:
Visne
2023-01-19 03:56:45 +01:00
committed by GitHub
parent 3ca5a0224b
commit c6d3e4f3bd
265 changed files with 499 additions and 666 deletions

View File

@@ -322,8 +322,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
{
if (EntityManager.TryGetComponent<PointLightComponent>(component.Owner, out var pointLightComponent))
{
bool hasAnyConnection = component.Connections != null;
pointLightComponent.Enabled = hasAnyConnection;
pointLightComponent.Enabled = component.Connections.Count > 0;
}
}

View File

@@ -248,9 +248,11 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
/// <param name="eventHorizon">The event horizon which is consuming the tiles on the grid.</param>
public void ConsumeTiles(List<(Vector2i, Tile)> tiles, MapGridComponent grid, EventHorizonComponent eventHorizon)
{
if (tiles.Count > 0)
RaiseLocalEvent(eventHorizon.Owner, new TilesConsumedByEventHorizonEvent(tiles, grid, eventHorizon));
grid.SetTiles(tiles);
if (tiles.Count <= 0)
return;
RaiseLocalEvent(eventHorizon.Owner, new TilesConsumedByEventHorizonEvent(tiles, grid, eventHorizon));
grid.SetTiles(tiles);
}
/// <summary>
@@ -369,12 +371,12 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
/// <param name="uid">The event horizon entity that is trying to collide with something.</param>
/// <param name="comp">The event horizon that is trying to collide with something.</param>
/// <param name="args">The event arguments.</param>
protected override sealed bool PreventCollide(EntityUid uid, EventHorizonComponent comp, ref PreventCollideEvent args)
protected override bool PreventCollide(EntityUid uid, EventHorizonComponent comp, ref PreventCollideEvent args)
{
if (base.PreventCollide(uid, comp, ref args) || args.Cancelled)
return true;
args.Cancelled = !CanConsumeEntity(args.BodyB.Owner, (EventHorizonComponent)comp);
args.Cancelled = !CanConsumeEntity(args.BodyB.Owner, comp);
return false;
}
@@ -450,10 +452,10 @@ public sealed class EventHorizonSystem : SharedEventHorizonSystem
/// <summary>
/// Handles event horizons deciding to escape containers they are inserted into.
/// Delegates the actual escape to <see cref="EventHorizonSystem.OnEventHorizonContained(EventHorizonContainedEvent)"> on a delay.
/// Delegates the actual escape to <see cref="EventHorizonSystem.OnEventHorizonContained(EventHorizonContainedEvent)" /> on a delay.
/// This ensures that the escape is handled after all other handlers for the insertion event and satisfies the assertion that
/// the inserted entity SHALL be inside of the specified container after all handles to the entity event
/// <see cref="EntGotInsertedIntoContainerMessage"> are processed.
/// <see cref="EntGotInsertedIntoContainerMessage" /> are processed.
/// </summary>
/// <param name="uid">The uid of the event horizon.</param>]
/// <param name="comp">The state of the event horizon.</param>]

View File

@@ -147,8 +147,8 @@ public sealed class SingularitySystem : SharedSingularitySystem
/// <param name="delta">The amount to adjust the energy of the singuarity.</param>
/// <param name="min">The minimum amount of energy for the singularity to be adjusted to.</param>
/// <param name="max">The maximum amount of energy for the singularity to be adjusted to.</param>
/// <param name="hardMin">Whether the amount of energy in the singularity should be forced to within the specified range if it already is below it.</param>
/// <param name="hardMax">Whether the amount of energy in the singularity should be forced to within the specified range if it already is above it.</param>
/// <param name="snapMin">Whether the amount of energy in the singularity should be forced to within the specified range if it already is below it.</param>
/// <param name="snapMax">Whether the amount of energy in the singularity should be forced to within the specified range if it already is above it.</param>
/// <param name="singularity">The state of the singularity to adjust the energy of.</param>
public void AdjustEnergy(EntityUid uid, float delta, float min = float.MinValue, float max = float.MaxValue, bool snapMin = true, bool snapMax = true, SingularityComponent? singularity = null)
{