]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix component constraints (#20241)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Wed, 20 Sep 2023 00:12:48 +0000 (10:12 +1000)
committerGitHub <noreply@github.com>
Wed, 20 Sep 2023 00:12:48 +0000 (10:12 +1000)
15 files changed:
Content.Client/Damage/DamageVisualsSystem.cs
Content.Server/Botany/Systems/PlantHolderSystem.cs
Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs
Content.Server/Construction/ConstructionSystem.Machine.cs
Content.Server/Construction/MachineFrameSystem.cs
Content.Server/Construction/RefiningSystem.cs
Content.Server/DeviceLinking/Systems/DeviceLinkSystem.cs
Content.Server/Explosion/EntitySystems/TriggerSystem.cs
Content.Server/Light/EntitySystems/ExpendableLightSystem.cs
Content.Server/Physics/Controllers/PullController.cs
Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs
Content.Server/Tools/ToolSystem.TilePrying.cs
Content.Server/VendingMachines/VendingMachineSystem.cs
Content.Shared/Cuffs/SharedCuffableSystem.cs
Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs

index 111ee2ddb5361200c2759d21ee58f2183ff688c2..718d4731823a0df57d362beee2a2aee46ea067b5 100644 (file)
@@ -135,7 +135,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem<DamageVisualsComponen
     private void InitializeVisualizer(EntityUid entity, DamageVisualsComponent damageVisComp)
     {
         if (!TryComp(entity, out SpriteComponent? spriteComponent)
-            || !TryComp<DamageableComponent?>(entity, out var damageComponent)
+            || !TryComp<DamageableComponent>(entity, out var damageComponent)
             || !HasComp<AppearanceComponent>(entity))
             return;
 
index b5f9335b5d8b1a45b1c4cfd731e26afc811746d3..586fa9c2b0dbedd7c05df1f939f6b4378979a928 100644 (file)
@@ -278,7 +278,7 @@ public sealed class PlantHolderSystem : EntitySystem
         if (HasComp<SharpComponent>(args.Used))
             DoHarvest(uid, args.User, component);
 
-        if (TryComp<ProduceComponent?>(args.Used, out var produce))
+        if (TryComp<ProduceComponent>(args.Used, out var produce))
         {
             _popup.PopupCursor(Loc.GetString("plant-holder-component-compost-message",
                 ("owner", uid),
index c9ae2f6c802814a6045fbc7bb435b9009621e279..9f7acce4fd2ac528b0281a55147ecc1d1786086a 100644 (file)
@@ -44,7 +44,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         [NotNullWhen(true)] out T? program,
         bool installedOnly = false,
         CartridgeLoaderComponent? loader = null,
-        ContainerManagerComponent? containerManager = null)
+        ContainerManagerComponent? containerManager = null) where T : IComponent
     {
         program = default;
         programUid = null;
@@ -76,7 +76,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         [NotNullWhen(true)] out EntityUid? programUid,
         bool installedOnly = false,
         CartridgeLoaderComponent? loader = null,
-        ContainerManagerComponent? containerManager = null)
+        ContainerManagerComponent? containerManager = null) where T : IComponent
     {
         return TryGetProgram<T>(uid, out programUid, out _, installedOnly, loader, containerManager);
     }
@@ -85,7 +85,7 @@ public sealed class CartridgeLoaderSystem : SharedCartridgeLoaderSystem
         EntityUid uid,
         bool installedOnly = false,
         CartridgeLoaderComponent? loader = null,
-        ContainerManagerComponent? containerManager = null)
+        ContainerManagerComponent? containerManager = null) where T : IComponent
     {
         return TryGetProgram<T>(uid, out _, out _, installedOnly, loader, containerManager);
     }
index 62abe9e567e05736f23108d38a0cf1a8da3afc56..a6472c38d15eafb1f422eebd32cc6d669af55c3f 100644 (file)
@@ -74,7 +74,7 @@ public sealed partial class ConstructionSystem
 
         foreach (var entity in component.PartContainer.ContainedEntities)
         {
-            if (TryComp<MachinePartComponent?>(entity, out var machinePart))
+            if (TryComp<MachinePartComponent>(entity, out var machinePart))
                 parts.Add(machinePart);
         }
 
