Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent the M_EMP from affecting its own grid #1998

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading