Skip to content

Commit

Permalink
Merge branch '2024-10-13-Workflows2' of https://github.com/dvir001/fr…
Browse files Browse the repository at this point in the history
…ontier-station-14 into Workflows2-test
  • Loading branch information
whatston3 committed Oct 16, 2024
2 parents 5de8231 + f72bbb5 commit c19b6bd
Show file tree
Hide file tree
Showing 75 changed files with 502 additions and 346 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
shell: pwsh
run: |
$env:DOTNET_gcServer=1
dotnet test --no-build --configuration DebugOpt Content.IntegrationTests/Content.IntegrationTests.csproj -- NUnit.ConsoleOut=0 NUnit.MapWarningTo=Failed
dotnet test --no-build --configuration DebugOpt Content.IntegrationTests/Content.IntegrationTests.csproj --filter FullyQualifiedName!~ShipyardTest -- NUnit.ConsoleOut=0 NUnit.MapWarningTo=Failed
ci-success:
name: Build & Test Debug
needs:
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Nyanotrasen/Mail/MailSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected override void OnAppearanceChange(EntityUid uid, MailComponent componen
if (args.Sprite == null)
return;

if (_appearance.TryGetData(uid, MailVisuals.JobIcon, out string job) ||
if (!_appearance.TryGetData(uid, MailVisuals.JobIcon, out string job) ||
!_prototypeManager.TryIndex<JobIconPrototype>(job, out var icon))
return;

Expand Down
7 changes: 2 additions & 5 deletions Content.IntegrationTests/Tests/PostMapInitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using FastAccessors;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
using Content.IntegrationTests.Tests._NF;

namespace Content.IntegrationTests.Tests
{
Expand All @@ -44,11 +45,7 @@ public sealed class PostMapInitTest
"/Maps/_NF/Shuttles/Bus/publicts.yml",
};

private static readonly string[] GameMaps =
{
"NFDev",
"Frontier",
};
private static readonly string[] GameMaps = FrontierConstants.GameMapPrototypes; // Frontier: use test constants

/// <summary>
/// Asserts that specific files have been saved as grids and not maps.
Expand Down
10 changes: 9 additions & 1 deletion Content.IntegrationTests/Tests/Station/StationJobsTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Content.IntegrationTests.Tests._NF;
using Content.Server.Maps;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
Expand Down Expand Up @@ -227,8 +228,15 @@ await server.WaitAssertion(() =>

Assert.Multiple(() =>
{
foreach (var gameMap in prototypeManager.EnumeratePrototypes<GameMapPrototype>())
foreach (var mapProto in FrontierConstants.GameMapPrototypes) // Frontier: EnumeratePrototypes<GameMapPrototype> < FrontierConstants.GameMapPrototypes
{
// Frontier: get prototype from proto ID
if (!prototypeManager.TryIndex<GameMapPrototype>(mapProto, out var gameMap))
{
Assert.Fail($"Could not find GameMapPrototype with ID {mapProto}! Is FrontierConstants up to date?");
}
// End Frontier

foreach (var (stationId, station) in gameMap.Stations)
{
if (!station.StationComponentOverrides.TryGetComponent(name, out var comp))
Expand Down
10 changes: 10 additions & 0 deletions Content.IntegrationTests/Tests/_NF/FrontierConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Content.IntegrationTests.Tests._NF;

public sealed class FrontierConstants
{
public static readonly string[] GameMapPrototypes =
{
"Frontier",
"NFDev"
};
}
2 changes: 1 addition & 1 deletion Content.Server/Gateway/Systems/GatewayGeneratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private void OnGeneratorOpen(Entity<GatewayGeneratorDestinationComponent> ent, r
var dungeonRotation = _dungeon.GetDungeonRotation(seed);
var dungeonPosition = (origin + dungeonRotation.RotateVec(new Vector2i(0, dungeonDistance))).Floored();

_dungeon.GenerateDungeon(_protoManager.Index<DungeonConfigPrototype>("Experiment"), args.MapUid, grid, dungeonPosition, seed);
_dungeon.GenerateDungeon(_protoManager.Index<DungeonConfigPrototype>("Experiment"), "Experiment", args.MapUid, grid, dungeonPosition, seed); // Frontier: added "Experiment"

// TODO: Dungeon mobs + loot.

Expand Down
5 changes: 4 additions & 1 deletion Content.Server/Procedural/DungeonJob/DungeonJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public sealed partial class DungeonJob : Job<List<Dungeon>>
private readonly EntityCoordinates? _targetCoordinates;

private readonly ISawmill _sawmill;
private readonly string _genId; // Frontier: add ID

public DungeonJob(
ISawmill sawmill,
Expand All @@ -73,6 +74,7 @@ public DungeonJob(
EntityUid gridUid,
int seed,
Vector2i position,
string genID, // Frontier
EntityCoordinates? targetCoordinates = null,
CancellationToken cancellation = default) : base(maxTime, cancellation)
{
Expand All @@ -99,6 +101,7 @@ public DungeonJob(
_seed = seed;
_position = position;
_targetCoordinates = targetCoordinates;
_genId = genID; // Frontier
}

/// <summary>
Expand Down Expand Up @@ -144,7 +147,7 @@ private async Task<List<Dungeon>> GetDungeons(

protected override async Task<List<Dungeon>?> Process()
{
_sawmill.Info($"Generating dungeon {_gen} with seed {_seed} on {_entManager.ToPrettyString(_gridUid)}");
_sawmill.Info($"Generating dungeon {_genId} with seed {_seed} on {_entManager.ToPrettyString(_gridUid)}"); // Frontier: _gen<_genId
_grid.CanSplit = false;
var random = new Random(_seed);
var position = (_position + random.NextPolarVector2(_gen.MinOffset, _gen.MaxOffset)).Floored();
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Procedural/DungeonSystem.Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private async void GenerateDungeon(IConsoleShell shell, string argstr, string[]
}

shell.WriteLine(Loc.GetString("cmd-dungen-start", ("seed", seed)));
GenerateDungeon(dungeon, dungeonUid, dungeonGrid, position, seed);
GenerateDungeon(dungeon, dungeon.ID, dungeonUid, dungeonGrid, position, seed); // Frontier: add dungeon.ID
}

private CompletionResult CompletionCallback(IConsoleShell shell, string[] args)
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/Procedural/DungeonSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public MapId GetOrCreateTemplate(DungeonRoomPrototype proto)
/// </summary>
/// <param name="coordinates">Coordinates to move the dungeon to afterwards. Will delete the original map</param>
public void GenerateDungeon(DungeonConfig gen,
string genID, // Frontier
EntityUid gridUid,
MapGridComponent grid,
Vector2i position,
Expand All @@ -212,6 +213,7 @@ public void GenerateDungeon(DungeonConfig gen,
gridUid,
seed,
position,
genID, // Frontier
coordinates,
cancelToken.Token);

Expand All @@ -221,6 +223,7 @@ public void GenerateDungeon(DungeonConfig gen,

public async Task<List<Dungeon>> GenerateDungeonAsync(
DungeonConfig gen,
string genID, // Frontier
EntityUid gridUid,
MapGridComponent grid,
Vector2i position,
Expand All @@ -244,6 +247,7 @@ public async Task<List<Dungeon>> GenerateDungeonAsync(
gridUid,
seed,
position,
genID, // Frontier
null,
cancelToken.Token);

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Salvage/SalvageSystem.Magnet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ private async Task TakeMagnetOffer(Entity<SalvageMagnetDataComponent> data, int
{
case AsteroidOffering asteroid:
var grid = _mapManager.CreateGridEntity(salvMap);
await _dungeon.GenerateDungeonAsync(asteroid.DungeonConfig, grid.Owner, grid.Comp, Vector2i.Zero, seed);
await _dungeon.GenerateDungeonAsync(asteroid.DungeonConfig, asteroid.Id, grid.Owner, grid.Comp, Vector2i.Zero, seed); // Frontier: added asteroid.Id - FIXME: value makes no sense.
break;
case DebrisOffering debris:
var debrisProto = _prototypeManager.Index<DungeonConfigPrototype>(debris.Id);
var debrisGrid = _mapManager.CreateGridEntity(salvMap);
await _dungeon.GenerateDungeonAsync(debrisProto, debrisGrid.Owner, debrisGrid.Comp, Vector2i.Zero, seed);
await _dungeon.GenerateDungeonAsync(debrisProto, debrisProto.ID, debrisGrid.Owner, debrisGrid.Comp, Vector2i.Zero, seed); // Frontier: debrisProto.ID
break;
case SalvageOffering wreck:
var salvageProto = wreck.SalvageMap;
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Salvage/SpawnSalvageMissionJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ private async Task<bool> InternalProcess() // Frontier: make process an internal
dungeonOffset = dungeonRotation.RotateVec(dungeonOffset);
var dungeonMod = _prototypeManager.Index<SalvageDungeonModPrototype>(mission.Dungeon);
var dungeonConfig = _prototypeManager.Index(dungeonMod.Proto);
var dungeons = await WaitAsyncTask(_dungeon.GenerateDungeonAsync(dungeonConfig, mapUid, grid, (Vector2i) dungeonOffset,
var dungeons = await WaitAsyncTask(_dungeon.GenerateDungeonAsync(dungeonConfig, dungeonConfig.ID, mapUid, grid, (Vector2i) dungeonOffset, // Frontier: add dungeonConfig.ID
_missionParams.Seed));

dungeon = dungeons.First();
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Shipyard/Systems/ShipyardSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ private void OnShipyardStartup(EntityUid uid, ShipyardConsoleComponent component
if (!_enabled)
return;
InitializeConsole();
SetupShipyard();
}

private void OnRoundRestart(RoundRestartCleanupEvent ev)
Expand All @@ -101,7 +100,7 @@ private void SetShipyardEnabled(bool value)

if (value)
{
SetupShipyard();
SetupShipyardIfNeeded();
}
else
{
Expand Down Expand Up @@ -148,6 +147,7 @@ public bool TryPurchaseShuttle(EntityUid stationUid, string shuttlePath, [NotNul
private bool TryAddShuttle(string shuttlePath, [NotNullWhen(true)] out EntityUid? shuttleGrid)
{
shuttleGrid = null;
SetupShipyardIfNeeded();
if (ShipyardMap == null)
return false;

Expand Down Expand Up @@ -276,7 +276,7 @@ private void CleanupShipyard()
_mapManager.DeleteMap(ShipyardMap.Value);
}

private void SetupShipyard()
private void SetupShipyardIfNeeded()
{
if (ShipyardMap != null && _mapManager.MapExists(ShipyardMap.Value))
return;
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Shuttles/Systems/ShuttleSystem.GridFill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private bool TryDungeonSpawn(Entity<MapGridComponent?> targetGrid, DungeonSpawnG
var spawnedGrid = _mapManager.CreateGridEntity(mapId);

_transform.SetMapCoordinates(spawnedGrid, new MapCoordinates(Vector2.Zero, mapId));
_dungeon.GenerateDungeon(dungeonProto, spawnedGrid.Owner, spawnedGrid.Comp, Vector2i.Zero, _random.Next(), spawnCoords);
_dungeon.GenerateDungeon(dungeonProto, dungeonProto.ID, spawnedGrid.Owner, spawnedGrid.Comp, Vector2i.Zero, _random.Next(), spawnCoords); // Frontier: add dungeonProto.ID

spawned = spawnedGrid.Owner;
return true;
Expand Down
5 changes: 4 additions & 1 deletion Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component,

foreach (var dunGen in dungenTypes)
{
if (dunGen.SkipDungeonGen)
continue;

var seed = _random.Next();
var offset = GetRandomPOICoord(3000f, 8500f, true);
if (!_map.TryLoad(_mapId, "/Maps/_NF/Dungeon/spaceplatform.yml", out var grids,
Expand All @@ -184,7 +187,7 @@ protected override void Started(EntityUid uid, AdventureRuleComponent component,
//pls fit the grid I beg, this is so hacky
//its better now but i think i need to do a normalization pass on the dungeon configs
//because they are all offset. confirmed good size grid, just need to fix all the offsets.
_dunGen.GenerateDungeon(dunGen, grids[0], mapGrid, new Vector2i(0, 0), seed);
_dunGen.GenerateDungeon(dunGen, dunGen.ID, grids[0], mapGrid, new Vector2i(0, 0), seed);
AddStationCoordsToSet(offset);
}
}
Expand Down
10 changes: 7 additions & 3 deletions Content.Server/_NF/Smuggling/DeadDropSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ public void CompromiseDeadDrop(EntityUid uid, DeadDropComponent _)
// Remove the dead drop.
RemComp<DeadDropComponent>(uid);

// Get our station: FIXME - check lifecycle on entities before adding another drop.
var station = _station.GetOwningStation(uid);

// If station is terminating, or if we aren't on one, nothing to do here.
if (station == null ||
!station.Value.Valid ||
Expand All @@ -209,7 +207,7 @@ public void CompromiseDeadDrop(EntityUid uid, DeadDropComponent _)
return;
}

// Find a new potential dead drop to spawn.
//Find a new potential dead drop to spawn.
var deadDropQuery = EntityManager.EntityQueryEnumerator<PotentialDeadDropComponent>();
List<(EntityUid ent, PotentialDeadDropComponent comp)> potentialDeadDrops = new();
while (deadDropQuery.MoveNext(out var ent, out var potentialDeadDrop))
Expand All @@ -229,6 +227,12 @@ public void CompromiseDeadDrop(EntityUid uid, DeadDropComponent _)
if (potentialDeadDrops.Count > 0)
{
var item = _random.Pick(potentialDeadDrops);

// If the item is tearing down, do nothing for now.
// FIXME: separate sector-wide scheduler?
if (MetaData(item.ent).EntityLifeStage >= EntityLifeStage.Terminating)
return;

AddDeadDrop(item.ent);
_sawmill.Debug($"Dead drop at {uid} compromised, new drop at {item.ent}!");
}
Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/Procedural/DungeonConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ public sealed class DungeonConfigPrototype : DungeonConfig, IPrototype
{
[IdDataField]
public string ID { get; private set; } = default!;

// Frontier: skip dungeon generation
[DataField]
public bool SkipDungeonGen = false;
// End Frontier
}
39 changes: 39 additions & 0 deletions Resources/Changelog/Frontier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4558,3 +4558,42 @@ Entries:
message: The NSF Marauder is no longer available for purchase.
id: 5402
time: '2024-10-14T22:35:31.0000000+00:00'
- author: whatston3
changes:
- type: Fix
message: Implanters in loadout selection are now properly labeled.
id: 5403
time: '2024-10-15T07:41:16.0000000+00:00'
- author: dustylens
changes:
- type: Add
message: Skipper kitchen equipment.
id: 5404
time: '2024-10-15T07:43:15.0000000+00:00'
- author: MisterMecky
changes:
- type: Fix
message: prebuilt tabletop computers can now be properly deconstructed
id: 5405
time: '2024-10-15T13:51:09.0000000+00:00'
- author: erhardsteinhauer
changes:
- type: Tweak
message: >-
Slightly changed how wearable containers (like backpacks etc) work: now
it's possible (but rather pointless) to put a belt in backpack, a
backpack in duffel, a toolbox fits in a backpack.
id: 5406
time: '2024-10-15T21:01:40.0000000+00:00'
- author: dvir001
changes:
- type: Remove
message: >-
The old EVA suit, emergency EVA suit, and ancient EVA suit are no longer
printable.
- type: Tweak
message: >-
Material costs for small electronics like small gyroscope circuitboards
were increased.
id: 5407
time: '2024-10-15T23:58:44.0000000+00:00'
Loading

0 comments on commit c19b6bd

Please sign in to comment.