actionworldflagactionswitch.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. class FlagTendencyActionReciveData : ActionReciveData
  2. {
  3. bool m_TendencyRecived;
  4. }
  5. class FlagTendencyActionData : ActionData
  6. {
  7. bool m_Tendency;
  8. };
  9. //!DEPRECATED
  10. class ActionWorldFlagActionSwitch: ActionSingleUseBase
  11. {
  12. bool m_switch_to;
  13. void ActionWorldFlagActionSwitch()
  14. {
  15. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
  16. }
  17. override void CreateConditionComponents()
  18. {
  19. m_ConditionItem = new CCINone;
  20. m_ConditionTarget = new CCTCursor;
  21. }
  22. /*override string GetText()
  23. {
  24. if (!m_switch_to)
  25. return "#switch_to_flag_raise";
  26. return "#switch_to_flag_lower";
  27. }*/
  28. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  29. {
  30. TerritoryFlag totem = TerritoryFlag.Cast( target.GetObject() );
  31. if (!totem)
  32. return false;
  33. float state = totem.GetAnimationPhase("flag_mast");
  34. if ( totem && totem.FindAttachmentBySlotName("Material_FPole_Flag") )
  35. {
  36. if ( player.GetFlagTendencyRaise() && state < 1 )
  37. {
  38. m_switch_to = true;
  39. return true;
  40. }
  41. else if ( !player.GetFlagTendencyRaise() && state > 0 )
  42. {
  43. m_switch_to = false;
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. override void Start( ActionData action_data ) //Setup on start of action
  50. {
  51. super.Start( action_data );
  52. bool state = action_data.m_Player.GetFlagTendencyRaise();
  53. action_data.m_Player.SetFlagTendencyRaise(!state);
  54. }
  55. override bool IsInstant()
  56. {
  57. return true;
  58. }
  59. override bool RemoveForceTargetAfterUse()
  60. {
  61. return false;
  62. }
  63. override typename GetInputType()
  64. {
  65. return InteractActionInput;
  66. }
  67. void SetFlagTendencyOnCurrentActionInvalid(bool state)
  68. {
  69. }
  70. };