Skip to content

Commit

Permalink
Fix bed physics (#1196)
Browse files Browse the repository at this point in the history
* Try to fix physics

* Add UpdateApperance check but not work

* Fix physics at all new collision entities
  • Loading branch information
Ady4ik committed Jun 19, 2024
1 parent 6fcd3e7 commit a344eb0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
10 changes: 10 additions & 0 deletions Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Content.Shared.Alert;
using Content.Shared.Bed.Sleep;
using Content.Shared.Buckle.Components;
using Content.Shared.Climbing.Components;
using Content.Shared.Climbing.Systems;
using Content.Shared.Database;
using Content.Shared.DoAfter;
using Content.Shared.Hands.Components;
Expand All @@ -27,6 +29,9 @@ namespace Content.Shared.Buckle;

public abstract partial class SharedBuckleSystem
{
/// SS220 BedCollisionFix begin
[Dependency] private readonly ClimbSystem _climbSystem = default!;
/// SS220 BedCollisionFix end
private void InitializeBuckle()
{
SubscribeLocalEvent<BuckleComponent, ComponentStartup>(OnBuckleComponentStartup);
Expand Down Expand Up @@ -545,6 +550,11 @@ public bool TryUnbuckle(EntityUid buckleUid, EntityUid userUid, bool force = fal
RaiseLocalEvent(buckleUid, ref ev);
RaiseLocalEvent(strapUid, ref ev);

// SS220 BedCollision Fix begin
if (HasComp<ClimbableComponent>(strapUid))
_climbSystem.ForciblySetClimbing(userUid, strapUid);
// SS220 BedCollision Fix begin

return true;
}

Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Structures/Furniture/beds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
anchored: true
noRot: true
- type: Anchorable
flags: 0 # SS220 NewPhysicsFix
- type: Pullable
- type: Climbable # SS220 NewPhysicsFix


- type: entity
Expand Down
32 changes: 19 additions & 13 deletions Resources/Prototypes/Entities/Structures/Machines/stasisbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
types:
Poison: -0.001
Blunt: -0.001
# SS220 Structure colision fix begin
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.45,-0.45,0.45,0.05"
density: 190
mask:
- TableMask
layer:
- TableLayer
# SS220 Structure colision fix end
- type: Sprite
sprite: Structures/Machines/stasis_bed.rsi
noRot: true
Expand Down Expand Up @@ -47,19 +60,12 @@
board: StasisBedMachineCircuitboard
- type: Physics
bodyType: Static
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeAabb
bounds: "-0.45,-0.45,0.45,0.05"
density: 190
mask:
- LowImpassable
# SS220 Structure colision fix begin
layer:
- StructureLayer
# SS220 Structure colision fix end
- type: GuideHelp
guides:
- Medical Doctor
# SS220 NewPhysicsFix begin
- type: Climbable
- type: Anchorable
flags: 0
# SS220 NewPhysicsFix end

0 comments on commit a344eb0

Please sign in to comment.