Skip to content

Commit

Permalink
Upstream 29.08.2024
Browse files Browse the repository at this point in the history
Merge pull request #71 from Space-Stories/upstream
  • Loading branch information
doublechest0 authored Aug 29, 2024
2 parents 19127e3 + d3bac3e commit 394a8ff
Show file tree
Hide file tree
Showing 103 changed files with 1,020 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Text="{Loc 'news-read-ui-next-text'}"
ToolTip="{Loc 'news-read-ui-next-tooltip'}"/>
</BoxContainer>
<controls:StripeBack Name="АrticleNameContainer">
<controls:StripeBack Name="ArticleNameContainer">
<PanelContainer>
<Label Name="PageNum" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,0,0"/>
<Label Name="PageName" Align="Center"/>
Expand Down
8 changes: 4 additions & 4 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ await server.WaitPost(() =>
var jobs = new HashSet<ProtoId<JobPrototype>>(comp.SetupAvailableJobs.Keys);

var spawnPoints = entManager.EntityQuery<SpawnPointComponent>()
.Where(x => x.SpawnType == SpawnPointType.Job)
.Select(x => x.Job!.Value);
.Where(x => x.SpawnType == SpawnPointType.Job && x.Job != null)
.Select(x => x.Job.Value);

jobs.ExceptWith(spawnPoints);

spawnPoints = entManager.EntityQuery<ContainerSpawnPointComponent>()
.Where(x => x.SpawnType == SpawnPointType.Job)
.Select(x => x.Job!.Value);
.Where(x => x.SpawnType is SpawnPointType.Job or SpawnPointType.Unset && x.Job != null)
.Select(x => x.Job.Value);

jobs.ExceptWith(spawnPoints);

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Anomaly/AnomalySynchronizerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void OnPowerChanged(Entity<AnomalySynchronizerComponent> ent, ref PowerC
if (!TryComp<AnomalyComponent>(ent.Comp.ConnectedAnomaly, out var anomaly))
return;

DisconneсtFromAnomaly(ent, anomaly);
DisconnectFromAnomaly(ent, anomaly);
}

private void OnExamined(Entity<AnomalySynchronizerComponent> ent, ref ExaminedEvent args)
Expand Down Expand Up @@ -125,7 +125,7 @@ private void ConnectToAnomaly(Entity<AnomalySynchronizerComponent> ent, Entity<A

//TODO: disconnection from the anomaly should also be triggered if the anomaly is far away from the synchronizer.
//Currently only bluespace anomaly can do this, but for some reason it is the only one that cannot be connected to the synchronizer.
private void DisconneсtFromAnomaly(Entity<AnomalySynchronizerComponent> ent, AnomalyComponent anomaly)
private void DisconnectFromAnomaly(Entity<AnomalySynchronizerComponent> ent, AnomalyComponent anomaly)
{
if (ent.Comp.ConnectedAnomaly == null)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ private void OnPacketRecv(EntityUid uid, AtmosMonitorComponent component, Device
}

_deviceNetSystem.QueuePacket(uid, args.SenderAddress, payload);
Alert(uid, component.LastAlarmState);
break;
}
}
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,10 @@ private void OnRoundEnd(Entity<NukeopsRuleComponent> ent)

var diskAtCentCom = false;
var diskQuery = AllEntityQuery<NukeDiskComponent, TransformComponent>();
while (diskQuery.MoveNext(out _, out var transform))
while (diskQuery.MoveNext(out var diskUid, out _, out var transform))
{
diskAtCentCom = transform.MapUid != null && centcomms.Contains(transform.MapUid.Value);
diskAtCentCom |= _emergency.IsTargetEscaping(diskUid);

// TODO: The target station should be stored, and the nuke disk should store its original station.
// This is fine for now, because we can assume a single station in base SS14.
Expand Down
12 changes: 4 additions & 8 deletions Content.Server/Shuttles/Systems/ArrivalsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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.Events;
using Content.Server.Station.Systems;
Expand Down Expand Up @@ -69,11 +70,6 @@ public sealed class ArrivalsSystem : EntitySystem
/// </summary>
public bool Enabled { get; private set; }

/// <summary>
/// Flags if all players must arrive via the Arrivals system, or if they can spawn in other ways.
/// </summary>
public bool Forced { get; private set; }

/// <summary>
/// Flags if all players spawning at the departure terminal have godmode until they leave the terminal.
/// </summary>
Expand All @@ -95,6 +91,8 @@ public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PlayerSpawningEvent>(HandlePlayerSpawning, before: new []{ typeof(ContainerSpawnPointSystem), typeof(SpawnPointSystem)});

SubscribeLocalEvent<StationArrivalsComponent, StationPostInitEvent>(OnStationPostInit);

SubscribeLocalEvent<ArrivalsShuttleComponent, ComponentStartup>(OnShuttleStartup);
Expand All @@ -112,11 +110,9 @@ public override void Initialize()

// Don't invoke immediately as it will get set in the natural course of things.
Enabled = _cfgManager.GetCVar(CCVars.ArrivalsShuttles);
Forced = _cfgManager.GetCVar(CCVars.ForceArrivals);
ArrivalsGodmode = _cfgManager.GetCVar(CCVars.GodmodeArrivals);

_cfgManager.OnValueChanged(CCVars.ArrivalsShuttles, SetArrivals);
_cfgManager.OnValueChanged(CCVars.ForceArrivals, b => Forced = b);
_cfgManager.OnValueChanged(CCVars.GodmodeArrivals, b => ArrivalsGodmode = b);

// Command so admins can set these for funsies
Expand Down Expand Up @@ -339,7 +335,7 @@ public void HandlePlayerSpawning(PlayerSpawningEvent ev)
return;

// Only works on latejoin even if enabled.
if (!Enabled || !Forced && _ticker.RunLevel != GameRunLevel.InRound)
if (!Enabled || _ticker.RunLevel != GameRunLevel.InRound)
return;

if (!HasComp<StationArrivalsComponent>(ev.Station))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void OnStationPostInit(ref StationPostInitEvent ev)
continue;
}

TryAddFTLDestination(gridXform.MapID, true, out _);
TryAddFTLDestination(gridXform.MapID, true, false, false, out _);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public sealed class ContainerSpawnPointSystem : EntitySystem
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly StationSpawningSystem _stationSpawning = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PlayerSpawningEvent>(HandlePlayerSpawning, before: new []{ typeof(SpawnPointSystem) });
}

