From: TemporalOroboros Date: Wed, 28 May 2025 09:34:58 +0000 (-0700) Subject: Fix radiation system warnings (#37892) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=10dee148937bc6632cc9c979b180ac2670f74a0f;p=space-station-14.git Fix radiation system warnings (#37892) * Use SharedMapSystem for GetTileIndices * Fix formatting errors in Server * Fix formatting errors in Client --- diff --git a/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs b/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs index 9ec24fae0e..d6e36dd0ad 100644 --- a/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs +++ b/Content.Client/Radiation/Overlays/RadiationPulseOverlay.cs @@ -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! diff --git a/Content.Server/Radiation/Systems/GeigerSystem.cs b/Content.Server/Radiation/Systems/GeigerSystem.cs index 6cf17c49c8..77df6c09e2 100644 --- a/Content.Server/Radiation/Systems/GeigerSystem.cs +++ b/Content.Server/Radiation/Systems/GeigerSystem.cs @@ -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) diff --git a/Content.Server/Radiation/Systems/RadiationSystem.Blockers.cs b/Content.Server/Radiation/Systems/RadiationSystem.Blockers.cs index d9683ac259..6a6cceb13a 100644 --- a/Content.Server/Radiation/Systems/RadiationSystem.Blockers.cs +++ b/Content.Server/Radiation/Systems/RadiationSystem.Blockers.cs @@ -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 diff --git a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs index 15e1c35256..ffcf12b9d8 100644 --- a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs +++ b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs @@ -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); diff --git a/Content.Server/Radiation/Systems/RadiationSystem.cs b/Content.Server/Radiation/Systems/RadiationSystem.cs index 7402a72701..34dbec6f86 100644 --- a/Content.Server/Radiation/Systems/RadiationSystem.cs +++ b/Content.Server/Radiation/Systems/RadiationSystem.cs @@ -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 _blockerQuery; private EntityQuery _resistanceQuery;