# N.A.T.O.W Munition file (see natow.sourceforge.net)
#
# This file defines the munitions used in the game.
# If you create a new munition go to natow.sourceforge.net, and it will probably
# get added to the set. (You can never have enough weapons). :)
#
# A munition definition is started by the keyword `munition'.
# An option from below then follows:
#
# name          - The name of the munition (one entry)
#
# type          - The type of projectile the munition uses,
#                 can be: (case insensitive)
#                 SHELL
#                 MISSILE
#                 BOMBLET
#
# cost          - The cost of the munition (integer)
#
# critical_time - The amount of time since the creation of the
#                 projectile until a timer event occurs (float)
#
# begin         - Begins one of the following:
#                 spawn_actions     - A list of actions when the projectile is created
#                 timer_actions     - ... when the timer hits critical_time
#                 apex_actions      - ... when the projectile first starts to fall
#                 collision_actions - ... when the projectile collides with something
#
#                 The actions are called when the apporpriate event happens, and they
#                 affect the current projectile unless stated.
#
#                 Actions: (case insensitive)
#
#                 change_type [name]
#                 deploy_parachute [drag]
#                 drop_parachute
#                 set_state_rising
#                 set_state_falling
#                 set_thrust [thrust]
#                 set_drag [drag]
#                 set_timer [time]
#                 reset_timer
#                 spawn_new [name]
#                 spawn_new_clone
#                 spawn_new_multiple [name] [n]
#                 spawn_new_clone_multiple [n]
#                 spawn_new_random [name] [dv]
#                 spawn_new_clone_random [dv]
#                 spawn_new_random_multiple [name] [n] [dv]
#                 spawn_new_clone_random_multiple [n] [dv]
#                 spawn_new_spread [name] [angle] [n]
#                 spawn_new_clone_spread [angle] [n]
#                 clip_to_collision
#                 bounce [efficiency]
#                 explode [radius] [force]
#                 delete
#
#                 [name] is a single entry naming another munition.
#                   e.g. Foo, "Foo" or "Mr Foo". NOT Mr Foo (i.e. a space not in quotes)
#                 [thrust] is the thrust of the projectile in ms^-2.
#                   e.g. 17.8 125.1
#                 [drag] is the drag coefficient of the projectile.
#                   e.g. 0.001 0.51
#                 [time] is the time in seconds (s).
#                   e.g. 0.01 3.5
#                 [n] is the number of projectiles to be created (an integer).
#                   e.g. 4 5
#                 [dv] is a velocity in ms^-1, it is used to add a random amount of
#                   velocity to the current projectile when spawning a new one, so
#                   the drift apart.
#                   e.g. 12.4 54.1021
#                 [angle] is the internal angle of a cone in degrees, it is used when
#                   projectiles fan out from their parent projectile.
#                   e.g. 180.0 45.3
#                 [efficiency] is the efficiency of a bounce, i.e. how much of the velocity
#                   is reflected.
#                   e.g. 0.21 0.98
#                 [radius] is the radius of an explosion in meters (m).
#                   e.g. 5.0 15.4
#                 [force] is the force of an explosion in kilonewtons (kN).
#                   e.g. 12.0 152.0
#
# end           - Finishes the last begin or munition
#
# Some of the below munitions have comments to help you work it out...

# EXAMPLE 1: A BASIC MUNITION
#
# Start the munition definition 
munition
	# Set the name of the munition
	name	"Small Shell"
	# Set what type of projectile it is (affects how it looks?)
	type	SHELL
	# How much it costs
	cost	5

	# When the projectile collides...
	begin collision_actions
		# ...Move the projectile back to that point...
		clip_to_collision
		# ...Cause an explosion at the projectiles current location...
		explode 2.0 1.0
		# ...Delete the projectile.
		delete
	end
end
# And you're done!

munition
	name	"Large Shell"
	type	SHELL
	cost	10

	begin collision_actions
		clip_to_collision
		explode 5.0 10.0
		delete
	end
end

munition
	name	"Bouncing Shell"
	type	SHELL
	cost	20
	critical_time 5.0

	begin timer_actions
		explode 5.0 10.0
		delete
	end

	begin collision_actions
		clip_to_collision
		bounce 0.8
	end
end

munition
	name	"Small Missile"
	type	MISSILE
	cost	20

	begin spawn_actions
		set_thrust 100.0
	end

	begin collision_actions
		clip_to_collision
		explode 8.0 10.0
		delete
	end
