Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into nfsd-station
Browse files Browse the repository at this point in the history
  • Loading branch information
TsjipTsjip committed Jan 17, 2024
2 parents 8f4d78d + 37ea0dd commit 3c03f89
Show file tree
Hide file tree
Showing 157 changed files with 7,371 additions and 1,650 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Content.Server.Item.PseudoItem;

/// <summary>
/// Signifies that pseudo-item creatures can sleep inside the container to which this component was added.
/// </summary>
[RegisterComponent]
public sealed partial class AllowsSleepInsideComponent : Component
{
}
23 changes: 23 additions & 0 deletions Content.Server/Nyanotrasen/Item/PseudoItem/PseudoItemSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
using Content.Server.Actions;
using Content.Server.Bed.Sleep;
using Content.Server.DoAfter;
using Content.Server.Popups;
using Content.Server.Storage.EntitySystems;
using Content.Shared.Bed.Sleep;
using Content.Shared.DoAfter;
using Content.Shared.Hands;
using Content.Shared.IdentityManagement;
Expand All @@ -18,6 +22,8 @@ public sealed class PseudoItemSystem : EntitySystem
[Dependency] private readonly ItemSystem _itemSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfter = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly ActionsSystem _actions = default!; // Frontier
[Dependency] private readonly PopupSystem _popup = default!; // Frontier

[ValidatePrototypeId<TagPrototype>]
private const string PreventTag = "PreventLabel";
Expand All @@ -32,6 +38,7 @@ public override void Initialize()
SubscribeLocalEvent<PseudoItemComponent, DropAttemptEvent>(OnDropAttempt);
SubscribeLocalEvent<PseudoItemComponent, PseudoItemInsertDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<PseudoItemComponent, ContainerGettingInsertedAttemptEvent>(OnInsertAttempt);
SubscribeLocalEvent<PseudoItemComponent, TryingToSleepEvent>(OnTrySleeping); // Frontier
}

private void AddInsertVerb(EntityUid uid, PseudoItemComponent component, GetVerbsEvent<InnateVerb> args)
Expand Down Expand Up @@ -96,6 +103,10 @@ private void OnEntRemoved(EntityUid uid, PseudoItemComponent component, EntGotRe

RemComp<ItemComponent>(uid);
component.Active = false;

// Frontier
if (component.SleepAction is { Valid: true })
_actions.RemoveAction(uid, component.SleepAction);
}

private void OnGettingPickedUpAttempt(EntityUid uid, PseudoItemComponent component,
Expand Down Expand Up @@ -142,6 +153,10 @@ public bool TryInsert(EntityUid storageUid, EntityUid toInsert, PseudoItemCompon
return false;
}

// Frontier
if (HasComp<AllowsSleepInsideComponent>(storageUid))
_actions.AddAction(toInsert, ref component.SleepAction, SleepingSystem.SleepActionId, toInsert);

component.Active = true;
return true;
}
Expand Down Expand Up @@ -171,4 +186,12 @@ private void OnInsertAttempt(EntityUid uid, PseudoItemComponent component,
// This hopefully shouldn't trigger, but this is a failsafe just in case so we dont bluespace them cats
args.Cancel();
}

// Frontier - show a popup when a pseudo-item falls asleep inside a bag.
private void OnTrySleeping(EntityUid uid, PseudoItemComponent component, TryingToSleepEvent args)
{
var parent = Transform(uid).ParentUid;
if (!HasComp<SleepingComponent>(uid) && parent is { Valid: true } && HasComp<AllowsSleepInsideComponent>(parent))
_popup.PopupEntity(Loc.GetString("popup-sleep-in-bag", ("entity", uid)), uid);
}
}
61 changes: 52 additions & 9 deletions Content.Server/_NF/PublicTransit/PublicTransitSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Content.Server._NF.PublicTransit.Components;
using Content.Server.Chat.Systems;
using Content.Server.GameTicking;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Shuttles.Systems;
using Content.Shared.GameTicking;
using Content.Shared.NF14.CCVar;
using Content.Shared.Shuttles.Components;
using Content.Shared.Tiles;
Expand All @@ -25,6 +27,7 @@ public sealed class PublicTransitSystem : EntitySystem
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly MapLoaderSystem _loader = default!;
[Dependency] private readonly ShuttleSystem _shuttles = default!;
[Dependency] private readonly ChatSystem _chat = default!;

