disinfectantspray.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. class DisinfectantSpray : Edible_Base
  2. {
  3. override void InitItemVariables()
  4. {
  5. super.InitItemVariables();
  6. can_this_be_combined = true;
  7. m_VarLiquidType = GetLiquidTypeInit();
  8. }
  9. override bool CanPutAsAttachment(EntityAI parent)
  10. {
  11. if (!super.CanPutAsAttachment(parent))
  12. return false;
  13. const int SLOTS_ARRAY = 8;
  14. bool isBarrel;
  15. bool isBarrelOpened;
  16. bool slotsEmptyTest = true;
  17. string slotNames[SLOTS_ARRAY] = {"BerryR", "BerryB", "Plant", "Nails", "OakBark", "BirchBark", "Lime", "Guts"};
  18. if (parent.IsKindOf("Barrel_ColorBase"))
  19. isBarrel = true;
  20. if (isBarrel && parent.GetAnimationPhase("Lid") == 1)
  21. isBarrelOpened = true;
  22. for (int i = 0; i < SLOTS_ARRAY ; ++i)
  23. {
  24. if (parent.FindAttachmentBySlotName(slotNames[i]) != null)
  25. {
  26. slotsEmptyTest = false;
  27. break;
  28. }
  29. }
  30. if ((isBarrelOpened && slotsEmptyTest) || !isBarrel)
  31. return true;
  32. return false;
  33. }
  34. override bool CanDetachAttachment( EntityAI parent )
  35. {
  36. bool isBarrel;
  37. bool isBarrelOpened;
  38. if (parent.IsKindOf("Barrel_ColorBase"))
  39. isBarrel = true;
  40. if (isBarrel && parent.GetAnimationPhase("Lid") == 1)
  41. isBarrelOpened = true;
  42. if (isBarrelOpened || !isBarrel)
  43. return true;
  44. return false;
  45. }
  46. override float GetDisinfectQuantity(int system = 0, Param param1 = null)
  47. {
  48. return (GetQuantityMax() * 0.15);
  49. }
  50. override void SetActions()
  51. {
  52. super.SetActions();
  53. AddAction(ActionDisinfectTarget);
  54. AddAction(ActionDisinfectSelf);
  55. AddAction(ActionDisinfectPlant);
  56. AddAction(ActionWashHandsItemContinuous);
  57. }
  58. }