end

munition
	name	"Large Missile"
	type	MISSILE
	cost	30

	begin spawn_actions
		set_thrust 100.0
	end

	begin collision_actions
		clip_to_collision
		explode 10.0 20.0
		delete
	end
end

munition
	name	"Baby Nuke"
	type	MISSILE
	cost	50

	begin spawn_actions
		set_thrust 100.0
	end

	begin collision_actions
		clip_to_collision
		explode 15.0 50.0
		delete
	end
end

munition
	name	"Nuke"
	type	MISSILE
	cost	100

	begin spawn_actions
		set_thrust 100.0
	end

	begin collision_actions
		clip_to_collision
		explode 20.0 100.0
		delete
	end
end

# EXAMPLE 2: SUBMUNITIONS
#
# This munition spawns 15 smaller munitions when it reaches the apex of its flight
# That is, when it first starts to reduce in height. The new projectiles ("Mirv
# Bomblet"s) are given a speed of 3ms^-1 in a random direction when they're created
# When the bomblets are created the "Mirv" changes type to a "Spent Mirv", which
# causes it to have a smaller explosion when it collides (no longer carrying the
# bomblets -- less explosives on board).
munition
	name	"Mirv"
	type	MISSILE
	cost	70

	# Because projectiles have no thrust by default, and this is a missile,
	# give it some thrust... light the engine.
	begin spawn_actions
		set_thrust 100.0
	end

	begin apex_actions
		spawn_new_random_multiple "Mirv Bomblet" 15 3.0
		change_type "Spent Mirv"
	end

	begin collision_actions
		clip_to_collision
		explode 15.0 50.0
		delete
	end
end
# And that's how you do submunitions!

munition
	name	"Mirv Bomblet"
	type	BOMBLET
	cost	15

	begin collision_actions
		clip_to_collision
		explode 10.0 15.0
		delete
	end
end

munition
	name	"Spent Mirv"
	type	MISSILE
	cost	15

	begin spawn_actions
		set_thrust 100.0
	end

	begin collision_actions
		clip_to_collision
		explode 5.0 2.0
		delete
	end
end

# EXAMPLE 3: A CHAIN OF MUNITIONS
#
# This munition changes type several times so a finite number of submunitions are
# released every 0.125 seconds after the projectile origionally hits it's apex.
munition
	name	"Parachute Cluster"
	type	MISSILE
	cost	40

	begin spawn_actions
		set_thrust 100.0
	end

	# When starts to fall, replace with a missile that drops parachutes
	begin apex_actions
		change_type "Parachute Cluster D5"
		reset_timer
	end

	begin collision_actions
		clip_to_collision
		explode 10.0 15.0
		delete
	end
end

# This missile `contains' 5 parachutes bomblets.
munition
	name "Parachute Cluster D5"
	type MISSILE
	critical_time 0.125

	begin spawn_actions
		set_thrust 100.0
	end

	# Drop a bomb after critical_time seconds */
	begin timer_actions
		spawn_new "Parachute Bomblet"
		change_type "Parachute Cluster D4"
		reset_timer
	end

	begin collision_actions
		clip_to_collision
		explode 8.0 12.0
		delete
	end
end

# This missile `contains' 4 parachutes bomblets.
munition
	name "Parachute Cluster D4"
	type MISSILE
	critical_time 0.125

	begin spawn_actions
		set_thrust 100.0
	end

	begin timer_actions
		spawn_new "Parachute Bomblet"
		change_type "Parachute Cluster D3"
		reset_timer
	end

	begin collision_actions
		clip_to_collision
		explode 6.0 9.0
		delete
	end
end

# This missile `contains' 3 parachutes bomblets.
munition
	name "Parachute Cluster D3"
	type MISSILE
	critical_time 0.125

	begin spawn_actions
		set_thrust 100.0
	end

	begin timer_actions
		spawn_new "Parachute Bomblet"
		change_type "Parachute Cluster D2"
		reset_timer
	end

	begin collision_actions
		clip_to_collision
		explode 4.0 6.0
		delete
	end
end

# This missile `contains' 2 parachutes bomblets.
munition
	name "Parachute Cluster D2"
	type MISSILE
	critical_time 0.125

	begin spawn_actions
		set_thrust 100.0
	end

	begin timer_actions
		spawn_new "Parachute Bomblet"
		change_type "Parachute Cluster D1"
		reset_timer
	end

	begin collision_actions
		clip_to_collision
		explode 2.0 3.0
		delete
	end
