2020-04-28 16:44:22 +02:00
|
|
|
|
using System.Collections.Generic;
|
2020-04-29 13:43:07 +02:00
|
|
|
|
using System.Linq;
|
2020-04-28 16:44:22 +02:00
|
|
|
|
using Content.Server.GameObjects.Components.Interactable;
|
|
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
|
|
|
|
|
|
2020-08-13 14:40:27 +02:00
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
2020-04-28 16:44:22 +02:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Despite the name, it's only really used for the welder logic in tools. Go figure.
|
|
|
|
|
|
/// </summary>
|
2020-05-11 15:26:07 +02:00
|
|
|
|
public class WelderSystem : EntitySystem
|
2020-04-28 16:44:22 +02:00
|
|
|
|
{
|
2020-08-15 00:12:30 +02:00
|
|
|
|
private readonly HashSet<WelderComponent> _activeWelders = new HashSet<WelderComponent>();
|
|
|
|
|
|
|
|
|
|
|
|
public bool Subscribe(WelderComponent welder)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _activeWelders.Add(welder);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool Unsubscribe(WelderComponent welder)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _activeWelders.Remove(welder);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-28 16:44:22 +02:00
|
|
|
|
public override void Update(float frameTime)
|
|
|
|
|
|
{
|
2020-08-15 00:12:30 +02:00
|
|
|
|
foreach (var tool in _activeWelders.ToArray())
|
2020-04-29 13:43:07 +02:00
|
|
|
|
{
|
2020-08-15 00:12:30 +02:00
|
|
|
|
tool.OnUpdate(frameTime);
|
2020-04-29 13:43:07 +02:00
|
|
|
|
}
|
2020-04-28 16:44:22 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|