Adds HugBot (#37557)
* - hugbot
- bdy with two arms because it needs two arms to hug
- is constructable from:
- box of hugs
- proximity sensor
- two borg arms
- lots of voice lines
- kinda like a medibot, it chases you down and then hugs you
- except if it's emagged, then it punches you :)
- it has a 2m cooldown per person by default
- MeleeAttackOperator
- Read the doc, but it's an operator which makes the NPC hit a target exactly once assuming it's in range.
- Used to make the hugbot attack
- RaiseEventForOwnerOperator
- Read the doc, but it's an operator which raises an event on the owning NPC.
- Used to make the hugbot hug extra code, specifically for the cooldown
- Changes to existing code:
- `ComponentFilter : UtilityQueryFilter` gets `RetainWithComp` added which, as the name implies, retains entities with the specified comps rather than removing them. Basically, it lets you negate the filter.
- `SpeakOperator : HTNOperator`'s `speech` field can use a `LocalizedDataSet` instead of just a locstring now
- (I updated all of the existing usages for this)
-
* two arms
* wait what if we just used mimebot arms so it doesn't look awful
* smort
This commit is contained in:
12
Content.Shared/Silicons/Bots/HugBotComponent.cs
Normal file
12
Content.Shared/Silicons/Bots/HugBotComponent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Content.Shared.Silicons.Bots;
|
||||
|
||||
/// <summary>
|
||||
/// This component describes how a HugBot hugs.
|
||||
/// </summary>
|
||||
/// <see cref="SharedHugBotSystem"/>
|
||||
[RegisterComponent, AutoGenerateComponentState]
|
||||
public sealed partial class HugBotComponent : Component
|
||||
{
|
||||
[DataField, AutoNetworkedField]
|
||||
public TimeSpan HugCooldown = TimeSpan.FromMinutes(2);
|
||||
}
|
||||
38
Content.Shared/Silicons/Bots/SharedHugBotSystem.cs
Normal file
38
Content.Shared/Silicons/Bots/SharedHugBotSystem.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Content.Shared.Emag.Systems;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Silicons.Bots;
|
||||
|
||||
/// <summary>
|
||||
/// This system handles HugBots.
|
||||
/// </summary>
|
||||
public abstract class SharedHugBotSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly EmagSystem _emag = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<HugBotComponent, GotEmaggedEvent>(OnEmagged);
|
||||
}
|
||||
|
||||
private void OnEmagged(Entity<HugBotComponent> entity, ref GotEmaggedEvent args)
|
||||
{
|
||||
if (!_emag.CompareFlag(args.Type, EmagType.Interaction) ||
|
||||
_emag.CheckFlag(entity, EmagType.Interaction) ||
|
||||
!TryComp<HugBotComponent>(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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event is raised on an entity when it is hugged by a HugBot.
|
||||
/// </summary>
|
||||
[Serializable, NetSerializable]
|
||||
public sealed partial class HugBotHugEvent(NetEntity hugBot) : EntityEventArgs
|
||||
{
|
||||
public readonly NetEntity HugBot = hugBot;
|
||||
}
|
||||
Reference in New Issue
Block a user