plantmaterial.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. class PlantMaterial extends Inventory_Base
  2. {
  3. override bool CanPutAsAttachment( EntityAI parent )
  4. {
  5. if (!super.CanPutAsAttachment(parent))
  6. {
  7. return false;
  8. }
  9. /*const int SLOTS_ARRAY1 = 6;
  10. const int SLOTS_ARRAY2 = 7;
  11. bool is_barrel = false;
  12. bool is_opened_barrel = false;
  13. bool slot_test1 = true;
  14. bool slot_test2 = true;
  15. string slot_names1[SLOTS_ARRAY1] = { "Nails", "OakBark", "BirchBark", "Lime", "Disinfectant", "Guts" };
  16. string slot_names2[SLOTS_ARRAY2] = { "BerryR", "BerryB", "Nails", "OakBark", "BirchBark", "Lime", "Disinfectant" };
  17. // is barrel
  18. if ( parent.IsKindOf("Barrel_ColorBase") )
  19. {
  20. is_barrel = true;
  21. }
  22. // is opened barrel
  23. if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
  24. {
  25. is_opened_barrel = true;
  26. }
  27. // all of the barrel attachment slots are empty (first set of ingredients)
  28. for ( int idx1 = 0; idx1 < SLOTS_ARRAY1 ; idx1++ )
  29. {
  30. if ( parent.FindAttachmentBySlotName(slot_names1[idx1]) != NULL )
  31. {
  32. slot_test1 = false;
  33. break;
  34. }
  35. }
  36. // all of the barrel attachment slots are empty (second set of ingredients)
  37. for ( int idx2 = 0; idx2 < SLOTS_ARRAY2 ; idx2++ )
  38. {
  39. if ( parent.FindAttachmentBySlotName(slot_names2[idx2]) != NULL )
  40. {
  41. slot_test2 = false;
  42. break;
  43. }
  44. }
  45. if ( ( is_opened_barrel && slot_test1 ) || ( is_opened_barrel && slot_test2) || !is_barrel )
  46. {
  47. return true;
  48. }*/
  49. return false;
  50. }
  51. override bool CanDetachAttachment( EntityAI parent )
  52. {
  53. /*bool is_barrel = false;
  54. bool is_opened_barrel = false;
  55. // is barrel
  56. if ( parent.IsKindOf("Barrel_ColorBase") )
  57. {
  58. is_barrel = true;
  59. }
  60. // is opened barrel
  61. if ( is_barrel && parent.GetAnimationPhase("Lid") == 1 )
  62. {
  63. is_opened_barrel = true;
  64. }
  65. if ( is_opened_barrel || !is_barrel )
  66. {
  67. return true;
  68. }*/
  69. return false;
  70. }
  71. override void SetActions()
  72. {
  73. super.SetActions();
  74. AddAction(ActionFertilizeSlot);
  75. }
  76. override void InitItemVariables()
  77. {
  78. super.InitItemVariables();
  79. can_this_be_combined = true;
  80. }
  81. }