Revert "Remove most usages of obsolete TransformComponent methods (#1… (#19714)

This commit is contained in:
metalgearsloth
2023-09-01 12:30:29 +10:00
committed by GitHub
parent 37222930d9
commit 4cfc578011
91 changed files with 227 additions and 315 deletions

View File

@@ -22,7 +22,6 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly AppearanceSystem _visualizer = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
@@ -229,7 +228,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
if (!gen1XForm.Anchored)
return false;
var genWorldPosRot = _transform.GetWorldPositionRotation(gen1XForm);
var genWorldPosRot = gen1XForm.GetWorldPositionRotation();
var dirRad = dir.ToAngle() + genWorldPosRot.WorldRotation; //needs to be like this for the raycast to work properly
var ray = new CollisionRay(genWorldPosRot.WorldPosition, dirRad.ToVec(), component.CollisionMask);
@@ -305,7 +304,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
var newField = Spawn(firstGenComp.CreatedField, currentCoords);
var fieldXForm = Transform(newField);
_transform.SetParent(newField, fieldXForm, firstGenComp.Owner);
fieldXForm.AttachParent(firstGenComp.Owner);
if (dirVec.GetDir() == Direction.East || dirVec.GetDir() == Direction.West)
{
var angle = fieldXForm.LocalPosition.ToAngle();

View File

@@ -13,7 +13,6 @@ public sealed class ContainmentFieldSystem : EntitySystem
{
[Dependency] private readonly ThrowingSystem _throwing = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
public override void Initialize()
{
@@ -27,16 +26,16 @@ public sealed class ContainmentFieldSystem : EntitySystem
{
var otherBody = args.OtherEntity;
if (HasComp<SpaceGarbageComponent>(otherBody))
if (TryComp<SpaceGarbageComponent>(otherBody, out var garbage))
{
_popupSystem.PopupEntity(Loc.GetString("comp-field-vaporized", ("entity", otherBody)), uid, PopupType.LargeCaution);
QueueDel(otherBody);
_popupSystem.PopupEntity(Loc.GetString("comp-field-vaporized", ("entity", otherBody)), component.Owner, PopupType.LargeCaution);
QueueDel(garbage.Owner);
}
if (TryComp<PhysicsComponent>(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard)
{
var fieldDir = _transform.GetWorldPosition(uid);
var playerDir = _transform.GetWorldPosition(otherBody);
var fieldDir = Transform(component.Owner).WorldPosition;
var playerDir = Transform(otherBody).WorldPosition;
_throwing.TryThrow(otherBody, playerDir-fieldDir, strength: component.ThrowForce);
}