@@ -130,7 +130,7 @@ public sealed partial class ConstructionSystem
             throw new Exception($"Couldn't insert board with prototype {component.BoardPrototype} to machine with prototype {MetaData(uid).EntityPrototype?.ID ?? "N/A"}!");
         }
 
-        if (!TryComp<MachineBoardComponent?>(board, out var machineBoard))
+        if (!TryComp<MachineBoardComponent>(board, out var machineBoard))
         {
             throw new Exception($"Entity with prototype {component.BoardPrototype} doesn't have a {nameof(MachineBoardComponent)}!");
         }
index 82d998e50fcf9208c053aaddc391fd32d97495d3..a033b39d203ed4284b858072d193eba026ebe143 100644 (file)
@@ -75,7 +75,7 @@ public sealed class MachineFrameSystem : EntitySystem
         }
 
         // Handle stacks
-        if (TryComp<StackComponent?>(args.Used, out var stack))
+        if (TryComp<StackComponent>(args.Used, out var stack))
         {
             if (TryInsertStack(uid, args.Used, component, stack))
                 args.Handled = true;
@@ -150,7 +150,7 @@ public sealed class MachineFrameSystem : EntitySystem
     /// <returns>Whether or not the function had any effect. Does not indicate success.</returns>
     private bool TryInsertBoard(EntityUid uid, EntityUid used, MachineFrameComponent component)
     {
-        if (!TryComp<MachineBoardComponent?>(used, out var machineBoard))
+        if (!TryComp<MachineBoardComponent>(used, out var machineBoard))
             return false;
 
         if (!_container.TryRemoveFromContainer(used))
index dacc4c20bc92ce2fb03ebe2dc10fef1b6970e0ce..40f69c51f817f88e62aefaac506a36bbc6b2aac3 100644 (file)
@@ -44,7 +44,7 @@ namespace Content.Server.Construction
 
                 // TODO: If something has a stack... Just use a prototype with a single thing in the stack.
                 // This is not a good way to do it.
-                if (TryComp<StackComponent?>(droppedEnt, out var stack))
+                if (TryComp<StackComponent>(droppedEnt, out var stack))
                     _stackSystem.SetCount(droppedEnt, 1, stack);
             }
         }
index 76f1d55a6b1d00eecaa78fd28dec54d60cb1116c..47f632843d3bf5438727465f560a060381e0fb13 100644 (file)
@@ -73,7 +73,7 @@ public sealed class DeviceLinkSystem : SharedDeviceLinkSystem
                 sinkComponent.InvokeCounter++;
 
                 //Just skip using device networking if the source or the sink doesn't support it
