Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listening Post 2.0 #639

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d99cab6
updates map, lowers server volume
DangerRevolution Jan 2, 2024
2000e2c
Delete PLEASEWORKTHISTIMEIBEGYOUS14.yml
DangerRevolution Jan 2, 2024
e77fb34
Update DV-pirateradio.yml
DangerRevolution Jan 2, 2024
05bb5f4
changes fax machine to *not* alert admins; and start with emagged by …
DangerRevolution Jan 4, 2024
55d7ee8
Revert "changes fax machine to *not* alert admins; and start with ema…
DangerRevolution Jan 9, 2024
0585707
Revert "Update DV-pirateradio.yml"
DangerRevolution Jan 9, 2024
eae11ec
Revert "Delete PLEASEWORKTHISTIMEIBEGYOUS14.yml"
DangerRevolution Jan 9, 2024
af218f4
Revert "updates map, lowers server volume"
DangerRevolution Jan 9, 2024
7744e9a
Merge branch 'DeltaV-Station:master' into listening-post-map-changes
DangerRevolution Jan 9, 2024
19f034a
adds new syndicate fax, maps it in as well as other QOL changes
DangerRevolution Jan 9, 2024
a3f0165
adds cybersun pen to Syndicate PDA's
DangerRevolution Jan 10, 2024
9d9443c
Update DV-pirateradio.yml
DangerRevolution Jan 10, 2024
6e3e27a
adds blacklist to CC Fax + quieter server
DangerRevolution Jan 10, 2024
df4efe5
Update PirateRadioSpawnRule.cs
VMSolidus Jan 14, 2024
94cef21
Merge branch 'master' into listening-post-map-changes
DangerRevolution Jan 15, 2024
35a46d0
unfinished scuttling system
VMSolidus Jan 15, 2024
b8147ca
Merge branch 'listening-post-map-changes' of https://github.com/Dange…
VMSolidus Jan 15, 2024
633307c
Adding colorblind quality of life.
VMSolidus Jan 15, 2024
00c1241
Tweaks to map and guards, no more self destruct system
VMSolidus Jan 19, 2024
2f68643
added guard flavor text
VMSolidus Jan 19, 2024
a040376
The reasons for these are now gone
VMSolidus Jan 19, 2024
accf0b7
DONE
VMSolidus Jan 20, 2024
c1c2873
Update events.yml
VMSolidus Jan 20, 2024
8945f23
Update PirateRadioSpawnRule.cs
VMSolidus Jan 20, 2024
4bb7138
Update DV-pirateradio.yml
VMSolidus Jan 20, 2024
9168046
Merge branch 'master' into listening-post-map-changes
DangerRevolution Jan 20, 2024
1ca239f
fixes crew monitor server not working at *extreme* ranges
DangerRevolution Jan 20, 2024
cdd078a
adds delta-v comment where needed
DangerRevolution Jan 20, 2024
6a82d29
Merge branch 'master' into listening-post-map-changes
DangerRevolution Jan 20, 2024
3796440
Small code optimization and tons of documentation
VMSolidus Jan 20, 2024
f603dc0
Merge branch 'listening-post-map-changes' of https://github.com/Dange…
VMSolidus Jan 20, 2024
a02a470
Update outpost visuals! Guards have a PDA now
VMSolidus Jan 20, 2024
1a83c8c
Merge branch 'listening-post-map-changes' of https://github.com/Dange…
DangerRevolution Jan 21, 2024
07b515f
Merge branch 'master' into listening-post-map-changes
VMSolidus Jan 22, 2024
11f8899
Update DV-pirateradio.yml
VMSolidus Jan 23, 2024
b0367e3
Update DV-pirateradio.yml
VMSolidus Jan 24, 2024
d05c031
Merge branch 'master' into listening-post-map-changes
VMSolidus Jan 28, 2024
c3ba187
Goodbye crab. Hello Content.Shared migration
VMSolidus Jan 28, 2024
f5e7ed3
Merge branch 'DeltaV-Station:master' into listening-post-map-changes
DangerRevolution Jan 28, 2024
dded704
Cleaning up pirateradio spawn
VMSolidus Jan 28, 2024
3d98425
Merge branch 'listening-post-map-changes' of https://github.com/Dange…
VMSolidus Jan 28, 2024
3291c2e
Update DV-pirateradio.yml
VMSolidus Jan 30, 2024
a834b87
reverts pen changes to upstream PDA's
DangerRevolution Feb 1, 2024
b7b9ac0
adds new PDA
DangerRevolution Feb 1, 2024
df53c08
adds new PDA to loadouts.
DangerRevolution Feb 1, 2024
b6d5cfa
Update Resources/Prototypes/DeltaV/Entities/Mobs/NPCs/salvage.yml
DangerRevolution Feb 1, 2024
fd98e8b
Merge branch 'master' into listening-post-map-changes
DangerRevolution Feb 1, 2024
20e8ddb
Merge branch 'master' into listening-post-map-changes
DangerRevolution Feb 5, 2024
c5a3331
Maintainer requested changes
VMSolidus Feb 5, 2024
9eda203
Merge branch 'listening-post-map-changes' of https://github.com/Dange…
VMSolidus Feb 5, 2024
79b9bad
Update salvage.yml
VMSolidus Feb 5, 2024
84b878c
Update syndicateNPCs.yml
VMSolidus Feb 6, 2024
31af8bd
Cleaning up unneeded stuff
VMSolidus Feb 11, 2024
f2fd5b0
more code cleanup
VMSolidus Feb 11, 2024
f1fd4bd
Update PirateRadioSpawnRule.cs
VMSolidus Feb 11, 2024
cbd0c58
Update computers.yml
VMSolidus Feb 11, 2024
034e2fa
Revert "Update computers.yml"
VMSolidus Feb 11, 2024
dd9aa50
Last fixes to the math
VMSolidus Feb 13, 2024
997a358
Update PirateRadioSpawnRule.cs
VMSolidus Feb 13, 2024
66b7b2d
Merge branch 'master' into listening-post-map-changes
VMSolidus Feb 13, 2024
6689915
Merge branch 'master' into listening-post-map-changes
VMSolidus Feb 22, 2024
96ea3cb
Merge branch 'master' into listening-post-map-changes
VMSolidus Feb 23, 2024
97ea85e
update license.
VMSolidus Feb 23, 2024
e13d337
Merge branch 'master' into listening-post-map-changes
DebugOk Mar 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/*
* Delta-V - This file is licensed under AGPLv3
* Copyright (c) 2024 Delta-V Contributors
* See AGPLv3.txt for details.
*/

