2020-01-26 03:38:51 +01:00
|
|
|
using Content.Client.GameObjects.Components.Mobs;
|
2019-09-26 22:32:32 +02:00
|
|
|
using Content.Client.UserInterface;
|
|
|
|
|
using Content.Shared.GameObjects.Components.Mobs;
|
2020-03-25 17:53:50 +01:00
|
|
|
using Content.Shared.GameObjects.EntitySystemMessages;
|
2020-03-25 11:16:57 +01:00
|
|
|
using Content.Shared.GameObjects.EntitySystems;
|
2020-01-26 03:38:51 +01:00
|
|
|
using Content.Shared.Input;
|
2020-03-25 11:16:57 +01:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Client.GameObjects;
|
2020-01-26 03:38:51 +01:00
|
|
|
using Robust.Client.Player;
|
2020-05-31 14:32:05 -07:00
|
|
|
using Robust.Shared.Input.Binding;
|
2019-09-26 22:32:32 +02:00
|
|
|
using Robust.Shared.IoC;
|
2020-01-26 03:38:51 +01:00
|
|
|
using Robust.Shared.Players;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Shared.Timing;
|
2019-09-26 22:32:32 +02:00
|
|
|
|
|
|
|
|
namespace Content.Client.GameObjects.EntitySystems
|
|
|
|
|
{
|
2020-03-25 11:16:57 +01:00
|
|
|
[UsedImplicitly]
|
|
|
|
|
public sealed class CombatModeSystem : SharedCombatModeSystem
|
2019-09-26 22:32:32 +02:00
|
|
|
{
|
2020-08-24 14:10:28 +02:00
|
|
|
[Dependency] private readonly IGameHud _gameHud = default!;
|
|
|
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
|
|
|
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
2019-09-26 22:32:32 +02:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
_gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged;
|
2020-05-31 14:32:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Shutdown()
|
|
|
|
|
{
|
|
|
|
|
CommandBinds.Unregister<CombatModeSystem>();
|
|
|
|
|
base.Shutdown();
|
2020-01-26 03:38:51 +01:00
|
|
|
}
|
|
|
|
|
|
2020-05-03 14:26:49 +02:00
|
|
|
public bool IsInCombatMode()
|
2020-01-26 03:38:51 +01:00
|
|
|
{
|
2021-03-10 14:48:29 +01:00
|
|
|
var entity = _playerManager.LocalPlayer?.ControlledEntity;
|
|
|
|
|
if (entity == null || !entity.TryGetComponent(out CombatModeComponent? combatMode))
|
2020-01-26 03:38:51 +01:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return combatMode.IsInCombatMode;
|
2019-09-26 22:32:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnTargetingZoneChanged(TargetingZone obj)
|
|
|
|
|
{
|
2020-03-25 17:53:50 +01:00
|
|
|
EntityManager.RaisePredictiveEvent(new CombatModeSystemMessages.SetTargetZoneMessage(obj));
|
2019-09-26 22:32:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|