actiondisinfectplant.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. class ActionDisinfectPlantCB : ActionContinuousBaseCB
  2. {
  3. override void CreateActionComponent()
  4. {
  5. m_ActionData.m_ActionComponent = new CAContinuousDisinfectPlant(UAQuantityConsumed.GARDEN_DISINFECT_PLANT);
  6. }
  7. };
  8. class ActionDisinfectPlant: ActionContinuousBase
  9. {
  10. PlantBase m_Plant;
  11. void ActionDisinfectPlant()
  12. {
  13. m_CallbackClass = ActionDisinfectPlantCB;
  14. m_SpecialtyWeight = UASoftSkillsWeight.PRECISE_LOW;
  15. m_CommandUID = DayZPlayerConstants.CMD_ACTIONFB_SPRAYPLANT;
  16. //m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH;
  17. m_FullBody = true;
  18. m_Text = "#apply";
  19. }
  20. override void CreateConditionComponents()
  21. {
  22. m_ConditionTarget = new CCTNonRuined(UAMaxDistances.DEFAULT);
  23. m_ConditionItem = new CCINotRuinedAndEmpty;
  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 ( slot && slot.GetPlant() )
  42. {
  43. m_Plant = PlantBase.Cast(slot.GetPlant());
  44. if (m_Plant.IsSprayable())
  45. {
  46. if ( m_Plant.GetPlantStateIndex() < 1 )
  47. return false;
  48. if ( item.GetQuantity() > 0 )
  49. {
  50. return true;
  51. }
  52. }
  53. }
  54. }
  55. return false;
  56. }
  57. };