actionshavetarget.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. class ActionShaveTargetCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.SHAVE);
  6. }
  7. };
  8. class ActionShaveTarget: ActionContinuousBase
  9. {
  10. void ActionShaveTarget()
  11. {
  12. m_CallbackClass = ActionShaveTargetCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
  14. m_FullBody = true;
  15. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH;
  16. m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
  17. m_Text = "#shave_target";
  18. }
  19. override void CreateConditionComponents()
  20. {
  21. m_ConditionItem = new CCINonRuined;
  22. m_ConditionTarget = new CCTMan(UAMaxDistances.DEFAULT);
  23. }
  24. override bool ActionCondition ( PlayerBase player, ActionTarget target, ItemBase item )
  25. {
  26. PlayerBase man;
  27. Class.CastTo(man, target.GetObject() );
  28. if ( man.CanShave() )
  29. {
  30. return true;
  31. }
  32. return false;
  33. }
  34. override void OnFinishProgressServer( ActionData action_data )
  35. {
  36. PlayerBase man;
  37. if ( action_data.m_Target && Class.CastTo(man, action_data.m_Target.GetObject()) )
  38. {
  39. if (CanReceiveAction(action_data.m_Target))
  40. {
  41. man.ShavePlayer();
  42. }
  43. }
  44. }
  45. };