using Content.Server.StationEvents.Events;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.StationEvents.Components;

Expand All @@ -12,4 +16,21 @@ public sealed partial class PirateRadioSpawnRuleComponent : Component

[DataField("additionalRule")]
public EntityUid? AdditionalRule;

[DataField("debrisCount")]
public int DebrisCount { get; set; }

[DataField("distanceModifier")]
public float DistanceModifier { get; set; }

[DataField("debrisDistanceModifier")]
public float DebrisDistanceModifier { get; set; }

/// <summary>
/// "Stations of Unusual Size Constant", derived from the AABB.Width of Shoukou.
/// This Constant is used to check the size of a station relative to the reference point
/// </summary>
[DataField("sousk")]
public float SOUSK = 123.44f;

}
Original file line number Diff line number Diff line change
@@ -1,32 +1,94 @@
/*
* Delta-V - This file is licensed under AGPLv3
* Copyright (c) 2024 Delta-V Contributors
* See AGPLv3.txt for details.
*/

using Robust.Server.GameObjects;
using Robust.Server.Maps;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
using Content.Server.RoundEnd;
using Content.Server.Station.Components;
using Content.Shared.Salvage;
using Content.Shared.Random.Helpers;
using System.Linq;
using Content.Shared.CCVar;

namespace Content.Server.StationEvents.Events;

