Emitter

From Cosmoteer Wiki
< Modding‎ | ComponentsModding/Components/Emitter
Jump to navigation Jump to search
CalloutIconWarning.png
Work in Progress
This page is currently WORK IN PROGRESS. Some things may be missing.

Feel free to contribute and don't worry about perfection - other editors can make corrections if necessary. Just get creating!

Code locations (what's this?):

Cosmoteer.Ships.Parts.Weapons.Emitter
Cosmoteer.Ships.Parts.Weapons.EmitterRules

The base class for emitters that attach to weapons.

Inherits from OperationalChainablePartComponentRules.

An abstract class, made to be inherited from (don't use it directly).

Inheritors :


Also contains the ResourceUsageRules class.

Parameters (Complete list)
Name Type Required? Buffable? Default value Description
FireTrigger ID<PartComponentRules>?

meaning : Reference to a component

Yes - - What component calls for the shot to be fired. In the base game that's always a trigger or a TurretWeapon.

Since this field is required, you can just have a line with FireTrigger and nothing else after it for "fake" weapon emitters that shouldn't shoot. The "base emitter" in all multi-barrel weapons like cannon_deck does that (except resource_collector).

GetTargetFrom ID<PartComponentRules>?

(Only Weapons used here)

Yes - - Presumably, a component that tells this emitter what target it should emit towards.

In the base game that's always a TurretWeapon, except in ion_beam_emitter and railgun_launcher where it's a FixedWeapon. Usually the same referenced in ChainedTo (see inheritance).

FireDelay Time - Yes -
DynamicDelayPredictor ID<PartComponentRules>? - - -
ResourceUsage List<EmitterRules.ResourceUsageRules>

meaning :

A list of ResourceUsageRules.

- - new

Contrary to what Type suggests, this does not need to be formatted like a list. You can just add the necessary parameters among the rest of the Emitter fields directly.

See Examples below.

Recoil - Yes - If > 0, the shot will push back the ship that the weapon is attached to.

Higher numbers push more.

Burst Range<BuffableInt> - Yes new

If set to a number higher than 1, can be used to make burst weapons, like shotguns.
BurstDelay Float - Yes - Can be used to make burst weapons, like shotguns.
UseResourcePerShotInBurst bool - - - Presumably, if "true", each shot fired in a burst will consume the amount of resources specified in ResourceUsage.
ResourceScaleFactor ID<PartComponentRules>? - - - Presumably used to apply a form of scaling.

Notes

Nothing yet.

ResourceUsageRules

Nested within the EmitterRules definition and nowhere else.

The fields in this class allow an Emitter to consume resources when shooting.

Parameters (Complete list)
Name Type Required? Buffable? Default value Description
ResourceStorage ID<PartComponentRules> Yes - - Which component loses resources when the emitter shoots.
ResourcesUsed Int - Yes 1 How many resources are lost per shot.
MinResourcesUsed Int? - Yes - Presumably, the emitter cannot shoot if less than this amount of resource is available.

Ammo weapons do not set this at all. Energy weapons always have "1", which suggests that they are able to shoot with any amount of remaining power, regardless of ResourcesUsed.[fact check needed][1] This might be to ensure that they run out of power instead of remaining low on battery without displaying the "out of power" indicator.

Examples

ResourceUsageRules in ships\terran\mining_laser_small.rules :

BeamEmitterBase : <./Data/shots/mining_beam_small/mining_beam_small.rules>
{
	Type = BeamEmitter
	ChainedTo = Turret
	FireTrigger // none, but field is required
	GetTargetFrom = Turret
	Location = [1.484375*.75, 0]
	OperationalToggle = IsOperational
	Duration = .2
	ResourceStorage = BatteryStorage
	ResourcesUsed = 120
	MinResourcesUsed = 1
	Width = abs((&../BeamEmitterLeft/Location/1) - (&../BeamEmitterRight/Location/1)) + (&^/0/Width) / 2
}
  1. fact check needed: See the label for the context.