Fix salvage gibbing (#9426)

This commit is contained in:
wrexbe
2022-07-05 08:03:36 -07:00
committed by GitHub
parent 8c4e17eef3
commit 4766638413
3 changed files with 17 additions and 12 deletions

View File

@@ -255,8 +255,9 @@ namespace Content.Shared.Body.Components
private void AddedToBody(SharedBodyComponent body)
{
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = 0;
_entMan.GetComponent<TransformComponent>(Owner).AttachParent(body.Owner);
var transformComponent = _entMan.GetComponent<TransformComponent>(Owner);
transformComponent.LocalRotation = 0;
transformComponent.AttachParent(body.Owner);
OnAddedToBody(body);
foreach (var mechanism in _mechanisms)
@@ -267,9 +268,9 @@ namespace Content.Shared.Body.Components
private void RemovedFromBody(SharedBodyComponent old)
{
if (!_entMan.GetComponent<TransformComponent>(Owner).Deleted)
if (_entMan.TryGetComponent<TransformComponent>(Owner, out var transformComponent))
{
_entMan.GetComponent<TransformComponent>(Owner).AttachToGridOrMap();
transformComponent.AttachToGridOrMap();
}
OnRemovedFromBody(old);