Chill bounties + fixes (#23411)
* Chill bounties + fixes * localize * fix arbitage
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Robust.Shared.Serialization;
|
||||
using Content.Shared.Cargo.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Cargo;
|
||||
|
||||
@@ -9,28 +8,24 @@ namespace Content.Shared.Cargo;
|
||||
/// A data structure for storing currently available bounties.
|
||||
/// </summary>
|
||||
[DataDefinition, NetSerializable, Serializable]
|
||||
public readonly partial record struct CargoBountyData(int Id, string Bounty, TimeSpan EndTime)
|
||||
public readonly partial record struct CargoBountyData
|
||||
{
|
||||
/// <summary>
|
||||
/// A numeric id used to identify the bounty
|
||||
/// A unique id used to identify the bounty
|
||||
/// </summary>
|
||||
[DataField("id"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public int Id { get; init; } = Id;
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string Id { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The prototype containing information about the bounty.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("bounty", customTypeSerializer: typeof(PrototypeIdSerializer<CargoBountyPrototype>), required:true)]
|
||||
public string Bounty { get; init; } = Bounty;
|
||||
[DataField(required: true)]
|
||||
public ProtoId<CargoBountyPrototype> Bounty { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The time at which the bounty is closed and no longer is available.
|
||||
/// </summary>
|
||||
[DataField("endTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan EndTime { get; init; } = EndTime;
|
||||
|
||||
public CargoBountyData() : this(default, string.Empty, default)
|
||||
public CargoBountyData(CargoBountyPrototype bounty, int uniqueIdentifier)
|
||||
{
|
||||
Bounty = bounty.ID;
|
||||
Id = $"{bounty.IdPrefix}{uniqueIdentifier:D3}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user