Files
wwdpublic/Content.Server/_Lavaland/Shuttles/Systems/DockingShuttleSystem.cs
Spatison 0f88cb6f4f Upstream 12.07-23.07 (#695)
* Make All Jetpacks Go on Suit Storage + Combat First Aid Kit Easier to Find (#2501)

make all jetpacks go on suit storage aswell

Signed-off-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
(cherry picked from commit f3e58032028de79a9ede1171ec27b7b0dec6f087)

make combat FAK easier to find

Signed-off-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
(cherry picked from commit d989dd1edb40837037e6eded435b66c0764bf1b3)

* Automatic Changelog Update (#2501)

(cherry picked from commit 3179e7d346aadf0735a1262d99db5c84373b4a14)

* Automatic Changelog Update (#2492)

(cherry picked from commit e113f7e9eb8d5b39b3457b9aee93e2a97505e2af)

* PDA Passport Slots (#2499)

# Description

By request from Ghost581 on behalf of Hullrot. I'll let the image speak
for itself. Your passport won't automatically spawn in the PDA, but to
be honest it's a space station 13 tradition that the ID shouldn't spawn
there either, so I don't wanna hear any complaints about it lol.

![image](https://github.com/user-attachments/assets/c22e58ef-3421-460b-a8ad-54ecdfedd3b8)

# Changelog

🆑
- add: Added a PDA slot for storing your character's passport.

Signed-off-by: VMSolidus <evilexecutive@gmail.com>

(cherry picked from commit 016768d5e66b012d17c830c12b75e1cc18f6215a)

* Automatic Changelog Update (#2499)

(cherry picked from commit 9d5ddc78a360a4418f97c472fe55228338947683)

* Fix Traits Anticheat (#2502)

# Description

Traits Anticheat was not accounting for traits having variable slot
occupancy, and was treating the "0 slot traits" as if they always had a
slot cost of 1. This PR corrects this by making it count the actual slot
costs of traits for the purpose of checking for illegal totals.

# Changelog

🆑
- fix: Fixed a bug with Traits Anticheat incorrectly triggering if the
player had selected enough 0 slot traits.

(cherry picked from commit 13eb1351b81f16fe26dc3fa14c9b05a8da600a31)

* Automatic Changelog Update (#2502)

(cherry picked from commit 3620f0ae93dae51ca425ef51802273270993ccae)

* Update Credits (#2504)

Co-authored-by: SimpleStation Changelogs <SimpleStation14@users.noreply.github.com>
(cherry picked from commit d1611704b5e69e66997e62d728e8a07c61a101b4)

* Fix SpaceWindv5 Wall Smoothing (#2506)

Update AtmosphereSystem.MAS.cs

(cherry picked from commit b4c3450331e4f2b8f4f5aabb6761d6ad13ad369f)

* Automatic Changelog Update (#2506)

(cherry picked from commit b3b26a48554cb528f5f4eb43cffafd8dd2dcbdb4)

* Fix Wizden's Division By Zero Error (#2507)

Update GunComponent.cs

(cherry picked from commit f36d91391b5c5a18c2f95da0ff3c2f1ea52b6914)

* Disable Contraband Examine (#2511)

Who fucking added this?

(cherry picked from commit ce2a85ccc1ca1d146f3ed627c4483d8b3db34d90)

* fix: emergency shuttle docked announcement

(cherry picked from commit 559b37d747e14698c2e4fcf4359f45dee0ad8aea)

* fix: non-functioning mining shuttle

(cherry picked from commit 4fc049036a1a8c6839d9bfc8c35f6a8374d79059)

* Disable shadows for observer pointlight (#36897)

no shadows

(cherry picked from commit b3b6d4731078950d3e3a8b1558ec0ab7d6cbbcb1)
(cherry picked from commit 470ded5b22e7a1a8d4296ba210cd05f5c217f138)

* Fix observer pointlights being broken (#37335)

(cherry picked from commit dfc8934782045106b07ccf1de6ee4e66d4aa4cb2)
(cherry picked from commit 11e0ed317b662f80ca7e4a754e183b18cde3506b)

* Automatic Changelog Update (#2512)

(cherry picked from commit 0cc861ac096ad5005f36528b7c02c8e612f5df37)

---------

Signed-off-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
Co-authored-by: Ghost581 <85649313+Ghost581X@users.noreply.github.com>
Co-authored-by: SimpleStation Changelogs <SimpleStation14@users.noreply.github.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
2025-07-23 15:29:58 +03:00

217 lines
7.8 KiB
C#

using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared._Lavaland.Shuttles.Components;
using Content.Shared._Lavaland.Shuttles.Systems;
using Content.Shared.Shuttles.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using System.Linq;
using Content.Server.GameTicking;
using Robust.Server.GameObjects;
using Robust.Shared.Timing;
using Content.Server._Lavaland.Procedural.Components;
using Content.Server.Station.Events;
using System.Security.Principal;
namespace Content.Server._Lavaland.Shuttles.Systems;
public sealed class DockingShuttleSystem : SharedDockingShuttleSystem
{
[Dependency] private readonly DockingConsoleSystem _console = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelist = default!;
[Dependency] private readonly StationSystem _station = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DockingShuttleComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<DockingShuttleComponent, FTLStartedEvent>(OnFTLStarted);
SubscribeLocalEvent<DockingShuttleComponent, FTLCompletedEvent>(OnFTLCompleted);
SubscribeLocalEvent<StationGridAddedEvent>(OnStationGridAdded);
SubscribeLocalEvent<DockingShuttleComponent, ShuttleAddStationEvent>(OnAddStation);
SubscribeLocalEvent<DockingShuttleComponent, ShuttleLocationChangeEvent>(OnLocationChange);
}
private void OnMapInit(Entity<DockingShuttleComponent> ent, ref MapInitEvent args)
{
// add any whitelisted destinations that it can FTL to
// since it needs a whitelist, this excludes the station
var query = EntityQueryEnumerator<FTLDestinationComponent, MapComponent>();
while (query.MoveNext(out var mapUid, out var dest, out var map))
{
if (!dest.Enabled || _whitelist.IsWhitelistFail(dest.Whitelist, ent))
continue;
AddDestinations(ent, map.MapId);
}
// Also update all consoles
var consoleQuery = EntityQueryEnumerator<DockingConsoleComponent>();
while (consoleQuery.MoveNext(out var uid, out var dest))
{
if (TerminatingOrDeleted(uid))
continue;
_console.UpdateShuttle((uid, dest));
}
}
private void OnFTLStarted(Entity<DockingShuttleComponent> ent, ref FTLStartedEvent args)
{
_console.UpdateConsolesUsing(ent);
}
private void OnFTLCompleted(Entity<DockingShuttleComponent> ent, ref FTLCompletedEvent args)
{
_console.UpdateConsolesUsing(ent);
}
/// <summary>
/// When any station has been added or an item that has been added by a station it checks to see if it has the docking component.
/// If there is a docking component then find the station that spawned it and add it to destinations.
/// </summary>
private void OnStationGridAdded(StationGridAddedEvent args)
{
var uid = args.GridId;
if (!TryComp<DockingShuttleComponent>(uid, out var comp))
return;
// only add the destination once
if (comp.Station != null)
return;
if (_station.GetOwningStation(uid) is not {} station || !TryComp<StationDataComponent>(station, out var data))
return;
// if this returns null. Suffer
if (GetStationbyName(data, Name(station)) is not {} grid)
return;
// add the source station as a destination
comp.Station = station;
// Add the warp point and set the current location to the station uid
comp.currentlocation = grid.Id;
AddDestinationUID(comp, Transform(uid).MapID, grid);
}
/// <summary>
/// If you have the exact station name then it will return it. This can also work with the ATS.
/// </summary>
private EntityUid? GetStationbyName(StationDataComponent component, string stationname)
{
foreach (var grid in component.Grids)
if (stationname == Name(grid))
return grid;
return null;
}
/// <summary>
/// If there is no mining shuttle on round start it will call this event and add it to destinations.
/// </summary>
private void OnAddStation(EntityUid uid, DockingShuttleComponent component, ShuttleAddStationEvent args)
{
component.Station = args.MapUid;
component.currentlocation = args.GridUid.Id;
AddDestinationUID(component, args.MapId, args.GridUid);
}
/// <summary>
/// When the location changes on FTL the value of currentlocation needs to be changed to the new location.
/// </summary>
private void OnLocationChange(EntityUid uid, DockingShuttleComponent component, ShuttleLocationChangeEvent args)
{
component.currentlocation = args.currentlocation;
}
/// <summary>
/// This function will specifically for lavaland components or station components on any given map.
/// This will allow for you to add more maps or have many stations/lavaland structures to warp too :)
/// </summary>
private void AddDestinations(DockingShuttleComponent component, MapId map)
{
// Tries to add stations if there
AddStation(component, map);
// Then tries lavaland components.
AddLavalandStation(component, map);
}
/// <summary>
/// Looks through all the BecomesStationComponent and adds said stations.
/// If there is multiple station on the same map now it will create warp points for said stations
/// </summary>
private void AddStation(DockingShuttleComponent component, MapId map)
{
var query = EntityQueryEnumerator<BecomesStationComponent, TransformComponent>();
while (query.MoveNext(out var gridUid, out var grid, out var xform))
{
if (xform.MapID != map)
continue;
// Check if this function is called again to update the shuttle console warp points.
if (component.LocationUID.Contains(gridUid))
continue;
AddDestinationUID(component, map, gridUid);
}
}
/// <summary>
/// Will specifically look through lavaland stations to add all grids marked with lavalandstationcomponent
/// This will allow people to add more warp points like a lavaland fight arena. :)
/// </summary>
private void AddLavalandStation(DockingShuttleComponent component, MapId map)
{
var query = EntityQueryEnumerator<LavalandStationComponent, TransformComponent>();
while (query.MoveNext(out var gridUid, out var grid, out var xform))
{
// Check if this function is called again to update the shuttle console warp points.
if (component.LocationUID.Contains(gridUid))
continue;
AddDestinationUID(component, map, gridUid);
}
}
/// <summary>
/// Add the destination gridUID to the destinations.
/// </summary>
private void AddDestinationUID(DockingShuttleComponent component, MapId map, EntityUid gridUid)
{
component.Destinations.Add(new DockingDestination()
{
Name = Name(gridUid),
Map = map
});
component.LocationUID.Add(gridUid);
}
}
public sealed class ShuttleAddStationEvent : EntityEventArgs
{
public readonly EntityUid MapUid;
public readonly MapId MapId;
public readonly EntityUid GridUid;
public ShuttleAddStationEvent(EntityUid mapUid, MapId mapId, EntityUid gridUid)
{
MapUid = mapUid;
MapId = mapId;
GridUid = gridUid;
}
}
public sealed class ShuttleLocationChangeEvent : EntityEventArgs
{
public readonly int currentlocation;
public ShuttleLocationChangeEvent(int location)
{
currentlocation = location;
}
}