Properly fix chair collision & disallow pulling objects you're buckled to (#3241)

Co-authored-by: cyclowns <cyclowns@protonmail.ch>
This commit is contained in:
mirrorcult
2021-02-16 01:42:03 -07:00
committed by GitHub
parent 372d994f16
commit 1ab8d3e6e9
3 changed files with 52 additions and 31 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.GameObjects.Components.Buckle; #nullable enable
using Content.Shared.GameObjects.Components.Buckle;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -19,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Buckle
return false; return false;
} }
public override void HandleComponentState(ComponentState curState, ComponentState nextState) public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{ {
if (curState is not BuckleComponentState buckle) if (curState is not BuckleComponentState buckle)
{ {
@@ -30,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Buckle
LastEntityBuckledTo = buckle.LastEntityBuckledTo; LastEntityBuckledTo = buckle.LastEntityBuckledTo;
DontCollide = buckle.DontCollide; DontCollide = buckle.DontCollide;
if (!Owner.TryGetComponent(out SpriteComponent ownerSprite)) if (!Owner.TryGetComponent(out SpriteComponent? ownerSprite))
{ {
return; return;
} }

View File

@@ -263,11 +263,20 @@ namespace Content.Server.GameObjects.Components.Buckle
SendMessage(new BuckleMessage(Owner, to)); SendMessage(new BuckleMessage(Owner, to));
if (Owner.TryGetComponent(out PullableComponent? pullableComponent)) if (Owner.TryGetComponent(out PullableComponent? ownerPullable))
{ {
if (pullableComponent.Puller != null) if (ownerPullable.Puller != null)
{ {
pullableComponent.TryStopPull(); ownerPullable.TryStopPull();
}
}
if (to.TryGetComponent(out PullableComponent? toPullable))
{
if (toPullable.Puller == Owner)
{
// can't pull it and buckle to it at the same time
toPullable.TryStopPull();
} }
} }

View File

@@ -15,13 +15,6 @@
bounds: "-0.5,-0.25,0.5,0.25" bounds: "-0.5,-0.25,0.5,0.25"
mask: mask:
- Impassable - Impassable
- MobImpassable
- VaultImpassable
- SmallImpassable
layer:
- Opaque
- Impassable
- MobImpassable
- VaultImpassable - VaultImpassable
- SmallImpassable - SmallImpassable
- type: Sprite - type: Sprite
@@ -54,7 +47,10 @@
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
bounds: "-0.45, -0.45, 0.05, 0.45" bounds: "-0.45, -0.45, 0.05, 0.45"
layer: [ Passable ] mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity - type: entity
name: stool name: stool
@@ -69,7 +65,10 @@
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
bounds: "-0.5, -0.25, 0.05, 0.25" bounds: "-0.5, -0.25, 0.05, 0.25"
layer: [ Passable ] mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity - type: entity
name: bar stool name: bar stool
@@ -83,7 +82,10 @@
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
bounds: "-0.5, -0.2, 0.2, 0.25" bounds: "-0.5, -0.2, 0.2, 0.25"
layer: [ Passable ] mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity - type: entity
name: white office chair name: white office chair
@@ -98,7 +100,10 @@
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
bounds: "-0.49, -0.25, 0.37, 0.25" bounds: "-0.49, -0.25, 0.37, 0.25"
layer: [ Passable ] mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity - type: entity
name: dark office chair name: dark office chair
@@ -120,7 +125,10 @@
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
bounds: "-0.45, -0.3, 0.35, 0.3" bounds: "-0.45, -0.3, 0.35, 0.3"
layer: [ Passable ] mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity - type: entity
name: wooden chair name: wooden chair
@@ -134,4 +142,7 @@
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
bounds: "-0.37, -0.25, 0.49, 0.24" bounds: "-0.37, -0.25, 0.49, 0.24"
layer: [ Passable ] mask:
- Impassable
- VaultImpassable
- SmallImpassable