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

@@ -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);
}