]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
minor MindShieldSystem cleanup (#35905)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Thu, 17 Apr 2025 11:38:53 +0000 (13:38 +0200)
committerGitHub <noreply@github.com>
Thu, 17 Apr 2025 11:38:53 +0000 (21:38 +1000)
clean up MindShieldSystem

Content.Server/Mindshield/MindShieldSystem.cs
Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml
Resources/Prototypes/tags.yml

index 63d6bf097e68e12aab715ae87d7995ebe447e597..89ae090acdb82ba495173cad48e4760459bc1845 100644 (file)
@@ -4,51 +4,44 @@ using Content.Server.Popups;
 using Content.Server.Roles;
 using Content.Shared.Database;
 using Content.Shared.Implants;
-using Content.Shared.Implants.Components;
 using Content.Shared.Mindshield.Components;
 using Content.Shared.Revolutionary.Components;
-using Content.Shared.Tag;
 using Robust.Shared.Containers;
 
 namespace Content.Server.Mindshield;
 
 /// <summary>
-/// System used for checking if the implanted is a Rev or Head Rev.
+/// System used for adding or removing components with a mindshield implant
+/// as well as checking if the implanted is a Rev or Head Rev.
 /// </summary>
 public sealed class MindShieldSystem : EntitySystem
 {
     [Dependency] private readonly IAdminLogManager _adminLogManager = default!;
     [Dependency] private readonly RoleSystem _roleSystem = default!;
     [Dependency] private readonly MindSystem _mindSystem = default!;
-    [Dependency] private readonly TagSystem _tag = default!;
     [Dependency] private readonly PopupSystem _popupSystem = default!;
 
-    [ValidatePrototypeId<TagPrototype>]
-    public const string MindShieldTag = "MindShield";
-
     public override void Initialize()
     {
         base.Initialize();
-        SubscribeLocalEvent<SubdermalImplantComponent, ImplantImplantedEvent>(ImplantCheck);
+
+        SubscribeLocalEvent<MindShieldImplantComponent, ImplantImplantedEvent>(OnImplantImplanted);
         SubscribeLocalEvent<MindShieldImplantComponent, EntGotRemovedFromContainerMessage>(OnImplantDraw);
     }
 
-    /// <summary>
-    /// Checks if the implant was a mindshield or not
-    /// </summary>
-    public void ImplantCheck(EntityUid uid, SubdermalImplantComponent comp, ref ImplantImplantedEvent ev)
+    private void OnImplantImplanted(Entity<MindShieldImplantComponent> ent, ref ImplantImplantedEvent ev)
     {
-        if (_tag.HasTag(ev.Implant, MindShieldTag) && ev.Implanted != null)
-        {
-            EnsureComp<MindShieldComponent>(ev.Implanted.Value);
-            MindShieldRemovalCheck(ev.Implanted.Value, ev.Implant);
-        }
+        if (ev.Implanted == null)
+            return;
+
+        EnsureComp<MindShieldComponent>(ev.Implanted.Value);
+        MindShieldRemovalCheck(ev.Implanted.Value, ev.Implant);
     }
 
     /// <summary>
     /// Checks if the implanted person was a Rev or Head Rev and remove role or destroy mindshield respectively.
     /// </summary>
-    public void MindShieldRemovalCheck(EntityUid implanted, EntityUid implant)
+    private void MindShieldRemovalCheck(EntityUid implanted, EntityUid implant)
     {
         if (HasComp<HeadRevolutionaryComponent>(implanted))
         {
index e071a94988b6de84a4b25162cd9e6ab64174ff78..13b906bbd7f5f931c3e2ca6c446d8e5d8daca3c9 100644 (file)
   components:
    - type: SubdermalImplant
    - type: MindShieldImplant
-   - type: Tag
-     tags:
-       - MindShield
 
 # Centcomm implants
 
index be6746141d812d6bfb2c4c95e443d3e269f17653..bd3644d53c7b2fd558ff2e330165d965275db74b 100644 (file)
 - type: Tag
   id: MimeHappyHonk
 
-- type: Tag
-  id: MindShield
-
 - type: Tag
   id: MindTransferTarget