Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into Gas
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 authored Nov 13, 2023
2 parents 896e800 + 4446769 commit 134bf68
Show file tree
Hide file tree
Showing 102 changed files with 26,023 additions and 1,353 deletions.
7 changes: 7 additions & 0 deletions Content.Server/Emp/EmpSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Shared.Emp;
using Content.Shared.Examine;
using Robust.Shared.Map;
using static Content.Server.Shuttles.Systems.ShuttleConsoleSystem;
using static Content.Server.Shuttles.Systems.ThrusterSystem;

namespace Content.Server.Emp;
Expand All @@ -29,6 +30,7 @@ public override void Initialize()
SubscribeLocalEvent<EmpDisabledComponent, ApcToggleMainBreakerAttemptEvent>(OnApcToggleMainBreaker);
SubscribeLocalEvent<EmpDisabledComponent, SurveillanceCameraSetActiveAttemptEvent>(OnCameraSetActive);
SubscribeLocalEvent<EmpDisabledComponent, ThrusterToggleAttemptEvent>(OnThrusterToggle);
SubscribeLocalEvent<EmpDisabledComponent, ShuttleToggleAttemptEvent>(OnShuttleConsoleToggle);
}

/// <summary>
Expand Down Expand Up @@ -147,6 +149,11 @@ private void OnThrusterToggle(EntityUid uid, EmpDisabledComponent component, ref
{
args.Cancelled = true;
}

private void OnShuttleConsoleToggle(EntityUid uid, EmpDisabledComponent component, ref ShuttleToggleAttemptEvent args)
{
args.Cancelled = true;
}
}

/// <summary>
Expand Down
16 changes: 15 additions & 1 deletion Content.Server/Power/EntitySystems/ApcSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Timing;
using Content.Shared.Tools.Components;
using Content.Shared.Emp;

namespace Content.Server.Power.EntitySystems;

Expand All @@ -36,6 +38,7 @@ public override void Initialize()
SubscribeLocalEvent<ApcComponent, GotEmaggedEvent>(OnEmagged);

SubscribeLocalEvent<ApcComponent, EmpPulseEvent>(OnEmpPulse);
SubscribeLocalEvent<ApcComponent, ToolUseAttemptEvent>(OnToolUseAttempt);
}

public override void Update(float deltaTime)
Expand Down Expand Up @@ -117,7 +120,7 @@ private void OnEmagged(EntityUid uid, ApcComponent comp, ref GotEmaggedEvent arg
}

public void UpdateApcState(EntityUid uid,
ApcComponent? apc=null,
ApcComponent? apc = null,
PowerNetworkBatteryComponent? battery = null)
{
if (!Resolve(uid, ref apc, ref battery, false))
Expand Down Expand Up @@ -189,6 +192,7 @@ private ApcExternalPowerState CalcExtPowerState(EntityUid uid, PowerState.Batter

return ApcExternalPowerState.Good;
}

private void OnEmpPulse(EntityUid uid, ApcComponent component, ref EmpPulseEvent args)
{
if (component.MainBreakerEnabled)
Expand All @@ -198,6 +202,16 @@ private void OnEmpPulse(EntityUid uid, ApcComponent component, ref EmpPulseEvent
ApcToggleBreaker(uid, component);
}
}

private void OnToolUseAttempt(EntityUid uid, ApcComponent component, ToolUseAttemptEvent args)
{
if (!HasComp<EmpDisabledComponent>(uid))
return;

// prevent reconstruct exploit to skip cooldowns
if (!component.MainBreakerEnabled)
args.Cancel();
}
}

[ByRefEvent]
Expand Down
48 changes: 38 additions & 10 deletions Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@
using Content.Server.UserInterface;
using Content.Shared.StationRecords;
using Content.Server.Chat.Systems;
using Content.Server.Forensics;
using Content.Server.Mind;
using Content.Server.Preferences.Managers;
using Content.Server.StationRecords;
using Content.Server.StationRecords.Systems;
using Content.Shared.Database;
using Content.Shared.Preferences;