end

# This missile `contains' a parachute bomblet.
munition
	name "Parachute Cluster D1"
	type MISSILE
	critical_time 0.125

	begin spawn_actions
		set_thrust 100.0
	end

	# Drop the last bomb
	begin timer_actions
		spawn_new "Parachute Bomblet"
	end

	begin collision_actions
		clip_to_collision
		explode 1.0 1.5
		delete
	end
end

# The submunition for the above parachute cluster set of munitions.
munition
	name	"Parachute Bomblet"
	type	BOMBLET
	cost	15

	begin apex_actions
		deploy_parachute 0.5
	end

	begin collision_actions
		clip_to_collision
		explode 7.0 5.0
		delete
	end
end
# And that's how you do a chain of munitons!

munition
	name	"Annihilator"
	type	MISSILE
	cost	500

	begin spawn_actions
		set_thrust 100.0
	end

	begin collision_actions
		clip_to_collision
		explode 50.0 200.0
		delete
	end
end

# Flea shell, contributed by David Crompton
munition
	name "Flea Shell"
	type SHELL
	cost 20
	
        begin collision_actions
                clip_to_collision
		explode 2.0 1.0
		bounce 0.25
		spawn_new "SFGA1"
		delete
        end
end


munition
	name "SFGA1"
	type SHELL
	
	begin apex_actions
		spawn_new_random_multiple "SFGB1" 10 2.5
		delete
	end
	
	begin collision_actions
		clip_to_collision
		explode 20.0 40.0
		delete
	end
end


munition
	name "SFGB1"
	type SHELL
	
	begin collision_actions
		clip_to_collision
		explode 2.0 1.0
		bounce 0.5
		spawn_new "SFGA2"
		delete
	end
end

munition
	name "SFGA2"
	type SHELL
	
	begin apex_actions
		spawn_new_random "SFGB2" 1.0
		delete
	end
end

munition
        name "SFGB2"
        type SHELL

        begin collision_actions
                clip_to_collision
                explode 2.0 1.0
                bounce 0.5
                spawn_new "SFGA3"
                delete
        end
end

munition
        name "SFGA3"
        type SHELL

        begin apex_actions
                spawn_new_random "SFGB3" 1.0
                delete
        end
end

munition
        name "SFGB3"
        type SHELL

        begin collision_actions
                clip_to_collision
                explode 2.0 1.0
                bounce 0.5
                spawn_new "SFGA4"
                delete
        end
end

munition
        name "SFGA4"
        type SHELL

        begin apex_actions
                spawn_new_random "SFGB4" 1.0
                delete
        end
end

munition
        name "SFGB4"
        type SHELL

        begin collision_actions
                clip_to_collision
                explode 2.0 1.0
                bounce 0.5
                spawn_new "SFGA5"
                delete
        end
end

munition
        name "SFGA5"
        type SHELL

        begin apex_actions
                spawn_new_random "SFGB5" 1.0
                delete
        end
end

munition
        name "SFGB5"
        type SHELL

        begin collision_actions
                clip_to_collision
                explode 2.0 1.0
                bounce 0.5
                spawn_new "SFGA6"
                delete
        end
end

munition
        name "SFGA6"
        type SHELL

        begin apex_actions
                spawn_new_random "SFGB6" 1.0
                delete
        end
end

munition
	name "SFGB6"
	type SHELL
	
	begin collision_actions
		clip_to_collision
		explode 5.0 10.0
		delete
	end
end

munition
	name		"Sparkler Shell"
	type		SHELL
	cost		40

	begin apex_actions
		spawn_new_random_multiple "Sparkler Bomblet" 1 3.0
		spawn_new "Spent Sparkler"
		delete
	end

	begin collision_actions
		clip_to_collision
		explode 25.0 50.0
		delete
	end
end

munition
	name		"Spent Sparkler"

	begin collision_actions
		clip_to_collision
		explode 3.0 6.0
		delete
	end
end

munition
	name		"Sparkler Bomblet"
	type		BOMBLET
	critical_time	0.5

	begin timer_actions
		spawn_new_random "Sparkler Bomblet" 5.0
		reset_timer
	end

	begin collision_actions
		clip_to_collision
		explode 1.0 2.0
		delete
	end
end
