Turn off collision for all subfloor objects (#4813)
* Turn off collision for all subfloor objects And not just ones that are hidden. * Only update collision on terminating * Move termination
This commit is contained in:
parent
fbea5744e2
commit
04b374f32f
|
|
@ -73,12 +73,17 @@ namespace Content.Shared.SubFloor
|
|||
private void OnSubFloorStarted(EntityUid uid, SubFloorHideComponent component, ComponentStartup _)
|
||||
{
|
||||
UpdateEntity(uid);
|
||||
EntityManager.EnsureComponent<CollideOnAnchorComponent>(uid);
|
||||
}
|
||||
|
||||
private void OnSubFloorTerminating(EntityUid uid, SubFloorHideComponent component, ComponentShutdown _)
|
||||
{
|
||||
// If component is being deleted don't need to worry about updating any component stuff because it won't matter very shortly.
|
||||
if (EntityManager.GetEntity(uid).LifeStage >= EntityLifeStage.Terminating) return;
|
||||
|
||||
// Regardless of whether we're on a subfloor or not, unhide.
|
||||
UpdateEntity(uid, true);
|
||||
EntityManager.RemoveComponent<CollideOnAnchorComponent>(uid);
|
||||
}
|
||||
|
||||
private void HandleAnchorChanged(EntityUid uid, SubFloorHideComponent component, ref AnchorStateChangedEvent args)
|
||||
|
|
@ -191,12 +196,6 @@ namespace Content.Shared.SubFloor
|
|||
{
|
||||
appearanceComponent.SetData(SubFloorVisuals.SubFloor, subFloorVisible);
|
||||
}
|
||||
|
||||
// So for collision all we care about is that the component is running.
|
||||
if (EntityManager.TryGetComponent(uid, out PhysicsComponent? physicsComponent))
|
||||
{
|
||||
physicsComponent.CanCollide = subFloor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue