Fix component constraints (#20241)

This commit is contained in:
metalgearsloth
2023-09-20 10:12:48 +10:00
committed by GitHub
parent d01a0e497d
commit 9f9577acd0
15 changed files with 19 additions and 19 deletions

View 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;

View 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),

View 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);
}

View 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)}!");
}

View 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))

View 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);
}
}

View 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);

View 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)

View 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);
}

View 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)
{

View 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 ||

View 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))

View 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))

View 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)
{

View 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)