forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'SerbiaStrong-220:master' into SponsorFix
- Loading branch information
Showing
169 changed files
with
249,553 additions
and
243,165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
Content.Server/SS220/StationEvents/CableRandomSpawnRule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using Content.Server.StationEvents.Components; | ||
using Content.Server.StationEvents.Events; | ||
using Content.Server.GameTicking.Rules.Components; | ||
using Content.Server.Station.Components; | ||
using Content.Shared.Storage; | ||
using Robust.Shared.Map; | ||
using Robust.Shared.Random; | ||
using Content.Server.Power.Components; | ||
|
||
namespace Content.Server.SS220.StationEvents; | ||
|
||
public sealed class CableRandomSpawnRule : StationEventSystem<CableRandomSpawnRuleComponent> | ||
{ | ||
/* | ||
* DO NOT COPY PASTE THIS TO MAKE YOUR MOB EVENT. | ||
* USE THE PROTOTYPE. | ||
*/ | ||
|
||
protected override void Started(EntityUid uid, CableRandomSpawnRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) | ||
{ | ||
base.Started(uid, component, gameRule, args); | ||
|
||
if (!TryGetRandomStation(out var station)) | ||
{ | ||
return; | ||
} | ||
|
||
var locations = EntityQueryEnumerator<CableComponent, TransformComponent>(); | ||
var validLocations = new List<EntityCoordinates>(); | ||
while (locations.MoveNext(out _, out _, out var transform)) | ||
{ | ||
if (CompOrNull<StationMemberComponent>(transform.GridUid)?.Station == station) | ||
{ | ||
validLocations.Add(transform.Coordinates); | ||
foreach (var spawn in EntitySpawnCollection.GetSpawns(component.Entries, RobustRandom)) | ||
{ | ||
Spawn(spawn, transform.Coordinates); | ||
} | ||
} | ||
} | ||
|
||
if (component.SpecialEntries.Count == 0 || validLocations.Count == 0) | ||
{ | ||
return; | ||
} | ||
|
||
// guaranteed spawn | ||
var specialEntry = RobustRandom.Pick(component.SpecialEntries); | ||
var specialSpawn = RobustRandom.Pick(validLocations); | ||
Spawn(specialEntry.PrototypeId, specialSpawn); | ||
|
||
foreach (var location in validLocations) | ||
{ | ||
foreach (var spawn in EntitySpawnCollection.GetSpawns(component.SpecialEntries, RobustRandom)) | ||
{ | ||
Spawn(spawn, location); | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Content.Server/SS220/StationEvents/CableRandomSpawnRuleComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Content.Shared.Storage; | ||
|
||
namespace Content.Server.SS220.StationEvents; | ||
|
||
[RegisterComponent, Access(typeof(CableRandomSpawnRule))] | ||
public sealed partial class CableRandomSpawnRuleComponent : Component | ||
{ | ||
[DataField("entries")] | ||
public List<EntitySpawnEntry> Entries = new(); | ||
|
||
/// <summary> | ||
/// At least one special entry is guaranteed to spawn | ||
/// </summary> | ||
[DataField("specialEntries")] | ||
public List<EntitySpawnEntry> SpecialEntries = new(); | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Resources/Locale/ru-RU/ss220/station-events/events/cable-random.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
station-event-banana-rain-announcement = Кажется, на станции завёлся особо опасный шутник. Он мог оставить следы своей деятельности. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.