# Defining a rack setup
#
# Initially we define the racks, stations and compatible weapons.
# Weapons can be specified via its simweapondata number, the weapon class or
# its weapon index number.

# To start a rack definition, use

# definerack <name>

# You can have each of addswd, addwid & addwclass in each rack definition, but
# not multiples.  These commands tell the code that particular weapons are loadable
# on a given rack

# addswd is used to add an array of swd index numbers
# addwid is used to add weapon id numbers
# addwclass is used to add weapon classes
#   addwclass keywords are:
#     "aim","rocket","bomb","gun","ecm","tank","agm",
#     "harm","sam","gbu","camera"

# Jettison

# weapjettmodes specifies if weapons can be jettisoned from their parents
# rackjettmodes specifies is racks can be jetted from it's parent
#	"emergency" & "selective"
# they both default to "EMERGENCY,SELECTIVE"

# a rackct of 0 signifies "no rack", and the weapon will be attached
# to the pylon or a/c without a rack

# TODO

# Add drag multipliers for weapons in the rack/pylons, which can 
# be used to affect the drag value (for recessed etc)

definerack mrp-no-rack
	weapjettmodes NONE
	rackjettmodes NONE
	rackct 0
	rackstations 1
	addwid 515

definerack ecm-camera-no-rack
	weapjettmodes NONE
	rackjettmodes NONE
	rackct 0
	rackstations 1
	addwclass ecm camera

definerack no-rack	
	rackct 0
	rackstations 1
	addwclass rocket, bomb, tank, agm, gbu, ecm
	addwid 258, 259, 298, 313, 513

definerack aim-no-rail
	rackct 0
	rackstations 1
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

definerack aim-with-rail
	rackct 2872
	rackstations 1
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

# rotated 45' and recessed
definerack aim-recessed-left
	rackct 3500
	rackstations 1
	weapjettmodes NONE
	rackjettmodes NONE
	# all Aim-7s, Aim-9s, Aim-54s and Aim-120s
	addwid 466 467 280 465 1 56 530 281 282 290 288 283 291 12 2 150 477 9

# rotated 45' and recessed
definerack aim-recessed-right
	rackct 3501
	rackstations 1
	weapjettmodes NONE
	rackjettmodes NONE
	# all Aim-7s, Aim-9s, Aim-54s and Aim-120s
	addwid 466 467 280 465 1 56 530 281 282 290 288 283 291 12 2 150 477 9


# Aim-7 & F-18
definerack lau-115
	rackct 3348
	rackstations 1
	weapjettmodes SELECTIVE
	rackjettmodes SELECTIVE
	addwid 466 467 280 465 1

definerack aimx2
	rackct 0
	rackstations 2731
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

definerack bru-41-left
	racksmsname MER
	rackct 2876
	rackstations 6
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu

definerack bru-41-right
	racksmsname MER
	rackct 2876
	rackstations 6
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu

# ITER 
definerack bru-42i-left
	racksmsname TER
	rackct 2812
	rackstations 3
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu
	addloadorder 0
	addloadorder 1 0
	addloadorder 1 0 2


# ITER 
definerack bru-42i-right
	racksmsname TER
	rackct 2812
	rackstations 3
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu
	addloadorder 0
	addloadorder 2 0
	addloadorder 2 0 1

# TER 
definerack bru-42-left
	racksmsname TER
	rackct 2813
	rackstations 3
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu
	addloadorder 2
	addloadorder 2 1
	addloadorder 2 1 0


# TER 
definerack bru-42-right
	racksmsname TER
	rackct 2813
	rackstations 3
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu
	addloadorder 2
	addloadorder 2 0
	addloadorder 2 0 1

# 
definerack bru-55-left	
	racksmsname SER
	rackct 1979
	rackstations 2
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu, agm
	addloadorder 0
	addloadorder 1 0

definerack bru-55-right	
	racksmsname SER
	rackct 1979
	rackstations 2
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu, agm
	addloadorder 0
	addloadorder 0 1

# Rack for BDU-33D/B (4+)
definerack suu-20	
	racksmsname SUU20
	rackct 3681
	rackstations 6
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwid 517

# Rack for BDU-33D/B (>3)
definerack bru-42bdu-left
	racksmsname TER
	rackct 2812
	rackstations 3
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwid 517
	addloadorder 0
	addloadorder 1 0
	addloadorder 1 0 2


