Resolve 'TransformComponent.MapPosition' is obsolete in content (#27939)

* Resolve `'TransformComponent.MapPosition' is obsolete: 'Use TransformSystem.GetMapCoordinates'` in content

* build?
This commit is contained in:
Kara
2024-05-12 07:31:54 -07:00
committed by GitHub
parent 8938e1d8b2
commit 855234aa30
59 changed files with 152 additions and 84 deletions

View File

@@ -3,6 +3,7 @@ using Content.Server.Forensics;
using Content.Server.Stack;
using Content.Shared.Prototypes;
using Content.Shared.Stacks;
using Robust.Server.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
@@ -30,7 +31,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
{
var position = system.EntityManager.GetComponent<TransformComponent>(owner).MapPosition;
var tSys = system.EntityManager.System<TransformSystem>();
var position = tSys.GetMapCoordinates(owner);
var getRandomVector = () => new Vector2(system.Random.NextFloat(-Offset, Offset), system.Random.NextFloat(-Offset, Offset));
@@ -48,7 +50,8 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
? minMax.Min
: system.Random.Next(minMax.Min, minMax.Max + 1);
if (count == 0) continue;
if (count == 0)
continue;
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
{