var buckleXform = Transform(buckle);
var oldBuckledXform = Transform(strap);
- if (buckleXform.ParentUid == strap.Owner && !Terminating(buckleXform.ParentUid))
+ if (buckleXform.ParentUid == strap.Owner && !Terminating(oldBuckledXform.ParentUid))
{
_transform.PlaceNextTo((buckle, buckleXform), (strap.Owner, oldBuckledXform));
buckleXform.ActivelyLerping = false;
{
SubscribeLocalEvent<StrapComponent, ComponentStartup>(OnStrapStartup);
SubscribeLocalEvent<StrapComponent, ComponentShutdown>(OnStrapShutdown);
+ SubscribeLocalEvent<StrapComponent, EntityTerminatingEvent>(OnStrapTerminating);
SubscribeLocalEvent<StrapComponent, ComponentRemove>((e, c, _) => StrapRemoveAll(e, c));
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnStrapContainerGettingInsertedAttempt);
StrapRemoveAll(uid, component);
}
+ private void OnStrapTerminating(Entity<StrapComponent> entity, ref EntityTerminatingEvent args)
+ {
+ StrapRemoveAll(entity, entity.Comp);
+ }
+
private void OnStrapContainerGettingInsertedAttempt(EntityUid uid, StrapComponent component, ContainerGettingInsertedAttemptEvent args)
{
// If someone is attempting to put this item inside of a backpack, ensure that it has no entities strapped to it.