Remove most usages of obsolete TransformComponent methods (#19571)

This commit is contained in:
Visne
2023-08-30 04:05:19 +02:00
committed by GitHub
parent 3ba60835ec
commit 1416942bea
91 changed files with 312 additions and 221 deletions

View File

@@ -22,6 +22,7 @@ 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()
{
@@ -228,7 +229,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
if (!gen1XForm.Anchored)
return false;
var genWorldPosRot = gen1XForm.GetWorldPositionRotation();
var genWorldPosRot = _transform.GetWorldPositionRotation(gen1XForm);
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);
@@ -304,7 +305,7 @@ public sealed class ContainmentFieldGeneratorSystem : EntitySystem
var newField = Spawn(firstGenComp.CreatedField, currentCoords);
var fieldXForm = Transform(newField);
fieldXForm.AttachParent(firstGenComp.Owner);
_transform.SetParent(newField, fieldXForm, firstGenComp.Owner);
if (dirVec.GetDir() == Direction.East || dirVec.GetDir() == Direction.West)
{
var angle = fieldXForm.LocalPosition.ToAngle();

View File

@@ -13,6 +13,7 @@ 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()
{
@@ -26,16 +27,16 @@ public sealed class ContainmentFieldSystem : EntitySystem
{
var otherBody = args.OtherEntity;
if (TryComp<SpaceGarbageComponent>(otherBody, out var garbage))
if (HasComp<SpaceGarbageComponent>(otherBody))
{
_popupSystem.PopupEntity(Loc.GetString("comp-field-vaporized", ("entity", otherBody)), component.Owner, PopupType.LargeCaution);
QueueDel(garbage.Owner);
_popupSystem.PopupEntity(Loc.GetString("comp-field-vaporized", ("entity", otherBody)), uid, PopupType.LargeCaution);
QueueDel(otherBody);
}
if (TryComp<PhysicsComponent>(otherBody, out var physics) && physics.Mass <= component.MaxMass && physics.Hard)
{
var fieldDir = Transform(component.Owner).WorldPosition;
var playerDir = Transform(otherBody).WorldPosition;
var fieldDir = _transform.GetWorldPosition(uid);
var playerDir = _transform.GetWorldPosition(otherBody);
_throwing.TryThrow(otherBody, playerDir-fieldDir, strength: component.ThrowForce);
}