Rename ThreatPrototype and mark fields as required (#20611)

This commit is contained in:
Leon Friedrich
2023-10-01 07:01:13 +11:00
committed by GitHub
parent 5164107788
commit 3f349eebad
3 changed files with 12 additions and 12 deletions

View File

@@ -64,7 +64,7 @@ public sealed class CommsHackerSystem : SharedCommsHackerSystem
var threats = _proto.Index<WeightedRandomPrototype>(comp.Threats); var threats = _proto.Index<WeightedRandomPrototype>(comp.Threats);
var threat = threats.Pick(_random); var threat = threats.Pick(_random);
CallInThreat(_proto.Index<ThreatPrototype>(threat)); CallInThreat(_proto.Index<NinjaHackingThreatPrototype>(threat));
// prevent calling in multiple threats // prevent calling in multiple threats
RemComp<CommsHackerComponent>(uid); RemComp<CommsHackerComponent>(uid);
@@ -76,10 +76,10 @@ public sealed class CommsHackerSystem : SharedCommsHackerSystem
/// <summary> /// <summary>
/// Makes announcement and adds game rule of the threat. /// Makes announcement and adds game rule of the threat.
/// </summary> /// </summary>
public void CallInThreat(ThreatPrototype threat) public void CallInThreat(NinjaHackingThreatPrototype ninjaHackingThreat)
{ {
_gameTicker.StartGameRule(threat.Rule, out _); _gameTicker.StartGameRule(ninjaHackingThreat.Rule, out _);
_chat.DispatchGlobalAnnouncement(Loc.GetString(threat.Announcement), playSound: true, colorOverride: Color.Red); _chat.DispatchGlobalAnnouncement(Loc.GetString(ninjaHackingThreat.Announcement), playSound: true, colorOverride: Color.Red);
} }
} }

View File

@@ -29,8 +29,8 @@ 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. /// 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? /// You wouldn't do that, right?
/// </summary> /// </summary>
[Prototype("threat")] [Prototype("ninjaHackingThreat")]
public sealed class ThreatPrototype : IPrototype public sealed class NinjaHackingThreatPrototype : IPrototype
{ {
[IdDataField] [IdDataField]
public string ID { get; private set; } = default!; public string ID { get; private set; } = default!;
@@ -38,12 +38,12 @@ public sealed class ThreatPrototype : IPrototype
/// <summary> /// <summary>
/// Locale id for the announcement to be made from CentCom. /// Locale id for the announcement to be made from CentCom.
/// </summary> /// </summary>
[DataField] [DataField(required: true)]
public string Announcement = default!; public LocId Announcement;
/// <summary> /// <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. /// 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> /// </summary>
[DataField] [DataField(required: true)]
public EntProtoId Rule = default!; public EntProtoId Rule;
} }

View File

@@ -5,12 +5,12 @@
Dragon: 1 Dragon: 1
Revenant: 1 Revenant: 1
- type: threat - type: ninjaHackingThreat
id: Dragon id: Dragon
announcement: terror-dragon announcement: terror-dragon
rule: Dragon rule: Dragon
- type: threat - type: ninjaHackingThreat
id: Revenant id: Revenant
announcement: terror-revenant announcement: terror-revenant
rule: RevenantSpawn rule: RevenantSpawn