namespace Content.Server.Shipyard.Systems;

Expand All @@ -36,6 +40,7 @@ public sealed partial class ShipyardSystem : SharedShipyardSystem
[Dependency] private readonly AccessReaderSystem _access = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly IServerPreferencesManager _prefManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly RadioSystem _radio = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
Expand Down Expand Up @@ -146,14 +151,13 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component
{
R = 10,
G = 50,
B = 175,
A = 155
B = 100,
A = 100
});
}

if (TryComp<AccessComponent>(targetId, out var newCap))
{
//later we will make a custom pilot job, for now they get the captain treatment
var newAccess = newCap.Tags.ToList();
newAccess.Add($"Captain");

Expand All @@ -175,16 +179,40 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component
if (ShipyardConsoleUiKey.Security != (ShipyardConsoleUiKey) args.UiKey)
_idSystem.TryChangeJobTitle(targetId, $"Captain", idCard, player);

// The following block of code is entirely to do with trying to sanely handle moving records from station to station.
// it is ass.
// This probably shouldnt be messed with further until station records themselves become more robust
// and not entirely dependent upon linking ID card entity to station records key lookups
// its just bad

var stationList = EntityQueryEnumerator<StationRecordsComponent>();

if (TryComp<StationRecordKeyStorageComponent>(targetId, out var keyStorage)
&& shuttleStation !=null
&& keyStorage.Key != null
&& _records.TryGetRecord<GeneralStationRecord>(station, keyStorage.Key.Value, out var record))
&& shuttleStation != null
&& keyStorage.Key != null)
{
_records.RemoveRecord(station, keyStorage.Key.Value);
_records.CreateGeneralRecord((EntityUid) shuttleStation, targetId, record.Name, record.Age, record.Species, record.Gender, $"Captain", record.Fingerprint, record.DNA);
_records.Synchronize((EntityUid) shuttleStation);
_records.Synchronize(station);
bool recSuccess = false;
while (stationList.MoveNext(out var stationUid, out var stationRecComp))
{
if (!_records.TryGetRecord<GeneralStationRecord>(stationUid, keyStorage.Key.Value, out var record))
continue;

_records.RemoveRecord(stationUid, keyStorage.Key.Value);
_records.CreateGeneralRecord((EntityUid) shuttleStation, targetId, record.Name, record.Age, record.Species, record.Gender, $"Captain", record.Fingerprint, record.DNA);
recSuccess = true;
break;
}

if (!recSuccess
&& _prefManager.GetPreferences(args.Session.UserId).SelectedCharacter is HumanoidCharacterProfile profile)
{
TryComp<FingerprintComponent>(player, out var fingerprintComponent);
TryComp<DnaComponent>(player, out var dnaComponent);
_records.CreateGeneralRecord((EntityUid) shuttleStation, targetId, profile.Name, profile.Age, profile.Species, profile.Gender, $"Captain", fingerprintComponent!.Fingerprint, dnaComponent!.DNA);
}
}
_records.Synchronize(shuttleStation!.Value);
_records.Synchronize(station);

//if (ShipyardConsoleUiKey.Security == (ShipyardConsoleUiKey) args.UiKey) Enable in the case we force this on every security ship
// EnsureComp<StationEmpImmuneComponent>(shuttle.Owner); Enable in the case we force this on every security ship
Expand Down
16 changes: 16 additions & 0 deletions Content.Server/Shuttles/Components/ShuttleConsoleComponent.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Numerics;
using Content.Shared.Shuttles.Components;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;

