diff --git a/Content.Server/GameTicking/Rules/Configurations/WaveDefenseRuleConfiguration.cs b/Content.Server/GameTicking/Rules/Configurations/WaveDefenseRuleConfiguration.cs index f992b3feb95..faab984eefc 100644 --- a/Content.Server/GameTicking/Rules/Configurations/WaveDefenseRuleConfiguration.cs +++ b/Content.Server/GameTicking/Rules/Configurations/WaveDefenseRuleConfiguration.cs @@ -11,7 +11,7 @@ public sealed class WaveDefenseRuleConfiguration : GameRuleConfiguration public float DifficultyMod = 0.65f; [DataField("waveTime")] - public int WaveTime = 300; + public int WaveTime = 240; [DataField("greetingSound", customTypeSerializer: typeof(SoundSpecifierTypeSerializer))] public SoundSpecifier? GreetSound = new SoundPathSpecifier("/Audio/Misc/nukeops.ogg"); diff --git a/Content.Server/GameTicking/Rules/WaveDefenseRuleSystem.cs b/Content.Server/GameTicking/Rules/WaveDefenseRuleSystem.cs index 1676047bf16..ee1040e344c 100644 --- a/Content.Server/GameTicking/Rules/WaveDefenseRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/WaveDefenseRuleSystem.cs @@ -1,14 +1,10 @@ +using Content.Server.Cargo.Systems; using Content.Server.Chat.Managers; using Content.Server.GameTicking.Rules.Components; using Content.Server.GameTicking.Rules.Configurations; -using Content.Server.Objectives.Interfaces; -using Content.Server.Players; using Content.Server.RoundEnd; using Content.Server.Spawners.Components; -using Content.Server.Traitor; using Content.Shared.Mobs; -using Robust.Server.Player; -using Robust.Shared.Configuration; using Robust.Shared.Map; using Robust.Shared.Prototypes; using Robust.Shared.Random; @@ -19,7 +15,8 @@ using Content.Shared.Administration; using Content.Shared.Mobs.Components; using System.Linq; -using Content.Shared.GameTicking; +using Content.Server.Cargo.Components; +using Content.Server.Station.Systems; namespace Content.Server.GameTicking.Rules; @@ -33,6 +30,8 @@ public sealed class WaveDefenseRuleSystem : GameRuleSystem [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly RoundEndSystem _roundEndSystem = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; + [Dependency] private readonly CargoSystem _cargo = default!; + [Dependency] private readonly StationSystem _station = default!; public override string Prototype => "WaveDefense"; @@ -190,7 +189,7 @@ private List PickMonsters(int wave) //Todo: fine tune this, i just slapped an integer here wcgw. //Ideally, we would have no numbers hard coded at all and should rely solely on the RuleConfig, so go there to change the actual difficulty //or make a new rule config. Same goes with timer - var wavePool = wave * _waveDefenseRuleConfig.DifficultyMod * (Defenders.Count * 2); + var wavePool = wave * _waveDefenseRuleConfig.DifficultyMod * (Defenders.Count * 3); var waveTemplate = _random.Pick(mobList).Value.Item1; var spawnList = new List(); @@ -222,7 +221,12 @@ private void OnMobDied(EntityUid mobUid, WaveMobComponent component, MobStateCha KillCount++; HighScore += component.Difficulty * 10; RemCompDeferred(mobUid); - } + var station = _station.GetOwningStation(mobUid); + if (TryComp(station, out var stationBank)) + { + _cargo.UpdateBankAccount(stationBank, (int)(component.Difficulty * 100)); + } + } } private void OnPlayerDied(EntityUid mobUid, WaveDefenderComponent component, MobStateChangedEvent args) diff --git a/Content.Server/Spawners/EntitySystems/TimedStorageFillSystem.cs b/Content.Server/Spawners/EntitySystems/TimedStorageFillSystem.cs index 1cd21618518..1be227bd789 100644 --- a/Content.Server/Spawners/EntitySystems/TimedStorageFillSystem.cs +++ b/Content.Server/Spawners/EntitySystems/TimedStorageFillSystem.cs @@ -1,11 +1,12 @@ +using Content.Server.Spawners.Components; +using Content.Server.Storage.EntitySystems; using Content.Server.Storage.Components; using Content.Shared.Storage; using Robust.Shared.Random; -using Content.Server.Spawners.Components; -namespace Content.Server.Storage.EntitySystems; +namespace Content.Server.Spawners.EntitySystems; -public sealed partial class TimedStorageFillSystem : EntitySystem +public sealed class TimedStorageFillSystem : EntitySystem { [Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly EntityStorageSystem _entityStorage = default!; @@ -15,10 +16,11 @@ public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnUnanchor); } private void OnStartup(EntityUid uid, TimedStorageFillComponent component, ComponentStartup args) - { + { FillStorage(uid, component); component.NextRefillTime = _robustRandom.NextFloat(component.MinimumSeconds, component.MaximumSeconds); } @@ -41,7 +43,8 @@ public override void Update(float frameTime) private void FillStorage(EntityUid uid, TimedStorageFillComponent component) { - if (component.Contents.Count == 0) return; + if (component.Contents.Count == 0) + return; TryComp(uid, out var serverStorageComp); TryComp(uid, out var entityStorageComp); @@ -73,4 +76,12 @@ private void FillStorage(EntityUid uid, TimedStorageFillComponent component) EntityManager.DeleteEntity(ent); } } + + private void OnUnanchor(EntityUid uid, TimedStorageFillComponent component, ref AnchorStateChangedEvent args) + { + if (!args.Anchored) + { + RemCompDeferred(uid); + } + } }