public void HandlePlayerSpawning(PlayerSpawningEvent args)
{
if (args.SpawnResult != null)
Expand Down
42 changes: 0 additions & 42 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,11 @@ public sealed class StationSpawningSystem : SharedStationSpawningSystem

private bool _randomizeCharacters;

private Dictionary<SpawnPriorityPreference, Action<PlayerSpawningEvent>> _spawnerCallbacks = new();

/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
Subs.CVar(_configurationManager, CCVars.ICRandomCharacters, e => _randomizeCharacters = e, true);

_spawnerCallbacks = new Dictionary<SpawnPriorityPreference, Action<PlayerSpawningEvent>>()
{
{ SpawnPriorityPreference.Arrivals, _arrivalsSystem.HandlePlayerSpawning },
{
SpawnPriorityPreference.Cryosleep, ev =>
{
if (_arrivalsSystem.Forced)
_arrivalsSystem.HandlePlayerSpawning(ev);
else
_containerSpawnPointSystem.HandlePlayerSpawning(ev);
}
}
};
}

/// <summary>
Expand All @@ -98,33 +82,7 @@ public override void Initialize()

var ev = new PlayerSpawningEvent(job, profile, station);

if (station != null && profile != null)
{
// Try to call the character's preferred spawner first.
if (_spawnerCallbacks.TryGetValue(profile.SpawnPriority, out var preferredSpawner))
{
preferredSpawner(ev);

foreach (var (key, remainingSpawner) in _spawnerCallbacks)
{
if (key == profile.SpawnPriority)
continue;

remainingSpawner(ev);
}
}
else
{
// Call all of them in the typical order.
foreach (var typicalSpawner in _spawnerCallbacks.Values)
{
typicalSpawner(ev);
}
}
}

RaiseLocalEvent(ev);

DebugTools.Assert(ev.SpawnResult is { Valid: true } or null);

return ev.SpawnResult;
Expand Down
6 changes: 0 additions & 6 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,12 +1478,6 @@ public static readonly CVarDef<int>
public static readonly CVarDef<bool> ArrivalsReturns =
CVarDef.Create("shuttle.arrivals_returns", false, CVar.SERVERONLY);

/// <summary>
/// Should all players be forced to spawn at departures, even on roundstart, even if their loadout says they spawn in cryo?
/// </summary>
public static readonly CVarDef<bool> ForceArrivals =
CVarDef.Create("shuttle.force_arrivals", false, CVar.SERVERONLY);

/// <summary>
/// Should all players who spawn at arrivals have godmode until they leave the map?
/// </summary>
Expand Down
Loading

0 comments on commit 394a8ff

Please sign in to comment.