2024-04-20 08:27:38 +02:00
|
|
|
using Content.Server.Administration.Logs;
|
Gathering resourses redesign (#1594)
* 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
2025-08-04 13:35:55 +03:00
|
|
|
using Content.Server.Atmos.EntitySystems;
|
2023-05-19 17:26:28 +10:00
|
|
|
using Content.Server.Body.Systems;
|
2025-05-17 21:11:08 +04:00
|
|
|
using Content.Server.Buckle.Systems;
|
2023-12-11 19:51:02 +11:00
|
|
|
using Content.Server.Parallax;
|
2024-07-03 22:23:11 +10:00
|
|
|
using Content.Server.Procedural;
|
2021-11-21 17:09:49 +11:00
|
|
|
using Content.Server.Shuttles.Components;
|
2025-05-13 05:14:18 -07:00
|
|
|
using Content.Server.Shuttles.Events;
|
2023-05-24 21:28:44 +10:00
|
|
|
using Content.Server.Station.Systems;
|
2023-03-24 12:54:41 +11:00
|
|
|
using Content.Server.Stunnable;
|
2025-05-17 21:11:08 +04:00
|
|
|
using Content.Shared.Buckle.Components;
|
|
|
|
|
using Content.Shared.Damage;
|
2025-05-18 17:47:35 +10:00
|
|
|
using Content.Shared.Light.Components;
|
2025-05-13 05:14:18 -07:00
|
|
|
using Content.Shared.Movement.Events;
|
2024-11-20 03:57:43 +03:00
|
|
|
using Content.Shared.Salvage;
|
2022-07-15 14:11:41 +10:00
|
|
|
using Content.Shared.Shuttles.Systems;
|
2023-09-07 04:13:31 +02:00
|
|
|
using Content.Shared.Throwing;
|
2021-07-21 21:15:12 +10:00
|
|
|
using JetBrains.Annotations;
|
2022-06-26 15:20:45 +10:00
|
|
|
using Robust.Server.GameObjects;
|
2024-07-01 16:11:30 +10:00
|
|
|
using Robust.Server.GameStates;
|
2023-11-27 22:12:34 +11:00
|
|
|
using Robust.Shared.Audio.Systems;
|
2023-04-25 11:48:29 +12:00
|
|
|
using Robust.Shared.Configuration;
|
2024-12-22 15:13:10 +13:00
|
|
|
using Robust.Shared.EntitySerialization.Systems;
|
2022-06-26 15:20:45 +10:00
|
|
|
using Robust.Shared.Map;
|
2022-11-22 13:12:04 +11:00
|
|
|
using Robust.Shared.Map.Components;
|
2021-07-21 21:15:12 +10:00
|
|
|
using Robust.Shared.Physics;
|
2022-09-14 17:26:26 +10:00
|
|
|
using Robust.Shared.Physics.Components;
|
|
|
|
|
using Robust.Shared.Physics.Systems;
|
2024-07-03 22:23:11 +10:00
|
|
|
using Robust.Shared.Prototypes;
|
2023-03-24 12:54:41 +11:00
|
|
|
using Robust.Shared.Random;
|
2024-03-30 02:40:55 +01:00
|
|
|
using Robust.Shared.Timing;
|
2025-06-21 08:23:19 -07:00
|
|
|
using Content.Shared.Maps;
|
2021-07-21 21:15:12 +10:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
namespace Content.Server.Shuttles.Systems;
|
|
|
|
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
public sealed partial class ShuttleSystem : SharedShuttleSystem
|
2021-07-21 21:15:12 +10:00
|
|
|
{
|
2024-07-03 22:23:11 +10:00
|
|
|
[Dependency] private readonly IAdminLogManager _logger = default!;
|
2023-10-11 14:07:21 +11:00
|
|
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
2024-07-03 22:23:11 +10:00
|
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
2024-07-03 22:23:11 +10:00
|
|
|
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
2023-12-11 19:51:02 +11:00
|
|
|
[Dependency] private readonly BiomeSystem _biomes = default!;
|
2023-05-19 17:26:28 +10:00
|
|
|
[Dependency] private readonly BodySystem _bobby = default!;
|
2025-05-17 21:11:08 +04:00
|
|
|
[Dependency] private readonly BuckleSystem _buckle = default!;
|
|
|
|
|
[Dependency] private readonly DamageableSystem _damageSys = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly DockingSystem _dockSystem = default!;
|
2024-07-03 22:23:11 +10:00
|
|
|
[Dependency] private readonly DungeonSystem _dungeon = default!;
|
2023-05-19 17:26:28 +10:00
|
|
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly MapLoaderSystem _loader = default!;
|
2025-05-17 21:11:08 +04:00
|
|
|
[Dependency] private readonly MapSystem _mapSystem = default!;
|
2023-11-22 15:35:37 +11:00
|
|
|
[Dependency] private readonly MetaDataSystem _metadata = default!;
|
2024-07-01 16:11:30 +10:00
|
|
|
[Dependency] private readonly PvsOverrideSystem _pvs = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
|
|
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
|
|
|
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
2024-11-20 03:57:43 +03:00
|
|
|
[Dependency] private readonly SharedSalvageSystem _salvage = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly ShuttleConsoleSystem _console = default!;
|
2023-05-24 21:28:44 +10:00
|
|
|
[Dependency] private readonly StationSystem _station = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly StunSystem _stuns = default!;
|
2023-09-07 04:13:31 +02:00
|
|
|
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
[Dependency] private readonly ThrusterSystem _thruster = default!;
|
|
|
|
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
2025-06-21 08:23:19 -07:00
|
|
|
[Dependency] private readonly TurfSystem _turf = default!;
|
Gathering resourses redesign (#1594)
* 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
2025-08-04 13:35:55 +03:00
|
|
|
[Dependency] private readonly AtmosphereSystem _atmos = default!;
|
2023-04-21 20:04:20 +10:00
|
|
|
|
2025-05-17 21:11:08 +04:00
|
|
|
private EntityQuery<BuckleComponent> _buckleQuery;
|
2024-07-28 13:14:18 +10:00
|
|
|
private EntityQuery<MapGridComponent> _gridQuery;
|
2025-05-17 21:11:08 +04:00
|
|
|
private EntityQuery<PhysicsComponent> _physicsQuery;
|
|
|
|
|
private EntityQuery<TransformComponent> _xformQuery;
|
2024-07-28 13:14:18 +10:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
public override void Initialize()
|
2021-07-21 21:15:12 +10:00
|
|
|
{
|
2023-04-21 20:04:20 +10:00
|
|
|
base.Initialize();
|
2022-06-26 15:20:45 +10:00
|
|
|
|
2025-05-17 21:11:08 +04:00
|
|
|
_buckleQuery = GetEntityQuery<BuckleComponent>();
|
2024-07-28 13:14:18 +10:00
|
|
|
_gridQuery = GetEntityQuery<MapGridComponent>();
|
2025-05-17 21:11:08 +04:00
|
|
|
_physicsQuery = GetEntityQuery<PhysicsComponent>();
|
|
|
|
|
_xformQuery = GetEntityQuery<TransformComponent>();
|
2024-07-28 13:14:18 +10:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
InitializeFTL();
|
|
|
|
|
InitializeGridFills();
|
|
|
|
|
InitializeIFF();
|
|
|
|
|
InitializeImpact();
|
2022-06-26 15:20:45 +10:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
SubscribeLocalEvent<ShuttleComponent, ComponentStartup>(OnShuttleStartup);
|
|
|
|
|
SubscribeLocalEvent<ShuttleComponent, ComponentShutdown>(OnShuttleShutdown);
|
2025-05-13 05:14:18 -07:00
|
|
|
SubscribeLocalEvent<ShuttleComponent, TileFrictionEvent>(OnTileFriction);
|
|
|
|
|
SubscribeLocalEvent<ShuttleComponent, FTLStartedEvent>(OnFTLStarted);
|
|
|
|
|
SubscribeLocalEvent<ShuttleComponent, FTLCompletedEvent>(OnFTLCompleted);
|
2021-07-21 21:15:12 +10:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
SubscribeLocalEvent<GridInitializeEvent>(OnGridInit);
|
|
|
|
|
}
|
2022-03-07 02:03:53 -03:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
{
|
|
|
|
|
base.Update(frameTime);
|
2024-03-30 02:40:55 +01:00
|
|
|
UpdateHyperspace();
|
2023-04-21 20:04:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnGridInit(GridInitializeEvent ev)
|
|
|
|
|
{
|
|
|
|
|
if (HasComp<MapComponent>(ev.EntityUid))
|
|
|
|
|
return;
|
2022-04-24 13:54:25 +10:00
|
|
|
|
2025-05-18 17:47:35 +10:00
|
|
|
EnsureComp<ShuttleComponent>(ev.EntityUid);
|
Gathering resourses redesign (#1594)
* 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
2025-08-04 13:35:55 +03:00
|
|
|
//EnsureComp<ImplicitRoofComponent>(ev.EntityUid); //CP14 - grids (ships) without roofs!
|
2023-04-21 20:04:20 +10:00
|
|
|
}
|
2022-04-24 13:54:25 +10:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args)
|
|
|
|
|
{
|
2025-06-26 19:50:49 -04:00
|
|
|
if (!HasComp<MapGridComponent>(uid))
|
2023-04-21 20:04:20 +10:00
|
|
|
{
|
|
|
|
|
return;
|
2021-07-21 21:15:12 +10:00
|
|
|
}
|
|
|
|
|
|
2025-06-26 19:50:49 -04:00
|
|
|
if (!TryComp(uid, out PhysicsComponent? physicsComponent))
|
2021-07-21 21:15:12 +10:00
|
|
|
{
|
2023-04-21 20:04:20 +10:00
|
|
|
return;
|
2021-07-21 21:15:12 +10:00
|
|
|
}
|
|
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
if (component.Enabled)
|
2021-07-21 21:15:12 +10:00
|
|
|
{
|
2023-12-11 19:51:02 +11:00
|
|
|
Enable(uid, component: physicsComponent, shuttle: component);
|
2021-07-21 21:15:12 +10:00
|
|
|
}
|
2025-05-13 05:14:18 -07:00
|
|
|
|
|
|
|
|
component.DampingModifier = component.BodyModifier;
|
2023-04-21 20:04:20 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Toggle(EntityUid uid, ShuttleComponent component)
|
|
|
|
|
{
|
2025-06-26 19:50:49 -04:00
|
|
|
if (!TryComp(uid, out PhysicsComponent? physicsComponent))
|
2023-04-21 20:04:20 +10:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
component.Enabled = !component.Enabled;
|
2021-07-21 21:15:12 +10:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
if (component.Enabled)
|
2021-07-21 21:15:12 +10:00
|
|
|
{
|
2023-12-11 19:51:02 +11:00
|
|
|
Enable(uid, component: physicsComponent, shuttle: component);
|
2021-07-21 21:15:12 +10:00
|
|
|
}
|
2023-04-21 20:04:20 +10:00
|
|
|
else
|
2021-07-21 21:15:12 +10:00
|
|
|
{
|
2023-12-11 19:51:02 +11:00
|
|
|
Disable(uid, component: physicsComponent);
|
2021-07-21 21:15:12 +10:00
|
|
|
}
|
2023-04-21 20:04:20 +10:00
|
|
|
}
|
2021-07-21 21:15:12 +10:00
|
|
|
|
2023-12-11 19:51:02 +11:00
|
|
|
public void Enable(EntityUid uid, FixturesComponent? manager = null, PhysicsComponent? component = null, ShuttleComponent? shuttle = null)
|
2023-04-21 20:04:20 +10:00
|
|
|
{
|
2023-12-11 19:51:02 +11:00
|
|
|
if (!Resolve(uid, ref manager, ref component, ref shuttle, false))
|
|
|
|
|
return;
|
2023-01-15 15:38:59 +11:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
_physics.SetBodyType(uid, BodyType.Dynamic, manager: manager, body: component);
|
2024-03-25 02:37:25 -04:00
|
|
|
_physics.SetBodyStatus(uid, component, BodyStatus.InAir);
|
2023-04-21 20:04:20 +10:00
|
|
|
_physics.SetFixedRotation(uid, false, manager: manager, body: component);
|
|
|
|
|
}
|
2021-07-21 21:15:12 +10:00
|
|
|
|
2023-12-11 19:51:02 +11:00
|
|
|
public void Disable(EntityUid uid, FixturesComponent? manager = null, PhysicsComponent? component = null)
|
2023-04-21 20:04:20 +10:00
|
|
|
{
|
2023-12-11 19:51:02 +11:00
|
|
|
if (!Resolve(uid, ref manager, ref component, false))
|
|
|
|
|
return;
|
2023-04-21 20:04:20 +10:00
|
|
|
|
|
|
|
|
_physics.SetBodyType(uid, BodyType.Static, manager: manager, body: component);
|
2024-03-25 02:37:25 -04:00
|
|
|
_physics.SetBodyStatus(uid, component, BodyStatus.OnGround);
|
2023-04-21 20:04:20 +10:00
|
|
|
_physics.SetFixedRotation(uid, true, manager: manager, body: component);
|
|
|
|
|
}
|
2021-12-01 18:32:37 +11:00
|
|
|
|
2023-04-21 20:04:20 +10:00
|
|
|
private void OnShuttleShutdown(EntityUid uid, ShuttleComponent component, ComponentShutdown args)
|
|
|
|
|
{
|
|
|
|
|
// None of the below is necessary for any cleanup if we're just deleting.
|
2025-06-26 19:50:49 -04:00
|
|
|
if (Comp<MetaDataComponent>(uid).EntityLifeStage >= EntityLifeStage.Terminating)
|
2023-04-21 20:04:20 +10:00
|
|
|
return;
|
2021-07-21 21:15:12 +10:00
|
|
|
|
2023-12-11 19:51:02 +11:00
|
|
|
Disable(uid);
|
2021-07-21 21:15:12 +10:00
|
|
|
}
|
2025-05-13 05:14:18 -07:00
|
|
|
|
|
|
|
|
private void OnTileFriction(Entity<ShuttleComponent> ent, ref TileFrictionEvent args)
|
|
|
|
|
{
|
|
|
|
|
args.Modifier *= ent.Comp.DampingModifier;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnFTLStarted(Entity<ShuttleComponent> ent, ref FTLStartedEvent args)
|
|
|
|
|
{
|
|
|
|
|
ent.Comp.DampingModifier = 0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnFTLCompleted(Entity<ShuttleComponent> ent, ref FTLCompletedEvent args)
|
|
|
|
|
{
|
|
|
|
|
ent.Comp.DampingModifier = ent.Comp.BodyModifier;
|
|
|
|
|
}
|
2021-07-21 21:15:12 +10:00
|
|
|
}
|