Skip to content

Commit

Permalink
fix upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed Feb 19, 2025
1 parent 85014d1 commit 1538e06
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 83 deletions.
4 changes: 2 additions & 2 deletions Content.Client/Viewport/ScalingViewport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected override void KeyBindUp(GUIBoundKeyEventArgs args)
_inputManager.ViewportKeyEvent(this, args);
}

protected override void Draw(DrawingHandleScreen handle)
protected override void Draw(IRenderHandle handle)
{
EnsureViewportCreated();

Expand All @@ -170,7 +170,7 @@ protected override void Draw(DrawingHandleScreen handle)
var drawBox = GetDrawBox();
var drawBoxGlobal = drawBox.Translated(GlobalPixelPosition);
_viewport.RenderScreenOverlaysBelow(handle, this, drawBoxGlobal);
handle.DrawTextureRect(_viewport.RenderTarget.Texture, drawBox);
handle.DrawingHandleScreen.DrawTextureRect(_viewport.RenderTarget.Texture, drawBox);
_viewport.RenderScreenOverlaysAbove(handle, this, drawBoxGlobal);
}

Expand Down
68 changes: 43 additions & 25 deletions Content.Server/Backmen/Arrivals/CentcommSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
using Content.Shared.Shuttles.Components;
using Content.Shared.Whitelist;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
Expand All @@ -56,10 +57,12 @@ public sealed class CentcommSystem : EntitySystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly MapLoaderSystem _loader = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;

public EntityUid CentComGrid { get; private set; } = EntityUid.Invalid;
public MapId CentComMap { get; private set; } = MapId.Nullspace;
public EntityUid CentComMapUid { get; private set; } = EntityUid.Invalid;
public Entity<MapComponent>? CentComMapUid { get; private set; }
public float ShuttleIndex { get; set; } = 0;

private WeightedRandomPrototype _stationCentComMapPool = default!;
Expand Down Expand Up @@ -126,9 +129,9 @@ private void OnLoadingMaps(LoadingMapsEvent ev)

private void OnCentComEndRound(RoundEndedEvent ev)
{
if (CentComMapUid.IsValid() && _shuttleSystem.TryAddFTLDestination(CentComMap, true, out var ftl))
if (CentComMapUid != null && _shuttleSystem.TryAddFTLDestination(CentComMap, true, out var ftl))
{
EnableFtl((CentComMapUid, ftl));
EnableFtl((CentComMapUid.Value, ftl));
}
}

Expand Down Expand Up @@ -242,7 +245,7 @@ private void OnCleanup(RoundRestartCleanupEvent ev)
_mapManager.DeleteMap(CentComMap);

CentComMap = MapId.Nullspace;
CentComMapUid = EntityUid.Invalid;
CentComMapUid = null;
ShuttleIndex = 0;
}

Expand All @@ -266,40 +269,52 @@ public void EnsureCentcom(bool force = false)

Log.Info("Start load centcom");

if (CentComMap == MapId.Nullspace)
var mapPickId = _stationCentComMapPool.Pick(_random);
if (!_prototypeManager.TryIndex<GameMapPrototype>(mapPickId, out var mapToLoad))
{
CentComMap = _mapManager.CreateMap();
mapPickId = StationCentComMapDefault;
mapToLoad = _prototypeManager.Index<GameMapPrototype>(StationCentComMapDefault);
}

CentComMapUid = _mapManager.GetMapEntityId(CentComMap);
if (!_loader.TryLoadMap(mapToLoad.MapPath, out var mapId, out var grids))
return;

var grid = grids.FirstOrNull(x=>HasComp<BecomesStationComponent>(x.Owner));

var mapId = _stationCentComMapPool.Pick(_random);
if (!_prototypeManager.TryIndex<GameMapPrototype>(mapId, out var map))
if (!Exists(mapId))
{
mapId = StationCentComMapDefault;
map = _prototypeManager.Index<GameMapPrototype>(StationCentComMapDefault);
Log.Error($"Failed to set up centcomm map!");
QueueDel(grid);
return;
}

if (!Exists(grid))
{
Log.Error($"Failed to set up centcomm grid!");
QueueDel(mapId);
return;
}

var ent = _gameTicker.LoadGameMap(
map, CentComMap, new MapLoadOptions()
{
LoadMap = false
}, "Central Command").FirstOrNull(HasComp<BecomesStationComponent>);

_metaDataSystem.SetEntityName(_mapManager.GetMapEntityId(CentComMap), Loc.GetString("map-name-centcomm"));

if (ent == null)
var xform = Transform(grid.Value);
if (xform.ParentUid != mapId.Value.Owner || xform.MapUid != mapId.Value.Owner)
{
Log.Warning("No CentComm map found, skipping setup.");
Log.Error($"Centcomm grid is not parented to its own map?");
QueueDel(mapId);
QueueDel(grid);
return;
}

CentComGrid = ent.Value;

CentComMapUid = mapId;
CentComMap = CentComMapUid.Value.Comp.MapId;

