Melee refactor (#10897)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.CombatMode;
|
||||
using Content.Client.Examine;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Verbs;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -45,6 +47,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
|
||||
private readonly VerbSystem _verbSystem;
|
||||
private readonly ExamineSystem _examineSystem;
|
||||
private readonly SharedCombatModeSystem _combatMode;
|
||||
|
||||
/// <summary>
|
||||
/// This maps the currently displayed entities to the actual GUI elements.
|
||||
@@ -59,12 +62,13 @@ namespace Content.Client.ContextMenu.UI
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_verbSystem = verbSystem;
|
||||
_examineSystem = EntitySystem.Get<ExamineSystem>();
|
||||
_examineSystem = _entityManager.EntitySysManager.GetEntitySystem<ExamineSystem>();
|
||||
_combatMode = _entityManager.EntitySysManager.GetEntitySystem<CombatModeSystem>();
|
||||
|
||||
_cfg.OnValueChanged(CCVars.EntityMenuGroupingType, OnGroupingChanged, true);
|
||||
|
||||
CommandBinds.Builder
|
||||
.Bind(ContentKeyFunctions.OpenContextMenu, new PointerInputCmdHandler(HandleOpenEntityMenu, outsidePrediction: true))
|
||||
.Bind(EngineKeyFunctions.AltUse, new PointerInputCmdHandler(HandleOpenEntityMenu, outsidePrediction: true))
|
||||
.Register<EntityMenuPresenter>();
|
||||
}
|
||||
|
||||
@@ -109,7 +113,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
return;
|
||||
|
||||
// open verb menu?
|
||||
if (args.Function == ContentKeyFunctions.OpenContextMenu)
|
||||
if (args.Function == EngineKeyFunctions.AltUse)
|
||||
{
|
||||
_verbSystem.VerbMenu.OpenVerbMenu(entity.Value);
|
||||
args.Handle();
|
||||
@@ -160,6 +164,9 @@ namespace Content.Client.ContextMenu.UI
|
||||
if (_stateManager.CurrentState is not GameplayStateBase)
|
||||
return false;
|
||||
|
||||
if (_combatMode.IsInCombatMode(args.Session?.AttachedEntity))
|
||||
return false;
|
||||
|
||||
var coords = args.Coordinates.ToMap(_entityManager);
|
||||
|
||||
if (_verbSystem.TryGetEntityMenuEntities(coords, out var entities))
|
||||
|
||||
Reference in New Issue
Block a user