actionunpin.c 877 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class ActionUnpin extends ActionSingleUseBase
  2. {
  3. void ActionUnpin()
  4. {
  5. m_Text = "#unpin";
  6. }
  7. override void CreateConditionComponents()
  8. {
  9. m_ConditionItem = new CCINonRuined;
  10. m_ConditionTarget = new CCTNone;
  11. }
  12. override bool HasTarget()
  13. {
  14. return false;
  15. }
  16. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  17. {
  18. if ( item.IsInherited(Grenade_Base) )
  19. {
  20. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_UNPINGRENAGE;
  21. }
  22. else
  23. {
  24. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_ITEM_ON;
  25. }
  26. Grenade_Base grenade = Grenade_Base.Cast(item);
  27. if( grenade )
  28. {
  29. if( grenade.IsPinned() )
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. override void OnExecute( ActionData action_data )
  37. {
  38. Grenade_Base grenade = Grenade_Base.Cast(action_data.m_MainItem);
  39. if( grenade )
  40. {
  41. grenade.Unpin();
  42. }
  43. }
  44. }