actionbandageself.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. class ActionBandageSelfCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. float effectivity = m_ActionData.m_MainItem.GetBandagingEffectivity();
  6. float adjustedTimeSpent = 0;
  7. if (effectivity > 0)
  8. adjustedTimeSpent = UATimeSpent.BANDAGE / effectivity;
  9. m_ActionData.m_ActionComponent = new CAContinuousRepeat(adjustedTimeSpent);
  10. }
  11. }
  12. class ActionBandageSelf : ActionBandageBase
  13. {
  14. void ActionBandageSelf()
  15. {
  16. m_CallbackClass = ActionBandageSelfCB;
  17. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_BANDAGE;
  18. m_FullBody = true;
  19. m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
  20. m_Text = "#treat_wound";
  21. }
  22. override void CreateConditionComponents()
  23. {
  24. m_ConditionItem = new CCINonRuined();
  25. m_ConditionTarget = new CCTSelf();
  26. }
  27. override bool HasTarget()
  28. {
  29. return false;
  30. }
  31. override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
  32. {
  33. return player.IsBleeding();
  34. }
  35. override void OnFinishProgressServer(ActionData action_data)
  36. {
  37. PlayerBase target = PlayerBase.Cast(action_data.m_Player);
  38. if (action_data.m_MainItem && target)
  39. ApplyBandage(action_data.m_MainItem, target);
  40. }
  41. }