Skip to content

Commit

Permalink
Add immuneGrids arg to EMP, no marauder emp immune (#1998)
Browse files Browse the repository at this point in the history
Co-authored-by: Dvir <[email protected]>
  • Loading branch information
whatston3 and dvir001 authored Sep 14, 2024
1 parent d2b3d58 commit ce6c74f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
11 changes: 7 additions & 4 deletions Content.Server/Emp/EmpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ public override void Initialize()
/// <param name="range">The range of the EMP pulse.</param>
/// <param name="energyConsumption">The amount of energy consumed by the EMP pulse.</param>
/// <param name="duration">The duration of the EMP effects.</param>
public void EmpPulse(MapCoordinates coordinates, float range, float energyConsumption, float duration)
/// <param name="immuneGrids">Frontier: a list of the grids that should not be affected by the
public void EmpPulse(MapCoordinates coordinates, float range, float energyConsumption, float duration, List<EntityUid>? immuneGrids = null)
{
foreach (var uid in _lookup.GetEntitiesInRange(coordinates, range))
{
// Block EMP on grid
// Frontier: Block EMP on grid
var gridUid = Transform(uid).GridUid;
var attemptEv = new EmpAttemptEvent();
if (TryComp<ProtectedGridComponent>(gridUid, out var prot) && prot.PreventEmpEvents)
if (gridUid != null &&
(immuneGrids != null && immuneGrids.Contains(gridUid.Value) ||
TryComp<ProtectedGridComponent>(gridUid, out var prot) && prot.PreventEmpEvents))
continue;
// End Frontier: block EMP on grid

TryEmpEffects(uid, energyConsumption, duration);
}
Expand Down
10 changes: 9 additions & 1 deletion Content.Server/_NF/M_Emp/M_EmpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,15 @@ private bool SpawnM_Emp(EntityUid uid, M_EmpGeneratorComponent component)
var empEnergyConsumption = 2700000;
var empDisabledDuration = 60;

_emp.EmpPulse(Transform(uid).MapPosition, empRange, empEnergyConsumption, empDisabledDuration);
var xform = Transform(uid);
List<EntityUid>? immuneGridList = null;
if (xform.GridUid != null)
{
immuneGridList = new List<EntityUid> {
xform.GridUid.Value
};
}
_emp.EmpPulse(xform.MapPosition, empRange, empEnergyConsumption, empDisabledDuration, immuneGrids: immuneGridList);

return true;
}
Expand Down
2 changes: 0 additions & 2 deletions Resources/Prototypes/_NF/Shipyard/Nfsd/marauder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
guidebookPage: Null
class:
- Capital
gridProtection:
- EmpEvents

- type: gameMap
id: Marauder
Expand Down

0 comments on commit ce6c74f

Please sign in to comment.