Fix radiation system warnings (#37892)
* Use SharedMapSystem for GetTileIndices * Fix formatting errors in Server * Fix formatting errors in Client
This commit is contained in:
@@ -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!
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user