From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Wed, 20 Sep 2023 00:12:48 +0000 (+1000) Subject: Fix component constraints (#20241) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=9f9577acd0ec3b242d556e2aa33318587bf3b275;p=space-station-14.git Fix component constraints (#20241) --- diff --git a/Content.Client/Damage/DamageVisualsSystem.cs b/Content.Client/Damage/DamageVisualsSystem.cs index 111ee2ddb5..718d473182 100644 --- a/Content.Client/Damage/DamageVisualsSystem.cs +++ b/Content.Client/Damage/DamageVisualsSystem.cs @@ -135,7 +135,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem(entity, out var damageComponent) + || !TryComp(entity, out var damageComponent) || !HasComp(entity)) return; diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index b5f9335b5d..586fa9c2b0 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -278,7 +278,7 @@ public sealed class PlantHolderSystem : EntitySystem if (HasComp(args.Used)) DoHarvest(uid, args.User, component); - if (TryComp(args.Used, out var produce)) + if (TryComp(args.Used, out var produce)) { _popup.PopupCursor(Loc.GetString("plant-holder-component-compost-message", ("owner", uid), diff --git a/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs b/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs index c9ae2f6c80..9f7acce4fd 100644 --- a/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs +++ b/Content.Server/CartridgeLoader/CartridgeLoaderSystem.cs @@ -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(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(uid, out _, out _, installedOnly, loader, containerManager); } diff --git a/Content.Server/Construction/ConstructionSystem.Machine.cs b/Content.Server/Construction/ConstructionSystem.Machine.cs index 62abe9e567..a6472c38d1 100644 --- a/Content.Server/Construction/ConstructionSystem.Machine.cs +++ b/Content.Server/Construction/ConstructionSystem.Machine.cs @@ -74,7 +74,7 @@ public sealed partial class ConstructionSystem foreach (var entity in component.PartContainer.ContainedEntities) { - if (TryComp(entity, out var machinePart)) + if (TryComp(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(board, out var machineBoard)) + if (!TryComp(board, out var machineBoard)) { throw new Exception($"Entity with prototype {component.BoardPrototype} doesn't have a {nameof(MachineBoardComponent)}!"); } diff --git a/Content.Server/Construction/MachineFrameSystem.cs b/Content.Server/Construction/MachineFrameSystem.cs index 82d998e50f..a033b39d20 100644 --- a/Content.Server/Construction/MachineFrameSystem.cs +++ b/Content.Server/Construction/MachineFrameSystem.cs @@ -75,7 +75,7 @@ public sealed class MachineFrameSystem : EntitySystem } // Handle stacks - if (TryComp(args.Used, out var stack)) + if (TryComp(args.Used, out var stack)) { if (TryInsertStack(uid, args.Used, component, stack)) args.Handled = true; @@ -150,7 +150,7 @@ public sealed class MachineFrameSystem : EntitySystem /// Whether or not the function had any effect. Does not indicate success. private bool TryInsertBoard(EntityUid uid, EntityUid used, MachineFrameComponent component) { - if (!TryComp(used, out var machineBoard)) + if (!TryComp(used, out var machineBoard)) return false; if (!_container.TryRemoveFromContainer(used)) diff --git a/Content.Server/Construction/RefiningSystem.cs b/Content.Server/Construction/RefiningSystem.cs index dacc4c20bc..40f69c51f8 100644 --- a/Content.Server/Construction/RefiningSystem.cs +++ b/Content.Server/Construction/RefiningSystem.cs @@ -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(droppedEnt, out var stack)) + if (TryComp(droppedEnt, out var stack)) _stackSystem.SetCount(droppedEnt, 1, stack); } } diff --git a/Content.Server/DeviceLinking/Systems/DeviceLinkSystem.cs b/Content.Server/DeviceLinking/Systems/DeviceLinkSystem.cs index 76f1d55a6b..47f632843d 100644 --- a/Content.Server/DeviceLinking/Systems/DeviceLinkSystem.cs +++ b/Content.Server/DeviceLinking/Systems/DeviceLinkSystem.cs @@ -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(uid) || !TryComp(sinkUid, out var sinkNetworkComponent)) + if (!HasComp(uid) || !TryComp(sinkUid, out var sinkNetworkComponent)) { var eventArgs = new SignalReceivedEvent(sink, uid); diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 569417f141..b3027523f6 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -154,7 +154,7 @@ namespace Content.Server.Explosion.EntitySystems private void HandleRattleTrigger(EntityUid uid, RattleComponent component, TriggerEvent args) { - if (!TryComp(uid, out var implanted)) + if (!TryComp(uid, out var implanted)) return; if (implanted.ImplantedEntity == null) diff --git a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs index ff6393fe5a..29f5dd7f41 100644 --- a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs +++ b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs @@ -154,7 +154,7 @@ namespace Content.Server.Light.EntitySystems private void OnExpLightInit(EntityUid uid, ExpendableLightComponent component, ComponentInit args) { - if (TryComp(uid, out var item)) + if (TryComp(uid, out var item)) { _item.SetHeldPrefix(uid, "unlit", item); } diff --git a/Content.Server/Physics/Controllers/PullController.cs b/Content.Server/Physics/Controllers/PullController.cs index 868c6eb82c..abe4d42bf6 100644 --- a/Content.Server/Physics/Controllers/PullController.cs +++ b/Content.Server/Physics/Controllers/PullController.cs @@ -152,7 +152,7 @@ namespace Content.Server.Physics.Controllers continue; } - if (!TryComp(pullableEnt, out var physics) || + if (!TryComp(pullableEnt, out var physics) || physics.BodyType == BodyType.Static || movingTo.MapId != pullableXform.MapID) { diff --git a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs index a0621ef63d..171f27752f 100644 --- a/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/ContainmentFieldGeneratorSystem.cs @@ -250,7 +250,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem var ent = closestResult.Value.HitEntity; - if (!TryComp(ent, out var otherFieldGeneratorComponent) || + if (!TryComp(ent, out var otherFieldGeneratorComponent) || otherFieldGeneratorComponent == component || !TryComp(ent, out var collidableComponent) || collidableComponent.BodyType != BodyType.Static || diff --git a/Content.Server/Tools/ToolSystem.TilePrying.cs b/Content.Server/Tools/ToolSystem.TilePrying.cs index 614d6b8734..faaed6abb8 100644 --- a/Content.Server/Tools/ToolSystem.TilePrying.cs +++ b/Content.Server/Tools/ToolSystem.TilePrying.cs @@ -57,7 +57,7 @@ public sealed partial class ToolSystem private bool TryPryTile(EntityUid toolEntity, EntityUid user, TilePryingComponent component, EntityCoordinates clickLocation) { - if (!TryComp(toolEntity, out var tool) && component.ToolComponentNeeded) + if (!TryComp(toolEntity, out var tool) && component.ToolComponentNeeded) return false; if (!_mapManager.TryFindGridAt(clickLocation.ToMap(EntityManager, _transformSystem), out _, out var mapGrid)) diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 38576b8951..aecc1442e3 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -223,7 +223,7 @@ namespace Content.Server.VendingMachines if (!Resolve(uid, ref vendComponent)) return false; - if (!TryComp(uid, out var accessReader)) + if (!TryComp(uid, out var accessReader)) return true; if (_accessReader.IsAllowed(sender, uid, accessReader) || HasComp(uid)) diff --git a/Content.Shared/Cuffs/SharedCuffableSystem.cs b/Content.Shared/Cuffs/SharedCuffableSystem.cs index 9294083a44..d64e15799d 100644 --- a/Content.Shared/Cuffs/SharedCuffableSystem.cs +++ b/Content.Shared/Cuffs/SharedCuffableSystem.cs @@ -451,7 +451,7 @@ namespace Content.Shared.Cuffs if (!Resolve(handcuff, ref handcuffComponent) || !Resolve(target, ref cuffable, false)) return false; - if (!TryComp(target, out var hands)) + if (!TryComp(target, out var hands)) { if (_net.IsServer) { diff --git a/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs b/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs index 2f071fd364..02c0f60853 100644 --- a/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs +++ b/Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs @@ -49,7 +49,7 @@ public abstract class SharedDeviceLinkSystem : EntitySystem List invalidSinks = new(); foreach (var sinkUid in sourceComponent.LinkedPorts.Keys) { - if (!TryComp(sinkUid, out var sinkComponent)) + if (!TryComp(sinkUid, out var sinkComponent)) { invalidSinks.Add(sinkUid); foreach (var savedSinks in sourceComponent.Outputs.Values)