namespace Content.Server.Shuttles.Components
{
Expand All @@ -14,5 +15,20 @@ public sealed partial class ShuttleConsoleComponent : SharedShuttleConsoleCompon
/// </summary>
[DataField("zoom")]
public Vector2 Zoom = new(1.5f, 1.5f);

/// <summary>
/// For EMP to allow keeping the shuttle off
/// </summary>
[DataField("enabled")]
public bool MainBreakerEnabled = true;

/// <summary>
/// While disabled by EMP
/// </summary>
[DataField("timeoutFromEmp", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan TimeoutFromEmp = TimeSpan.Zero;

[DataField("disableDuration"), ViewVariables(VVAccess.ReadWrite)]
public float DisableDuration = 60f;
}
}
42 changes: 42 additions & 0 deletions Content.Server/Shuttles/Systems/ShuttleConsoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Server.Emp;
using Content.Shared.Tools.Components;
using Content.Shared.Emp;

namespace Content.Server.Shuttles.Systems;

Expand Down Expand Up @@ -59,6 +62,9 @@ public override void Initialize()

SubscribeLocalEvent<FTLDestinationComponent, ComponentStartup>(OnFtlDestStartup);
SubscribeLocalEvent<FTLDestinationComponent, ComponentShutdown>(OnFtlDestShutdown);

SubscribeLocalEvent<ShuttleConsoleComponent, EmpPulseEvent>(OnEmpPulse);
SubscribeLocalEvent<ShuttleConsoleComponent, ToolUseAttemptEvent>(OnToolUseAttempt);
}

private void OnFtlDestStartup(EntityUid uid, FTLDestinationComponent component, ComponentStartup args)
Expand Down Expand Up @@ -369,6 +375,22 @@ public override void Update(float frameTime)
{
RemovePilot(uid, comp);
}

/// <summary>
/// This makes the Shuttle Console kick pilots like its removed, to make sure EMP in effect.
/// </summary>
var disabled = EntityQueryEnumerator<EmpDisabledComponent, ShuttleConsoleComponent>();
while (disabled.MoveNext(out var uid, out _, out var comp))
{
if (comp.TimeoutFromEmp <= _timing.CurTime)
{
ClearPilots(comp);
comp.TimeoutFromEmp += TimeSpan.FromSeconds(0.1);
comp.MainBreakerEnabled = false;
}
else
comp.MainBreakerEnabled = true;
}
}

/// <summary>
Expand Down Expand Up @@ -462,4 +484,24 @@ public void ClearPilots(ShuttleConsoleComponent component)
RemovePilot(pilot, pilotComponent);
}
}

private void OnEmpPulse(EntityUid uid, ShuttleConsoleComponent component, ref EmpPulseEvent args)
{
args.Affected = true;
args.Disabled = true;
component.TimeoutFromEmp = _timing.CurTime;
}

private void OnToolUseAttempt(EntityUid uid, ShuttleConsoleComponent component, ToolUseAttemptEvent args)
{
if (!HasComp<EmpDisabledComponent>(uid))
return;

// prevent reconstruct exploit to skip cooldowns
if (!component.MainBreakerEnabled)
args.Cancel();
}

