misc optimization (#6436)
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Content.Shared.Pulling.Components
|
||||
/// </summary>
|
||||
public DistanceJoint? PullJoint { get; set; }
|
||||
|
||||
public bool BeingPulled => Puller != default;
|
||||
public bool BeingPulled => Puller != null;
|
||||
|
||||
public EntityCoordinates? MovingTo { get; set; }
|
||||
|
||||
@@ -76,15 +76,9 @@ namespace Content.Shared.Pulling.Components
|
||||
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceRelationship(comp, this);
|
||||
}
|
||||
|
||||
protected override void Shutdown()
|
||||
{
|
||||
EntitySystem.Get<SharedPullingStateManagementSystem>().ForceDisconnectPullable(this);
|
||||
base.Shutdown();
|
||||
}
|
||||
|
||||
protected override void OnRemove()
|
||||
{
|
||||
if (Puller != default)
|
||||
if (Puller != null)
|
||||
{
|
||||
// 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);
|
||||
|
||||
@@ -31,6 +31,19 @@ namespace Content.Shared.Pulling
|
||||
{
|
||||
[Dependency] private readonly SharedJointSystem _jointSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SharedPullableComponent, ComponentShutdown>(OnShutdown);
|
||||
}
|
||||
|
||||
private void OnShutdown(EntityUid uid, SharedPullableComponent component, ComponentShutdown args)
|
||||
{
|
||||
if (component.Puller != null)
|
||||
ForceRelationship(null, component);
|
||||
}
|
||||
|
||||
// A WARNING:
|
||||
// The following 2 functions are the most internal part of the pulling system's relationship management.
|
||||
// They do not expect to be cancellable.
|
||||
|
||||
Reference in New Issue
Block a user