Skip to content

Commit

Permalink
Спавн пачками не изменяя количество мобов
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiiwwwie committed Jan 29, 2025
1 parent 475c6b0 commit 1ffa2cf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.StationEvents.Events;
using Content.Server.StationEvents.Events;
using Content.Shared.Storage;

namespace Content.Server.StationEvents.Components;
Expand All @@ -14,4 +14,9 @@ public sealed partial class VentCrittersRuleComponent : Component
/// </summary>
[DataField("specialEntries")]
public List<EntitySpawnEntry> SpecialEntries = new();

//SS220 fauna Update start
[DataField("stackAmount")]
public int StackAmount = 1;
//SS220 fauna update end
}
25 changes: 19 additions & 6 deletions Content.Server/StationEvents/Events/VentCrittersRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,33 @@ protected override void Started(EntityUid uid, VentCrittersRuleComponent compone
{
return;
}

//SS220 fauna update
if (component.StackAmount == 0)
{
return;
}
//SS220 fauna update
var locations = EntityQueryEnumerator<VentCritterSpawnLocationComponent, TransformComponent>();
var validLocations = new List<EntityCoordinates>();
var counter = 1;
while (locations.MoveNext(out _, out _, out var transform))
{
if (CompOrNull<StationMemberComponent>(transform.GridUid)?.Station == station &&
HasComp<BecomesStationComponent>(transform.GridUid)) //SS220 Vent critters spawn fix
if (counter % component.StackAmount == 0)
{
validLocations.Add(transform.Coordinates);
foreach (var spawn in EntitySpawnCollection.GetSpawns(component.Entries, RobustRandom))
if (CompOrNull<StationMemberComponent>(transform.GridUid)?.Station == station &&
HasComp<BecomesStationComponent>(transform.GridUid)) //SS220 Vent critters spawn fix
{
Spawn(spawn, transform.Coordinates);
validLocations.Add(transform.Coordinates);
foreach (var spawn in EntitySpawnCollection.GetSpawns(component.Entries, RobustRandom))
{
for (var i = 0; i < component.StackAmount; i++) //SS220 fauna Update for loop
{
Spawn(spawn, transform.Coordinates); //This line from offs
}
}
}
}
counter = counter + 1;
}

if (component.SpecialEntries.Count == 0 || validLocations.Count == 0)
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/GameRules/events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@
weight: 5
duration: 60
- type: VentCrittersRule
stackAmount: 3
entries:
- id: MobGiantSpiderAngry
prob: 0.05
Expand Down

0 comments on commit 1ffa2cf

Please sign in to comment.