/// <summary>
/// If enabled then spawns the bus and sets up the bus line.
Expand All @@ -42,7 +45,9 @@ public override void Initialize()
SubscribeLocalEvent<StationTransitComponent, ComponentShutdown>(OnStationShutdown);
SubscribeLocalEvent<TransitShuttleComponent, ComponentStartup>(OnShuttleStartup);
SubscribeLocalEvent<TransitShuttleComponent, EntityUnpausedEvent>(OnShuttleUnpaused);
SubscribeLocalEvent<TransitShuttleComponent, FTLCompletedEvent>(OnShuttleArrival);
SubscribeLocalEvent<TransitShuttleComponent, FTLTagEvent>(OnShuttleTag);
SubscribeLocalEvent<RoundStartedEvent>(OnRoundStart);

Enabled = _cfgManager.GetCVar(NF14CVars.PublicTransit);
FlyTime = _cfgManager.GetCVar(NF14CVars.PublicTransitFlyTime);
Expand All @@ -52,6 +57,21 @@ public override void Initialize()
_cfgManager.OnValueChanged(NF14CVars.PublicTransitFlyTime, SetFly);
}

public void OnRoundStart(RoundStartedEvent args)
{
Counter = 0;
if (Enabled)
SetupPublicTransit();
}

public override void Shutdown()
{
base.Shutdown();
_cfgManager.UnsubValueChanged(NF14CVars.PublicTransitFlyTime, SetFly);
_cfgManager.UnsubValueChanged(NF14CVars.PublicTransit, SetTransit);
}


/// <summary>
/// Hardcoded snippit to intercept FTL events. It catches the transit shuttle and ensures its looking for the "DockTransit" priority dock.
/// </summary>
Expand All @@ -65,13 +85,6 @@ private void OnShuttleTag(EntityUid uid, TransitShuttleComponent component, ref
args.Tag = "DockTransit";
}

public override void Shutdown()
{
base.Shutdown();
_cfgManager.UnsubValueChanged(NF14CVars.PublicTransitFlyTime, SetFly);
_cfgManager.UnsubValueChanged(NF14CVars.PublicTransit, SetTransit);
}

/// <summary>
/// Checks to make sure the grid is on the appropriate playfield, i.e., not in mapping space being worked on.
/// If so, adds the grid to the list of bus stops, but only if its not already there
Expand All @@ -82,8 +95,6 @@ private void OnStationStartup(EntityUid uid, StationTransitComponent component,
{
if (!StationList.Contains(uid)) //if the grid isnt already in
StationList.Add(uid); //add it to the list
if (Enabled) //and just in case this has been added dynamically mid-round, lets do a setup check
SetupPublicTransit();
}
}

Expand Down Expand Up @@ -114,6 +125,24 @@ private void OnShuttleUnpaused(EntityUid uid, TransitShuttleComponent component,
component.NextTransfer += args.PausedTime;
}

private void OnShuttleArrival(EntityUid uid, TransitShuttleComponent comp, ref FTLCompletedEvent args)
{
var consoleQuery = EntityQueryEnumerator<ShuttleConsoleComponent>();

while (consoleQuery.MoveNext(out var consoleUid, out _))
{
if (Transform(consoleUid).GridUid == uid)
{
var destinationString = MetaData(comp.NextStation).EntityName;

_chat.TrySendInGameICMessage(consoleUid, Loc.GetString("public-transit-arrival",
("destination", destinationString), ("waittime", _cfgManager.GetCVar(NF14CVars.PublicTransitWaitTime))),
InGameICChatType.Speak, ChatTransmitRange.HideChat, hideLog: true, checkRadioPrefix: false,
ignoreActionBlocker: true);
}
}
}

/// <summary>
/// Here is our bus stop list handler. Theres probably a better way...
/// First, sets our output to null just in case
Expand Down Expand Up @@ -158,6 +187,20 @@ public override void Update(float frameTime)
if (comp.NextTransfer > curTime)
continue;

var consoleQuery = EntityQueryEnumerator<ShuttleConsoleComponent>();

while (consoleQuery.MoveNext(out var consoleUid, out _))
{
if (Transform(consoleUid).GridUid == uid)
{
var destinationString = MetaData(comp.NextStation).EntityName;

_chat.TrySendInGameICMessage(consoleUid, Loc.GetString("public-transit-departure",
("destination", destinationString), ("flytime", FlyTime)),
InGameICChatType.Speak, ChatTransmitRange.HideChat, hideLog: true, checkRadioPrefix: false,
ignoreActionBlocker: true);
}
}
_shuttles.FTLTravel(uid, shuttle, comp.NextStation, hyperspaceTime: FlyTime, dock: true);

