actionemptyseedspack.c 907 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. User action for emptying packs of seeds (horticulture)
  3. */
  4. class ActionEmptySeedsPack: ActionSingleUseBase
  5. {
  6. void ActionEmptySeedsPack()
  7. {
  8. m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_EMPTYSEEDSPACK;
  9. m_FullBody = false;
  10. m_Text = "#unbox";
  11. }
  12. override void CreateConditionComponents()
  13. {
  14. m_ConditionItem = new CCINone;
  15. m_ConditionTarget = new CCTNone;
  16. }
  17. override bool HasTarget()
  18. {
  19. return false;
  20. }
  21. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  22. {
  23. return true;
  24. }
  25. override void OnExecuteServer( ActionData action_data )
  26. {
  27. SeedPackBase item_SPB = SeedPackBase.Cast( action_data.m_MainItem );
  28. // The following careful script fixes an issue with VME with unknown repro.
  29. if (item_SPB)
  30. {
  31. PlayerBase player;
  32. if (action_data)
  33. player = action_data.m_Player;
  34. item_SPB.EmptySeedPack( player );
  35. }
  36. }
  37. };