From e64b6b03fa1e92e2e2312d0c40107bc0754bf83e Mon Sep 17 00:00:00 2001 From: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:29:08 -0800 Subject: [PATCH] Conveyors spin fix (#37468) * Init commit * And on the third day god said: good enough * and on the fourth day god said: oops * Commit of evil * I hate conveyors * Switch the numbas * I hate conveyors * Master Merge * And on the third day, God said: Good Enough * I hate conveyors * AAAA * Optimize it a bit * Move that * Init Commit * Oops * Remove that * One last commit * Removed one TryComp * Remove TryComp --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> --- .../Controllers/SharedConveyorController.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Physics/Controllers/SharedConveyorController.cs b/Content.Shared/Physics/Controllers/SharedConveyorController.cs index b1ccb3be2a..e8b22b410c 100644 --- a/Content.Shared/Physics/Controllers/SharedConveyorController.cs +++ b/Content.Shared/Physics/Controllers/SharedConveyorController.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using Content.Shared.Conveyor; using Content.Shared.Gravity; using Content.Shared.Movement.Components; @@ -58,6 +58,9 @@ public abstract class SharedConveyorController : VirtualController private void OnConveyedFriction(Entity ent, ref TileFrictionEvent args) { + if(!ent.Comp.Conveying) + return; + // Conveyed entities don't get friction, they just get wishdir applied so will inherently slowdown anyway. args.Modifier = 0f; } @@ -140,7 +143,15 @@ public abstract class SharedConveyorController : VirtualController continue; var physics = ent.Entity.Comp3; + + if (physics.BodyStatus != BodyStatus.OnGround) + { + SetConveying(ent.Entity.Owner, ent.Entity.Comp1, false); + continue; + } + var velocity = physics.LinearVelocity; + var angularVelocity = physics.AngularVelocity; var targetDir = ent.Direction; // If mob is moving with the conveyor then combine the directions. @@ -163,6 +174,7 @@ public abstract class SharedConveyorController : VirtualController // We provide a small minimum friction speed as well for those times where the friction would stop large objects // snagged on corners from sliding into the centerline. _mover.Friction(0.2f, frameTime: frameTime, friction: 5f, ref velocity); + _mover.Friction(0f, frameTime: frameTime, friction: 5f, ref angularVelocity); } SharedMoverController.Accelerate(ref velocity, targetDir, 20f, frameTime); @@ -172,8 +184,10 @@ public abstract class SharedConveyorController : VirtualController // Need friction to outweigh the movement as it will bounce a bit against the wall. // This facilitates being able to sleep entities colliding into walls. _mover.Friction(0f, frameTime: frameTime, friction: 40f, ref velocity); + _mover.Friction(0f, frameTime: frameTime, friction: 40f, ref angularVelocity); } + PhysicsSystem.SetAngularVelocity(ent.Entity.Owner, angularVelocity); PhysicsSystem.SetLinearVelocity(ent.Entity.Owner, velocity, wakeBody: false); if (!IsConveyed((ent.Entity.Owner, ent.Entity.Comp2)))