Fix some things setting StackComponent count manually.

This commit is contained in:
Vera Aguilera Puerto
2021-05-30 08:53:02 +02:00
parent 88f5c620db
commit 1ec2f39291
6 changed files with 21 additions and 17 deletions

View File

@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using Content.Server.GameObjects.Components.Stack;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Utility;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
@@ -32,8 +33,7 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId))
{
var spawned = owner.EntityManager.SpawnEntity(entityId, owner.Transform.MapPosition);
var stack = spawned.GetComponent<StackComponent>();
stack.Count = count;
owner.EntityManager.EventBus.RaiseLocalEvent(spawned.Uid, new StackChangeCountEvent(count), false);
spawned.RandomOffset(0.5f);
}
else