Today's lesson is #4, how to make Attachables and AEmitters.

First up, Attachables. Why them first? Because they're easy.
Attachables are useful, especially in editing Actors, for armor plating, but you can do much more than you may think with them. Special Attachables are found in Actor definitions for legs, arms, heads, feet and hands, and on Craft and Doors. Basically, anything you see that has a hinge on an MO is likely an attachable.

To make a MOSRotating into an Attachable, you need only add 3 extra lines, or rather one extra statement and two lines, and change the opening line.
[code]AddEffect = Attachable
	PresetName = Basic Attachable
	Mass = 1
	Sharpness = 0
	HitsMOs = 0
	GetsHitByMOs = 0
	SpriteFile = ContentFile
		FilePath = Base.rte/Null.bmp
	FrameCount = 1
	SpriteOffset = Vector
		X = 0
		Y = 0
	AtomGroup = AtomGroup
		AutoGenerate = 1
		Material = Material
			CopyOf = Air
		Resolution = 1
		Depth = 0
	DeepGroup = AtomGroup
		AutoGenerate = 1
		Material = Material
			CopyOf = Air
		Resolution = 1
		Depth = 1
	DeepCheck = 0
	AddGib = Gib
		GibParticle = MOSParticle
			CopyOf = Fire Puff Small
		Count = 3
		Spread = 3.14
		MaxVelocity = 10
		MinVelocity = 4
		InheritsVel = 1
	JointOffset = Vector
		X = 0
		Y = 0
	JointStrength = 1000
	JointStiffness = 0.5[/code]
As you can see, we changed the first line from "AddAmmo = MOSRotating" to "AddEffect = Attachable" and added some lines to the bottom.
[list][*]JointOffset is the offset where an invisible joint is created on the Attachable. When you eventually call "AddAttachable = Attachable" on the parent MO, the ParentOffset you will assign to it is where on the parent MO the Joint will be placed.

[*]JointStrength is the maximum impulse the joint can take before it snaps, releasing the Attachable. Nothing gibs, it just detaches.

[*]JointStiffness is a scalar value as to how much impulse is transferred to the parent MO when the Attachable experiences any. For an Attachable experiencing 100 impluse, 0.5 JointStiffness would transfer 50 Impulse back to the parent MO. 0.1 would transfer 10, and 2.0 would transfer 200 (breaking the laws of physics in the meantime, but who cares about that).[/list]
And that's pretty much it for Attachables. One last thing, to attach an Attachable to another MO (must be MOSRotating or higher, including other Attachables), use the following code block.
[code]	AddAttachable = Attachable
		CopyOf = Basic Attachable
		ParentOffset = Vector
			X = 0
			Y = 0[/code]
This will attach the Attachable at 0,0 on the parent MO, or right on the SpriteOffset.


Now, AEmitters, perhaps the single coolest MO of Cortex Command, barring the ones you can control.
An AEmitter is pretty much just a MOSRotating that can emit stuff, so it looks very similar.
[code]AddEffect = AEmitter
	PresetName = Basic AEmitter
	Mass = 1
	HitsMOs = 0
	GetsHitByMOs = 0
	SpriteFile = ContentFile
		FilePath = Base.rte/Null.bmp
	FrameCount = 1
	SpriteOffset = Vector
		X = 0
		Y = 0
	AtomGroup = AtomGroup
		AutoGenerate = 1
		Material = Material
			CopyOf = Air
		Resolution = 1
		Depth = 0
	GibImpulseLimit = 0.000001

	AddEmission = Emission
		EmittedParticle = MOSParticle
			CopyOf = Basic MOSParticle
		ParticlesPerMinute = 6000
		BurstSize = 1
		Spread = 0
		MaxVelocity = 0
		MinVelocity = 0
		PushesEmitter = 0
		StartTimeMS = 100
		StopTimeMS = 1000
	EmissionEnabled = 1
	EmissionsIgnoreThis = 1
	BurstSize = 1
	BurstScale = 1
	BurstTriggered = 1
	BurstSpacing = 500
	EmissionDamage = 0
	FlashOnlyOnBurst = 0[/code]
As you can see, there is quite a few things to talk about in the block offset from the rest of the definition. So, let's get to it.
[list][*]AddEmission = Emission begins an emission definition. An emission definition is somewhat like a Gib definition in that you can have many of them, and each one defines one set of particles to emit at one set of speeds and spread. Additionally, it defines when to begin emitting them and when to stop, and if the emissions affect the AEmitter any.
[*]BurstSize is the amount of particles to emit at the Burst, a special case of emission.
[*]Spread, Min and Max velocity are just like their Gib counterparts, though the Spread is centered on the AEmitter's emission facing.
[*]ParticlesPerMinute is, as it sounds, how many particles are emitter per minute. Check the wiki for a more detailed breakdown of how this affects emissions.
[*]PushesEmitter controls whether or not the emissions transfer impulse to the Emitter. Setting this to 1 is useful for rocket-type weapons, or anything that would require thrust or the equivalent.
[*]Start- and StopTimeMS are, as you would expect, the number of milliseconds after the creation of the AEmitter to start or stop emission of that emission.[/list]
Outside that block is more variables for controlling various bits of the AEmitter.
[list][*]EmissionsEnabled just toggles the AEmitter. Most useful when using Lua to control the AEmitter.
[*]EmissionsIgnoreThis controls if the emissions are able to collide with the AEmitter and any parents it may have. The same as FireIgnoresThis, but for AEmitters instead of HDFirearms.
[*]BurstSize and ParticlesPerMinute can be placed outside of any specific emission to control all emissions not specifically defined. Thus, in this AEmitter, all emissions without BurstSize defined will have a BurstSize of 1.
[*]BurstScale scales the size of a Burst. It may only affect the velocities of the bursted emission, but it may also control the number of particles spawned and the Spread.
[*]BurstTriggered I'm not entirely sure what does. Likely, it activates the AEmitter when it bursts, so you would use it in conjunction with EmissionsEnabled = 0 to have an AEmitter that begins regular emission after a burst.
[*]BurstSpacing defines how to limit the Burst. This is most useful for jetpacks to limit how long the player must wait before being able to burst it, to limit jettapping. In MS.
[*]Emission- and BurstDamage are most useful for Wounds (which are AEmitters). This is how much damage to do to the Actor on which they are placed as they emit or burst.
[*]FlashOnlyOnBurst controls the MuzzleFlash defined for this AEmitter. Whether to show it all the time it is emitting or only when it bursts.[/list]
And that is only the tip of the iceburg for AEmitters. You can do some pretty crazy stuff with them, but for now that is enough. Take a look inside the basegame files for examples, especially the flak cannon and Coalition rocket launcher.