Fix 3000 errors

This commit is contained in:
DrSmugleaf
2021-12-05 18:09:01 +01:00
parent 2bfec7ec62
commit 2a3b7d809d
569 changed files with 2979 additions and 3280 deletions

View File

@@ -1,15 +1,11 @@
using System;
using Content.Shared.Physics.Pull;
using Robust.Shared.Analyzers;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics.Joints;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
namespace Content.Shared.Pulling.Components
@@ -28,14 +24,14 @@ namespace Content.Shared.Pulling.Components
/// The current entity pulling this component.
/// SharedPullingStateManagementSystem should be writing this. This means definitely not you.
/// </summary>
public EntityUid? Puller { get; set; }
public EntityUid Puller { get; set; }
/// <summary>
/// The pull joint.
/// SharedPullingStateManagementSystem should be writing this. This means probably not you.
/// </summary>
public DistanceJoint? PullJoint { get; set; }
public bool BeingPulled => Puller != null;
public bool BeingPulled => Puller != default;
public EntityCoordinates? MovingTo { get; set; }
@@ -53,25 +49,25 @@ namespace Content.Shared.Pulling.Components
return;
}
if (state.Puller == null)
if (!state.Puller.HasValue)
{
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceDisconnectPullable(this);
return;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetEntity(state.Puller.Value, out var entity))
if (!state.Puller.Value.IsValid())
{
Logger.Error($"Invalid entity {state.Puller.Value} for pulling");
return;
}
if (Puller == entity)
if (Puller == state.Puller)
{
// don't disconnect and reconnect a puller for no reason
return;
}
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullerComponent?>(entity.Value, out var comp))
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullerComponent?>(state.Puller.Value, out var comp))
{
Logger.Error($"Entity {state.Puller.Value} for pulling had no Puller component");
// ensure it disconnects from any different puller, still
@@ -90,7 +86,7 @@ namespace Content.Shared.Pulling.Components
protected override void OnRemove()
{
if (Puller != null)
if (Puller != default)
{
// This is absolute paranoia but it's also absolutely necessary. Too many puller state bugs. - 20kdc
Logger.ErrorS("c.go.c.pulling", "PULLING STATE CORRUPTION IMMINENT IN PULLABLE {0} - OnRemove called when Puller is set!", Owner);

View File

@@ -1,10 +1,7 @@
using Content.Shared.Pulling;
using Content.Shared.Movement.Components;
using Robust.Shared.Analyzers;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.ViewVariables;
using Robust.Shared.Log;
using Component = Robust.Shared.GameObjects.Component;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Pulling.Components
{
@@ -15,12 +12,12 @@ namespace Content.Shared.Pulling.Components
public override string Name => "Puller";
// Before changing how this is updated, please see SharedPullerSystem.RefreshMovementSpeed
public float WalkSpeedModifier => Pulling == null ? 1.0f : 0.75f;
public float WalkSpeedModifier => Pulling == default ? 1.0f : 0.75f;
public float SprintSpeedModifier => Pulling == null ? 1.0f : 0.75f;
public float SprintSpeedModifier => Pulling == default ? 1.0f : 0.75f;
[ViewVariables]
public EntityUid? Pulling { get; set; }
public EntityUid Pulling { get; set; }
protected override void Shutdown()
{
@@ -30,7 +27,7 @@ namespace Content.Shared.Pulling.Components
protected override void OnRemove()
{
if (Pulling != null)
if (Pulling != default)
{
// This is absolute paranoia but it's also absolutely necessary. Too many puller state bugs. - 20kdc
Logger.ErrorS("c.go.c.pulling", "PULLING STATE CORRUPTION IMMINENT IN PULLER {0} - OnRemove called when Pulling is set!", Owner);

View File

@@ -19,8 +19,8 @@ namespace Content.Shared.Pulling.Systems
private void OnRelayMoveInput(EntityUid uid, SharedPullableComponent component, RelayMoveInputEvent args)
{
var entity = args.Session.AttachedEntityUid;
if (entity == null || !_blocker.CanMove(entity.Value)) return;
var entity = args.Session.AttachedEntity;
if (!entity.IsValid() || !_blocker.CanMove(entity)) return;
_pullSystem.TryStopPull(component);
}
}

View File

@@ -1,6 +1,5 @@
using Content.Shared.Alert;
using Content.Shared.Hands;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.EntitySystems;
using Content.Shared.Physics.Pull;
using Content.Shared.Pulling.Components;
@@ -31,11 +30,11 @@ namespace Content.Shared.Pulling.Systems
if (component.Pulling == null)
return;
if (component.Pulling == EntityManager.GetEntity(args.BlockingEntity))
if (component.Pulling == args.BlockingEntity)
{
if (EntityManager.TryGetComponent<SharedPullableComponent>(args.BlockingEntity, out var comp))
{
_pullSystem.TryStopPull(comp, EntityManager.GetEntity(uid));
_pullSystem.TryStopPull(comp, uid);
}
}
}

View File

@@ -6,19 +6,18 @@ using Content.Shared.GameTicking;
using Content.Shared.Input;
using Content.Shared.Physics.Pull;
using Content.Shared.Pulling.Components;
using Content.Shared.Pulling.Events;
using Content.Shared.Rotatable;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Input.Binding;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Players;
using Robust.Shared.IoC;
using Content.Shared.Verbs;
using Robust.Shared.Localization;
namespace Content.Shared.Pulling
{
@@ -203,11 +202,10 @@ namespace Content.Shared.Pulling
private bool HandleMovePulledObject(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
if (session?.AttachedEntityUid == null)
if (session?.AttachedEntity is not { } player ||
!player.IsValid())
return false;
var player = session.AttachedEntityUid.Value;
if (!TryGetPulled(player, out var pulled))
{
return false;
@@ -233,7 +231,7 @@ namespace Content.Shared.Pulling
return _pullers.Remove(puller);
}
public EntityUid? GetPulled(EntityUid by)
public EntityUid GetPulled(EntityUid by)
{
return _pullers.GetValueOrDefault(by);
}