@@ -1,5 +1,4 @@
|
|||||||
using Content.Server.Cargo.Components;
|
using Content.Server.Cargo.Components;
|
||||||
using Content.Server.Cargo.Systems;
|
|
||||||
using Content.Server.Salvage.Expeditions;
|
using Content.Server.Salvage.Expeditions;
|
||||||
using Content.Server.Salvage.Expeditions.Structure;
|
using Content.Server.Salvage.Expeditions.Structure;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
@@ -20,7 +19,7 @@ public sealed partial class SalvageSystem
|
|||||||
* Handles setup / teardown of salvage expeditions.
|
* Handles setup / teardown of salvage expeditions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private const int MissionLimit = 5;
|
private const int MissionLimit = 3;
|
||||||
|
|
||||||
private readonly JobQueue _salvageQueue = new();
|
private readonly JobQueue _salvageQueue = new();
|
||||||
private readonly List<(SpawnSalvageMissionJob Job, CancellationTokenSource CancelToken)> _salvageJobs = new();
|
private readonly List<(SpawnSalvageMissionJob Job, CancellationTokenSource CancelToken)> _salvageJobs = new();
|
||||||
@@ -225,20 +224,27 @@ public sealed partial class SalvageSystem
|
|||||||
component.Missions.Clear();
|
component.Missions.Clear();
|
||||||
var configs = Enum.GetValues<SalvageMissionType>().ToList();
|
var configs = Enum.GetValues<SalvageMissionType>().ToList();
|
||||||
|
|
||||||
if (configs.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Temporarily removed coz it SUCKS
|
// Temporarily removed coz it SUCKS
|
||||||
configs.Remove(SalvageMissionType.Mining);
|
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<DifficultyRating>();
|
||||||
|
_random.Shuffle(allDifficulties);
|
||||||
|
var difficulties = allDifficulties.Take(MissionLimit).ToList();
|
||||||
|
difficulties.Sort();
|
||||||
|
|
||||||
|
if (configs.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (var i = 0; i < MissionLimit; i++)
|
for (var i = 0; i < MissionLimit; i++)
|
||||||
{
|
{
|
||||||
_random.Shuffle(configs);
|
_random.Shuffle(configs);
|
||||||
var rating = (DifficultyRating) i;
|
var rating = difficulties[i];
|
||||||
|
|
||||||
foreach (var config in configs)
|
foreach (var config in configs)
|
||||||
{
|
{
|
||||||
var mission = new SalvageMissionParams()
|
var mission = new SalvageMissionParams
|
||||||
{
|
{
|
||||||
Index = component.NextIndex,
|
Index = component.NextIndex,
|
||||||
MissionType = config,
|
MissionType = config,
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ public sealed class SalvageTimeMod : IPrototype, ISalvageMod
|
|||||||
/// Cost for difficulty modifiers.
|
/// Cost for difficulty modifiers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("cost")]
|
[DataField("cost")]
|
||||||
public float Cost { get; } = 0f;
|
public float Cost { get; }
|
||||||
|
|
||||||
[DataField("minDuration")]
|
[DataField("minDuration")]
|
||||||
public int MinDuration = 900;
|
public int MinDuration = 630;
|
||||||
|
|
||||||
[DataField("maxDuration")]
|
[DataField("maxDuration")]
|
||||||
public int MaxDuration = 900;
|
public int MaxDuration = 570;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public sealed class SalvageExpeditionDataComponent : Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed record SalvageMissionParams
|
public sealed record SalvageMissionParams : IComparable<SalvageMissionParams>
|
||||||
{
|
{
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public ushort Index;
|
public ushort Index;
|
||||||
@@ -86,6 +86,14 @@ public sealed record SalvageMissionParams
|
|||||||
/// Base difficulty for this mission.
|
/// Base difficulty for this mission.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)] public DifficultyRating Difficulty;
|
[ViewVariables(VVAccess.ReadWrite)] public DifficultyRating Difficulty;
|
||||||
|
|
||||||
|
public int CompareTo(SalvageMissionParams? other)
|
||||||
|
{
|
||||||
|
if (other == null)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return Difficulty.CompareTo(other.Difficulty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public abstract class SharedSalvageSystem : EntitySystem
|
|||||||
|
|
||||||
var time = GetMod<SalvageTimeMod>(rand, ref rating);
|
var time = GetMod<SalvageTimeMod>(rand, ref rating);
|
||||||
// Round the duration to nearest 15 seconds.
|
// 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;
|
exactDuration = MathF.Round(exactDuration / 15f) * 15f;
|
||||||
var duration = TimeSpan.FromSeconds(exactDuration);
|
var duration = TimeSpan.FromSeconds(exactDuration);
|
||||||
|
|
||||||
|
|||||||
@@ -56,3 +56,11 @@
|
|||||||
- type: TechnologyDisk
|
- type: TechnologyDisk
|
||||||
- type: StaticPrice
|
- type: StaticPrice
|
||||||
price: 50
|
price: 50
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
parent: TechnologyDisk
|
||||||
|
id: TechnologyDiskRare
|
||||||
|
suffix: rare.
|
||||||
|
components:
|
||||||
|
- type: TechnologyDisk
|
||||||
|
tierWeightPrototype: RareTechDiskTierWeights
|
||||||
|
|||||||
@@ -37,3 +37,9 @@
|
|||||||
1: 25
|
1: 25
|
||||||
2: 10
|
2: 10
|
||||||
3: 1
|
3: 1
|
||||||
|
|
||||||
|
- type: weightedRandom
|
||||||
|
id: RareTechDiskTierWeights
|
||||||
|
weights:
|
||||||
|
2: 19
|
||||||
|
3: 1
|
||||||
|
|||||||
@@ -75,8 +75,8 @@
|
|||||||
- type: salvageTimeMod
|
- type: salvageTimeMod
|
||||||
id: RushTime
|
id: RushTime
|
||||||
desc: Rush
|
desc: Rush
|
||||||
minDuration: 720
|
minDuration: 420
|
||||||
maxDuration: 780
|
maxDuration: 465
|
||||||
cost: 1
|
cost: 1
|
||||||
|
|
||||||
# Misc mods
|
# Misc mods
|
||||||
|
|||||||
@@ -30,19 +30,22 @@
|
|||||||
SheetUranium: 1.0
|
SheetUranium: 1.0
|
||||||
CratePartsT3: 1.0
|
CratePartsT3: 1.0
|
||||||
CratePartsT3T4: 0.5
|
CratePartsT3T4: 0.5
|
||||||
|
TechnologyDiskRare: 0.5
|
||||||
# cloning boards
|
# cloning boards
|
||||||
CloningPodMachineCircuitboard: 0.5
|
CloningPodMachineCircuitboard: 0.5
|
||||||
MedicalScannerMachineCircuitboard: 0.5
|
MedicalScannerMachineCircuitboard: 0.5
|
||||||
CloningConsoleComputerCircuitboard: 0.5
|
CloningConsoleComputerCircuitboard: 0.5
|
||||||
BiomassReclaimerMachineCircuitboard: 0.5
|
BiomassReclaimerMachineCircuitboard: 0.5
|
||||||
# basic weapons
|
# basic weapons
|
||||||
CrateArmorySMG: 0.25
|
Katana: 0.25
|
||||||
CrateArmoryLaser: 0.25
|
KukriKnife: 0.25
|
||||||
WeaponMakeshiftLaser: 0.25
|
WeaponLaserGun: 0.25
|
||||||
|
MakeshiftShield: 0.25
|
||||||
# rare armor
|
# rare armor
|
||||||
ClothingHeadHelmetSwat: 0.1
|
ClothingHeadHelmetSwat: 0.25
|
||||||
|
ClothingOuterArmorBasicSlim: 0.25
|
||||||
# rare weapons
|
# rare weapons
|
||||||
WeaponSubMachineGunC20r: 0.1
|
WeaponMakeshiftLaser: 0.1
|
||||||
# money
|
# money
|
||||||
SpaceCash500: 1.0
|
SpaceCash500: 1.0
|
||||||
SpaceCash1000: 0.75
|
SpaceCash1000: 0.75
|
||||||
@@ -55,11 +58,12 @@
|
|||||||
ResearchAndDevelopmentServerMachineCircuitboard: 1.0
|
ResearchAndDevelopmentServerMachineCircuitboard: 1.0
|
||||||
CratePartsT4: 1.0
|
CratePartsT4: 1.0
|
||||||
PowerCellAntiqueProto: 0.25
|
PowerCellAntiqueProto: 0.25
|
||||||
# rare weapons
|
# basic weapons
|
||||||
WeaponAdvancedLaser: 1.0
|
CrateArmorySMG: 1.0
|
||||||
WeaponLaserCannon: 1.0
|
CrateArmoryLaser: 1.0
|
||||||
WeaponXrayCannon: 1.0
|
CrateArmoryShotgun: 1.0
|
||||||
WeaponSniperHristov: 1.0
|
# rare armor
|
||||||
|
ClothingOuterArmorRiot: 1.0
|
||||||
# rare chemicals
|
# rare chemicals
|
||||||
CognizineChemistryBottle: 1.0
|
CognizineChemistryBottle: 1.0
|
||||||
OmnizineChemistryBottle: 1.0
|
OmnizineChemistryBottle: 1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user