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

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