Skip to content

Commit

Permalink
Merge branch 'master' into Chitinid
Browse files Browse the repository at this point in the history
  • Loading branch information
ElusiveCoin authored Jan 15, 2025
2 parents 470fe85 + c65f619 commit bd75fe5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
19 changes: 19 additions & 0 deletions Content.Shared/_DV/Carrying/CarryingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public override void Initialize()
SubscribeLocalEvent<BeingCarriedComponent, StrappedEvent>(OnDrop);
SubscribeLocalEvent<BeingCarriedComponent, UnstrappedEvent>(OnDrop);
SubscribeLocalEvent<BeingCarriedComponent, EscapeInventoryEvent>(OnDrop);
SubscribeLocalEvent<BeingCarriedComponent, ComponentRemove>(OnRemoved);
SubscribeLocalEvent<CarriableComponent, CarryDoAfterEvent>(OnDoAfter);
}

Expand Down Expand Up @@ -205,6 +206,19 @@ private void OnDrop<TEvent>(Entity<BeingCarriedComponent> ent, ref TEvent args)
DropCarried(ent.Comp.Carrier, ent);
}

private void OnRemoved(Entity<BeingCarriedComponent> ent, ref ComponentRemove args)
{
/*
This component has been removed for whatever reason, so just make sure that the
carrier is cleaned up.
*/
if (!TryComp<CarryingComponent>(ent.Comp.Carrier, out var carryingComponent))
// This carrier has probably already been cleaned, no reason to try again
return;

CleanupCarrier(ent.Comp.Carrier, ent);
}

private void OnDoAfter(Entity<CarriableComponent> ent, ref CarryDoAfterEvent args)
{
if (args.Handled || args.Cancelled)
Expand Down Expand Up @@ -295,6 +309,11 @@ public bool TryCarry(EntityUid carrier, Entity<CarriableComponent?> toCarry)
public void DropCarried(EntityUid carrier, EntityUid carried)
{
Drop(carried);
CleanupCarrier(carrier, carried);
}

private void CleanupCarrier(EntityUid carrier, EntityUid carried)
{
RemComp<CarryingComponent>(carrier); // get rid of this first so we don't recursively fire that event
RemComp<CarryingSlowdownComponent>(carrier);
_virtualItem.DeleteInHandsMatching(carrier, carried);
Expand Down
15 changes: 8 additions & 7 deletions Resources/Changelog/DeltaVChangelog.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
Entries:
- author: deltanedas
changes:
- message: Artifacts can no longer create singularities or tesla balls.
type: Remove
id: 416
time: '2024-07-01T20:10:00.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/1441
- author: Timemaster99
changes:
- message: Gave prosecutors access to brig timers
Expand Down Expand Up @@ -3860,3 +3853,11 @@
id: 915
time: '2025-01-15T20:47:03.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2741
- author: BarryNorfolk
changes:
- message: Fixed virtual items persisting after inserting carried organics into
biomass reclaimers
type: Fix
id: 916
time: '2025-01-15T22:35:49.0000000+00:00'
url: https://github.com/DeltaV-Station/Delta-v/pull/2729

0 comments on commit bd75fe5

Please sign in to comment.