Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into 20240409-DungeonLootSpawners
Browse files Browse the repository at this point in the history
  • Loading branch information
ErhardSteinhauer authored Apr 27, 2024
2 parents 7ea2631 + 6659a6d commit 2cc225a
Show file tree
Hide file tree
Showing 23 changed files with 6,996 additions and 5,076 deletions.
5 changes: 5 additions & 0 deletions Content.Client/Shuttles/UI/NavScreen.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
HorizontalExpand="True"
Margin="3"
Name="ReadonlyDisplay">
<controls:Label Text="{controls:Loc 'shuttle-console-designation'}"/>
<controls:Label Name="ShuttleDesignation"
Text="{controls:Loc 'shuttle-console-designation-unknown'}"
HorizontalExpand="True"
Align="Right"/>
<controls:Label Text="{controls:Loc 'shuttle-console-position'}"/>
<controls:Label Name="GridPosition"
Text="0.0, 0.0"
Expand Down
16 changes: 16 additions & 0 deletions Content.Client/Shuttles/UI/NavScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Physics.Components;

Expand Down Expand Up @@ -52,6 +53,21 @@ private void OnIffSearchChanged(string text)
public void SetShuttle(EntityUid? shuttle)
{
_shuttleEntity = shuttle;

// Frontier - PR #1284 Add Shuttle Designation
if (_entManager.TryGetComponent<MetaDataComponent>(shuttle, out var metadata))
{
var shipNameParts = metadata.EntityName.Split(' ');
var designation = shipNameParts[^1];
if (designation[2] == '-')
{
NavDisplayLabel.Text = string.Join(' ', shipNameParts[..^1]);
ShuttleDesignation.Text = designation;
}
else
NavDisplayLabel.Text = metadata.EntityName;
}
// End Frontier - PR #1284
}

private void OnIFFTogglePressed(BaseButton.ButtonEventArgs args)
Expand Down
81 changes: 55 additions & 26 deletions Content.Server/Atmos/EntitySystems/AtmosphereSystem.Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Server.Atmos.Components;
using Content.Shared.Administration;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Robust.Shared.Console;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
Expand Down Expand Up @@ -104,44 +105,72 @@ private void FixGridAtmosCommand(IConsoleShell shell, string argstr, string[] ar
continue;
}

var transform = Transform(euid.Value);
// Force Invalidate & update air on all tiles
Entity<GridAtmosphereComponent, GasTileOverlayComponent, MapGridComponent, TransformComponent> grid =
new(euid.Value, gridAtmosphere, Comp<GasTileOverlayComponent>(euid.Value), gridComp, Transform(euid.Value));

foreach (var (indices, tileMain) in gridAtmosphere.Tiles)
{
var tile = tileMain.Air;
if (tile == null)
continue;
RebuildGridTiles(grid);

if (!_mapSystem.TryGetTile(gridComp, indices, out var gTile) || gTile.IsEmpty)
{
gridAtmosphere.Tiles.Remove(indices);
var query = GetEntityQuery<AtmosFixMarkerComponent>();
foreach (var (indices, tile) in gridAtmosphere.Tiles.ToArray())
{
if (tile.Air is not {Immutable: false} air)
continue;
}

if (tile.Immutable && !IsTileSpace(euid, transform.MapUid, indices))
{
tile = new GasMixture(tile.Volume) { Temperature = tile.Temperature };
tileMain.Air = tile;
}

tile.Clear();
air.Clear();
var mixtureId = 0;
foreach (var entUid in gridComp.GetAnchoredEntities(indices))
var enumerator = _mapSystem.GetAnchoredEntitiesEnumerator(grid, grid, indices);
while (enumerator.MoveNext(out var entUid))
{
if (!TryComp(entUid, out AtmosFixMarkerComponent? afm))
continue;
mixtureId = afm.Mode;
break;
if (query.TryComp(entUid, out var marker))
mixtureId = marker.Mode;
}
var mixture = mixtures[mixtureId];
Merge(tile, mixture);
tile.Temperature = mixture.Temperature;

gridAtmosphere.InvalidatedCoords.Add(indices);
var mixture = mixtures[mixtureId];
Merge(air, mixture);
air.Temperature = mixture.Temperature;
}
}
}

