3 static ELogitechLEDState m_CurrentState = ELogitechLEDState.DEFAULT;
4 static string s_sReloadKey;
5 static string s_sVONDirectKey;
6 static string s_sVONChannelKey;
9 static void ActivateState(ELogitechLEDState state)
11 if (state == m_CurrentState)
14 bool isLogiLEDEnabled;
17 settings.Get(
"m_bLogitechSupport", isLogiLEDEnabled);
19 if (!isLogiLEDEnabled)
24 case ELogitechLEDState.DEFAULT:
27 case ELogitechLEDState.BLEEDING:
30 case ELogitechLEDState.UNCONSCIOUS:
31 SetEffectUnconscious();
32 case ELogitechLEDState.RELOAD:
35 case ELogitechLEDState.COMMS:
43 static void SetFactionColor(
Faction currentFaction)
48 bool isLogiLEDEnabled;
51 settings.Get(
"m_bLogitechSupport", isLogiLEDEnabled);
53 if (!isLogiLEDEnabled)
62 switch (currentFaction.GetFactionKey())
80 logiLed.SetLighting(r, g, b);
84 private static void SetEffectBleeding()
86 if (m_CurrentState == ELogitechLEDState.UNCONSCIOUS)
102 string quicksSlotActionName;
108 quicksSlotActionName =
"SwitchWeaponCategory1";
111 quicksSlotActionName =
"SwitchWeaponCategory2";
114 quicksSlotActionName =
"SwitchWeaponCategory3";
117 quicksSlotActionName =
"SwitchWeaponCategory4";
120 quicksSlotActionName =
"SwitchWeaponCategory5";
123 quicksSlotActionName =
"SwitchWeaponCategory6";
126 quicksSlotActionName =
"SwitchWeaponCategory7";
129 quicksSlotActionName =
"SwitchWeaponCategory8";
132 quicksSlotActionName =
"SwitchWeaponCategory9";
135 quicksSlotActionName =
"SwitchWeaponCategory0";
140 array<string> bindings = {};
142 binding.GetBindings(quicksSlotActionName, bindings, EInputDeviceType.KEYBOARD,
"click",
false);
148 logiLed.SaveCurrentLighting();
150 if (!bindings.IsEmpty())
151 logiLed.FlashSingleKey(bindings[0], 0, 50, 0, 0, 500);
153 logiLed.PulseLighting(100, 0, 0, 0, 1000);
155 m_CurrentState = ELogitechLEDState.BLEEDING;
159 private static void SetDefault()
165 if (m_CurrentState == ELogitechLEDState.RELOAD)
168 GetGame().GetCallqueue().Remove(EndEffectReload);
170 else if (m_CurrentState == ELogitechLEDState.COMMS)
173 GetGame().GetCallqueue().Remove(EndEffectComms);
176 logiLed.StopEffects();
177 logiLed.RestoreLighting();
178 m_CurrentState = ELogitechLEDState.DEFAULT;
182 private static void SetEffectUnconscious()
192 logiLed.SaveCurrentLighting();
193 logiLed.SetLighting(15, 15, 15);
194 m_CurrentState = ELogitechLEDState.UNCONSCIOUS;
198 private static void SetEffectReload()
200 if (m_CurrentState == ELogitechLEDState.BLEEDING || m_CurrentState == ELogitechLEDState.UNCONSCIOUS)
208 array<string> bindings = {};
210 binding.GetBindings(
"CharacterReload", bindings, EInputDeviceType.KEYBOARD,
"click",
false);
212 if (bindings.IsEmpty())
215 s_sReloadKey = bindings[0];
218 logiLed.SaveCurrentLighting();
219 logiLed.FlashSingleKey(s_sReloadKey, 65, 47, 2, 0, 500);
220 m_CurrentState = ELogitechLEDState.RELOAD;
222 GetGame().GetCallqueue().CallLater(EndEffectReload, 3000);
226 private static void EndEffectReload()
228 if (m_CurrentState != ELogitechLEDState.RELOAD )
235 logiLed.StopEffectsOnKey(s_sReloadKey);
236 logiLed.RestoreLighting();
238 m_CurrentState = ELogitechLEDState.DEFAULT;
242 private static void SetEffectComms()
244 if (m_CurrentState == ELogitechLEDState.BLEEDING || m_CurrentState == ELogitechLEDState.UNCONSCIOUS)
253 array<string> bindingsDirect = {};
254 array<string> bindingsChannel = {};
256 binding.GetBindings(
"VONDirect", bindingsDirect, EInputDeviceType.KEYBOARD,
"hold",
false);
257 binding.GetBindings(
"VONChannel", bindingsChannel, EInputDeviceType.KEYBOARD,
"hold",
false);
259 if (!bindingsDirect.IsEmpty())
260 s_sVONDirectKey = bindingsDirect[0];
262 if (!bindingsChannel.IsEmpty())
263 s_sVONChannelKey = bindingsChannel[0];
265 logiLed.SaveCurrentLighting();
267 logiLed.FlashSingleKey(s_sVONDirectKey, 65, 47, 2, 0, 500);
268 logiLed.FlashSingleKey(s_sVONChannelKey, 65, 47, 2, 0, 500);
270 m_CurrentState = ELogitechLEDState.COMMS;
272 GetGame().GetCallqueue().CallLater(EndEffectComms, 3000);
276 private static void EndEffectComms()
278 if (m_CurrentState != ELogitechLEDState.COMMS )
285 logiLed.StopEffectsOnKey(s_sVONDirectKey);
286 logiLed.StopEffectsOnKey(s_sVONChannelKey);
287 logiLed.RestoreLighting();
289 m_CurrentState = ELogitechLEDState.DEFAULT;