public sealed class PirateRadioSpawnRule : StationEventSystem<PirateRadioSpawnRuleComponent>
{
[Dependency] private readonly IEntityManager _entities = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly TraitorRuleSystem _TraitorRuleSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IConfigurationManager _confMan = default!;

protected override void Started(EntityUid uid, PirateRadioSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{
//Start of Syndicate Listening Outpost spawning system
base.Started(uid, component, gameRule, args);

var shuttleMap = _mapManager.CreateMap();
var options = new MapLoadOptions
var xformQuery = GetEntityQuery<TransformComponent>();
var aabbs = EntityQuery<StationDataComponent>().SelectMany(x =>
x.Grids.Select(x =>
xformQuery.GetComponent(x).WorldMatrix.TransformBox(_mapManager.GetGridComp(x).LocalAABB)))
.ToArray();
if (aabbs.Length < 1) return;
var aabb = aabbs[0];

for (var i = 1; i < aabbs.Length; i++)
{
aabb.Union(aabbs[i]);
}
var distanceFactorCoefficient = component.SOUSK / aabb.Width;
var distanceModifier = Math.Clamp(component.DistanceModifier, 1, 25);
var distanceModifierNormalized = distanceModifier * distanceFactorCoefficient;
var a = MathF.Max(aabb.Height / 2f, aabb.Width / 2f) * distanceModifierNormalized;
var randomoffset = _random.NextVector2(a, a * 2.5f);
var outpostOptions = new MapLoadOptions
{
LoadMap = true,
Offset = aabb.Center + randomoffset,
LoadMap = false,
};
if (!_map.TryLoad(GameTicker.DefaultMap, component.PirateRadioShuttlePath, out var outpostids, outpostOptions)) return;
//End of Syndicate Listening Outpost spawning system

//Start of Debris Field Generation
var debrisSpawner = _confMan.GetCVar<bool>(CCVars.WorldgenEnabled);
if (debrisSpawner == true) return;
var debrisCount = Math.Clamp(component.DebrisCount, 0, 6);
if (debrisCount == 0) return;
var debrisDistanceModifier = Math.Clamp(component.DebrisDistanceModifier, 3, 10);
foreach (var id in outpostids)
{
if (!TryComp<MapGridComponent>(id, out var grid)) return;
var outpostaabb = _entities.GetComponent<TransformComponent>(id).WorldMatrix.TransformBox(grid.LocalAABB);
var b = MathF.Max(outpostaabb.Height / 2f, aabb.Width / 2f) * debrisDistanceModifier;
var k = 1;
while (k < debrisCount + 1)
{
var debrisRandomOffset = _random.NextVector2(b, b * 2.5f);
var randomer = _random.NextVector2(b, b * 5f); //Second random vector to ensure the outpost isn't perfectly centered in the debris field
var debrisOptions = new MapLoadOptions
{
Offset = outpostaabb.Center + debrisRandomOffset + randomer,
LoadMap = false,
};

_map.TryLoad(shuttleMap, component.PirateRadioShuttlePath, out _, options);
var salvageProto = _random.Pick(_prototypeManager.EnumeratePrototypes<SalvageMapPrototype>().ToList());
_map.TryLoad(GameTicker.DefaultMap, salvageProto.MapPath.ToString(), out _, debrisOptions);
k++;
}
}
//End of Debris Field generation
}

protected override void Ended(EntityUid uid, PirateRadioSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleEndedEvent args)
Expand All @@ -36,4 +98,4 @@ protected override void Ended(EntityUid uid, PirateRadioSpawnRuleComponent compo
if (component.AdditionalRule != null)
GameTicker.EndGameRule(component.AdditionalRule.Value);
}
}
}
Loading
Loading