diff --git a/Content.Server/Radiation/Components/RadiationBlockingContainerComponent.cs b/Content.Server/Radiation/Components/RadiationBlockingContainerComponent.cs
new file mode 100644
index 0000000000..1a23671476
--- /dev/null
+++ b/Content.Server/Radiation/Components/RadiationBlockingContainerComponent.cs
@@ -0,0 +1,17 @@
+using Content.Server.Radiation.Systems;
+
+namespace Content.Server.Radiation.Components;
+
+///
+/// Prevents entities from emitting or receiving radiation when placed inside this container.
+///
+[RegisterComponent]
+[Access(typeof(RadiationSystem))]
+public sealed partial class RadiationBlockingContainerComponent : Component
+{
+ ///
+ /// How many rads per second does the blocker absorb?
+ ///
+ [DataField("resistance")]
+ public float RadResistance = 1f;
+}
diff --git a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs
index 719b3fc1ca..fa132186a9 100644
--- a/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs
+++ b/Content.Server/Radiation/Systems/RadiationSystem.GridCast.cs
@@ -5,10 +5,11 @@ using Content.Shared.Radiation.Components;
using Content.Shared.Radiation.Systems;
using Content.Shared.Stacks;
using Robust.Shared.Collections;
-using Robust.Shared.Map;
+using Robust.Shared.Containers;
using Robust.Shared.Map.Components;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
+using System.Linq;
namespace Content.Server.Radiation.Systems;
@@ -16,6 +17,9 @@ namespace Content.Server.Radiation.Systems;
public partial class RadiationSystem
{
[Dependency] private readonly SharedStackSystem _stack = default!;
+ [Dependency] private readonly SharedContainerSystem _container = default!;
+
+ private EntityQuery _radiationBlockingContainers;
private void UpdateGridcast()
{
@@ -33,6 +37,8 @@ public partial class RadiationSystem
var gridQuery = GetEntityQuery();
var stackQuery = GetEntityQuery();
+ _radiationBlockingContainers = GetEntityQuery();
+
// precalculate world positions for each source
// so we won't need to calc this in cycle over and over again
var sourcesData = new ValueList<(EntityUid, RadiationSourceComponent, TransformComponent, Vector2)>();
@@ -71,6 +77,9 @@ public partial class RadiationSystem
rads += ray.Rads;
}
+ // Apply modifier if the destination entity is hidden within a radiation blocking container
+ rads = GetAdjustedRadiationIntensity(dest.Owner, rads);
+
receiversTotalRads.Add((dest, rads));
}
@@ -89,7 +98,7 @@ public partial class RadiationSystem
// also send an event with combination of total rad
if (rads > 0)
- IrradiateEntity(receiver.Owner, rads,GridcastUpdateRate);
+ IrradiateEntity(receiver.Owner, rads, GridcastUpdateRate);
}
// raise broadcast event that radiation system has updated
@@ -114,8 +123,13 @@ public partial class RadiationSystem
// check if receiver is too far away
if (dist > GridcastMaxDistance)
return null;
+
// will it even reach destination considering distance penalty
var rads = incomingRads - slope * dist;
+
+ // Apply rad modifier if the source is enclosed within a radiation blocking container
+ rads = GetAdjustedRadiationIntensity(sourceUid, rads);
+
if (rads <= MinIntensity)
return null;
@@ -218,4 +232,15 @@ public partial class RadiationSystem
return ray;
}
+
+ private float GetAdjustedRadiationIntensity(EntityUid uid, float rads)
+ {
+ var radblockingComps = new List();
+ if (_container.TryFindComponentsOnEntityContainerOrParent(uid, _radiationBlockingContainers, radblockingComps))
+ {
+ rads -= radblockingComps.Sum(x => x.RadResistance);
+ }
+
+ return float.Max(rads, 0);
+ }
}
diff --git a/Resources/Prototypes/Catalog/Fills/Boxes/general.yml b/Resources/Prototypes/Catalog/Fills/Boxes/general.yml
index 4694966232..78d04343b6 100644
--- a/Resources/Prototypes/Catalog/Fills/Boxes/general.yml
+++ b/Resources/Prototypes/Catalog/Fills/Boxes/general.yml
@@ -414,3 +414,15 @@
layers:
- state: box
- state: syringe
+
+- type: entity
+ name: lead-lined box
+ parent: BoxCardboard
+ suffix: Debug
+ id: BoxLeadLined
+ description: This box stymies the transmission of harmful radiation.
+ components:
+ - type: Sprite
+ state: box
+ - type: RadiationBlockingContainer
+ resistance: 2
\ No newline at end of file
diff --git a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml
index 18ffe0fb05..e03d94c53c 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml
@@ -44,6 +44,8 @@
- Artifact
- type: Weldable
- type: SuppressArtifactContainer
+ - type: RadiationBlockingContainer
+ resistance: 5
- type: PlaceableSurface
isPlaceable: false
- type: Damageable