Close context menu on entering combat mode (#11624)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Content.Client.HUD;
|
using Content.Client.HUD;
|
||||||
|
using Content.Client.Verbs;
|
||||||
using Content.Shared.CombatMode;
|
using Content.Shared.CombatMode;
|
||||||
using Content.Shared.Targeting;
|
using Content.Shared.Targeting;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -50,6 +51,8 @@ namespace Content.Client.CombatMode
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var verbs = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<VerbSystem>();
|
||||||
|
verbs.CloseAllMenus();
|
||||||
_gameHud.TargetingZone = ActiveZone;
|
_gameHud.TargetingZone = ActiveZone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Client.CombatMode;
|
||||||
using Content.Client.ContextMenu.UI;
|
using Content.Client.ContextMenu.UI;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
@@ -28,14 +29,16 @@ namespace Content.Client.Verbs.UI
|
|||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||||
|
|
||||||
|
private readonly CombatModeSystem _combatMode;
|
||||||
private readonly VerbSystem _verbSystem;
|
private readonly VerbSystem _verbSystem;
|
||||||
|
|
||||||
public EntityUid CurrentTarget;
|
public EntityUid CurrentTarget;
|
||||||
public SortedSet<Verb> CurrentVerbs = new();
|
public SortedSet<Verb> CurrentVerbs = new();
|
||||||
|
|
||||||
public VerbMenuPresenter(VerbSystem verbSystem)
|
public VerbMenuPresenter(CombatModeSystem combatMode, VerbSystem verbSystem)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
_combatMode = combatMode;
|
||||||
_verbSystem = verbSystem;
|
_verbSystem = verbSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +49,8 @@ namespace Content.Client.Verbs.UI
|
|||||||
/// <param name="force">Used to force showing all verbs (mostly for admins).</param>
|
/// <param name="force">Used to force showing all verbs (mostly for admins).</param>
|
||||||
public void OpenVerbMenu(EntityUid target, bool force = false)
|
public void OpenVerbMenu(EntityUid target, bool force = false)
|
||||||
{
|
{
|
||||||
if (_playerManager.LocalPlayer?.ControlledEntity is not {Valid: true} user)
|
if (_playerManager.LocalPlayer?.ControlledEntity is not {Valid: true} user ||
|
||||||
|
_combatMode.IsInCombatMode(user))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Client.CombatMode;
|
||||||
using Content.Client.ContextMenu.UI;
|
using Content.Client.ContextMenu.UI;
|
||||||
using Content.Client.Examine;
|
using Content.Client.Examine;
|
||||||
using Content.Client.Gameplay;
|
using Content.Client.Gameplay;
|
||||||
@@ -28,6 +29,7 @@ namespace Content.Client.Verbs
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class VerbSystem : SharedVerbSystem
|
public sealed class VerbSystem : SharedVerbSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly CombatModeSystem _combatMode = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly ExamineSystem _examineSystem = default!;
|
[Dependency] private readonly ExamineSystem _examineSystem = default!;
|
||||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||||
@@ -60,7 +62,7 @@ namespace Content.Client.Verbs
|
|||||||
SubscribeNetworkEvent<VerbsResponseEvent>(HandleVerbResponse);
|
SubscribeNetworkEvent<VerbsResponseEvent>(HandleVerbResponse);
|
||||||
|
|
||||||
EntityMenu = new(this);
|
EntityMenu = new(this);
|
||||||
VerbMenu = new(this);
|
VerbMenu = new(_combatMode, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset(RoundRestartCleanupEvent ev)
|
public void Reset(RoundRestartCleanupEvent ev)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Actions.ActionTypes;
|
using Content.Shared.Actions.ActionTypes;
|
||||||
using Content.Shared.Targeting;
|
using Content.Shared.Targeting;
|
||||||
|
using Content.Shared.Verbs;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
@@ -51,6 +52,7 @@ namespace Content.Shared.CombatMode
|
|||||||
_isInCombatMode = value;
|
_isInCombatMode = value;
|
||||||
if (CombatToggleAction != null)
|
if (CombatToggleAction != null)
|
||||||
EntitySystem.Get<SharedActionsSystem>().SetToggled(CombatToggleAction, _isInCombatMode);
|
EntitySystem.Get<SharedActionsSystem>().SetToggled(CombatToggleAction, _isInCombatMode);
|
||||||
|
|
||||||
Dirty();
|
Dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user