Skip to content

Commit

Permalink
Syndicate Listening Outpost Version 2 (Simple-Station#1065)
Browse files Browse the repository at this point in the history
# Description

This PR does two things. First it updates the code behind the Syndicate
Listening Outpost event so that it isn't completely dogshit anymore.
Thanks to my college for teaching me Trigonometry, I now actually know
how to write a system like this from scratch. A key note is that the new
system for spawning the outpost actually accepts a List of shuttle
paths, and will randomly select a shuttle from said list to be spawned.
This allows people to potentially make "Variant" listening outposts,
such as a much larger 8-person outpost. It also now has support for
Multi-grid or map stations, via the GetSpawnableStations function, which
it uses to select a random station to spawn in reference to.

This PR also makes significant updates to the ListeningPost, extending
the outpost bridge to include new consoles, such as the Syndicate
Communications Console, which allows the LP operators to troll the
station even harder. As well as camera consoles, assuming we ever get
cross-grid cameras working... The listening post also gets a new cargo
dock, with concealed turret shutters inside the dock, and a window
facing into the cavern entrance. The cargo dock can be docked by ships,
presumably for directly exchanging supplies and equipment with the
listening post.

To make use of this dock, the Listening Post now has actual syndicate
supplies, in the form of their surplus crates, which will serve either
as loot for salvage, or supplies to be given to syndicate agents should
they have some way of getting to the outpost. Woe upon a station should
they ever team up with Nukies.

The asteroid has also had its defenses beefed up, with turrets in
various positions to guard it from spaceborne attackers. Salvage players
are REALLY going to have to work to crack the outposts open and get to
their goodies.

<details><summary><h1>Media</h1></summary>
<p>


![image](https://github.com/user-attachments/assets/67e1048a-1b5a-4495-a2f2-b0fcac90badb)


</p>
</details>

# Changelog

:cl:
- add: The Syndicate has significantly expanded their Listening Outpost
operations, featuring larger, better defended outposts. These new
outposts also serve as supply depots for Syndicate agents in the field.
  • Loading branch information
VMSolidus authored Oct 19, 2024
1 parent 951e670 commit 9442d40
Show file tree
Hide file tree
Showing 6 changed files with 932 additions and 634 deletions.

This file was deleted.

96 changes: 0 additions & 96 deletions Content.Server/DeltaV/StationEvents/Events/PirateRadioSpawnRule.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Content.Server.StationEvents.Events;

namespace Content.Server.StationEvents.Components;

[RegisterComponent, Access(typeof(PirateRadioSpawnRule))]
public sealed partial class PirateRadioSpawnRuleComponent : Component
{
[DataField]
public List<string> PirateRadioShuttlePath { get; private set; } = new()
{
"Maps/Shuttles/pirateradio.yml",
};

[DataField]
public EntityUid? AdditionalRule;

[DataField]
public int DebrisCount { get; set; }

[DataField]
public float MinimumDistance { get; set; } = 750f;

[DataField]
public float MaximumDistance { get; set; } = 1250f;

[DataField]
public float MinimumDebrisDistance { get; set; } = 150f;

[DataField]
public float MaximumDebrisDistance { get; set; } = 250f;

[DataField]
public float DebrisMinimumOffset { get; set; } = 50f;

[DataField]
public float DebrisMaximumOffset { get; set; } = 100f;
}
84 changes: 84 additions & 0 deletions Content.Server/StationEvents/Events/PirateRadioSpawnRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Content.Server.GameTicking;
using Content.Server.StationEvents.Components;
using Content.Shared.Salvage;
using Content.Shared.Random.Helpers;
using System.Linq;
using Content.Server.GameTicking.Components;
using Content.Shared.CCVar;

namespace Content.Server.StationEvents.Events;

public sealed class PirateRadioSpawnRule : StationEventSystem<PirateRadioSpawnRuleComponent>
{
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _confMan = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly TransformSystem _xform = default!;

protected override void Started(EntityUid uid, PirateRadioSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
base.Started(uid, component, gameRule, args);

var stations = _gameTicker.GetSpawnableStations();
if (stations is null || stations.Count <= 0)
return;

var targetStation = _random.Pick(stations);
var randomOffset = _random.NextVector2(component.MinimumDistance, component.MaximumDistance);

var outpostOptions = new MapLoadOptions
{
Offset = _xform.GetWorldPosition(targetStation) + randomOffset,
LoadMap = false,
};

if (!_map.TryLoad(GameTicker.DefaultMap, _random.Pick(component.PirateRadioShuttlePath), out var outpostids, outpostOptions))
return;

SpawnDebris(component, outpostids);
}

private void SpawnDebris(PirateRadioSpawnRuleComponent component, IReadOnlyList<EntityUid> outpostids)
{
if (_confMan.GetCVar(CCVars.WorldgenEnabled)
|| component.DebrisCount <= 0)
return;

foreach (var id in outpostids)
{
var outpostaabb = _xform.GetWorldPosition(id);
var k = 0;
while (k < component.DebrisCount)
{
var debrisRandomOffset = _random.NextVector2(component.MinimumDebrisDistance, component.MaximumDebrisDistance);
var randomer = _random.NextVector2(component.DebrisMinimumOffset, component.DebrisMaximumOffset); //Second random vector to ensure the outpost isn't perfectly centered in the debris field
var debrisOptions = new MapLoadOptions
{
Offset = outpostaabb + debrisRandomOffset + randomer,
LoadMap = false,
};

var salvageProto = _random.Pick(_prototypeManager.EnumeratePrototypes<SalvageMapPrototype>().ToList());
if (!_map.TryLoad(GameTicker.DefaultMap, salvageProto.MapPath.ToString(), out _, debrisOptions))
return;

k++;
}
}
}

protected override void Ended(EntityUid uid, PirateRadioSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
{
base.Ended(uid, component, gameRule, args);

if (component.AdditionalRule != null)
GameTicker.EndGameRule(component.AdditionalRule.Value);
}
}
Loading

0 comments on commit 9442d40

Please sign in to comment.