# Rack for BDU-33D/B (>3)
definerack bru-42bdu-right
	racksmsname TER
	rackct 2812
	rackstations 3
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwid 517
	addloadorder 0
	addloadorder 2 0
	addloadorder 2 0 1

# 
definerack bru-57-left	
	racksmsname SER
	rackct 1979
	rackstations 2
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwid 258, 259, 298, 313, 513
	addloadorder 0
	addloadorder 1 0

definerack bru-57-right	
	racksmsname SER
	rackct 1979
	rackstations 2
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwid 258, 259, 298, 313, 513
	addloadorder 0
	addloadorder 0 1

# Maverick x 3
definerack lau-88-left
	racksmsname L88
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	rackct 2810
	rackstations 3
	addwid 4 18 19 20
	addloadorder 1 2
	addloadorder 0 1 2 

# Maverick x 3
definerack lau-88-right
	racksmsname L88
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	rackct 2810
	rackstations 3
	addwid 4 18 19 20
	addloadorder 0 2
	addloadorder 0 1 2

# Maverick
definerack lau-117
	racksmsname L117
	weapjettmodes NONE
	rackct 1982
	rackstations 1
	addwid 4 18 19 20

# HARM
definerack lau-118
	racksmsname L118
	rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	rackct 1859
	rackstations 1
#	addwid 23
	addwclass harm

###########################################
###########################################
###########################################
#
# hardpoint groups, these are used according to
# the hardpointXXGrp data specified in the a/c.dat file

# the group is searched until a rack definition is found that
# matches the weapon being loaded, and the qty of that weapon.

# multiple pylon styles can be added per group, and each pylon
# can hold several different rack styles.

# pylonjettmodes will determine whether or not a particular
# pylon can be jettisoned under what conditions

###########################################
###########################################
###########################################

definerack a10-centerrack
	racksmsname MAU
	rackct 2808
	rackstations 3
	#rackjettmodes EMERGENCY,SELECTIVE
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu
	addloadorder 1
	addloadorder 0 2
	addloadorder 0 2 1

# for a/c with pylons as part of the a/c LOD
definegroup a10-center
	addpylon
		addrack lau-117
		addrack lau-118
		addrack aim-with-rail
		addrack no-rack
		addrack a10-centerrack
		addrack lau-88-left
		addrack bru-42-left
		addrack bru-41-left
	
###########################################
###########################################
###########################################

definerack b52-dualmer-rack
	rackct 2727
	rackstations 12
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu, agm, harm

definerack b52-hsab-rack
	rackct 2880
	rackstations 9
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass rocket, bomb, gbu, agm, harm
	addloadorder 6
	addloadorder 6 0
	addloadorder 6 3 0
	addloadorder 2 8 1 7
	addloadorder 2 8 1 7 3
	addloadorder 2 8 1 7 6 0 
	addloadorder 2 8 1 7 6 0 3
	addloadorder 2 8 4 1 7 6 0 3
	addloadorder 2 8 4 1 7 5 6 0 3

definegroup b52-hsab
	addpylon
		addrack b52-hsab-rack

definegroup b52-dualmer
	addpylon
		addrack b52-dualmer-rack

###########################################
###########################################
###########################################

definerack f4-pylon-aa-left
	rackct 3537
	rackstations 2
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim
	
definerack f4-pylon-aa-right
	rackct 3537
	rackstations 2
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim
	addloadorder 1 0
	
definegroup f4-inner-wing-left
	addpylon 
		addrack f4-pylon-aa-left
		addrack lau-117
		addrack lau-88-left
		addrack lau-118
		addrack no-rack
		addrack bru-42-left
		addrack bru-41-left	
	
definegroup f4-inner-wing-right
	addpylon 
		addrack f4-pylon-aa-right
		addrack lau-117
		addrack lau-88-right
		addrack lau-118
		addrack no-rack
		addrack bru-42-right
		addrack bru-41-right

###########################################
###########################################
###########################################

definerack f8-aim-left
	rackct 3076
	rackstations 1
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

definerack f8-aim-right
	rackct 3079
	rackstations 1
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

definerack f8-aimx2-left
	rackct 3076
	rackstations 2
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

