diff --git a/Content.Server/Salvage/SalvageSystem.Expeditions.cs b/Content.Server/Salvage/SalvageSystem.Expeditions.cs index 9568fbfe6f..fb49773cad 100644 --- a/Content.Server/Salvage/SalvageSystem.Expeditions.cs +++ b/Content.Server/Salvage/SalvageSystem.Expeditions.cs @@ -1,5 +1,4 @@ using Content.Server.Cargo.Components; -using Content.Server.Cargo.Systems; using Content.Server.Salvage.Expeditions; using Content.Server.Salvage.Expeditions.Structure; using Content.Shared.CCVar; @@ -20,7 +19,7 @@ public sealed partial class SalvageSystem * Handles setup / teardown of salvage expeditions. */ - private const int MissionLimit = 5; + private const int MissionLimit = 3; private readonly JobQueue _salvageQueue = new(); private readonly List<(SpawnSalvageMissionJob Job, CancellationTokenSource CancelToken)> _salvageJobs = new(); @@ -225,20 +224,27 @@ public sealed partial class SalvageSystem component.Missions.Clear(); var configs = Enum.GetValues().ToList(); - if (configs.Count == 0) - return; - // Temporarily removed coz it SUCKS configs.Remove(SalvageMissionType.Mining); + // this doesn't support having more missions than types of ratings + // but the previous system didn't do that either. + var allDifficulties = Enum.GetValues(); + _random.Shuffle(allDifficulties); + var difficulties = allDifficulties.Take(MissionLimit).ToList(); + difficulties.Sort(); + + if (configs.Count == 0) + return; + for (var i = 0; i < MissionLimit; i++) { _random.Shuffle(configs); - var rating = (DifficultyRating) i; + var rating = difficulties[i]; foreach (var config in configs) { - var mission = new SalvageMissionParams() + var mission = new SalvageMissionParams { Index = component.NextIndex, MissionType = config, diff --git a/Content.Shared/Salvage/Expeditions/Modifiers/SalvageTimeMod.cs b/Content.Shared/Salvage/Expeditions/Modifiers/SalvageTimeMod.cs index f65465fbbd..9359e97971 100644 --- a/Content.Shared/Salvage/Expeditions/Modifiers/SalvageTimeMod.cs +++ b/Content.Shared/Salvage/Expeditions/Modifiers/SalvageTimeMod.cs @@ -13,11 +13,11 @@ public sealed class SalvageTimeMod : IPrototype, ISalvageMod /// Cost for difficulty modifiers. /// [DataField("cost")] - public float Cost { get; } = 0f; + public float Cost { get; } [DataField("minDuration")] - public int MinDuration = 900; + public int MinDuration = 630; [DataField("maxDuration")] - public int MaxDuration = 900; + public int MaxDuration = 570; } diff --git a/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs b/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs index 10c3cae7b6..a32b25506e 100644 --- a/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs +++ b/Content.Shared/Salvage/Expeditions/SalvageExpeditions.cs @@ -72,7 +72,7 @@ public sealed class SalvageExpeditionDataComponent : Component } [Serializable, NetSerializable] -public sealed record SalvageMissionParams +public sealed record SalvageMissionParams : IComparable { [ViewVariables] public ushort Index; @@ -86,6 +86,14 @@ public sealed record SalvageMissionParams /// Base difficulty for this mission. /// [ViewVariables(VVAccess.ReadWrite)] public DifficultyRating Difficulty; + + public int CompareTo(SalvageMissionParams? other) + { + if (other == null) + return -1; + + return Difficulty.CompareTo(other.Difficulty); + } } /// diff --git a/Content.Shared/Salvage/SharedSalvageSystem.cs b/Content.Shared/Salvage/SharedSalvageSystem.cs index 813299b423..5aa0fc4e61 100644 --- a/Content.Shared/Salvage/SharedSalvageSystem.cs +++ b/Content.Shared/Salvage/SharedSalvageSystem.cs @@ -121,7 +121,7 @@ public abstract class SharedSalvageSystem : EntitySystem var time = GetMod(rand, ref rating); // Round the duration to nearest 15 seconds. - var exactDuration = time.MinDuration + (time.MaxDuration - time.MinDuration) * rand.NextFloat(); + var exactDuration = MathHelper.Lerp(time.MinDuration, time.MaxDuration, rand.NextFloat()); exactDuration = MathF.Round(exactDuration / 15f) * 15f; var duration = TimeSpan.FromSeconds(exactDuration); diff --git a/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml b/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml index 3f053df6c8..84f52cf181 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml @@ -56,3 +56,11 @@ - type: TechnologyDisk - type: StaticPrice price: 50 + +- type: entity + parent: TechnologyDisk + id: TechnologyDiskRare + suffix: rare. + components: + - type: TechnologyDisk + tierWeightPrototype: RareTechDiskTierWeights diff --git a/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml b/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml index 7d70d00568..df989a7795 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/Computers/techdiskterminal.yml @@ -37,3 +37,9 @@ 1: 25 2: 10 3: 1 + +- type: weightedRandom + id: RareTechDiskTierWeights + weights: + 2: 19 + 3: 1 diff --git a/Resources/Prototypes/Procedural/salvage_mods.yml b/Resources/Prototypes/Procedural/salvage_mods.yml index fa81b0332b..7ff2918c13 100644 --- a/Resources/Prototypes/Procedural/salvage_mods.yml +++ b/Resources/Prototypes/Procedural/salvage_mods.yml @@ -75,8 +75,8 @@ - type: salvageTimeMod id: RushTime desc: Rush - minDuration: 720 - maxDuration: 780 + minDuration: 420 + maxDuration: 465 cost: 1 # Misc mods diff --git a/Resources/Prototypes/Procedural/salvage_rewards.yml b/Resources/Prototypes/Procedural/salvage_rewards.yml index 998bf3b531..29c64a96c0 100644 --- a/Resources/Prototypes/Procedural/salvage_rewards.yml +++ b/Resources/Prototypes/Procedural/salvage_rewards.yml @@ -30,19 +30,22 @@ SheetUranium: 1.0 CratePartsT3: 1.0 CratePartsT3T4: 0.5 + TechnologyDiskRare: 0.5 # cloning boards CloningPodMachineCircuitboard: 0.5 MedicalScannerMachineCircuitboard: 0.5 CloningConsoleComputerCircuitboard: 0.5 BiomassReclaimerMachineCircuitboard: 0.5 # basic weapons - CrateArmorySMG: 0.25 - CrateArmoryLaser: 0.25 - WeaponMakeshiftLaser: 0.25 + Katana: 0.25 + KukriKnife: 0.25 + WeaponLaserGun: 0.25 + MakeshiftShield: 0.25 # rare armor - ClothingHeadHelmetSwat: 0.1 + ClothingHeadHelmetSwat: 0.25 + ClothingOuterArmorBasicSlim: 0.25 # rare weapons - WeaponSubMachineGunC20r: 0.1 + WeaponMakeshiftLaser: 0.1 # money SpaceCash500: 1.0 SpaceCash1000: 0.75 @@ -55,11 +58,12 @@ ResearchAndDevelopmentServerMachineCircuitboard: 1.0 CratePartsT4: 1.0 PowerCellAntiqueProto: 0.25 - # rare weapons - WeaponAdvancedLaser: 1.0 - WeaponLaserCannon: 1.0 - WeaponXrayCannon: 1.0 - WeaponSniperHristov: 1.0 + # basic weapons + CrateArmorySMG: 1.0 + CrateArmoryLaser: 1.0 + CrateArmoryShotgun: 1.0 + # rare armor + ClothingOuterArmorRiot: 1.0 # rare chemicals CognizineChemistryBottle: 1.0 OmnizineChemistryBottle: 1.0