actionturnoffwhileinhands.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. class ActionTurnOffWhileInHands : ActionSingleUseBase
  2. {
  3. void ActionTurnOffWhileInHands()
  4. {
  5. m_Text = "#switch_off";
  6. }
  7. override void CreateConditionComponents()
  8. {
  9. m_ConditionItem = new CCINonRuined();
  10. m_ConditionTarget = new CCTNone();
  11. }
  12. override bool HasTarget()
  13. {
  14. return false;
  15. }
  16. override bool HasProneException()
  17. {
  18. return true;
  19. }
  20. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  21. {
  22. if (item.IsInherited(Roadflare))
  23. {
  24. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_LIGHTFLARE;
  25. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_LIGHTFLARE;
  26. }
  27. else if (item.IsInherited(Chemlight_ColorBase))
  28. {
  29. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_LITCHEMLIGHT;
  30. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_LITCHEMLIGHT;
  31. }
  32. else if (item.IsInherited(GPSReceiver))
  33. {
  34. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_PRESS_TRIGGER;
  35. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_PRESS_TRIGGER;
  36. }
  37. else
  38. {
  39. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ITEM_OFF;
  40. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_ITEM_OFF;
  41. }
  42. return item.HasEnergyManager() && item.GetCompEM().CanSwitchOff();
  43. }
  44. override void OnExecuteServer(ActionData action_data)
  45. {
  46. action_data.m_MainItem.GetCompEM().SwitchOff();
  47. }
  48. }