Fix radiation system warnings (#37892)

* Use SharedMapSystem for GetTileIndices

* Fix formatting errors in Server

* Fix formatting errors in Client
This commit is contained in:
TemporalOroboros
2025-05-28 02:34:58 -07:00
committed by GitHub
parent 1b54969a05
commit 10dee14893
5 changed files with 11 additions and 10 deletions

View File

@@ -59,7 +59,7 @@ namespace Content.Client.Radiation.Overlays
shd?.SetParameter("positionInput", tempCoords);
shd?.SetParameter("range", instance.Range);
var life = (_gameTiming.RealTime - instance.Start).TotalSeconds / instance.Duration;
shd?.SetParameter("life", (float) life);
shd?.SetParameter("life", (float)life);
// There's probably a very good reason not to do this.
// Oh well!

View File

@@ -165,8 +165,8 @@ public sealed class GeigerSystem : SharedGeigerSystem
param = sounds.Params.WithLoop(true).WithVolume(component.Volume + 1.5f).WithMaxDistance(component.BroadcastRange);
component.Stream = _audio.PlayPvs(sound, uid, param)?.Entity;
}
else if(component.User is not null && _player.TryGetSessionByEntity(component.User.Value, out var session))
component.Stream = _audio.PlayGlobal(sound, session, param)?.Entity;
else if (component.User is not null && _player.TryGetSessionByEntity(component.User.Value, out var session))
component.Stream = _audio.PlayGlobal(sound, session, param)?.Entity;
}
public static GeigerDangerLevel RadsToLevel(float rads)

View File

@@ -108,7 +108,7 @@ public partial class RadiationSystem
// save resistance into rad protection grid
var gridId = trs.GridUid.Value;
var tilePos = grid.TileIndicesFor(trs.Coordinates);
var tilePos = _maps.TileIndicesFor((trs.GridUid.Value, grid), trs.Coordinates);
AddToTile(gridId, tilePos, component.RadResistance);
// and remember it as last valid position

View File

@@ -74,7 +74,7 @@ public partial class RadiationSystem
foreach (var source in _sources)
{
// send ray towards destination entity
if (Irradiate(source, destUid, destTrs, destWorld, debug) is not {} ray)
if (Irradiate(source, destUid, destTrs, destWorld, debug) is not { } ray)
continue;
// add rads to total rad exposure
@@ -156,7 +156,7 @@ public partial class RadiationSystem
// if source and destination on the same grid it's possible that
// between them can be another grid (ie. shuttle in center of donut station)
// however we can do simplification and ignore that case
if (GridcastSimplifiedSameGrid && destTrs.GridUid is {} gridUid && source.GridUid == gridUid)
if (GridcastSimplifiedSameGrid && destTrs.GridUid is { } gridUid && source.GridUid == gridUid)
{
if (!_gridQuery.TryGetComponent(gridUid, out var gridComponent))
return ray;
@@ -222,12 +222,12 @@ public partial class RadiationSystem
: Vector2.Transform(ray.Destination, grid.Comp2.InvLocalMatrix);
Vector2i sourceGrid = new(
(int) Math.Floor(srcLocal.X / grid.Comp1.TileSize),
(int) Math.Floor(srcLocal.Y / grid.Comp1.TileSize));
(int)Math.Floor(srcLocal.X / grid.Comp1.TileSize),
(int)Math.Floor(srcLocal.Y / grid.Comp1.TileSize));
Vector2i destGrid = new(
(int) Math.Floor(dstLocal.X / grid.Comp1.TileSize),
(int) Math.Floor(dstLocal.Y / grid.Comp1.TileSize));
(int)Math.Floor(dstLocal.X / grid.Comp1.TileSize),
(int)Math.Floor(dstLocal.Y / grid.Comp1.TileSize));
// iterate tiles in grid line from source to destination
var line = new GridLineEnumerator(sourceGrid, destGrid);

View File

@@ -14,6 +14,7 @@ public sealed partial class RadiationSystem : EntitySystem
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedStackSystem _stack = default!;
[Dependency] private readonly SharedMapSystem _maps = default!;
private EntityQuery<RadiationBlockingContainerComponent> _blockerQuery;
private EntityQuery<RadiationGridResistanceComponent> _resistanceQuery;