definerack f8-aimx2-right
	rackct 3079
	rackstations 2
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

definegroup f8-left
	addpylon
		pylonsmsname MAU
		pylonct 3077
		addrack no-rack
		addrack bru-42-left

definegroup f8-right
	addpylon
		pylonsmsname MAU
		pylonct 3077
		addrack no-rack
		addrack bru-42-right

definegroup f8-leftfuse
	addpylon
		addrack f8-aim-left
		addrack f8-aimx2-left

definegroup f8-rightfuse
	addpylon
		addrack f8-aim-left
		addrack f8-aimx2-left

###########################################
###########################################
###########################################

definerack f14-aim54-fuserack
	rackct 2784
	rackstations 4
	weapjettmodes SELECTIVE
	addwid 477 9

definerack f14-aim7-fuserack
	rackct 2783
	rackstations 4
	weapjettmodes SELECTIVE
	addwclass aim

definerack f14-ag-fuserack
	rackct 2792
	rackstations 4
	weapjettmodes EMERGENCY,SELECTIVE
	addany
	addswd 0

definegroup f14-fuselage
	addpylon
		pylonsmsname MAU
		pylonct 0
	    addrack f14-aim54-fuserack
		addrack f14-aim7-fuserack
		addrack f14-ag-fuserack

definegroup f14-aim
	addpylon
		pylonsmsname MAU
		pylonct 0
		addrack aim-with-rail

definegroup f14-pylon
	addpylon
		pylonsmsname MAU
		pylonct 0
	    addrack aim-recessed-left
	    addrack aim-no-rail
		addrack no-rack

definegroup f14-nacelle
	addpylon
		pylonsmsname MAU
		pylonct 0
		addrack no-rack

###########################################
###########################################
###########################################

definerack f15e-cft-rack-left
	rackct 2726
	rackstations 6
	weapjettmodes EMERGENCY,SELECTIVE
	addany
	addswd 0


definerack f15e-cft-rack-right
	rackct 2725
	rackstations 6
	weapjettmodes EMERGENCY,SELECTIVE
	addany
	addswd 0

definerack f15e-cft-aa-rack-left
	rackct 2726
	rackstations 3
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass aim
	addloadorder 0 2

definerack f15e-cft-aa-rack-right
	rackct 2725
	rackstations 3
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass aim
	addloadorder 0 2

definerack f15e-cft-large-rack-left
	rackct 2726
	rackstations 6
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass gbu
	addwid 6 76 82 258 260 # mk83 bsu50 GBU-31(v)3/B GBU-35(v)1/B GBU-31(v)1/B
	addloadorder 0 2 5 3


definerack f15e-cft-large-rack-right
	rackct 2725
	rackstations 6
	weapjettmodes EMERGENCY,SELECTIVE
	addwclass gbu
	addwid 6 76 82 258 260 # mk83 bsu50 GBU-31(v)3/B GBU-35(v)1/B GBU-31(v)1/B
	addloadorder 0 2 5 3


definegroup f15e-cft-left
	addpylon
		pylonsmsname FST
		pylonct 0
		addrack f15e-cft-aa-rack-left
		addrack f15e-cft-large-rack-left
		addrack f15e-cft-rack-left

definegroup f15e-cft-right
	addpylon
		pylonsmsname FST
		pylonct 0
		addrack f15e-cft-aa-rack-right
		addrack f15e-cft-large-rack-right
		addrack f15e-cft-rack-right


definegroup f15e-center
	addpylon
		pylonsmsname MAU
		pylonct 2873
		addrack lau-117
		addrack lau-118
		addrack aim-with-rail
		addrack no-rack
		addrack lau-88-left
		addrack bru-42-left
		addrack bru-41-left
		
definegroup f15c-center
	addpylon
		pylonsmsname MAU
		pylonct 3347
		addrack lau-117
		addrack lau-118
		addrack aim-with-rail
		addrack no-rack
		addrack lau-88-left
		addrack bru-42-left
		addrack bru-41-left	

###########################################
###########################################
###########################################

definerack f-16-370-wing-tank
	weapjettmodes EMERGENCY,SELECTIVE
	rackjettmodes NONE
	rackct 3084
	rackstations 1
	addwclass tank

