use weighted random for ninja threats (#20469)
* change threats to be weighted random and a little cleanup * ninja rule stores weighted random id for threats * move threats out of the rule and into weighted random --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Content.Shared.Random;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Communications;
|
||||
|
||||
@@ -15,14 +14,14 @@ public sealed partial class CommsHackerComponent : Component
|
||||
/// <summary>
|
||||
/// Time taken to hack the console
|
||||
/// </summary>
|
||||
[DataField("delay")]
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan Delay = TimeSpan.FromSeconds(20);
|
||||
|
||||
/// <summary>
|
||||
/// Possible threats to choose from.
|
||||
/// Weighted random for the possible threats to choose from.
|
||||
/// </summary>
|
||||
[DataField("threats", required: true)]
|
||||
public List<Threat> Threats = new();
|
||||
[DataField(required: true)]
|
||||
public ProtoId<WeightedRandomPrototype> Threats = string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -30,18 +29,21 @@ public sealed partial class CommsHackerComponent : Component
|
||||
/// Generally some kind of mid-round minor antag, though you could make it call in scrubber backflow if you wanted to.
|
||||
/// You wouldn't do that, right?
|
||||
/// </summary>
|
||||
[DataDefinition]
|
||||
public sealed partial class Threat
|
||||
[Prototype("threat")]
|
||||
public sealed class ThreatPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Locale id for the announcement to be made from CentCom.
|
||||
/// </summary>
|
||||
[DataField("announcement")]
|
||||
[DataField]
|
||||
public string Announcement = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The game rule for the threat to be added, it should be able to work when added mid-round otherwise this will do nothing.
|
||||
/// </summary>
|
||||
[DataField("rule", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string Rule = default!;
|
||||
[DataField]
|
||||
public EntProtoId Rule = default!;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user