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

EMP Update #100

Merged
merged 30 commits into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
364adc2
WIP
dvir001 Jul 15, 2023
b11866b
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 16, 2023
2e6e664
EMP
dvir001 Jul 16, 2023
c36a970
E
dvir001 Jul 16, 2023
5e93820
Ye
dvir001 Jul 16, 2023
657c7c6
More EMP
dvir001 Jul 17, 2023
5cdaaa9
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 17, 2023
2d94e63
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 18, 2023
22f751c
More EMP
dvir001 Jul 18, 2023
b4d742b
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 20, 2023
2164900
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 21, 2023
3dc19ed
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 23, 2023
f5bb763
EMP
dvir001 Jul 24, 2023
dc467be
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 24, 2023
5938b0e
Merge branch 'EMP-Guns' of https://github.com/dvir001/frontier-statio…
dvir001 Jul 24, 2023
9594415
EMP
dvir001 Jul 24, 2023
c69eee8
EMP
dvir001 Jul 25, 2023
2ae659d
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 25, 2023
d3e5b4e
Merge branch 'EMP-Guns' of https://github.com/dvir001/frontier-statio…
dvir001 Jul 25, 2023
eb4c0d3
EMP
dvir001 Jul 25, 2023
9308509
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 27, 2023
9430877
EMP
dvir001 Jul 27, 2023
591b880
Merge branch 'EMP-Guns' of https://github.com/dvir001/frontier-statio…
dvir001 Jul 27, 2023
84002c3
EMP
dvir001 Jul 27, 2023
ce54ec6
EMP
dvir001 Jul 28, 2023
6d93f47
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 28, 2023
88a23e4
reporting for duty
Cheackraze Jul 29, 2023
5d36d5c
Merge branch 'new-frontiers-14:master' into EMP-Guns
dvir001 Jul 29, 2023
625add7
Delete M_EmpGridComponent.cs
dvir001 Jul 29, 2023
d65042d
fix yml linter
Cheackraze Jul 29, 2023
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
8 changes: 8 additions & 0 deletions Content.Client/_NF/M_Emp/M_EmpComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared._NF.M_Emp;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

[NetworkedComponent, RegisterComponent]
public sealed class M_EmpGeneratorComponent : SharedM_EmpGeneratorComponent
{
}
1 change: 1 addition & 0 deletions Content.Server/Emp/EmpSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Server.Entry;
using Content.Server.Explosion.EntitySystems;
using Content.Server.Power.EntitySystems;
using Content.Server.Radio;
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Light/EntitySystems/PoweredLightSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ private void OnDoAfter(EntityUid uid, PoweredLightComponent component, DoAfterEv

private void OnEmpPulse(EntityUid uid, PoweredLightComponent component, ref EmpPulseEvent args)
{
if (TryDestroyBulb(uid, component))
args.Affected = true;
// if (TryDestroyBulb(uid, component)) // Make it so EMP isnt exploding lights
// args.Affected = true; // Make it so EMP isnt exploding lights
}
}
}
3 changes: 3 additions & 0 deletions Content.Server/Power/Components/ApcComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public sealed class ApcComponent : BaseApcNetComponent
[DataField("onReceiveMessageSound")]
public SoundSpecifier OnReceiveMessageSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");

[DataField("apcIgnoreEmp")]
public bool ApcIgnoreEmp = false;

[ViewVariables]
public ApcChargeState LastChargeState;
public TimeSpan LastChargeStateTime;
Expand Down
16 changes: 12 additions & 4 deletions Content.Server/Power/EntitySystems/ApcSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,19 @@ private ApcExternalPowerState CalcExtPowerState(EntityUid uid, PowerState.Batter

private void OnEmpPulse(EntityUid uid, ApcComponent component, ref EmpPulseEvent args)
{
if (component.MainBreakerEnabled)
if (component.ApcIgnoreEmp)
{
args.Affected = true;
args.Disabled = true;
ApcToggleBreaker(uid, component);
args.Affected = false;
args.Disabled = false;
}
else
{
if (component.MainBreakerEnabled)
{
args.Affected = true;
args.Disabled = true;
ApcToggleBreaker(uid, component);
}
}
}
}
Expand Down
116 changes: 116 additions & 0 deletions Content.Server/_NF/M_Emp/M_EmpGeneratorComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using Content.Shared.Radio;
using Content.Shared._NF.M_Emp;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server._NF.M_Emp
{
/// <summary>
/// A M_Emp generator.
/// </summary>
[NetworkedComponent, RegisterComponent]
[Access(typeof(M_EmpSystem))]
public sealed class M_EmpGeneratorComponent : SharedM_EmpGeneratorComponent
{
/// <summary>
/// Current state of this generator
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
[DataField("generatorState")]
public GeneratorState GeneratorState = GeneratorState.Inactive;

/// <summary>
/// How long it takes for the generator to EMP
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("baseActivatingTime")]
public TimeSpan BaseActivatingTime = TimeSpan.FromSeconds(3.5);

/// <summary>
/// How long it actually takes for the generator to EMP
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("activatingTime")]
public TimeSpan ActivatingTime = TimeSpan.FromSeconds(3.5);

/// <summary>
/// How long the generator EMP is working
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("engagedTime")]
public TimeSpan EngagedTime = TimeSpan.FromSeconds(60);

/// <summary>
/// How long the generator Cooling Down
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("baseCoolingDownTime")]
public TimeSpan BaseCoolingDownTime = TimeSpan.FromSeconds(60);

/// <summary>
/// How long the generator actually has to cooldown after use
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("coolingDownTime")]
public TimeSpan CoolingDownTime = TimeSpan.FromSeconds(60);

/// <summary>
/// How long the generator has to recharge after use
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("baseRecharging")]
public TimeSpan BaseRecharging = TimeSpan.FromSeconds(60);

/// <summary>
/// How long the generator actually has to recharge after use
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("Recharging")]
public TimeSpan Recharging = TimeSpan.FromSeconds(60);

[DataField("M_EmpChannel", customTypeSerializer: typeof(PrototypeIdSerializer<RadioChannelPrototype>))]
public string M_EmpChannel = "Security";

/// <summary>
/// Current how much charge the generator currently has
/// </summary>
[DataField("chargeRemaining")]
public int ChargeRemaining = 5;

/// <summary>
/// How much capacity the generator can hold
/// </summary>
[DataField("chargeCapacity")]
public int ChargeCapacity = 5;

/// <summary>
/// Used as a guard to prevent spamming the appearance system
/// </summary>
[DataField("previousCharge")]
public int PreviousCharge = 5;
}

[CopyByRef, DataRecord]
public record struct GeneratorState(GeneratorStateType StateType, TimeSpan Until)
{
public static readonly GeneratorState Inactive = new (GeneratorStateType.Inactive, TimeSpan.Zero);
};

public sealed class M_EmpGeneratorActivatedEvent : EntityEventArgs
{
public EntityUid Generator;

public M_EmpGeneratorActivatedEvent(EntityUid generator)
{
Generator = generator;
}
}
public enum GeneratorStateType
{
Inactive,
Activating,
Engaged,
CoolingDown,
Recharging,
}
}
Loading
Loading