Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into Heavy-Hydro-Tray
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 committed Jul 30, 2023
2 parents c4fc491 + 91daa5e commit 02e9294
Show file tree
Hide file tree
Showing 96 changed files with 22,788 additions and 2,405 deletions.
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
2 changes: 1 addition & 1 deletion Content.Server/Lathe/LatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override void Update(float frameTime)
if (lathe.CurrentRecipe == null)
continue;

if (_timing.CurTime - comp.StartTime >= comp.ProductionLength)
if (_timing.CurTime - comp.StartTime >= (comp.ProductionLength * 3))
FinishProducing(uid, lathe);
}
}
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

0 comments on commit 02e9294

Please sign in to comment.