actionraiseflag.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. class ActionManipulateFlagCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousRepeat(1);
  6. }
  7. };
  8. class ActionRaiseFlag: ActionContinuousBase
  9. {
  10. void ActionRaiseFlag()
  11. {
  12. m_CallbackClass = ActionManipulateFlagCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_RAISE_FLAG;
  14. m_FullBody = true;
  15. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT;
  16. m_Text = "#raise_flag";
  17. }
  18. override void CreateConditionComponents()
  19. {
  20. m_ConditionTarget = new CCTCursor;
  21. m_ConditionItem = new CCINone;
  22. }
  23. override typename GetInputType()
  24. {
  25. return ContinuousInteractActionInput;
  26. }
  27. override bool HasTarget()
  28. {
  29. return true;
  30. }
  31. override bool HasProgress()
  32. {
  33. return true;
  34. }
  35. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  36. {
  37. TerritoryFlag totem = TerritoryFlag.Cast( target.GetObject() );
  38. if (!totem)
  39. return false;
  40. float state = totem.GetAnimationPhase("flag_mast");
  41. if ( totem.FindAttachmentBySlotName("Material_FPole_Flag") && state > 0 )
  42. {
  43. return true;
  44. }
  45. return false;
  46. }
  47. override void OnFinishProgressServer( ActionData action_data )
  48. {
  49. TerritoryFlag totem = TerritoryFlag.Cast( action_data.m_Target.GetObject() );
  50. if ( totem )
  51. {
  52. totem.AnimateFlagEx(totem.GetAnimationPhase("flag_mast") - UAMisc.FLAG_STEP_INCREMENT, action_data.m_Player);
  53. totem.AddRefresherTime01(UAMisc.FLAG_STEP_INCREMENT);
  54. }
  55. }
  56. };