if (TryGetNextStation(out var nextStation) && nextStation is {Valid : true} destination)
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Access/Components/IdCardConsoleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public sealed partial class IdCardConsoleComponent : Component
"Maintenance",
"Medical",
"Mercenary", // Frontier
"Pilot", // Frontier
"Quartermaster",
"Research",
"ResearchDirector",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ public sealed partial class PseudoItemComponent : Component, ITransferredByCloni
public int Size = 120;

public bool Active = false;

[DataField]
public EntityUid? SleepAction;
}
53 changes: 53 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2793,3 +2793,56 @@ Entries:
message: Anomaly generator now require bananium processed ore.
id: 4743
time: '2024-01-12T02:57:26.0000000+00:00'
- author: Mnemotechnician
changes:
- type: Add
message: >-
Added a mothership console to the Caduceus, offering small medical
ships.
id: 4744
time: '2024-01-14T01:16:16.0000000+00:00'
- author: Lokey82
changes:
- type: Add
message: Added the NT Stellaris, A new theatre ship.
id: 4745
time: '2024-01-14T16:11:17.0000000+00:00'
- author: VividPups
changes:
- type: Tweak
message: >-
Mayflower - Replaced wall-mounted lockers of the Merc and Prisoner with
regular ones, removed loose .45 cal ammo and speedloaders.
id: 4746
time: '2024-01-14T16:19:12.0000000+00:00'
- author: ghostprince
changes:
- type: Tweak
message: >-
Added the new AutoTune vender, sitting on frontier and selling all the
instrument you are looking for, might or might not have some hidden
secrets in its inventory.
id: 4747
time: '2024-01-14T22:00:29.0000000+00:00'
- author: Cheackraze
changes:
- type: Tweak
message: >-
The public transit shuttle will now announce its next destination to
local chat on both arrival and departure
- type: Fix
message: Fixed the public transit shuttle from spawning twice each round
id: 4748
time: '2024-01-15T00:13:42.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Add
message: Pilot Job with some job related drip. Check AstroVend for new looks.
id: 4749
time: '2024-01-15T01:04:57.0000000+00:00'
- author: Mnemotechnician
changes:
- type: Add
message: Scientists have discovered that small creatures can sleep inside bags.
id: 4750
time: '2024-01-15T01:40:21.0000000+00:00'
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/actions/sleep.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
popup-sleep-in-bag = {THE($entity)} curls up and falls asleep.
5 changes: 4 additions & 1 deletion Resources/Locale/en-US/_NF/adventure/adventure.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ shipyard-rules-default2 =
shuttle-ftl-proximity = Nearby objects too massive for FTL!
changelog-tab-title-Upstream = Upstream Changelog
changelog-tab-title-Upstream = Upstream Changelog
public-transit-departure = Now departing for {$destination}. Estimated travel time: {$flytime} seconds.
public-transit-arrival = Thank you for choosing NT Public Transit. Next transfer to {$destination} departs in {$waittime} seconds.
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/job/job-description.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
job-description-mercenary = Execute the bidding of anyone- for the right price. Enjoy being unbound from the confines of the law.
job-description-stc = Expertly de-conflict the space around the station and help the NFSD issue fines for overdocked ships.
job-description-pilot = Pilot spaceships from point A to B, outmaneuver pirates and dodge asteroids. You are a leaf on the solar wind, let others marvel at how you soar.
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/_NF/job/job-names.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
job-name-mercenary = Mercenary
job-name-stc = Station Traffic Controller
job-name-pilot = Pilot
# Role timers - Make these alphabetical or I cut you
JobMercenary = Mercenary
JobSTC = Station Traffic Controller
JobPilot = Pilot
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/_NF/prototypes/access/accesses.ftl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
id-card-access-level-frontier = Station Traffic Controller
id-card-access-level-mercenary = Mercenary
id-card-access-level-pilot = Pilot
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ ent-CrateVendingMachineRestockCondimentStationFilled = Condiment Station restock
ent-CrateVendingMachineRestockLessLethalVendFilled = LessLethalVend restock crate
.desc = Contains two restock boxes for the LessLethalVend vending machine.
ent-CrateVendingMachineRestockAutoTuneVendFilled = AutoTuneVend restock crate
.desc = Contains two restock boxes for the AutoTuneVend vending machine.
Loading

0 comments on commit 3c03f89

Please sign in to comment.