Skip to content

Commit

Permalink
EMP
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 committed Jul 25, 2023
1 parent d3e5b4e commit eb4c0d3
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Content.Server/_NF/M_Emp/M_EmpGeneratorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,28 @@ public sealed class M_EmpGeneratorComponent : SharedM_EmpGeneratorComponent
public GeneratorState GeneratorState = GeneratorState.Inactive;

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

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

/// <summary>
/// How long the generator can hold the debris until it starts losing the lock
/// How long the generator EMP is working
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("engagedTime")]
public TimeSpan EngagedTime = TimeSpan.FromSeconds(60);

/// <summary>
/// How long the generator can hold the debris while losing the lock
/// How long the generator Cooling Down
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("coolingDownTime")]
Expand Down
8 changes: 7 additions & 1 deletion Content.Server/_NF/M_Emp/M_EmpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ private void StartGenerator(EntityUid uid, M_EmpGeneratorComponent component, En
}
gridState.ActiveGenerators.Add(uid);

PlayActivatedSound(uid, component);

component.GeneratorState = new GeneratorState(GeneratorStateType.Activating, gridState.CurrentTime + component.ActivatingTime);
RaiseLocalEvent(new M_EmpGeneratorActivatedEvent(uid));
Report(uid, component.M_EmpChannel, "m_emp-system-report-activate-success");
Expand Down Expand Up @@ -271,7 +273,7 @@ private void Transition(EntityUid uid, M_EmpGeneratorComponent generator, TimeSp
generator.GeneratorState = new GeneratorState(GeneratorStateType.CoolingDown, currentTime + generator.CoolingDownTime);
break;
case GeneratorStateType.CoolingDown:
Report(uid, generator.M_EmpChannel, "m_emp-system-announcement-recharging");
//Report(uid, generator.M_EmpChannel, "m_emp-system-announcement-recharging"); //Less chat spam
generator.GeneratorState = new GeneratorState(GeneratorStateType.Recharging, currentTime + generator.CooldownTime);
break;
case GeneratorStateType.Recharging:
Expand Down Expand Up @@ -316,6 +318,10 @@ public override void Update(float frameTime)
}
}
}
private void PlayActivatedSound(EntityUid uid, SharedM_EmpGeneratorComponent component)
{
_audio.PlayPvs(_audio.GetSound(component.ActivatedSound), uid);
}
}

public sealed class M_EmpGridState
Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/_NF/M_Emp/SharedM_EmpGeneratorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Audio;

namespace Content.Shared._NF.M_Emp;

Expand All @@ -18,6 +19,10 @@ public abstract class SharedM_EmpGeneratorComponent : Component
/// </summary>
[DataField("partRatingDelay"), ViewVariables(VVAccess.ReadWrite)]
public float PartRatingDelay = 0.75f;

[DataField("activatedSound")]
public SoundSpecifier ActivatedSound =
new SoundPathSpecifier("/Audio/Effects/countdown.ogg");
}

[Serializable, NetSerializable]
Expand Down
4 changes: 2 additions & 2 deletions Resources/Locale/en-US/m_emp/m_emp-system.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ m_emp-system-announcement-recharging = Recharging.
m_emp-system-report-already-active = The M_EMP Generator is already active.
m_emp-system-report-cooling-down = The M_EMP Generator is cooling down.
m_emp-system-report-activate-success = The M_EMP Generator pulse on GRID at CORDS!
m_emp-system-report-activate-success = The M_EMP Generator engaging on GRID at CORDS!
m_emp-system-generator-examined-inactive = The M_EMP Generator is inactive.
m_emp-system-generator-examined-starting = The M_EMP Generator is starting up.
Expand All @@ -15,5 +15,5 @@ m_emp-system-generator-examined-active = The M_EMP active. EMP will last { $time
}
m_emp-system-generator-examined-cooling-down = Cooling down.
m_emp-system-generator-examined-recharging = Recharging. Ready in: {$timeLeft} seconds.
m_emp-system-generator-delay-upgrade = Attaching/cooldown delay
m_emp-system-generator-delay-upgrade = Cooling down / Recharging speed
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
description: Mobile EMP generator.
components:
- type: Sprite
sprite: Structures/Machines/m_emp.rsi
sprite: _NF/Structures/Machines/m_emp.rsi
layers:
- state: m_emp
- state: m_emp-ready
Expand Down

0 comments on commit eb4c0d3

Please sign in to comment.