definerack f-16-600-wing-tank
	weapjettmodes EMERGENCY,SELECTIVE
	rackjettmodes NONE
	rackct 3571
	rackstations 1
	addwid 200

definerack f-16-center-tank
	weapjettmodes EMERGENCY,SELECTIVE
	rackjettmodes NONE 
	rackct 0
	rackstations 1
	addwclass tank

definegroup f16-wingtip
	addpylon
		pylonsmsname LNCHW
		pylonct 0
        	addrack aim-no-rail

definegroup f16-2/8
	addpylon
		pylonsmsname LNCH	
		pylonct 1858
        	addrack aim-no-rail

definegroup f16-3/4		
	# wing tank	
	addpylon	
		addrack f-16-370-wing-tank
		addrack f-16-600-wing-tank
	# normal pylon	
	addpylon	
		pylonsmsname MAU
		pylonct 1980
		#order by number of slots
		addrack lau-117
		addrack lau-118
		addrack no-rack
		addrack lau-88-left
		addrack bru-42i-left
		addrack bru-57-left
		addrack bru-42bdu-left
		addrack suu-20

	addpylon	
		pylonsmsname LNCH
		pylonct 1858
        	addrack aim-no-rail	

definegroup f16-6/7		
	# wing tank	
	addpylon	
		addrack f-16-370-wing-tank
		addrack f-16-600-wing-tank
	# normal pylon	
	addpylon	
		pylonsmsname MAU
		pylonct 1980
		#order by number of slots
		addrack lau-117
		addrack lau-118
		addrack aim
		addrack no-rack
		addrack lau-88-right
		addrack bru-42i-right
		addrack bru-57-right
		addrack bru-42bdu-right
		addrack suu-20

	addpylon	
		pylonsmsname LNCH
		pylonct 1858
        	addrack aim-no-rail	


definegroup f16-centerline
	addpylon 
		addrack mrp-no-rack
	addpylon 
		addrack f-16-center-tank
	addpylon
		pylonsmsname MAU
		pylonct 2815
		addrack ecm-camera-no-rack
		addrack no-rack

###########################################
###########################################
###########################################

definerack f18-aimx2
	rackct 2941
	rackstations 2
	weapjettmodes NONE
	rackjettmodes NONE
	addwclass aim

definegroup f18-wingtip
	addpylon
		pylonsmsname LNCHW
		pylonct 0
        addrack aim-no-rail

definegroup f18-left
	addpylon
		pylonsmsname MAU
		pylonct 2874
		addrack lau-117
		addrack lau-118
		addrack lau-115
		addrack aim-with-rail
		addrack f18-aimx2
		addrack no-rack
		addrack bru-55-left


definegroup f18-right
	addpylon
		pylonsmsname MAU
		pylonct 2874
		addrack lau-117
		addrack lau-118
		addrack lau-115	
		addrack aim-with-rail
		addrack f18-aimx2
		addrack no-rack
		addrack bru-55-left

definegroup f18-leftfuse
	addpylon
		pylonsmsname MAU
		pylonct 0
	        addrack aim-no-rail
	addpylon
		pylonsmsname MAU
		addrack no-rack

definegroup f18-rightfuse
	addpylon
		pylonsmsname MAU
		pylonct 0
	        addrack aim-no-rail
	addpylon
		pylonsmsname MAU
		addrack no-rack

definegroup f18-centerline
	addpylon
		pylonsmsname MAU
		pylonct 2815
		addrack lau-117
		addrack lau-118
		addrack aim
		addrack aimx2
		addrack no-rack
		addrack bru-55-left

###########################################
###########################################
###########################################

# Mirage 2000 racks

definerack m2k-tanks
	rackjettmodes NONE
	weapjettmodes EMERGENCY,SELECTIVE
	rackct 3513
	rackstations 1
	addwclass tank

definerack m2k-R530
	rackjettmodes EMERGENCY
	weapjettmodes SELECTIVE
	rackct 3514
	rackstations 1
	addwclass aim

definerack m2k-R550
	rackjettmodes NONE
	weapjettmodes SELECTIVE
	rackct 3512
	rackstations 1
	addwclass aim

definerack m2k-Mica-fwd
	rackjettmodes NONE
	weapjettmodes SELECTIVE
	rackct 3516
	rackstations 1
	addwclass aim

