From da72b802e985c7e660366a0c9f422ca2378faf24 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sat, 15 Jul 2023 14:15:12 -0400 Subject: [PATCH] Longer bounties (#18053) --- .../StationCargoBountyDatabaseComponent.cs | 25 +++++++------------ .../Cargo/Systems/CargoSystem.Bounty.cs | 4 ++- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/Content.Server/Cargo/Components/StationCargoBountyDatabaseComponent.cs b/Content.Server/Cargo/Components/StationCargoBountyDatabaseComponent.cs index 656f64b542..f043810023 100644 --- a/Content.Server/Cargo/Components/StationCargoBountyDatabaseComponent.cs +++ b/Content.Server/Cargo/Components/StationCargoBountyDatabaseComponent.cs @@ -27,21 +27,14 @@ public sealed class StationCargoBountyDatabaseComponent : Component public int TotalBounties; /// - /// A poor-man's weighted list of the durations for how long - /// each bounty will last. + /// The minimum amount of time the bounty lasts before being removed. /// - [DataField("bountyDurations")] - public List BountyDurations = new() - { - TimeSpan.FromMinutes(5), - TimeSpan.FromMinutes(7.5f), - TimeSpan.FromMinutes(7.5f), - TimeSpan.FromMinutes(7.5f), - TimeSpan.FromMinutes(10), - TimeSpan.FromMinutes(10), - TimeSpan.FromMinutes(10), - TimeSpan.FromMinutes(10), - TimeSpan.FromMinutes(10), - TimeSpan.FromMinutes(15) - }; + [DataField("minBountyTime"), ViewVariables(VVAccess.ReadWrite)] + public float MinBountyTime = 600f; + + /// + /// The maxmium amount of time the bounty lasts before being removed. + /// + [DataField("maxBountyTime"), ViewVariables(VVAccess.ReadWrite)] + public float MaxBountyTime = 905f; } diff --git a/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs b/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs index bd8fed644a..30c666cdd0 100644 --- a/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs +++ b/Content.Server/Cargo/Systems/CargoSystem.Bounty.cs @@ -256,7 +256,9 @@ public sealed partial class CargoSystem if (component.Bounties.Count >= component.MaxBounties) return false; - var endTime = _timing.CurTime + _random.Pick(component.BountyDurations) + TimeSpan.FromSeconds(_random.Next(-10, 10)); + var duration = MathF.Round(_random.NextFloat(component.MinBountyTime, component.MaxBountyTime) / 15) * 15; + var endTime = _timing.CurTime + TimeSpan.FromSeconds(duration); + component.Bounties.Add(new CargoBountyData(component.TotalBounties, bounty.ID, endTime)); _adminLogger.Add(LogType.Action, LogImpact.Low, $"Added bounty \"{bounty.ID}\" (id:{component.TotalBounties}) to station {ToPrettyString(uid)}"); component.TotalBounties++;