ActSystem and Destruction Threshold Behaviors use EntityUid.

This commit is contained in:
Vera Aguilera Puerto
2021-11-09 12:06:00 +01:00
parent c5fda6daca
commit 5cec5c421c
14 changed files with 44 additions and 42 deletions

View File

@@ -19,8 +19,10 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
[DataField("spawn")]
public Dictionary<string, MinMax> Spawn { get; set; } = new();
public void Execute(IEntity owner, DestructibleSystem system)
public void Execute(EntityUid owner, DestructibleSystem system, IEntityManager entityManager)
{
var position = entityManager.GetComponent<TransformComponent>(owner).MapPosition;
foreach (var (entityId, minMax) in Spawn)
{
var count = minMax.Min >= minMax.Max
@@ -31,7 +33,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId))
{
var spawned = owner.EntityManager.SpawnEntity(entityId, owner.Transform.MapPosition);
var spawned = entityManager.SpawnEntity(entityId, position);
var stack = spawned.GetComponent<StackComponent>();
EntitySystem.Get<StackSystem>().SetCount(spawned.Uid, count, stack);
spawned.RandomOffset(0.5f);
@@ -40,7 +42,7 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
{
for (var i = 0; i < count; i++)
{
var spawned = owner.EntityManager.SpawnEntity(entityId, owner.Transform.MapPosition);
var spawned = entityManager.SpawnEntity(entityId, position);
spawned.RandomOffset(0.5f);
}
}