-                if (!HasComp<DeviceNetworkComponent>(uid) || !TryComp<DeviceNetworkComponent?>(sinkUid, out var sinkNetworkComponent))
+                if (!HasComp<DeviceNetworkComponent>(uid) || !TryComp<DeviceNetworkComponent>(sinkUid, out var sinkNetworkComponent))
                 {
                     var eventArgs = new SignalReceivedEvent(sink, uid);
 
index 569417f1414174e311a7d391e6df4f545cc25b3f..b3027523f6155523f4dbf53c89e443e2447bd962 100644 (file)
@@ -154,7 +154,7 @@ namespace Content.Server.Explosion.EntitySystems
 
         private void HandleRattleTrigger(EntityUid uid, RattleComponent component, TriggerEvent args)
         {
-            if (!TryComp<SubdermalImplantComponent?>(uid, out var implanted))
+            if (!TryComp<SubdermalImplantComponent>(uid, out var implanted))
                 return;
 
             if (implanted.ImplantedEntity == null)
index ff6393fe5a3d4b3cb8d3667ca1fd51180b44aa63..29f5dd7f41d0ad869eaea47d146386231e94ffba 100644 (file)
@@ -154,7 +154,7 @@ namespace Content.Server.Light.EntitySystems
 
         private void OnExpLightInit(EntityUid uid, ExpendableLightComponent component, ComponentInit args)
         {
-            if (TryComp<ItemComponent?>(uid, out var item))
+            if (TryComp<ItemComponent>(uid, out var item))
             {
                 _item.SetHeldPrefix(uid, "unlit", item);
             }
index 868c6eb82cc5c3ffe27a379a8112d335e451559c..abe4d42bf6790adf1a1e0a558ef6ece2946d3e40 100644 (file)
@@ -152,7 +152,7 @@ namespace Content.Server.Physics.Controllers
                     continue;
                 }
 
-                if (!TryComp<PhysicsComponent?>(pullableEnt, out var physics) ||
+                if (!TryComp<PhysicsComponent>(pullableEnt, out var physics) ||
                     physics.BodyType == BodyType.Static ||
                     movingTo.MapId != pullableXform.MapID)
                 {
index a0621ef63defa450dcdd52fb10761ba252c2228b..171f27752f9d2b5cf3db6b03476559ae97a67e50 100644 (file)
@@ -250,7 +250,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
 
         var ent = closestResult.Value.HitEntity;
 
-        if (!TryComp<ContainmentFieldGeneratorComponent?>(ent, out var otherFieldGeneratorComponent) ||
+        if (!TryComp<ContainmentFieldGeneratorComponent>(ent, out var otherFieldGeneratorComponent) ||
             otherFieldGeneratorComponent == component ||
             !TryComp<PhysicsComponent>(ent, out var collidableComponent) ||
             collidableComponent.BodyType != BodyType.Static ||
index 614d6b873406a0946120da4409d08146dc6255a5..faaed6abb87e51f3234b6393a65e8a1b31bc4286 100644 (file)
@@ -57,7 +57,7 @@ public sealed partial class ToolSystem
 
     private bool TryPryTile(EntityUid toolEntity, EntityUid user, TilePryingComponent component, EntityCoordinates clickLocation)
     {
-        if (!TryComp<ToolComponent?>(toolEntity, out var tool) && component.ToolComponentNeeded)
+        if (!TryComp<ToolComponent>(toolEntity, out var tool) && component.ToolComponentNeeded)
             return false;
 
         if (!_mapManager.TryFindGridAt(clickLocation.ToMap(EntityManager, _transformSystem), out _, out var mapGrid))
index 38576b8951ae7901b9bb8310e4530babf2e61afb..aecc1442e3d82a10316c24652185ecf89ab8b5d8 100644 (file)
@@ -223,7 +223,7 @@ namespace Content.Server.VendingMachines
             if (!Resolve(uid, ref vendComponent))
                 return false;
 
-            if (!TryComp<AccessReaderComponent?>(uid, out var accessReader))
+            if (!TryComp<AccessReaderComponent>(uid, out var accessReader))
                 return true;
 
             if (_accessReader.IsAllowed(sender, uid, accessReader) || HasComp<EmaggedComponent>(uid))
index 9294083a44441f5ad83e7f7f5dcb86025e484cc2..d64e15799dcc40288d975a6af989c1da7a8eff84 100644 (file)
@@ -451,7 +451,7 @@ namespace Content.Shared.Cuffs
             if (!Resolve(handcuff, ref handcuffComponent) || !Resolve(target, ref cuffable, false))
                 return false;
 
-            if (!TryComp<HandsComponent?>(target, out var hands))
+            if (!TryComp<HandsComponent>(target, out var hands))
             {
                 if (_net.IsServer)
                 {
index 2f071fd36423f1b7cad3abccdecbbb4eadadd354..02c0f608532f0a245ea0870b67148b5212d376cb 100644 (file)
@@ -49,7 +49,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem
         List<EntityUid> invalidSinks = new();
         foreach (var sinkUid  in sourceComponent.LinkedPorts.Keys)
         {
-            if (!TryComp<DeviceLinkSinkComponent?>(sinkUid, out var sinkComponent))
+            if (!TryComp<DeviceLinkSinkComponent>(sinkUid, out var sinkComponent))
             {
                 invalidSinks.Add(sinkUid);
                 foreach (var savedSinks in sourceComponent.Outputs.Values)