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.Shared.GameObjects;
@@ -19,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Buckle
return false;
}
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
if (curState is not BuckleComponentState buckle)
{
@@ -30,7 +31,7 @@ namespace Content.Client.GameObjects.Components.Buckle
LastEntityBuckledTo = buckle.LastEntityBuckledTo;
DontCollide = buckle.DontCollide;
if (!Owner.TryGetComponent(out SpriteComponent ownerSprite))
if (!Owner.TryGetComponent(out SpriteComponent? ownerSprite))
{
return;
}

View File

@@ -263,11 +263,20 @@ namespace Content.Server.GameObjects.Components.Buckle
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"
mask:
- Impassable
- MobImpassable
- VaultImpassable
- SmallImpassable
layer:
- Opaque
- Impassable
- MobImpassable
- VaultImpassable
- SmallImpassable
- type: Sprite
@@ -52,9 +45,12 @@
color: "#8e9799"
- type: Physics
shapes:
- !type:PhysShapeAabb
bounds: "-0.45, -0.45, 0.05, 0.45"
layer: [ Passable ]
- !type:PhysShapeAabb
bounds: "-0.45, -0.45, 0.05, 0.45"
mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity
name: stool
@@ -67,9 +63,12 @@
color: "#8e9799"
- type: Physics
shapes:
- !type:PhysShapeAabb
bounds: "-0.5, -0.25, 0.05, 0.25"
layer: [ Passable ]
- !type:PhysShapeAabb
bounds: "-0.5, -0.25, 0.05, 0.25"
mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity
name: bar stool
@@ -81,9 +80,12 @@
color: "white"
- type: Physics
shapes:
- !type:PhysShapeAabb
bounds: "-0.5, -0.2, 0.2, 0.25"
layer: [ Passable ]
- !type:PhysShapeAabb
bounds: "-0.5, -0.2, 0.2, 0.25"
mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity
name: white office chair
@@ -96,9 +98,12 @@
state: officechair_white
- type: Physics
shapes:
- !type:PhysShapeAabb
bounds: "-0.49, -0.25, 0.37, 0.25"
layer: [ Passable ]
- !type:PhysShapeAabb
bounds: "-0.49, -0.25, 0.37, 0.25"
mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity
name: dark office chair
@@ -118,9 +123,12 @@
state: comfychair_preview
- type: Physics
shapes:
- !type:PhysShapeAabb
bounds: "-0.45, -0.3, 0.35, 0.3"
layer: [ Passable ]
- !type:PhysShapeAabb
bounds: "-0.45, -0.3, 0.35, 0.3"
mask:
- Impassable
- VaultImpassable
- SmallImpassable
- type: entity
name: wooden chair
@@ -132,6 +140,9 @@
color: "white"
- type: Physics
shapes:
- !type:PhysShapeAabb
bounds: "-0.37, -0.25, 0.49, 0.24"
layer: [ Passable ]
- !type:PhysShapeAabb
bounds: "-0.37, -0.25, 0.49, 0.24"
mask:
- Impassable
- VaultImpassable
- SmallImpassable