2021-06-09 22:19:39 +02:00
|
|
|
using Content.Client.HUD;
|
|
|
|
|
using Content.Shared.CombatMode;
|
|
|
|
|
using Content.Shared.Targeting;
|
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;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.CombatMode
|
2019-09-26 22:32:32 +02:00
|
|
|
{
|
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!;
|
2019-09-26 22:32:32 +02:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
|
|
|
_gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged;
|
2021-06-18 01:49:18 -07:00
|
|
|
|
|
|
|
|
SubscribeLocalEvent<CombatModeComponent, PlayerAttachedEvent>((_, component, _) => component.PlayerAttached());
|
|
|
|
|
SubscribeLocalEvent<CombatModeComponent, PlayerDetachedEvent>((_, component, _) => component.PlayerDetached());
|
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-12-06 14:00:39 +01:00
|
|
|
return EntityManager.TryGetComponent(_playerManager.LocalPlayer?.ControlledEntity, out CombatModeComponent? combatMode) &&
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
2021-12-06 14:00:39 +01:00
|
|
|
|
|
|
|
|
public static class A
|
|
|
|
|
{
|
|
|
|
|
}
|
2019-09-26 22:32:32 +02:00
|
|
|
}
|