Skip to content

Commit

Permalink
Merge branch 'new-frontiers-14:master' into AsteroidVaultFTL-Event
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan authored Sep 21, 2023
2 parents 7dfaa9e + c589573 commit 4ce28b6
Show file tree
Hide file tree
Showing 103 changed files with 4,278 additions and 2,809 deletions.
57 changes: 54 additions & 3 deletions Content.Server/StationEvents/Events/AnomalySpawnRule.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
using Content.Server.Anomaly;
using Content.Server.Anomaly;
using Content.Server.GameTicking.Rules.Components;
using Content.Server.Station.Components;
using Content.Server.StationEvents.Components;
using Content.Shared.CCVar;
using Content.Shared.Physics;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics;
using Robust.Shared.Configuration;
using Robust.Shared.Random;

namespace Content.Server.StationEvents.Events;

public sealed class AnomalySpawnRule : StationEventSystem<AnomalySpawnRuleComponent>
{
[Dependency] private readonly AnomalySystem _anomaly = default!;
[Dependency] private readonly IConfigurationManager _configuration = default!;
[Dependency] protected readonly IRobustRandom _random = default!;

protected override void Added(EntityUid uid, AnomalySpawnRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args)
{
Expand All @@ -22,7 +31,7 @@ protected override void Started(EntityUid uid, AnomalySpawnRuleComponent compone
{
base.Started(uid, component, gameRule, args);

if (!TryGetRandomStation(out var chosenStation))
if (TryGetRandomStation(out var chosenStation, HasComp<StationJobsComponent>))
return;

if (!TryComp<StationDataComponent>(chosenStation, out var stationData))
Expand All @@ -36,7 +45,49 @@ protected override void Started(EntityUid uid, AnomalySpawnRuleComponent compone
var amountToSpawn = Math.Max(1, (int) MathF.Round(GetSeverityModifier() / 2));
for (var i = 0; i < amountToSpawn; i++)
{
_anomaly.SpawnOnRandomGridLocation(grid.Value, component.AnomalySpawnerPrototype);
SpawnOnRandomGridLocation(grid.Value, component.AnomalySpawnerPrototype);
}
}

private void SpawnOnRandomGridLocation(EntityUid grid, string toSpawn)
{
if (!TryComp<MapGridComponent>(grid, out var gridComp))
return;

var xform = Transform(grid);

var targetCoords = xform.Coordinates;
var gridBounds = gridComp.LocalAABB.Scale(_configuration.GetCVar(CCVars.AnomalyGenerationGridBoundsScale));

for (var i = 0; i < 25; i++)
{
var randomX = _random.Next((int) gridBounds.Left, (int) gridBounds.Right);
var randomY = _random.Next((int) gridBounds.Bottom, (int) gridBounds.Top);

var tile = new Vector2i(randomX, randomY);

// don't spawn inside of solid objects
var physQuery = GetEntityQuery<PhysicsComponent>();
var valid = true;
foreach (var ent in gridComp.GetAnchoredEntities(tile))
{
if (!physQuery.TryGetComponent(ent, out var body))
continue;
if (body.BodyType != BodyType.Static ||
!body.Hard ||
(body.CollisionLayer & (int) CollisionGroup.Impassable) == 0)
continue;

valid = false;
break;
}
if (!valid)
continue;

targetCoords = gridComp.GridTileToLocal(tile);
break;
}

Spawn(toSpawn, targetCoords);
}
}
Binary file not shown.
84 changes: 84 additions & 0 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,3 +697,87 @@ Entries:
message: Captain stamp will use your card name for the stamp.
id: 70
time: '2023-09-16T05:50:32.0000000+00:00'
- author: dvir001
changes:
- type: Add
message: SR Found their sunglasses under the pet bed.
id: 71
time: '2023-09-19T16:42:25.0000000+00:00'
- author: dvir01
changes:
- type: Fix
message: NT Added more lube for belts, they can move more stuff now
id: 72
time: '2023-09-19T16:49:00.0000000+00:00'
- author: dvir01
changes:
- type: Tweak
message: Anomaly locators range went up from 20 to 2000
id: 73
time: '2023-09-19T17:10:25.0000000+00:00'
- author: Leander
changes:
- type: Add
message: >-
Leander Co successfully reverse engineered the genetic code of
mothroaches after stealing a live specimen from the Nyano sector.
id: 74
time: '2023-09-19T17:13:41.0000000+00:00'
- author: Leander
changes:
- type: Add
message: >-
Added blue/red galaxy suits for when you need to do intergalactic
business.
id: 75
time: '2023-09-19T17:15:18.0000000+00:00'
- author: dvir01
changes:
- type: Tweak
message: >-
As per the SR and Security request, Frontier machines are made from a
stronger metal now.
- type: Tweak
message: The pirates Black Market shipyard computer has lost its immortality.
id: 76
time: '2023-09-19T17:22:02.0000000+00:00'
- author: dvir01
changes:
- type: Add
message: >-
Added the floor tiles crate for the price of 500, get some fun tiles for
your ship!
id: 77
time: '2023-09-19T17:45:24.0000000+00:00'
- author: dvir01
changes:
- type: Tweak
message: ChefVend Monkey cube price fixed
- type: Tweak
message: Dry monkey cube and dry carps has the same price as the dead mob.
id: 78
time: '2023-09-19T18:07:34.0000000+00:00'
- author: dvir01
changes:
- type: Tweak
message: Captains stamps now show up in Bureaucracy crates, and SR vend machines.
- type: Tweak
message: >-
SR Vend machine have a bit more items in it, NT hopes the SR will find
this useful.
id: 79
time: '2023-09-19T18:12:22.0000000+00:00'
- author: dvir01
changes:
- type: Tweak
message: >-
NT Has updated the locks on the cargo crates again, the crates should
open again as expected,
id: 80
time: '2023-09-19T18:48:18.0000000+00:00'
- author: potato1234x
changes:
- type: Tweak
message: Resprited the mailbox.
id: 81
time: '2023-09-19T21:07:40.0000000+00:00'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-FloorsFun = { ent-CrateFloorsFun }
.desc = { ent-CrateFloorsFun.desc }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ent-CrateFloorsFun = Fun floors tiles crate
.desc = A crate full of 30 random tiles, used for decoration.
8 changes: 8 additions & 0 deletions Resources/Locale/en-US/_Nyano/store/uplink-catalog.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
uplink-kanabou-name = Kanabou
uplink-kanabou-desc = A weapon for those who wish to forgo subtlety. Particularly suited to oni.
uplink-rickenbacker4001-name = Rickenbacker 4001
uplink-rickenbacker4001-desc = When it comes down to it, there are very few people who will swing the bat.
uplink-samurai-bundle-name = Syndicate samurai armor bundle
uplink-samurai-bundle-desc = A bundle containing a modern replica of a full Tousei-Gusoku set.
8 changes: 8 additions & 0 deletions Resources/Locale/en-US/accent/accents.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,11 @@ accent-words-slimes-2 = Blimpuf?
accent-words-slimes-3 = Blump!
accent-words-slimes-4 = Bluuump...
accent-words-slimes-5 = Blabl blump!
# Nyanotrasen Mothroach
accent-words-mothroach-1 = Squeak!
accent-words-mothroach-2 = Chirp!
accent-words-mothroach-3 = Peep!
accent-words-mothroach-4 = Eeee!
accent-words-mothroach-5 = Eep!
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/ghost/roles/ghost-role-component.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,6 @@ ghost-role-information-loneop-rules = You are a syndicate operative tasked with
ghost-role-information-behonker-name = Behonker
ghost-role-information-behonker-description = You are an antagonist, bring death and honks to those who do not follow the honkmother.
ghost-role-information-mothroach-name = Mothroach
ghost-role-information-mothroach-description = A cute but mischievous mothroach.
Loading

0 comments on commit 4ce28b6

Please sign in to comment.