improvisedsuppressor.c 973 B

123456789101112131415161718192021222324252627282930313233343536
  1. class ImprovisedSuppressor extends SuppressorBase
  2. {
  3. const int SLOTS_ARRAY = 9;
  4. string slot_names[SLOTS_ARRAY] = { /*"weaponMuzzleAK", */"weaponBayonetAK", "weaponBayonet", "weaponBayonetMosin", "weaponBayonetSKS",/* "weaponMuzzleM4",*/ "weaponMuzzleMosin", /*"pistolMuzzle",*/ "weaponMuzzleMP5" };
  5. override bool CanPutAsAttachment( EntityAI parent )
  6. {
  7. bool cond_state = true;
  8. if (!super.CanPutAsAttachment(parent))
  9. return false;
  10. for ( int i = 0; i < SLOTS_ARRAY ; i++ )
  11. {
  12. if (parent.IsSlotReserved(InventorySlots.GetSlotIdFromString(slot_names[i])))
  13. {
  14. cond_state = false;
  15. break;
  16. }
  17. if ( parent.FindAttachmentBySlotName(slot_names[i]) != NULL )
  18. {
  19. cond_state = false;
  20. break;
  21. }
  22. }
  23. if ( cond_state && !parent.IsKindOf("PlateCarrierHolster") && !parent.IsKindOf("PlateCarrierComplete") && !parent.IsKindOf("CarrierHolsterSolo") && !parent.IsKindOf("ChestHolster") )
  24. {
  25. return true;
  26. }
  27. return false;
  28. }
  29. }