using Content.Shared.Emag.Systems;
using Robust.Shared.Serialization;
namespace Content.Shared.Silicons.Bots;
///
/// This system handles HugBots.
///
public abstract class SharedHugBotSystem : EntitySystem
{
[Dependency] private readonly EmagSystem _emag = default!;
public override void Initialize()
{
SubscribeLocalEvent(OnEmagged);
}
private void OnEmagged(Entity entity, ref GotEmaggedEvent args)
{
if (!_emag.CompareFlag(args.Type, EmagType.Interaction) ||
_emag.CheckFlag(entity, EmagType.Interaction) ||
!TryComp(entity, out var hugBot))
return;
// HugBot HTN checks for emag state within its own logic, so we don't need to change anything here.
args.Handled = true;
}
}
///
/// This event is raised on an entity when it is hugged by a HugBot.
///
[Serializable, NetSerializable]
public sealed partial class HugBotHugEvent(NetEntity hugBot) : EntityEventArgs
{
public readonly NetEntity HugBot = hugBot;
}