Skip to content

Commit

Permalink
expeditions go nyooom
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheackraze committed Jul 12, 2023
1 parent 25882b3 commit f033282
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 141 deletions.
5 changes: 5 additions & 0 deletions Content.Server/Salvage/SalvageSystem.Expeditions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
using Robust.Shared.CPUJob.JobQueues.Queues;
using System.Linq;
using System.Threading;
using Content.Server.Shuttles.Systems;
using Content.Server.Station.Systems;
using Content.Shared.Salvage.Expeditions;
using Robust.Shared.GameStates;

Expand All @@ -21,6 +23,7 @@ public sealed partial class SalvageSystem
*/

[Dependency] private readonly CargoSystem _cargo = default!;
[Dependency] private readonly StationSystem _stationSystem = default!;

private const int MissionLimit = 5;

Expand Down Expand Up @@ -272,6 +275,8 @@ private void SpawnMission(SalvageMissionParams missionParams, EntityUid station)
_tileDefManager,
_biome,
_dungeon,
_shuttle,
_stationSystem,
this,
station,
missionParams,
Expand Down
28 changes: 23 additions & 5 deletions Content.Server/Salvage/SpawnSalvageMissionJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
using Content.Server.Procedural;
using Content.Server.Salvage.Expeditions;
using Content.Server.Salvage.Expeditions.Structure;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Content.Server.Station.Components;
using Content.Server.Station.Systems;
using Content.Shared.Atmos;
using Content.Shared.Dataset;
using Content.Shared.Gravity;
Expand Down Expand Up @@ -43,7 +47,8 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
private readonly BiomeSystem _biome;
private readonly DungeonSystem _dungeon;
private readonly SalvageSystem _salvage;

private readonly ShuttleSystem _shuttle;
private readonly StationSystem _stationSystem;
public readonly EntityUid Station;
private readonly SalvageMissionParams _missionParams;

Expand All @@ -56,6 +61,8 @@ public SpawnSalvageMissionJob(
ITileDefinitionManager tileDefManager,
BiomeSystem biome,
DungeonSystem dungeon,
ShuttleSystem shuttle,
StationSystem stationSystem,
SalvageSystem salvage,
EntityUid station,
SalvageMissionParams missionParams,
Expand All @@ -68,6 +75,8 @@ public SpawnSalvageMissionJob(
_tileDefManager = tileDefManager;
_biome = biome;
_dungeon = dungeon;
_shuttle = shuttle;
_stationSystem = stationSystem;
_salvage = salvage;
Station = station;
_missionParams = missionParams;
Expand Down Expand Up @@ -138,12 +147,21 @@ protected override async Task<bool> Process()
expedition.Difficulty = _missionParams.Difficulty;
expedition.Rewards = mission.Rewards;

// Don't want consoles to have the incorrect name until refreshed.
var ftlUid = _entManager.CreateEntityUninitialized("FTLPoint", new EntityCoordinates(mapUid, Vector2.Zero));
// On Frontier, we cant share our locations it breaks ftl in a bad bad way
/*var ftlUid = _entManager.CreateEntityUninitialized("FTLPoint", new EntityCoordinates(mapUid, Vector2.Zero));
_entManager.GetComponent<MetaDataComponent>(ftlUid).EntityName = SharedSalvageSystem.GetFTLName(_prototypeManager.Index<DatasetPrototype>("names_borer"), _missionParams.Seed);
_entManager.InitializeAndStartEntity(ftlUid);
_entManager.InitializeAndStartEntity(ftlUid);*/

// so we just gunna yeet them there instead why not. they chose this life.
var stationData = _entManager.GetComponent<StationDataComponent>(Station);
var shuttleUid = _stationSystem.GetLargestGrid(stationData);
if (shuttleUid is { Valid : true } vesselUid)
{
var shuttle = _entManager.GetComponent<ShuttleComponent>(vesselUid);
_shuttle.FTLTravel(vesselUid, shuttle, new EntityCoordinates(mapUid, Vector2.Zero), 8f, 50f);
}

var landingPadRadius = 24;
var landingPadRadius = 38; //we go a liiitle bigger for the shipses
var minDungeonOffset = landingPadRadius + 4;

// We'll use the dungeon rotation as the spawn angle
Expand Down
28 changes: 25 additions & 3 deletions Content.Server/_NF/GameRule/NfAdventureRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ private void OnPlayerSpawningEvent(PlayerSpawnCompleteEvent ev)
private void OnStartup(RoundStartingEvent ev)
{
var depotMap = "/Maps/cargodepot.yml";
var mapId = GameTicker.DefaultMap;
var depotOffset = _random.NextVector2(1500f, 3000f);
var depotColor = new Color(55, 200, 55);
var mapId = GameTicker.DefaultMap;
var depotOffset = _random.NextVector2(1500f, 2400f);
if (_map.TryLoad(mapId, depotMap, out var depotUids, new MapLoadOptions
{
Offset = depotOffset
Expand All @@ -105,7 +105,29 @@ private void OnStartup(RoundStartingEvent ev)
}

;
depotOffset = _random.NextVector2(2300f, 3400f);
if (_map.TryLoad(mapId, depotMap, out var depotUid3s, new MapLoadOptions
{
Offset = depotOffset
}))
{
var meta = EnsureComp<MetaDataComponent>(depotUid3s[0]);
meta.EntityName = "NT Cargo Depot C NF14";
_shuttle.SetIFFColor(depotUid3s[0], depotColor);
}

;
if (_map.TryLoad(mapId, depotMap, out var depotUid4s, new MapLoadOptions
{
Offset = -depotOffset
}))
{
var meta = EnsureComp<MetaDataComponent>(depotUid4s[0]);
meta.EntityName = "NT Cargo Depot D NF14";
_shuttle.SetIFFColor(depotUid4s[0], depotColor);
}

;
var dungenTypes = _prototypeManager.EnumeratePrototypes<DungeonConfigPrototype>();

foreach (var dunGen in dungenTypes)
Expand Down Expand Up @@ -151,7 +173,7 @@ private void OnStartup(RoundStartingEvent ev)

//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
//because they are all offset. confirmed good size grid, just need to fix all the offsets.
_dunGen.GenerateDungeon(dunGen, grids[0], mapGrid, (Vector2i) offset, seed);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public sealed class CCVars : CVars
/// A loc string for what should be displayed as the title on the Rules window.
/// </summary>
public static readonly CVarDef<string> RulesHeader =
CVarDef.Create("server.rules_header", "ui-rules-header", CVar.REPLICATED | CVar.SERVER);
CVarDef.Create("server.rules_header", "Frontier Server Rules", CVar.REPLICATED | CVar.SERVER);

/*
* Ambience
Expand Down
Loading

0 comments on commit f033282

Please sign in to comment.