* Add Crash to Windlands survival gamemode and map Introduces the CP14CrashToWindlandsRule and its component for a new survival gamemode where a ship crashes into wildlands. Adds the 'nautilus_ship' map, updates English and Russian locale files with new gamemode titles and descriptions, and modifies relevant prototype and map pool files to support the new mode. * fix FTL map * firebombing is real * fix biome dungen all grid overriding * Update PostMapInitTest.cs * Update DungeonJob.CP14Biome.cs * Refactor demiplane generation and crash rules Replaces the old demiplane job system with a new procedural location generation system (CP14LocationGenerationSystem and CP14SpawnProceduralLocationJob). Splits the crash-to-windlands rule into CP14CrashingShipRule (handles explosions) and CP14ExpeditionToWindlandsRule (handles map generation and FTL), with corresponding new components. Updates roundstart game rule prototype and moves/renames several files for clarity and modularity. * Refactor location generation to support optional seed and position Updated the GenerateLocation method to accept an optional seed and position, defaulting to a random seed if none is provided. Adjusted all call sites and the procedural job to support these changes, improving flexibility and consistency in procedural location generation. * procedural integration into game map * Demiplanes deletion * clear demiplane content * remapping procedural + frigid coast deletion * clear demiplane guidebook * dungeons generations * Refactor procedural location configs and add ComossIsland Consolidated and renamed procedural location and dungeonConfig prototypes for demiplane locations, replacing T1-prefixed and legacy IDs with new, consistent names. Updated map YAMLs to reference new location IDs and configs. Added a new ComossIsland location and dungeonConfig. Refactored code to support passing custom dungeon layers and removed unused ExamineProb field from CP14ProceduralLocationPrototype. * Enhance procedural world gen and location configs Improved procedural world generation by adding location generation probability, adjusting level ranges, and refining modifier uniqueness. Updated CP14ProceduralLocationPrototype and CP14ProceduralModifierPrototype, refactored node data generation logic, and made related test and map changes. Added new venicialis_fort station map and updated several procedural location and modifier YAMLs for consistency. * fix * connections room spawners * track finishing global world generation * real connection * Update PostMapInitTest.cs * Update venicialis.yml * Update venicialis.yml * fix raids, decrease city island sizes * Update migration.yml * Update migration.yml * fix shutdowning * Update CP14SpawnProceduralLocationJob.cs
100 lines
3.3 KiB
C#
100 lines
3.3 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Content.Server.Atmos.EntitySystems;
|
|
using Content.Server.Procedural;
|
|
using Content.Shared._CP14.Procedural.Prototypes;
|
|
using Content.Shared.Atmos;
|
|
using Content.Shared.Gravity;
|
|
using Content.Shared.Procedural;
|
|
using Content.Shared.Procedural.DungeonLayers;
|
|
using Robust.Shared.CPUJob.JobQueues;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Map.Components;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server._CP14.Procedural;
|
|
|
|
public sealed class CP14SpawnProceduralLocationJob(
|
|
double maxTime,
|
|
IEntityManager entManager,
|
|
ILogManager logManager,
|
|
IPrototypeManager protoManager,
|
|
DungeonSystem dungeon,
|
|
SharedMapSystem map,
|
|
EntityUid mapUid,
|
|
MapId mapId,
|
|
Vector2i position,
|
|
int seed,
|
|
ProtoId<CP14ProceduralLocationPrototype> config,
|
|
List<ProtoId<CP14ProceduralModifierPrototype>> modifiers,
|
|
string? jobName = null,
|
|
CancellationToken cancellation = default)
|
|
: Job<bool>(maxTime, cancellation)
|
|
{
|
|
public readonly EntityUid MapUid = mapUid;
|
|
public string? JobName = jobName;
|
|
|
|
private readonly ISawmill _sawmill = logManager.GetSawmill("cp14_procedural_location_job");
|
|
|
|
protected override async Task<bool> Process()
|
|
{
|
|
_sawmill.Debug($"Spawning procedural location `{config.Id}` with seed {seed}");
|
|
var gridComp = entManager.EnsureComponent<MapGridComponent>(MapUid);
|
|
|
|
MetaDataComponent? metadata = null;
|
|
DungeonConfigPrototype dungeonConfig = new();
|
|
|
|
//Boilerplate: reserve all old grid tiles
|
|
dungeonConfig.Layers.Add(new CP14ReserveGrid());
|
|
|
|
//Setup location config
|
|
var locationConfig = protoManager.Index(config);
|
|
var indexedLocation = protoManager.Index(locationConfig.LocationConfig);
|
|
|
|
dungeonConfig.Layers.AddRange(indexedLocation.Layers);
|
|
dungeonConfig.ReserveTiles = indexedLocation.ReserveTiles;
|
|
|
|
//Add map components
|
|
entManager.AddComponents(MapUid, locationConfig.Components);
|
|
|
|
//Apply modifiers
|
|
foreach (var modifier in modifiers)
|
|
{
|
|
if (!protoManager.TryIndex(modifier, out var indexedModifier))
|
|
continue;
|
|
|
|
if (indexedModifier.Layers != null)
|
|
dungeonConfig.Layers.AddRange(indexedModifier.Layers);
|
|
if (indexedModifier.Components != null)
|
|
entManager.AddComponents(MapUid, indexedModifier.Components);
|
|
|
|
_sawmill.Debug($"Added modifier: {seed} - {modifier.Id}");
|
|
}
|
|
|
|
//Setup gravity
|
|
var gravity = entManager.EnsureComponent<GravityComponent>(MapUid);
|
|
gravity.Enabled = true;
|
|
entManager.Dirty(MapUid, gravity, metadata);
|
|
|
|
// Setup default atmos
|
|
var moles = new float[Atmospherics.AdjustedNumberOfGases];
|
|
moles[(int)Gas.Oxygen] = 21.824779f;
|
|
moles[(int)Gas.Nitrogen] = 82.10312f;
|
|
var mixture = new GasMixture(moles, Atmospherics.T20C);
|
|
entManager.System<AtmosphereSystem>().SetMapAtmosphere(MapUid, false, mixture);
|
|
|
|
if (!map.IsInitialized(mapId))
|
|
map.InitializeMap(mapId);
|
|
map.SetPaused(mapId, false);
|
|
|
|
//Spawn modified config
|
|
await WaitAsyncTask(dungeon.GenerateDungeonAsync(dungeonConfig,
|
|
MapUid,
|
|
gridComp,
|
|
position,
|
|
seed));
|
|
|
|
return true;
|
|
}
|
|
}
|