⚡ Triggers

From Cosmoteer Wiki
Modding/Components/Triggers
Jump to navigation Jump to search
CalloutIconWarning.png
Work in Progress
This page is currently WORK IN PROGRESS. Some things may not be up-to-date or documented at all.

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

CalloutIconNote.png
Info
This entire page was updated with information gained from analysing the "Cosmoteer.dll" assembly for the "0.26.1d_steam" game version.

This type of component causes things to happen. When a trigger makes something happen, we say it "fires".

Triggers allow you to pick what makes them fire, and what exactly happens then. This is done with references to other components.

They are strongly tied to toggles.

Component list

Here is a list of components that can act as triggers:

Components and inheritance
Name Category Short description

(click component for more details)

Code reference

(what's this?)

Inherits from
Emitter ⚙️ Other The base class for emitters that attach to weapons.

The provided trigger will fire when the (derived) component emits.

Cosmoteer.Ships.Parts.Weapons.Emitter OperationalChainablePartComponent
InlineResourceConverter 📦 Resource Acts as a resource storage that converts from another storage on-demand as-needed, holding a small "overflow" reserve to prevent any net loss of resources.

The provided trigger will fire when the component runs out of resources to convert.

Cosmoteer.Ships.Parts.Resources.InlineResourceConverter BaseResourceStorage
DamageTrigger ⚡ Trigger A part sub-component that triggers when the part takes damage. Cosmoteer.Ships.Parts.Logic.PartDamageTrigger OperationalPartComponent
DebugTrigger ⚡ Trigger A part trigger component that can be manually triggered via the part debugger. Cosmoteer.Ships.Parts.Logic.PartDebugTrigger PartComponent
DelayTrigger ⚡ Trigger A part component trigger that is triggered after another trigger plus some delay. Cosmoteer.Ships.Parts.Logic.PartDelayTrigger OperationalPartComponent
ModeTrigger ⚡ Trigger A part trigger component that triggers when a mode changes. Cosmoteer.Ships.Parts.Logic.PartModeTrigger OperationalPartComponent
MultiTrigger ⚡ Trigger A part sub-component that combines multiple other trigger components into a single trigger component. Cosmoteer.Ships.Parts.Logic.PartMultiTrigger OperationalPartComponent
ThresholdTrigger ⚡ Trigger A part component trigger that is triggered when a value from another component is within a certain range. Cosmoteer.Ships.Parts.Logic.PartThresholdTrigger PartComponent
Timer ⏲️ Timer A part sub-component that triggers after a certain amount of time. Cosmoteer.Ships.Parts.Logic.PartTimer OperationalPartComponent
ToggleTrigger ⚡ Trigger A part sub-component trigger that is triggered whenever a toggle component changes toggle state. Cosmoteer.Ships.Parts.Logic.PartToggleTrigger OperationalPartComponent
TriggerProxy 🔗 Proxy A part sub-component that acts as a proxy to a trigger component in another part. Cosmoteer.Ships.Parts.Logic.PartTriggerProxy PartComponent
UITrigger 🗔 UI A part sub-component that can be triggered by the player. Cosmoteer.Ships.Parts.UI.PartUITrigger OperationalPartComponent
RailgunProjectile 🎯Projectile A chainable component that when operational accelerates in a direction and causes a trigger when it reaches the end.

The provided trigger will fire every fixed-update when the projectile is operational.

Cosmoteer.Ships.Parts.Weapons.RailgunProjectile OperationalChainablePartComponent
ResourceConverter 📦 Resource A part sub-component that converts from one type of resource to another.

The provided trigger will fire when the component finishes converting.

Cosmoteer.Ships.Parts.Resources.ResourceConverter OperationalPartComponent
Weapon (modding) ⚙️ Other The base class for all types of weapon components.

The provided trigger will fire when the component reloads.

Cosmoteer.Ships.Parts.Weapons.Weapon OperationalChainablePartComponent

Component specification

DamageTrigger

Code location (what's this?): Cosmoteer.Ships.Parts.Logic.PartDamageTrigger

A part sub-component that triggers when the part takes damage.

Inherits from OperationalPartComponent.

Parameters for DamageTrigger (List excluding inhereted parameters)
Name Type Required? Buffable? Default value Description
MinDamage BuffableInt? - Yes -2147483648 The minimum damage dealt, that is required for this trigger to fire
MaxDamage BuffableInt? - Yes 2147483647 The maximum damage dealt, that is allowed for this trigger to fire

Examples

CalloutIconWarning.pngWork in Progress
This subsection is currently work-in-progress: Some things may be missing.

Feel free to contribute to make it better!

DebugTrigger

Code location (what's this?): Cosmoteer.Ships.Parts.Logic.PartDebugTrigger

A part trigger component that can be manually triggered via the part debugger.

Inherits from PartComponent.

There are no parameters unique to DebugTrigger.

Examples

CalloutIconWarning.pngWork in Progress
This subsection is currently work-in-progress: Some things may be missing.

Feel free to contribute to make it better!

DelayTrigger

Code location (what's this?): Cosmoteer.Ships.Parts.Logic.PartDelayTrigger

A part component trigger that is triggered after another trigger plus some delay.

Inherits from OperationalPartComponent.

Parameters for DamageTrigger (List excluding inhereted parameters)
Name Type Required? Buffable? Default value Description
Trigger ID<PartComponentRules> Yes - -2147483648 The trigger to be delayed
Delay BuffableTime Yes Yes 2147483647 The time to delay the trigger for

Examples

CalloutIconWarning.pngWork in Progress
This subsection is currently work-in-progress: Some things may be missing.

Feel free to contribute to make it better!

ModeTrigger

Code location (what's this?): Cosmoteer.Ships.Parts.Logic.PartModeTrigger

A part trigger component that triggers when a mode changes.

Inherits from OperationalPartComponent.

Parameters for ModeTrigger (List excluding inhereted parameters)
Name Type Required? Buffable? Default value Description
Mode ID<PartComponentRules> Yes - - The mode to monitor for changes.
TriggerInModes List<int> - - effectively: fire on change to any mode The list of mode values, when it should fire.

Examples

2 examples from laser_blaster_large.rules :

ShootLeftTrigger
{
	Type = ModeTrigger
	Mode = ShootCycle
	TriggerInModes = [0]
}

ShootRightTrigger
{
	Type = ModeTrigger
	Mode = ShootCycle
	TriggerInModes = [1]
	OperationalToggle = FireAlternatingToggle
}

MultiTrigger

Code location (what's this?): Cosmoteer.Ships.Parts.Logic.PartMultiTrigger

A part sub-component that combines multiple other trigger components into a single trigger component.

It will also check if the provided buffs (in the "ViaBuffs" parameter) change and fire if one of them does change.

Similar to the Multitoggle of toggles.

Inherits from OperationalPartComponent.

Parameters for MultiTrigger (List excluding inhereted parameters)
Name Type Required? Buffable? Default value Description
Triggers ID<PartComponentRules>[]? - - No triggers to listen to The list of triggers to listen to.
ViaBuffs BuffMultiProxyRules? - - No buffs will be wached for changes The list of buffs to monitor for changes.

Examples

Example from missile_launcher_he.rules :

CommonReloadResetTrigger
{
	Type = MultiTrigger
	Triggers = [WeaponA, WeaponB, WeaponC]
}

ThresholdTrigger

Code location (what's this?): Cosmoteer.Ships.Parts.Logic.PartThresholdTrigger

A part component trigger that is triggered when a value from another component is within a certain range.

Inherits from PartComponent.

Parameters for ThresholdTrigger (List excluding inhereted parameters)
Name Type Required? Buffable? Default value Description
AmountFrom ID<PartComponentRules> Yes - - The value, that is watched for changes
MinAmount float - - -3.4028235E+38f The minimum value, that is required for this trigger to fire
MaxAmount float - - 3.4028235E+38f The maximum value, that is allowed for this trigger to fire
Invert bool - - false If true the range is inverted, so instead of watching for values within the range [MinAmount, MaxAmount]

it will instead watch within either of the ranges [-3.4028235E+38f, MinAmount) & (MaxAmount, 3.4028235E+38f]

Examples

Example from thruster_med.rules :

BurstTrigger
{
	Type = ThresholdTrigger
	AmountFrom = MainThruster
	MinAmount = .5
}

ToggleTrigger

Code location (what's this?): Cosmoteer.Ships.Parts.Logic.PartToggleTrigger

A part sub-component trigger that is triggered whenever a toggle component changes toggle state.

In other words, these make things happen when something changes.

Inherits from OperationalPartComponent.

Parameters for ToggleTrigger (List excluding inhereted parameters)
Name Type Required? Buffable? Default value Description
Toggle ID<PartComponentRules> Yes - - The toggle to monitor for changes.
TriggerWhenOn bool - - true If true this trigger will fire when the toggle gets changed to the "On" state
TriggerWhenOff bool - - true If true this trigger will fire when the toggle gets changed to the "Off" state

Examples

This is a component from thruster_boost.rules :

BoostOffInstantDrainTrigger
{
	Type = ToggleTrigger
	Toggle = BoostOffInstantDrainToggles
	TriggerWhenOn = false
	TriggerWhenOff = true
	OperationalToggle = FullAmmoToggle
	InvertOperationalToggle = true
}

You may have figured it out, but if you haven't, this will be used as the trigger of the component that removes all power from the thruster. This is what happens in-game if you turn a boosting thruster off, or cancel its boost.

That component is itself toggled On based on the state of the MultiToggleBoostOffInstantDrainToggle. However, it's using the optional parameters TriggerWhenOn and TriggerWhenOff to invert its own functionality. This means when it's turned On, it doesn't cause anything to happen, but when it's turned Off, it does.

In combination with the MultiToggle, that means the thruster will be drained when any of the conditions in BoostOffInstantDrainToggle are false, causing it to become false because it has Mode = "All". This in turn makes BoostOffInstantDrainTrigger false, which is what makes it fire as we saw above.

Additionally, the InvertOperationalToggle parameter means that it will never do anything if the condition "FullAmmo" is true. In other words it only works when the thruster's battery is not full.

You can test this by activating the boost then deactivating it or turning the thruster Off, all while the game is paused and the battery is full.

See also