[ByRefEvent]
public record struct ShuttleToggleAttemptEvent(bool Cancelled);
}
92 changes: 92 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1695,3 +1695,95 @@ Entries:
that is missing in the current ship lineup.
id: 4602
time: '2023-11-05T20:59:22.0000000+00:00'
- author: IData-RedactedI
changes:
- type: Add
message: >-
A new vending machine has arrived on frontier. Carrying much less lethal
weapons, this machine is sure to become a firm favorite for those who
aren't blood thirsty killers.
id: 4603
time: '2023-11-07T22:18:19.0000000+00:00'
- author: YumiGumi
changes:
- type: Add
message: Added tiny fans on airlocks for the SLI Gourd
id: 4604
time: '2023-11-08T02:10:03.0000000+00:00'
- author: Cheackraze
changes:
- type: Fix
message: Fixed Record Consoles sometimes not showing player records.
id: 4605
time: '2023-11-09T03:18:44.0000000+00:00'
- author: Bing Guss
changes:
- type: Add
message: Added new lobby art.
id: 4606
time: '2023-11-09T22:55:16.0000000+00:00'
- author: Lokey82
changes:
- type: Add
message: >-
CentCom has become tired of supplying Esquires with mass-media consoles,
so they have contracted the help of a new ship engineer. Please welcome
the NT14-WaveShot, A new ship for reporters!
id: 4607
time: '2023-11-12T20:53:03.0000000+00:00'
- author: cynical24
changes:
- type: Add
message: >-
Due to a lack of Detective-based ships, the NSF Inquisitor has been
added to Security's shipyard!
id: 4608
time: '2023-11-12T21:02:02.0000000+00:00'
- author: CharcoalShipyard
changes:
- type: Add
message: 'Kosmologistika note was added on the shuttle console. '
- type: Tweak
message: Price was changed
- type: Fix
message: Powergrid was changed for the better.
id: 4609
time: '2023-11-12T21:30:19.0000000+00:00'
- author: ErhardSteinhauer
changes: []
id: 4610
time: '2023-11-12T21:31:01.0000000+00:00'
- author: dvir001
changes:
- type: Add
message: >-
The NFSD added the new combat magboots to all security hardsuits
lockers.
- type: Tweak
message: >-
The NFSD Adjusted all security gear to fit with modern times, missing
pistols no more.
id: 4611
time: '2023-11-13T19:08:22.0000000+00:00'
- author: RadiantFlash7
changes:
- type: Tweak
message: Adjusted a lot of minor things on Caduceus with feedback!
id: 4612
time: '2023-11-13T19:19:11.0000000+00:00'
- author: dvir01
changes:
- type: Add
message: >-
NT managed to strike a deal with PACMAN Corp and will now sell
generators in cargo.
id: 4613
time: '2023-11-13T19:36:54.0000000+00:00'
- author: dvir01
changes:
- type: Add
message: >-
Cargo has a new crate for scientists, contains a full kit to start your
very own science lab, everything you need in one crate!
id: 4614
time: '2023-11-13T19:37:38.0000000+00:00'
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
advertisement-lesslethalvend-1 = Brighten someone else's day with a rubber bullet!
advertisement-lesslethalvend-2 = Less Lethal (tm). Its the way to go!
advertisement-lesslethalvend-3 = Beanbags aren't just for sitting on!
advertisement-lesslethalvend-4 = Shock your friends with a tazer TODAY!
advertisement-lesslethalvend-5 = Warning: must be over 3 months old to purchase
advertisement-lesslethalvend-6 = Dont belive their lies
advertisement-lesslethalvend-7 = Tire out your foes with the peaceful option TODAY!
advertisement-lesslethalvend-8 = Less Lethal (tm) means more FUN
advertisement-lesslethalvend-9 = BUY BUY BUY BUY NOW!
advertisement-lesslethalvend-10 = Only a complete idiot buys lethal, go Less Lethal (tm) TODAY!
advertisement-lesslethalvend-11 = Beat those evildoers with a stick. NOW
advertisement-lesslethalvend-12 = Proudly parnered with the NFSD
advertisement-lesslethalvend-13 = Vote Space Kennidy, sponsored by the Less Lethal Group
advertisement-lesslethalvend-14 = Less death means we pass the saving on to YOU!
advertisement-lesslethalvend-15 = Proud to be the No. 1 weapon machine on Frontier Station
advertisement-lesslethalvend-16 = Warning: do not eat the rubber bullets.
advertisement-lesslethalvend-17 = Buy the handy dandy beanbag shell. Its organic!
advertisement-lesslethalvend-18 = Warning: do not eat the beanbag shells.
advertisement-lesslethalvend-19 = Buy your rubbers here TODAY!
advertisement-lesslethalvend-20 = Could you be our 1,000,000th customer?
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ent-EnginePortableGeneratorJrPacman = { ent-PortableGeneratorJrPacman }
.desc = { ent-PortableGeneratorJrPacman.desc }
ent-EnginePortableGeneratorPacman = { ent-PortableGeneratorPacman }
.desc = { ent-PortableGeneratorPacman.desc }
ent-EnginePortableGeneratorSuperPacman = { ent-PortableGeneratorSuperPacman }
.desc = { ent-PortableGeneratorSuperPacman.desc }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-CrateScienceLabBundle = scientist lab kit
.desc = Contains a full kit to build your very own science lab.
Loading

0 comments on commit 134bf68

Please sign in to comment.