mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-05 13:57:29 +00:00
* Generic offering window
* More work
* weh
* Parity
* Progression meter
* magnet
* rona
* PG asteroid work
* code red
* Asteroid spawnings
* clams
* a
* Marker fixes
* More fixes
* Workings of biome asteroids
* A
* Fix this loading code
* a
* Fix masking
* weh
* Fixes
* Magnet claiming
* toe
* petogue
* magnet
* Bunch of fixes
* Fix default
* Fixes
* asteroids
* Fix offerings
* Localisation and a bunch of fixes
* a
* Fixes
* Preliminary draft
* Announcement fixes
* Fixes and bump spawn rate
* Fix asteroid spawns and UI
* More fixes
* Expeditions fix
* fix
* Gravity
* Fix announcement rounding
* a
* Offset tweak
* sus
* jankass
* Fix merge
(cherry picked from commit bf79acd127)
75 lines
2.2 KiB
C#
75 lines
2.2 KiB
C#
using Content.Server.Shuttles.Components;
|
|
using Content.Server.Shuttles.Events;
|
|
using Content.Server.Station.Components;
|
|
using Content.Server.UserInterface;
|
|
|
|
namespace Content.Server.Shuttles.Systems;
|
|
|
|
public sealed partial class ShuttleConsoleSystem
|
|
{
|
|
/// <summary>
|
|
/// Refreshes all drone console entities.
|
|
/// </summary>
|
|
public void RefreshDroneConsoles()
|
|
{
|
|
var query = AllEntityQuery<DroneConsoleComponent>();
|
|
|
|
while (query.MoveNext(out var uid, out var comp))
|
|
{
|
|
comp.Entity = GetShuttleConsole(uid, comp);
|
|
}
|
|
}
|
|
|
|
private void OnDronePilotConsoleOpen(EntityUid uid, DroneConsoleComponent component, AfterActivatableUIOpenEvent args)
|
|
{
|
|
component.Entity = GetShuttleConsole(uid);
|
|
}
|
|
|
|
private void OnDronePilotConsoleClose(EntityUid uid, DroneConsoleComponent component, BoundUIClosedEvent args)
|
|
{
|
|
component.Entity = null;
|
|
}
|
|
|
|
private void OnCargoGetConsole(EntityUid uid, DroneConsoleComponent component, ref ConsoleShuttleEvent args)
|
|
{
|
|
args.Console = GetShuttleConsole(uid, component);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the relevant shuttle console to proxy from the drone console.
|
|
/// </summary>
|
|
private EntityUid? GetShuttleConsole(EntityUid uid, DroneConsoleComponent? component = null)
|
|
{
|
|
if (!Resolve(uid, ref component))
|
|
return null;
|
|
|
|
var stationUid = _station.GetOwningStation(uid);
|
|
|
|
if (stationUid == null)
|
|
return null;
|
|
|
|
// I know this sucks but needs device linking or something idunno
|
|
var query = AllEntityQuery<ShuttleConsoleComponent, TransformComponent>();
|
|
|
|
while (query.MoveNext(out var cUid, out _, out var xform))
|
|
{
|
|
if (xform.GridUid == null ||
|
|
!TryComp<StationMemberComponent>(xform.GridUid, out var member) ||
|
|
member.Station != stationUid)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
foreach (var compType in component.Components.Values)
|
|
{
|
|
if (!HasComp(xform.GridUid, compType.Component.GetType()))
|
|
continue;
|
|
|
|
return cUid;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|