Skip to content

Commit

Permalink
Тразитный хаб и играбельное ЦК
Browse files Browse the repository at this point in the history
  • Loading branch information
VigersRay committed Jun 9, 2024
1 parent b1a48c2 commit e45c30f
Show file tree
Hide file tree
Showing 37 changed files with 60,225 additions and 152 deletions.
2 changes: 1 addition & 1 deletion Content.Server/GameTicking/GameTicker.RoundFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public IReadOnlyList<EntityUid> LoadGameMap(GameMapPrototype map, MapId targetMa

var gridIds = _map.LoadMap(targetMapId, ev.GameMap.MapPath.ToString(), ev.Options);

_metaData.SetEntityName(_mapManager.GetMapEntityId(targetMapId), $"station map - {map.MapName}");
_metaData.SetEntityName(_mapManager.GetMapEntityId(targetMapId), $"станция - {map.MapName}"); // Sunrise-edit

var gridUids = gridIds.ToList();
RaiseLocalEvent(new PostGameMapLoad(map, targetMapId, gridUids, stationName));
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ private void OnRoundEnd(Entity<NukeopsRuleComponent> ent)
return;

var nukeQuery = AllEntityQuery<NukeComponent, TransformComponent>();
var centcomms = _emergency.GetCentcommMaps();
var transitHub = _emergency.GetTransitHubMaps();

while (nukeQuery.MoveNext(out var nuke, out var nukeTransform))
{
if (nuke.Status != NukeStatus.ARMED)
continue;

// UH OH
if (nukeTransform.MapUid != null && centcomms.Contains(nukeTransform.MapUid.Value))
if (nukeTransform.MapUid != null && transitHub.Contains(nukeTransform.MapUid.Value))
{
ent.Comp.WinConditions.Add(WinCondition.NukeActiveAtCentCom);
SetWinType((ent, ent), WinType.OpsMajor);
Expand Down Expand Up @@ -218,7 +218,7 @@ private void OnRoundEnd(Entity<NukeopsRuleComponent> ent)
var diskQuery = AllEntityQuery<NukeDiskComponent, TransformComponent>();
while (diskQuery.MoveNext(out _, out var transform))
{
diskAtCentCom = transform.MapUid != null && centcomms.Contains(transform.MapUid.Value);
diskAtCentCom = transform.MapUid != null && transitHub.Contains(transform.MapUid.Value);

// 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
16 changes: 8 additions & 8 deletions Content.Server/RoundEnd/RoundEndSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading;
using Content.Server._Sunrise.TransitHub;
using Content.Server.Administration.Logs;
using Content.Server.AlertLevel;
using Content.Shared.CCVar;
Expand Down Expand Up @@ -106,15 +107,14 @@ private void Reset()
return targetGrid == null ? null : Transform(targetGrid.Value).MapUid;
}

/// <summary>
/// Attempts to get centcomm's MapUid
/// </summary>
public EntityUid? GetCentcomm()
// Sunrise-Start
public EntityUid? GetTransitHub()
{
AllEntityQuery<StationCentcommComponent>().MoveNext(out var centcomm);
AllEntityQuery<StationTransitHubComponent>().MoveNext(out var transitHub);

return centcomm == null ? null : centcomm.MapEntity;
return transitHub == null ? null : transitHub.MapEntity;
}
// Sunrise-End

public bool CanCallOrRecall()
{
Expand Down Expand Up @@ -204,7 +204,7 @@ public void RequestRoundEnd(TimeSpan countdownTime, EntityUid? requester = null,
var payload = new NetworkPayload
{
[ShuttleTimerMasks.ShuttleMap] = shuttle,
[ShuttleTimerMasks.SourceMap] = GetCentcomm(),
[ShuttleTimerMasks.SourceMap] = GetTransitHub(), // Sunrise-Edit
[ShuttleTimerMasks.DestMap] = GetStation(),
[ShuttleTimerMasks.ShuttleTime] = countdownTime,
[ShuttleTimerMasks.SourceTime] = countdownTime + TimeSpan.FromSeconds(_shuttle.TransitTime + _cfg.GetCVar(CCVars.EmergencyShuttleDockTime)),
Expand Down Expand Up @@ -248,7 +248,7 @@ public void CancelRoundEndCountdown(EntityUid? requester = null, bool checkCoold
var payload = new NetworkPayload
{
[ShuttleTimerMasks.ShuttleMap] = shuttle,
[ShuttleTimerMasks.SourceMap] = GetCentcomm(),
[ShuttleTimerMasks.SourceMap] = GetTransitHub(), // Sunrsie-Edit
[ShuttleTimerMasks.DestMap] = GetStation(),
[ShuttleTimerMasks.ShuttleTime] = zero,
[ShuttleTimerMasks.SourceTime] = zero,
Expand Down
29 changes: 0 additions & 29 deletions Content.Server/Shuttles/Components/StationCentcommComponent.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading;
using Content.Server._Sunrise.TransitHub;
using Content.Server.DeviceNetwork.Components;
using Content.Server.Screens.Components;
using Content.Server.Shuttles.Components;
Expand Down Expand Up @@ -177,23 +178,23 @@ private void UpdateEmergencyConsole(float frameTime)
while (dataQuery.MoveNext(out var stationUid, out var comp))
{
if (!TryComp<ShuttleComponent>(comp.EmergencyShuttle, out var shuttle) ||
!TryComp<StationCentcommComponent>(stationUid, out var centcomm))
!TryComp<StationTransitHubComponent>(stationUid, out var transitHub)) // Sunrise-Edit
{
continue;
}

if (!Deleted(centcomm.Entity))
if (!Deleted(transitHub.Entity)) // Sunrise-Edit
{
_shuttle.FTLToDock(comp.EmergencyShuttle.Value, shuttle,
centcomm.Entity.Value, _consoleAccumulator, TransitTime);
transitHub.Entity.Value, _consoleAccumulator, TransitTime); // Sunrise-Edit
continue;
}

if (!Deleted(centcomm.MapEntity))
if (!Deleted(transitHub.MapEntity)) // Sunrise-Edit
{
// TODO: Need to get non-overlapping positions.
_shuttle.FTLToCoordinates(comp.EmergencyShuttle.Value, shuttle,
new EntityCoordinates(centcomm.MapEntity.Value,
new EntityCoordinates(transitHub.MapEntity.Value, // Sunrise-Edit
_random.NextVector2(1000f)), _consoleAccumulator, TransitTime);
}
}
Expand All @@ -213,7 +214,7 @@ private void UpdateEmergencyConsole(float frameTime)
{
var stationUid = _station.GetOwningStation(uid);

if (!TryComp<StationCentcommComponent>(stationUid, out var centcomm) ||
if (!TryComp<StationTransitHubComponent>(stationUid, out var centcomm) || // Sunrise-Edit
Deleted(centcomm.Entity) ||
pod.LaunchTime == null ||
pod.LaunchTime > _timing.CurTime)
Expand All @@ -238,7 +239,7 @@ private void UpdateEmergencyConsole(float frameTime)
// All the others.
if (_consoleAccumulator < minTime)
{
var query = AllEntityQuery<StationCentcommComponent, TransformComponent>();
var query = AllEntityQuery<StationTransitHubComponent, TransformComponent>(); // Sunrise-Edit

// Guarantees that emergency shuttle arrives first before anyone else can FTL.
while (query.MoveNext(out var comp, out var centcommXform))
Expand Down Expand Up @@ -399,7 +400,7 @@ public bool EarlyLaunch()
{
[ShuttleTimerMasks.ShuttleMap] = shuttle,
[ShuttleTimerMasks.SourceMap] = _roundEnd.GetStation(),
[ShuttleTimerMasks.DestMap] = _roundEnd.GetCentcomm(),
[ShuttleTimerMasks.DestMap] = _roundEnd.GetTransitHub(), // Sunrise-Edit
[ShuttleTimerMasks.ShuttleTime] = time,
[ShuttleTimerMasks.SourceTime] = time,
[ShuttleTimerMasks.DestTime] = time + TimeSpan.FromSeconds(TransitTime),
Expand Down
Loading

0 comments on commit e45c30f

Please sign in to comment.