Ghost hearing action (#19722)
This commit is contained in:
@@ -16,6 +16,7 @@ using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Movement.Events;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -64,11 +65,35 @@ namespace Content.Server.Ghost
|
||||
SubscribeNetworkEvent<GhostWarpToTargetRequestEvent>(OnGhostWarpToTargetRequest);
|
||||
|
||||
SubscribeLocalEvent<GhostComponent, BooActionEvent>(OnActionPerform);
|
||||
SubscribeLocalEvent<GhostComponent, ToggleGhostHearingActionEvent>(OnGhostHearingAction);
|
||||
SubscribeLocalEvent<GhostComponent, InsertIntoEntityStorageAttemptEvent>(OnEntityStorageInsertAttempt);
|
||||
|
||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(_ => MakeVisible(true));
|
||||
}
|
||||
|
||||
private void OnGhostHearingAction(EntityUid uid, GhostComponent component, ToggleGhostHearingActionEvent args)
|
||||
{
|
||||
args.Handled = true;
|
||||
|
||||
if (HasComp<GhostHearingComponent>(uid))
|
||||
{
|
||||
RemComp<GhostHearingComponent>(uid);
|
||||
_actions.SetToggled(component.ToggleGhostHearingActionEntity, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddComp<GhostHearingComponent>(uid);
|
||||
_actions.SetToggled(component.ToggleGhostHearingActionEntity, false);
|
||||
}
|
||||
|
||||
var str = HasComp<GhostHearingComponent>(uid)
|
||||
? Loc.GetString("ghost-gui-toggle-hearing-popup-on")
|
||||
: Loc.GetString("ghost-gui-toggle-hearing-popup-off");
|
||||
|
||||
Popup.PopupEntity(str, uid, uid);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
private void OnActionPerform(EntityUid uid, GhostComponent component, BooActionEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
@@ -164,6 +189,7 @@ namespace Content.Server.Ghost
|
||||
_actions.SetCooldown(component.BooActionEntity.Value, start, end);
|
||||
}
|
||||
|
||||
_actions.AddAction(uid, ref component.ToggleGhostHearingActionEntity, component.ToggleGhostHearingAction);
|
||||
_actions.AddAction(uid, ref component.ToggleLightingActionEntity, component.ToggleLightingAction);
|
||||
_actions.AddAction(uid, ref component.ToggleFoVActionEntity, component.ToggleFoVAction);
|
||||
_actions.AddAction(uid, ref component.ToggleGhostsActionEntity, component.ToggleGhostsAction);
|
||||
|
||||
Reference in New Issue
Block a user