]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Rename ThreatPrototype and mark fields as required (#20611)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sat, 30 Sep 2023 20:01:13 +0000 (07:01 +1100)
committerGitHub <noreply@github.com>
Sat, 30 Sep 2023 20:01:13 +0000 (13:01 -0700)
Content.Server/Communications/CommsHackerSystem.cs
Content.Shared/Communications/CommsHackerComponent.cs
Resources/Prototypes/threats.yml

index 851be07454fb4d40f7d8f79f9ae9b693d42e755b..1248d214003c8596bec211d252c03dc0f5396f58 100644 (file)
@@ -64,7 +64,7 @@ public sealed class CommsHackerSystem : SharedCommsHackerSystem
 
         var threats = _proto.Index<WeightedRandomPrototype>(comp.Threats);
         var threat = threats.Pick(_random);
-        CallInThreat(_proto.Index<ThreatPrototype>(threat));
+        CallInThreat(_proto.Index<NinjaHackingThreatPrototype>(threat));
 
         // prevent calling in multiple threats
         RemComp<CommsHackerComponent>(uid);
@@ -76,10 +76,10 @@ public sealed class CommsHackerSystem : SharedCommsHackerSystem
     /// <summary>
     /// Makes announcement and adds game rule of the threat.
     /// </summary>
-    public void CallInThreat(ThreatPrototype threat)
+    public void CallInThreat(NinjaHackingThreatPrototype ninjaHackingThreat)
     {
-        _gameTicker.StartGameRule(threat.Rule, out _);
-        _chat.DispatchGlobalAnnouncement(Loc.GetString(threat.Announcement), playSound: true, colorOverride: Color.Red);
+        _gameTicker.StartGameRule(ninjaHackingThreat.Rule, out _);
+        _chat.DispatchGlobalAnnouncement(Loc.GetString(ninjaHackingThreat.Announcement), playSound: true, colorOverride: Color.Red);
     }
 }
 
index fdd1876c1d769713be9d7ed2250db01a4e8fbd52..810058f1ce57bdaf87e99b359a57fc2e355702f8 100644 (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.
 /// You wouldn't do that, right?
 /// </summary>
-[Prototype("threat")]
-public sealed class ThreatPrototype : IPrototype
+[Prototype("ninjaHackingThreat")]
+public sealed class NinjaHackingThreatPrototype : IPrototype
 {
     [IdDataField]
     public string ID { get; private set; } = default!;
@@ -38,12 +38,12 @@ public sealed class ThreatPrototype : IPrototype
     /// <summary>
     /// Locale id for the announcement to be made from CentCom.
     /// </summary>
-    [DataField]
-    public string Announcement = default!;
+    [DataField(required: true)]
+    public LocId Announcement;
 
     /// <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]
-    public EntProtoId Rule = default!;
+    [DataField(required: true)]
+    public EntProtoId Rule;
 }
index 6e21cc1037decf40a2ee2145261112ab1a42b40e..cb20ce19d97e83caf398b48e7e262eae9f163d48 100644 (file)
@@ -5,12 +5,12 @@
     Dragon: 1
     Revenant: 1
 
-- type: threat
+- type: ninjaHackingThreat
   id: Dragon
   announcement: terror-dragon
   rule: Dragon
 
-- type: threat
+- type: ninjaHackingThreat
   id: Revenant
   announcement: terror-revenant
   rule: RevenantSpawn