actionopen.c 971 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. class ActionOpen: ActionSingleUseBase
  2. {
  3. void ActionOpen()
  4. {
  5. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENITEM_ONCE;
  6. m_CommandUIDProne = DayZPlayerConstants.CMD_ACTIONFB_OPENITEM_ONCE;
  7. //m_Animation = "open";
  8. m_Text = "#open";
  9. }
  10. override void CreateConditionComponents()
  11. {
  12. m_ConditionItem = new CCINonRuined;
  13. m_ConditionTarget = new CCTNone;
  14. }
  15. override bool HasTarget()
  16. {
  17. return false;
  18. }
  19. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  20. {
  21. if ( item && !item.IsOpen() )
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. override bool ActionConditionContinue( ActionData action_data )
  28. {
  29. return true;
  30. }
  31. override void OnExecuteClient( ActionData action_data )
  32. {
  33. ClearInventoryReservationEx(action_data);
  34. }
  35. override void OnExecuteServer( ActionData action_data )
  36. {
  37. if( !GetGame().IsMultiplayer() )
  38. ClearInventoryReservationEx(action_data);
  39. action_data.m_MainItem.Open();
  40. }
  41. };