Files
tbd-station-14/Content.Client/GameObjects/EntitySystems/CombatModeSystem.cs
ike709 1d052d0410 Improves the HUD (#3655)
* All good except the combat doll

* Makes the HUD inventory less terrible

* Cleanup, nuke the Combat Mode button

* Harm icon

* Switch the icon

* Basic goon hud

* Toggleable

* Nuke the popup, properly centers it

* Fix clicking the button

* Nuke some old code

* missed a comment

* Remove defaults

* Localization

* Nuke some old yaml

* New sprites

Co-authored-by: ike709 <sparebytes@protonmail.com>
2021-03-27 02:23:12 +11:00

54 lines
1.6 KiB
C#

using Content.Client.GameObjects.Components.Mobs;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Input.Binding;
using Robust.Shared.IoC;
using Robust.Shared.Players;
using Robust.Shared.Timing;
namespace Content.Client.GameObjects.EntitySystems
{
[UsedImplicitly]
public sealed class CombatModeSystem : SharedCombatModeSystem
{
[Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
public override void Initialize()
{
base.Initialize();
_gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged;
}
public override void Shutdown()
{
CommandBinds.Unregister<CombatModeSystem>();
base.Shutdown();
}
public bool IsInCombatMode()
{
var entity = _playerManager.LocalPlayer?.ControlledEntity;
if (entity == null || !entity.TryGetComponent(out CombatModeComponent? combatMode))
{
return false;
}
return combatMode.IsInCombatMode;
}
private void OnTargetingZoneChanged(TargetingZone obj)
{
EntityManager.RaisePredictiveEvent(new CombatModeSystemMessages.SetTargetZoneMessage(obj));
}
}
}