Make conveyors stack items that stop (#42829)

* Initial commit

* formatting

---------

Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
This commit is contained in:
SlamBamActionman
2026-02-07 14:03:42 +01:00
committed by GitHub
parent 3a202be222
commit 2221df17c3

View File

@@ -4,6 +4,7 @@ using Content.Shared.Gravity;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Movement.Systems;
using Content.Shared.Stacks;
using Robust.Shared.Collections;
using Robust.Shared.Map;
using Robust.Shared.Physics;
@@ -24,6 +25,7 @@ public abstract class SharedConveyorController : VirtualController
[Dependency] private readonly FixtureSystem _fixtures = default!;
[Dependency] private readonly SharedGravitySystem _gravity = default!;
[Dependency] private readonly SharedMoverController _mover = default!;
[Dependency] private readonly SharedStackSystem _stack = default!;
protected const string ConveyorFixture = "conveyor";
@@ -164,7 +166,15 @@ public abstract class SharedConveyorController : VirtualController
if (ent.Result)
{
SetConveying(ent.Entity.Owner, ent.Entity.Comp1, targetDir.LengthSquared() > 0f);
if (targetDir.LengthSquared() > 0f)
{
SetConveying(ent.Entity.Owner, ent.Entity.Comp1, true);
}
else if (ent.Entity.Comp1.Conveying)
{
SetConveying(ent.Entity.Owner, ent.Entity.Comp1, false);
_stack.TryMergeToContacts(ent.Entity.Owner);
}
// We apply friction here so when we push items towards the center of the conveyor they don't go overspeed.
// We also don't want this to apply to mobs as they apply their own friction and otherwise