actioncoverheadself.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. class ActionCoverHeadSelfCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.COVER_HEAD);
  6. }
  7. };
  8. class ActionCoverHeadSelf: ActionContinuousBase
  9. {
  10. void ActionCoverHeadSelf()
  11. {
  12. m_CallbackClass = ActionCoverHeadSelfCB;
  13. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_COVERHEAD_SELF;
  14. m_StanceMask = DayZPlayerConstants.STANCEMASK_ERECT | DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_PRONE;
  15. //m_Animation = "INJECTEPIPENS";
  16. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_LOW;
  17. m_Text = "#put_on_head";
  18. }
  19. override void CreateConditionComponents()
  20. {
  21. m_ConditionItem = new CCINonRuined;
  22. m_ConditionTarget = new CCTSelf;
  23. }
  24. override bool HasTarget()
  25. {
  26. return false;
  27. }
  28. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  29. {
  30. if (IsWearingHeadgear(player))
  31. return false;
  32. return true;
  33. }
  34. override void OnFinishProgressServer( ActionData action_data )
  35. {
  36. ItemBase new_item;
  37. if (Class.CastTo(new_item,action_data.m_Player.GetInventory().CreateAttachmentEx("BurlapSackCover",InventorySlots.HEADGEAR)))
  38. {
  39. MiscGameplayFunctions.TransferItemProperties(action_data.m_MainItem,new_item,true,false,true);
  40. action_data.m_MainItem.Delete();
  41. }
  42. }
  43. bool IsWearingHeadgear( PlayerBase player )
  44. {
  45. if (player.GetInventory().FindAttachment(InventorySlots.HEADGEAR))
  46. {
  47. return true;
  48. }
  49. return false;
  50. }
  51. };