_metaDataSystem.SetEntityName(CentComMapUid.Value, Loc.GetString("map-name-centcomm"));

CentComGrid = grid.Value;
if (_shuttle.TryAddFTLDestination(CentComMap, true, false, false, out var ftl))
{
ftl.RequireCoordinateDisk = false;
DisableFtl((CentComMapUid, ftl));
DisableFtl((CentComMapUid.Value.Owner, ftl));
}

var q = EntityQueryEnumerator<StationCentcommComponent>();
Expand Down Expand Up @@ -357,7 +372,10 @@ private void OnPreGameMapLoad(PreGameMapLoad ev)
return;
}

ev.Options.Offset = new Vector2(0, 0);
ev.Options.PauseMaps = false;
ev.Options.InitializeMaps = true;
ev.Offset = Vector2.Zero;
ev.Rotation = Angle.Zero;
}

private void OnFtlActionUsed(EntityUid uid, ActorComponent component, CentcomFtlAction args)
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Backmen/Shipwrecked/ShipwreckedRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@
using Content.Shared.Zombies;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Server.Player;
using Robust.Shared.Audio;
using Robust.Shared.Configuration;
using Robust.Shared.EntitySerialization;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Map.Enumerators;
Expand Down Expand Up @@ -545,8 +545,8 @@ private async void SpawnPlanetaryStructures(EntityUid uid, ShipwreckedRuleCompon

private MapId LoadDefaultMap()
{
_gameTicker.LoadGameMap(_prototypeManager.Index<GameMapPrototype>(DefaultShuttle), _gameTicker.DefaultMap, new MapLoadOptions(), null);
return _gameTicker.DefaultMap;
_gameTicker.LoadGameMap(_prototypeManager.Index<GameMapPrototype>(DefaultShuttle), out var mapId);
return mapId;
}

[ValidatePrototypeId<GameMapPrototype>]
Expand Down
36 changes: 6 additions & 30 deletions Content.Server/Backmen/Shipyard/Systems/ShipyardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
using Content.Shared.Backmen.Shipyard;
using Content.Shared.GameTicking;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Map;
using Content.Shared.Backmen.CCVar;
using Robust.Shared.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using Content.Shared.Backmen.Shipyard.Components;
using Content.Shared.Backmen.Shipyard.Prototypes;
using Robust.Shared.EntitySerialization;
using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;

namespace Content.Server.Backmen.Shipyard.Systems;

Expand Down Expand Up @@ -121,41 +123,15 @@ private bool TryAddShuttle(string shuttlePath, [NotNullWhen(true)] out EntityUid
if (ShipyardMap == null)
return false;

var loadOptions = new MapLoadOptions()
{
Offset = new Vector2(500f + _shuttleIndex, 1f)
};

if (!_map.TryLoad(ShipyardMap.Value, shuttlePath, out var gridList, loadOptions))
if (!_map.TryLoadGrid(ShipyardMap.Value, new ResPath(shuttlePath), out var grid, offset: new Vector2(500f + _shuttleIndex, 1f)))
{
_sawmill.Error($"Unable to spawn shuttle {shuttlePath}");
return false;
}

_shuttleIndex += Comp<MapGridComponent>(gridList[0]).LocalAABB.Width + ShuttleSpawnBuffer;

//only dealing with 1 grid at a time for now, until more is known about multi-grid drifting
if (gridList.Count != 1)
{
if (gridList.Count < 1)
{
_sawmill.Error($"Unable to spawn shuttle {shuttlePath}, no grid found in file");
}

if (gridList.Count > 1)
{
_sawmill.Error($"Unable to spawn shuttle {shuttlePath}, too many grids present in file");

foreach (var grid in gridList)
{
_mapManager.DeleteGrid(grid);
}
}

return false;
}
_shuttleIndex += Comp<MapGridComponent>(grid.Value).LocalAABB.Width + ShuttleSpawnBuffer;

shuttleGrid = gridList[0];
shuttleGrid = grid;
return true;
}

Expand Down
9 changes: 4 additions & 5 deletions Content.Server/Backmen/SpecForces/SpecForcesSystem.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Linq;
using System.Numerics;
using Content.Server.GameTicking;
using Content.Shared.GameTicking;
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Content.Server.Spawners.Components;
Expand All @@ -22,6 +22,8 @@
using Content.Shared.Backmen.CCVar;
using Content.Shared.Ghost.Roles.Components;
using Robust.Shared.Configuration;
using Robust.Shared.EntitySerialization;
using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.Serialization.Manager;

namespace Content.Server.Backmen.SpecForces;
Expand Down Expand Up @@ -287,10 +289,7 @@ private void SpawnSpecForces(SpecForceTeamPrototype proto, List<EntityCoordinate
/// <returns>Grid's entity of the shuttle.</returns>
private EntityUid? SpawnShuttle(string shuttlePath)
{
var shuttleMap = _mapManager.CreateMap();
var options = new MapLoadOptions {LoadMap = true};

if (!_map.TryLoad(shuttleMap, shuttlePath, out var grids, options))
if (!_map.TryLoadMap(new ResPath(shuttlePath), out var map, out var grids))
{
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/EntityEffects/Effects/HealthChange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public override void Effect(EntityEffectBaseArgs args)
args.TargetEntity,
damageSpec * scale,
IgnoreResistances,
interruptsDoAfters: false
interruptsDoAfters: false,
// start-backmen: surgery
targetPart: TargetBodyPart.All,
partMultiplier: 0.5f,
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Shuttles/Systems/EmergencyShuttleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public void AnnounceShuttleDock(ShuttleDockResult result, bool extended)
// TODO: Need filter extensions or something don't blame me.
_audio.PlayGlobal(audioFile, Filter.Broadcast(), true);

_centcommSystem.EnableFtl(_centcommSystem.CentComMapUid); // backmen: centcom
_centcommSystem.EnableFtl(_centcommSystem.CentComMapUid!.Value.Owner); // backmen: centcom
}

private void OnStationInit(EntityUid uid, StationCentcommComponent component, MapInitEvent args)
Expand Down Expand Up @@ -521,8 +521,8 @@ public HashSet<EntityUid> GetCentcommMaps()
{
var maps = new HashSet<EntityUid>();

if(_centcommSystem.CentComMapUid.IsValid())
maps.Add(_centcommSystem.CentComMapUid);
if(_centcommSystem.CentComMapUid != null)
maps.Add(_centcommSystem.CentComMapUid.Value);

return maps;
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Follower/FollowerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override void Initialize()
SubscribeLocalEvent<BeforeSerializationEvent>(OnBeforeSave);
SubscribeLocalEvent<FollowedComponent, PolymorphedEvent>(OnFollowedPolymorphed);
}

/*
private void OnFollowedGetState(EntityUid uid, FollowedComponent component, ref ComponentGetState args)
{
component.Following.RemoveWhere(x => TerminatingOrDeleted(x));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ent-ClothingHeadEVAHelmetBase = base space helmet
.desc = { ent-ClothingHeadBase.desc }
ent-ClothingHeadHardsuitBase = base hardsuit helmet
.desc = { "" }
ent-ClothingHeadHardsuitWithLightBase = base hardsuit helmet with light
ent-ClothingHeadSuitWithLightBase = base hardsuit helmet with light
.desc = { ent-ClothingHeadHardsuitBase.desc }
ent-ClothingHeadHatHoodWinterBase = base winter coat hood
.desc = A hood, made to keep your head warm.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ent-ClothingHeadEVAHelmetBase = базовый космический шлем
.desc = { ent-ClothingHeadBase.desc }
ent-ClothingHeadHardsuitBase = базовый шлем скафандра
.desc = { ent-ClothingHeadBase.desc }
ent-ClothingHeadHardsuitWithLightBase = базовый шлем скафандра с фонарём
ent-ClothingHeadSuitWithLightBase = базовый шлем скафандра с фонарём
.desc = { ent-ClothingHeadHardsuitBase.desc }
ent-ClothingHeadHatHoodWinterBase = базовый капюшон зимней куртки
.desc = Капюшон, чтобы держать голову в тепле.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- type: entity
parent: ClothingHeadHardsuitWithLightBase
parent: ClothingHeadSuitWithLightBase
id: ClothingHeadHelmetCBURNLeader
categories: [ HideSpawnMenu ]
name: cburn commander helmet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@

#Captain's Hardsuit
- type: entity
parent: [ ClothingHeadHardsuitBase, ClothingHeadHardsuitWithLightBase ] #Backmen edit
parent: [ ClothingHeadHardsuitBase, ClothingHeadSuitWithLightBase ] #Backmen edit
id: ClothingHeadHelmetHardsuitCap
name: captain's hardsuit helmet
description: Special hardsuit helmet, made for the captain of the station.
Expand Down Expand Up @@ -503,7 +503,7 @@

#Cybersun Juggernaut Hardsuit
- type: entity
parent: ClothingHeadHardsuitWithLightBase # Corvax-Resprite
parent: ClothingHeadSuitWithLightBase # Corvax-Resprite
id: ClothingHeadHelmetHardsuitCybersun
name: cybersun juggernaut helmet
description: Made of compressed red matter, this helmet was designed in the Tau chromosphere facility.
Expand Down Expand Up @@ -748,7 +748,7 @@

#Deathsquad Hardsuit
- type: entity
parent: [ BaseCentcommContraband, ClothingHeadHardsuitWithLightBase ] # Corvax-Resprite
parent: [ BaseCentcommContraband, ClothingHeadSuitWithLightBase ] # Corvax-Resprite
id: ClothingHeadHelmetHardsuitDeathsquad
name: deathsquad hardsuit helmet
description: A robust helmet for special operations.
Expand Down
Loading

0 comments on commit 1538e06

Please sign in to comment.