Fix chairs deleting players (#37261)
Unbuckle entities when a strap is about to be deleted
This commit is contained in:
@@ -458,7 +458,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
var buckleXform = Transform(buckle);
|
var buckleXform = Transform(buckle);
|
||||||
var oldBuckledXform = Transform(strap);
|
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));
|
_transform.PlaceNextTo((buckle, buckleXform), (strap.Owner, oldBuckledXform));
|
||||||
buckleXform.ActivelyLerping = false;
|
buckleXform.ActivelyLerping = false;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ public abstract partial class SharedBuckleSystem
|
|||||||
{
|
{
|
||||||
SubscribeLocalEvent<StrapComponent, ComponentStartup>(OnStrapStartup);
|
SubscribeLocalEvent<StrapComponent, ComponentStartup>(OnStrapStartup);
|
||||||
SubscribeLocalEvent<StrapComponent, ComponentShutdown>(OnStrapShutdown);
|
SubscribeLocalEvent<StrapComponent, ComponentShutdown>(OnStrapShutdown);
|
||||||
|
SubscribeLocalEvent<StrapComponent, EntityTerminatingEvent>(OnStrapTerminating);
|
||||||
SubscribeLocalEvent<StrapComponent, ComponentRemove>((e, c, _) => StrapRemoveAll(e, c));
|
SubscribeLocalEvent<StrapComponent, ComponentRemove>((e, c, _) => StrapRemoveAll(e, c));
|
||||||
|
|
||||||
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnStrapContainerGettingInsertedAttempt);
|
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnStrapContainerGettingInsertedAttempt);
|
||||||
@@ -35,6 +36,11 @@ public abstract partial class SharedBuckleSystem
|
|||||||
StrapRemoveAll(uid, component);
|
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)
|
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.
|
// If someone is attempting to put this item inside of a backpack, ensure that it has no entities strapped to it.
|
||||||
|
|||||||
Reference in New Issue
Block a user