Radiation rework (#10970)

This commit is contained in:
Alex Evgrashin
2022-10-11 05:09:10 +02:00
committed by GitHub
parent 667fc1970d
commit 7d882f22c9
34 changed files with 1010 additions and 46 deletions

View File

@@ -0,0 +1,29 @@
using Content.Server.Radiation.Systems;
namespace Content.Server.Radiation.Components;
/// <summary>
/// Blocks radiation when placed on tile.
/// </summary>
[RegisterComponent]
[Access(typeof(RadiationSystem))]
public sealed class RadiationBlockerComponent : Component
{
/// <summary>
/// Does it block radiation at all?
/// </summary>
[DataField("enabled")]
public bool Enabled = true;
/// <summary>
/// How many rads per second does the blocker absorb?
/// </summary>
[DataField("resistance")]
public float RadResistance = 1f;
/// <summary>
/// Current position of the rad blocker in grid coordinates.
/// Null if doesn't anchored or doesn't block rads.
/// </summary>
public (EntityUid Grid, Vector2i Tile)? CurrentPosition;
}

View File

@@ -0,0 +1,16 @@
using Content.Server.Radiation.Systems;
namespace Content.Server.Radiation.Components;
/// <summary>
/// Grid component that stores radiation resistance of <see cref="RadiationBlockerComponent"/> per tile.
/// </summary>
[RegisterComponent]
[Access(typeof(RadiationSystem), Other = AccessPermissions.ReadExecute)]
public sealed class RadiationGridResistanceComponent : Component
{
/// <summary>
/// Radiation resistance per tile.
/// </summary>
public readonly Dictionary<Vector2i, float> ResistancePerTile = new();
}

View File

@@ -0,0 +1,20 @@
using Content.Server.Radiation.Systems;
using Content.Shared.Radiation.Components;
namespace Content.Server.Radiation.Components;
/// <summary>
/// Marks component that receive radiation from <see cref="RadiationSourceComponent"/>.
/// </summary>
[RegisterComponent]
[Access(typeof(RadiationSystem))]
public sealed class RadiationReceiverComponent : Component
{
/// <summary>
/// Current radiation value in rads per second.
/// Periodically updated by radiation system.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public float CurrentRadiation;
}