Merge branch 'final-version' into upupup

This commit is contained in:
Aviu00
2024-02-05 10:24:33 +03:00
1189 changed files with 31542 additions and 354012 deletions

View File

@@ -8,10 +8,10 @@ using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Salvage;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Spawners.Components;
using Content.Server.Spawners.EntitySystems;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
@@ -81,7 +81,6 @@ public sealed class ArrivalsSystem : EntitySystem
{
base.Initialize();
SubscribeLocalEvent<PlayerSpawningEvent>(OnPlayerSpawn, before: new[] { typeof(SpawnPointSystem), typeof(ContainerSpawnPointSystem) });
SubscribeLocalEvent<StationArrivalsComponent, ComponentStartup>(OnArrivalsStartup);
SubscribeLocalEvent<ArrivalsShuttleComponent, ComponentStartup>(OnShuttleStartup);
@@ -313,7 +312,7 @@ public sealed class ArrivalsSystem : EntitySystem
}
}
private void OnPlayerSpawn(PlayerSpawningEvent ev)
public void HandlePlayerSpawning(PlayerSpawningEvent ev)
{
if (ev.SpawnResult != null)
return;

View File

@@ -1,9 +1,10 @@
using System.Threading;
using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Components;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
using Content.Shared.Access;
using Content.Shared.CCVar;
using Content.Shared.Database;

View File

@@ -11,6 +11,7 @@ using Content.Server.DeviceNetwork.Systems;
using Content.Server.GameTicking.Events;
using Content.Server.Popups;
using Content.Server.RoundEnd;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
@@ -233,21 +234,30 @@ public sealed partial class EmergencyShuttleSystem : EntitySystem
{
var countdownTime = TimeSpan.FromSeconds(_configManager.GetCVar(CCVars.RoundRestartTime));
var shuttle = args.Entity;
if (!TryComp<DeviceNetworkComponent>(shuttle, out var net))
return;
var payload = new NetworkPayload
if (TryComp<DeviceNetworkComponent>(shuttle, out var net))
{
[ShuttleTimerMasks.ShuttleMap] = shuttle,
[ShuttleTimerMasks.SourceMap] = _roundEnd.GetCentcomm(),
[ShuttleTimerMasks.DestMap] = _roundEnd.GetStation(),
[ShuttleTimerMasks.ShuttleTime] = countdownTime,
[ShuttleTimerMasks.SourceTime] = countdownTime,
[ShuttleTimerMasks.DestTime] = countdownTime,
[ShuttleTimerMasks.Text] = new[] { "BYE!" }
};
var payload = new NetworkPayload
{
[ShuttleTimerMasks.ShuttleMap] = shuttle,
[ShuttleTimerMasks.SourceMap] = _roundEnd.GetCentcomm(),
[ShuttleTimerMasks.DestMap] = _roundEnd.GetStation(),
[ShuttleTimerMasks.ShuttleTime] = countdownTime,
[ShuttleTimerMasks.SourceTime] = countdownTime,
[ShuttleTimerMasks.DestTime] = countdownTime,
};
_deviceNetworkSystem.QueuePacket(shuttle, null, payload, net.TransmitFrequency);
// by popular request
// https://discord.com/channels/310555209753690112/770682801607278632/1189989482234126356
if (_random.Next(1000) == 0)
{
payload.Add(ScreenMasks.Text, ShuttleTimerMasks.Kill);
payload.Add(ScreenMasks.Color, Color.Red);
}
else
payload.Add(ScreenMasks.Text, ShuttleTimerMasks.Bye);
_deviceNetworkSystem.QueuePacket(shuttle, null, payload, net.TransmitFrequency);
}
}
/// <summary>

View File

@@ -1,7 +1,7 @@
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Events;
using Content.Server.Station.Components;
using Content.Server.UserInterface;
using Content.Shared.UserInterface;
namespace Content.Server.Shuttles.Systems;

View File

@@ -21,6 +21,7 @@ using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Shared.UserInterface;
namespace Content.Server.Shuttles.Systems;

View File

@@ -1,69 +0,0 @@
using Content.Shared.TextScreen;
using Content.Server.Shuttles.Components;
using Content.Server.DeviceNetwork.Systems;
using Robust.Shared.Timing;
namespace Content.Server.Shuttles.Systems;
/// <summary>
/// Controls the wallmounted screens on stations and shuttles displaying e.g. FTL duration, ETA
/// </summary>
public sealed class ShuttleTimerSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ShuttleTimerComponent, DeviceNetworkPacketEvent>(OnPacketReceived);
}
/// <summary>
/// Determines if/how a broadcast packet affects this timer.
/// All shuttle timer packets are broadcast in their network, and subnetting is implemented by filtering timer MapUid.
/// </summary>
private void OnPacketReceived(EntityUid uid, ShuttleTimerComponent component, DeviceNetworkPacketEvent args)
{
var timerXform = Transform(uid);
// no false positives.
if (timerXform.MapUid == null)
return;
string key;
args.Data.TryGetValue(ShuttleTimerMasks.ShuttleMap, out EntityUid? shuttleMap);
args.Data.TryGetValue(ShuttleTimerMasks.SourceMap, out EntityUid? source);
args.Data.TryGetValue(ShuttleTimerMasks.DestMap, out EntityUid? dest);
args.Data.TryGetValue(ShuttleTimerMasks.Docked, out bool docked);
string?[] text = new string?[] { docked ? Loc.GetString("shuttle-timer-etd") : Loc.GetString("shuttle-timer-eta")};
switch (timerXform.MapUid)
{
// sometimes the timer transforms on FTL shuttles have a hyperspace mapuid, so matching by grid works as a fallback.
case var local when local == shuttleMap || timerXform.GridUid == shuttleMap:
key = ShuttleTimerMasks.ShuttleTime;
break;
case var origin when origin == source:
key = ShuttleTimerMasks.SourceTime;
break;
case var remote when remote == dest:
key = ShuttleTimerMasks.DestTime;
text = new string?[] { Loc.GetString("shuttle-timer-eta") };
break;
default:
return;
}
if (!args.Data.TryGetValue(key, out TimeSpan duration))
return;
if (args.Data.TryGetValue(ShuttleTimerMasks.Text, out string?[]? label))
text = label;
_appearanceSystem.SetData(uid, TextScreenVisuals.TargetTime, _gameTiming.CurTime + duration);
_appearanceSystem.SetData(uid, TextScreenVisuals.ScreenText, text);
}
}