definerack m2k-Mica-aft
	rackjettmodes NONE
	weapjettmodes SELECTIVE
	rackct 3518
	rackstations 1
	addwclass aim

definerack m2k-AG
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 3519
	rackstations 1
	addwclass rocket, bomb, agm, harm, gbu

definerack m2k-AG-center
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 3515
	rackstations 1
	addwclass rocket, bomb, agm, harm, gbu, tank

definerack m2k-AG2x-L
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 3572
	rackstations 2
	addwclass bomb, gbu
	addloadorder 1 0

definerack m2k-AG2x-R
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 3572
	rackstations 2
	addwclass bomb, gbu
	addloadorder 0 1

definerack m2k-AG3x-L
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 2813
	rackstations 3
	addwclass bomb, gbu

definerack m2k-AG3x-R
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 2812
	rackstations 3
	addwclass bomb, gbu

definerack m2k-AG4x-L
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 3485
	rackstations 4
	addwclass bomb, gbu

definerack m2k-AG4x-R
	rackjettmodes NONE
	weapjettmodes SELECTIVE,EMERGENCY
	rackct 3484
	rackstations 4
	addwclass bomb, gbu

# Mirage 2000 groups

definegroup m2k-center
	addpylon 
		addrack m2k-tanks
		addrack m2k-AG-center
	addpylon
		pylonct 3515
		addrack m2k-AG2x-L
		addrack m2k-AG3x-L
		addrack m2k-AG4x-L

definegroup m2k-fusefwd
	addpylon 
		addrack m2k-AG
		addrack m2k-Mica-fwd

definegroup m2k-fuseaft
	addpylon 
		addrack m2k-AG
		addrack m2k-Mica-aft

definegroup m2k-winginner-L
	addpylon 
		addrack m2k-tanks
		addrack m2k-R530
		addrack m2k-AG
	addpylon
		pylonct 3519
		addrack m2k-AG2x-L
		addrack m2k-AG3x-L
		addrack m2k-AG4x-L

definegroup m2k-winginner-R
	addpylon 
		addrack m2k-tanks
		addrack m2k-R530
		addrack m2k-AG
	addpylon
		pylonct 3519
		addrack m2k-AG2x-R
		addrack m2k-AG3x-R
		addrack m2k-AG4x-R
		
definegroup m2k-wingtip
	addpylon 
		addrack m2k-R550

###########################################
###########################################
###########################################

definegroup generic-aim
	addpylon
		pylonsmsname LNCHW
		pylonct 0
	        addrack aim-no-rail

definegroup recessed-aim
	addpylon
		pylonsmsname MAU
		pylonct 0
			addrack aim-recessed-left
			addrack aim-no-rail
			addrack no-rack

# for a/c without pylons as part of the a/c LOD
definegroup pylon-left
	addpylon
		pylonsmsname LNCH	
		pylonct 1858
        	addrack aim-no-rail
	addpylon
		pylonsmsname MAU
		pylonct 1980
		addrack lau-117
		addrack lau-118
		addrack aim-with-rail
		addrack no-rack
		addrack lau-88-left
		addrack bru-42-left
		addrack bru-41-left

# for a/c without pylons as part of the a/c LOD
definegroup pylon-right
	addpylon
		pylonsmsname LNCH	
		pylonct 1858
        	addrack aim-no-rail
	addpylon
		pylonsmsname MAU
		pylonct 1980
		addrack lau-117
		addrack lau-118
		addrack aim-with-rail
		addrack no-rack
		addrack lau-88-right
		addrack bru-42-right
		addrack bru-41-right

# for a/c with pylons as part of the a/c LOD
definegroup nopylon-left
	addpylon
		pylonsmsname MAU
		addrack lau-117
		addrack lau-118
		addrack aim-with-rail
		addrack no-rack
		addrack lau-88-left
		addrack bru-42-left
		addrack bru-41-left

# for a/c with pylons as part of the a/c LOD
definegroup nopylon-right
	addpylon
		pylonsmsname MAU
		addrack lau-117
		addrack lau-118
		addrack aim-with-rail
		addrack no-rack
		addrack lau-88-right
		addrack bru-42-right
		addrack bru-41-right

# helo rack
definegroup 0
	addpylon
#		jettmodes EMERGENCY,SELECTIVE
		pylonct 0
		addrack no-rack