@@ -13,11 +13,11 @@ public sealed class SalvageTimeMod : IPrototype, ISalvageMod
|
||||
/// Cost for difficulty modifiers.
|
||||
/// </summary>
|
||||
[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;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public sealed class SalvageExpeditionDataComponent : Component
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed record SalvageMissionParams
|
||||
public sealed record SalvageMissionParams : IComparable<SalvageMissionParams>
|
||||
{
|
||||
[ViewVariables]
|
||||
public ushort Index;
|
||||
@@ -86,6 +86,14 @@ public sealed record SalvageMissionParams
|
||||
/// Base difficulty for this mission.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)] public DifficultyRating Difficulty;
|
||||
|
||||
public int CompareTo(SalvageMissionParams? other)
|
||||
{
|
||||
if (other == null)
|
||||
return -1;
|
||||
|
||||
return Difficulty.CompareTo(other.Difficulty);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -121,7 +121,7 @@ public abstract class SharedSalvageSystem : EntitySystem
|
||||
|
||||
var time = GetMod<SalvageTimeMod>(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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user