actionfertilizeslot.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. class ActionFertilizeSlotCB : ActionContinuousBaseCB
  2. {
  3. private const float QUANTITY_USED_PER_SEC = 10;
  4. override void CreateActionComponent()
  5. {
  6. m_ActionData.m_ActionComponent = new CAContinuousFertilizeGardenSlot(QUANTITY_USED_PER_SEC);
  7. }
  8. };
  9. class ActionFertilizeSlot: ActionContinuousBase
  10. {
  11. void ActionFertilizeSlot()
  12. {
  13. m_CallbackClass = ActionFertilizeSlotCB;
  14. m_SpecialtyWeight = UASoftSkillsWeight.ROUGH_MEDIUM;
  15. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_INTERACT;
  16. m_FullBody = true;
  17. m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
  18. m_Text = "#fertilize_slot";
  19. }
  20. override void CreateConditionComponents()
  21. {
  22. m_ConditionTarget = new CCTDummy;
  23. m_ConditionItem = new CCINonRuined;
  24. }
  25. override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item )
  26. {
  27. GardenBase garden_base;
  28. if ( Class.CastTo(garden_base, target.GetObject()))
  29. {
  30. Slot slot;
  31. array<string> selections = new array<string>;
  32. garden_base.GetActionComponentNameList(target.GetComponentIndex(), selections);
  33. string selection;
  34. for (int s = 0; s < selections.Count(); s++)
  35. {
  36. selection = selections[s];
  37. slot = garden_base.GetSlotBySelection( selection );
  38. if (slot)
  39. break;
  40. }
  41. if ( garden_base.NeedsFertilization( selection ) )
  42. {
  43. if ( item.GetQuantity() > 0 )
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. override void OnFinishProgressServer( ActionData action_data )
  52. {
  53. // The functionality is in the Execute event of this user action's component.
  54. }
  55. };