/// <summary>
/// Clears & re-creates all references to <see cref="TileAtmosphere"/>s stored on a grid.
/// </summary>
private void RebuildGridTiles(
Entity<GridAtmosphereComponent, GasTileOverlayComponent, MapGridComponent, TransformComponent> ent)
{
foreach (var indices in ent.Comp1.Tiles.Keys)
{
InvalidateVisuals((ent, ent), indices);
}

var atmos = ent.Comp1;
atmos.MapTiles.Clear();
atmos.ActiveTiles.Clear();
atmos.ExcitedGroups.Clear();
atmos.HotspotTiles.Clear();
atmos.SuperconductivityTiles.Clear();
atmos.HighPressureDelta.Clear();
atmos.CurrentRunTiles.Clear();
atmos.CurrentRunExcitedGroups.Clear();
atmos.InvalidatedCoords.Clear();
atmos.CurrentRunInvalidatedTiles.Clear();
atmos.PossiblyDisconnectedTiles.Clear();
atmos.Tiles.Clear();

var volume = GetVolumeForTiles(ent);
TryComp(ent.Comp4.MapUid, out MapAtmosphereComponent? mapAtmos);

var enumerator = _map.GetAllTilesEnumerator(ent, ent);
while (enumerator.MoveNext(out var tileRef))
{
var tile = GetOrNewTile(ent, ent, tileRef.Value.GridIndices);
UpdateTileData(ent, mapAtmos, tile);
UpdateAdjacentTiles(ent, tile, activate: true);
UpdateTileAir(ent, tile, volume);
}
}

private CompletionResult FixGridAtmosCommandCompletions(IConsoleShell shell, string[] args)
{
MapId? playerMap = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public sealed partial class AtmosphereSystem
private int _currentRunAtmosphereIndex;
private bool _simulationPaused;

private TileAtmosphere GetOrNewTile(EntityUid owner, GridAtmosphereComponent atmosphere, Vector2i index)
private TileAtmosphere GetOrNewTile(EntityUid owner, GridAtmosphereComponent atmosphere, Vector2i index, bool invalidateNew = true)
{
var tile = atmosphere.Tiles.GetOrNew(index, out var existing);
if (existing)
return tile;

atmosphere.InvalidatedCoords.Add(index);
if (invalidateNew)
atmosphere.InvalidatedCoords.Add(index);

tile.GridIndex = owner;
tile.GridIndices = index;
return tile;
Expand Down Expand Up @@ -68,7 +70,7 @@ private bool ProcessRevalidate(Entity<GridAtmosphereComponent, GasTileOverlayCom
atmosphere.CurrentRunInvalidatedTiles.EnsureCapacity(atmosphere.InvalidatedCoords.Count);
foreach (var indices in atmosphere.InvalidatedCoords)
{
var tile = GetOrNewTile(uid, atmosphere, indices);
var tile = GetOrNewTile(uid, atmosphere, indices, invalidateNew: false);
atmosphere.CurrentRunInvalidatedTiles.Enqueue(tile);

// Update tile.IsSpace and tile.MapAtmosphere, and tile.AirtightData.
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void OnStartup(RoundStartingEvent ev)

if (_map.TryLoad(mapId, cove, out var depotUid6s, new MapLoadOptions
{
Offset = _random.NextVector2(4650f, 6800f)
Offset = _random.NextVector2(10000f, 15000f)
}))
{
if (_prototypeManager.TryIndex<GameMapPrototype>("Cove", out var stationProto))
Expand Down
12 changes: 12 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4311,3 +4311,15 @@ Entries:
ion storms. Same for harpies.
id: 4948
time: '2024-04-27T17:48:50.0000000+00:00'
- author: dvir01
changes:
- type: Tweak
message: The pirates moved to a new base, McCove if you will.
id: 4949
time: '2024-04-27T18:33:25.0000000+00:00'
- author: GingerAvalanche
changes:
- type: Add
message: Shuttle console display UI now shows ship name and designation
id: 4950
time: '2024-04-27T19:07:30.0000000+00:00'
3 changes: 2 additions & 1 deletion Resources/Locale/en-US/_NF/shuttles/console.ftl
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
shuttle-console-designation = Designation:
shuttle-console-designation = Designation:
shuttle-console-designation-unknown = Unknown
Loading

0 comments on commit 2cc225a

Please sign in to comment.