Files
tbd-station-14/Content.Server/Actions/ActionsSystem.cs
Leon Friedrich 5ac5dd6a64 Actions Rework (#6791)
* Rejig Actions

* fix merge errors

* lambda-b-gon

* fix PAI, add innate actions

* Revert "fix PAI, add innate actions"

This reverts commit 4b501ac083e979e31ebd98d7b98077e0dbdd344b.

* Just fix by making nullable.

if only require: true actually did something somehow.

* Make AddActions() ensure an actions component

and misc comments

* misc cleanup

* Limit range even when not checking for obstructions

* remove old guardian code

* rename function and make EntityUid nullable

* fix magboot bug

* fix action search menu

* make targeting toggle all equivalent actions

* fix combat popups (enabling <-> disabling)
2022-02-24 22:12:29 -06:00

41 lines
1.1 KiB
C#

using Content.Server.Chat.Managers;
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
namespace Content.Server.Actions
{
[UsedImplicitly]
public sealed class ActionsSystem : SharedActionsSystem
{
[Dependency] private readonly IChatManager _chatMan = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ActionsComponent, PlayerAttachedEvent>(OnPlayerAttached);
}
private void OnPlayerAttached(EntityUid uid, ActionsComponent component, PlayerAttachedEvent args)
{
// need to send state to new player.
component.Dirty();
}
protected override bool PerformBasicActions(EntityUid user, ActionType action)
{
var result = base.PerformBasicActions(user, action);
if (!string.IsNullOrWhiteSpace(action.Speech))
{
_chatMan.EntitySay(user, Loc.GetString(action.Speech));
result = true;
}
return result;
}
}
}