Fixed rotation check for pulling (#8845)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -11,8 +11,6 @@ namespace Content.Shared.Pulling.Components
|
||||
[RegisterComponent]
|
||||
public sealed class SharedPullableComponent : Component
|
||||
{
|
||||
public float? MaxDistance => PullJoint?.MaxLength;
|
||||
|
||||
/// <summary>
|
||||
/// The current entity pulling this component.
|
||||
/// SharedPullingStateManagementSystem should be writing this. This means definitely not you.
|
||||
@@ -29,6 +27,20 @@ namespace Content.Shared.Pulling.Components
|
||||
[Access(typeof(SharedPullingStateManagementSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
|
||||
public EntityCoordinates? MovingTo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the physics component has FixedRotation should we keep it upon being pulled
|
||||
/// </summary>
|
||||
[Access(typeof(SharedPullingSystem), Other = AccessPermissions.ReadExecute)]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("fixedRotation")]
|
||||
public bool FixedRotationOnPull { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// What the pullable's fixedrotation was set to before being pulled.
|
||||
/// </summary>
|
||||
[Access(typeof(SharedPullingSystem), Other = AccessPermissions.ReadExecute)]
|
||||
[ViewVariables]
|
||||
public bool PrevFixedRotation;
|
||||
|
||||
public override ComponentState GetComponentState()
|
||||
{
|
||||
return new PullableComponentState(Puller);
|
||||
|
||||
@@ -85,6 +85,13 @@ namespace Content.Shared.Pulling
|
||||
|
||||
if (msg.Cancelled) return false;
|
||||
|
||||
// Stop pulling confirmed!
|
||||
|
||||
if (TryComp<PhysicsComponent>(pullable.Owner, out var pullablePhysics))
|
||||
{
|
||||
pullablePhysics.FixedRotation = pullable.PrevFixedRotation;
|
||||
}
|
||||
|
||||
_pullSm.ForceRelationship(null, pullable);
|
||||
return true;
|
||||
}
|
||||
@@ -172,11 +179,11 @@ namespace Content.Shared.Pulling
|
||||
RaiseLocalEvent(pullable.Owner, pullAttempt);
|
||||
|
||||
if (pullAttempt.Cancelled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_pullSm.ForceRelationship(puller, pullable);
|
||||
pullable.PrevFixedRotation = pullablePhysics.FixedRotation;
|
||||
pullablePhysics.FixedRotation = pullable.FixedRotationOnPull;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
- Wringer
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
fixedRotation: false
|
||||
- type: Transform
|
||||
noRot: true
|
||||
- type: Fixtures
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
- type: MovedByPressure
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
fixedRotation: false
|
||||
- type: Transform
|
||||
noRot: true
|
||||
- type: Fixtures
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
maxIntensity: 45
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
modifier: 0.5
|
||||
- type: Physics
|
||||
bodyType: Dynamic
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
- type: InteractionOutline
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
sprite: Structures/Doors/Airlocks/Standard/basic.rsi
|
||||
state: "assembly"
|
||||
- type: Physics
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
components:
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
noRot: true
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
@@ -59,7 +58,6 @@
|
||||
noRot: true
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
@@ -114,8 +112,6 @@
|
||||
- type: Construction
|
||||
graph: Machine
|
||||
node: destroyedMachineFrame
|
||||
- type: Physics
|
||||
fixedRotation: false
|
||||
- type: Damageable
|
||||
damageContainer: Inorganic
|
||||
damageModifierSet: Metallic
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
noRot: true
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
- type: Rotatable
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
- type: InteractionOutline
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
- type: InteractionOutline
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
- type: Clickable
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
sprite: Structures/Power/Generation/ame.rsi
|
||||
state: control
|
||||
- type: Physics
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
- type: InteractionOutline
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
anchored: true
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
@@ -111,7 +110,6 @@
|
||||
- type: InteractionOutline
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
@@ -155,7 +153,6 @@
|
||||
- type: InteractionOutline
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
- type: Clickable
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
fixedRotation: false
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
id: hydroponicsTray
|
||||
description: An interstellar-grade space farmplot allowing for rapid growth and selective breeding of crops. Just... keep in mind the space weeds.
|
||||
components:
|
||||
- type: Physics
|
||||
fixedRotation: false
|
||||
- type: Transform
|
||||
noRot: true
|
||||
- type: Fixtures
|
||||
|
||||
Reference in New Issue
Block a user