Components

From Cosmoteer Wiki
< ModdingModding/Components
Jump to navigation Jump to search

Code locations (what's this?):

Cosmoteer.Ships.Parts.PartComponent
Cosmoteer.Ships.Parts.PartComponentRules
Cosmoteer.Bullets.BulletComponent
Cosmoteer.Bullets.BulletComponentRules
Cosmoteer.Bullets.IBulletComponent


A component is a block of code, defined inside the Components{} group of the .rules file for a part or projectile.

Those components provide some sort of functionality to it : everything that's not simply covered by data fields, and isn't stats.

You'll find that in most part or projectile .rules files, components are the bulk of the code, and stats use references to them or their contents.

This page focuses on part components (currently). See also : Projectile components.

Existing components

Below is a list of all some of the existing components, so that you hopefully may find some things useful for your own mod.

Also check out the table below this one to learn about the parent classes for these components in the inheritance hierarchy, what logic they implement and more.

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

Feel free to contribute to make it better!

CalloutIconTip.pngTip
Sort according to your needs by clicking the headers.
Components and inheritance
Name Category Short description

(click a component for more details)

Code Reference

(what's this?)

Inherits from
MultiToggle 🎚️Toggle A toggle that switches based on how specified toggles are switched. Can be set up to switch in specific states,

e.g. when all specified toggles are ON.

Cosmoteer.Ships.Parts.Logic.PartMultiToggle PartComponent
TriggeredToggle 🎚️Toggle A toggle that switches when a specified trigger fires. Cosmoteer.Ships.Parts.Logic.PartTriggeredToggle OperationalPartComponent
DistanceThreshold 🎚️Toggle A toggle can switch and has a value that depends on the distance from another component relative to a set distance. Cosmoteer.Ships.Parts.Logic.DistanceThreshold OperationalPartComponent
PartUIToggle 🎚️Toggle A part sub-component that tracks a value whose state can be toggled by the player.

That's buttons like "Boost" and "Turn On/Off".

Cosmoteer.Ships.Parts.UI.PartUIToggle OperationalPartComponent
ToggleProxy 🎚️Toggle A toggle proxy. Cosmoteer.Ships.Parts.Logic.PartToggleProxy

PartComponent
ToggleTrigger Trigger A trigger that fires whenever a specified toggle switches. Cosmoteer.Ships.Parts.Logic.PartToggleTrigger

OperationalPartComponent
ModeTrigger Trigger A trigger that fires whenever a mods changes. (elaborate?) Cosmoteer.Ships.Parts.Logic.PartModeTrigger

OperationalPartComponent
Multitrigger Trigger ((TBA - see article for now))
TriggerProxy Trigger A trigger proxy. Cosmoteer.Ships.Parts.Logic.PartTriggerProxy

PartComponent
BuffProvider 🔮Buff A buff provider.

Allows other parts to use the buffs.

Cosmoteer.Ships.Parts.Buffs.PartBuffProvider

OperationalPartComponent
AreaBuffProviderRules 🔮Buff A buff provider for which you can define a custom area.

Allows other parts to use the buffs.

Cosmoteer.Ships.Parts.Buffs.PartAreaBuffProviderRules
BasePartBuffProviderRules
BasePartBuffProviderRules 🔮Buff Stores rules common to all buff provider components. Cosmoteer.Ships.Parts.Buffs.BasePartBuffProviderRules OperationalPartComponentRules
BuffableValue Other A part sub-component that provides a value that can be modified by a buff. Cosmoteer.Ships.Parts.Buffs.PartBuffableValue
PartComponent
Timer ⏲️Timers A trigger that fires after a certain time. Cosmoteer.Ships.Parts.Logic.PartTimer OperationalPartComponent
Stopwatch ⏲️Timers A trigger that fires at a rate. Cosmoteer.Ships.Parts.Logic.PartStopwatch OperationalPartComponent
TriggeredEffects 🖼️ Media A component that performs hit and media effects when triggered. Cosmoteer.Ships.Parts.Effects.PartTriggeredEffects ChainablePartComponent
ResourceStorage Storage Allows the part to store resources. Can be used as a toggle. Cosmoteer.Ships.Parts.Resources.ResourceStorage

BaseResourceStorage
ResourceStorageProxy Storage A part sub-component that acts as a proxy to a resource storage in another part.

This is how Ion Beam Prisms store energy.

Cosmoteer.Ships.Parts.Resources.ResourceStorageProxy

BaseResourceStorage
FixedWeapon Weapons🎯 A weapon that is fixed in a particular direction. Cosmoteer.Ships.Parts.Weapons.FixedWeapon Weapon (modding)
TurretWeapon Weapons🎯
Weapon (modding) Weapons🎯
BeamEmitter Weapons🎯 A weapon emitter that emits a straight beam.

Used by all beam and hitscan weapons.

Cosmoteer.Ships.Parts.Weapons.BeamEmitterRules

Emitter
Emitter Weapons🎯 The base class for emitters that attach to weapons. Cosmoteer.Ships.Parts.Weapons.Emitter OperationalChainablePartComponent
Sprite a.k.a PartSprite Visuals 🎨 A part sub-component that renders a sprite, possibly attached to another component. Cosmoteer.Ships.Parts.Graphics.PartSprite OperationalChainablePartComponent
ShipRenderLayerRules Visuals 🎨 Stores the rules for a single render layer on a ship. Cosmoteer.Ships.ShipRenderLayerRules -
ProgressBar UI A part sub-component that causes a progress bar to be displayed below the part's health bar. Cosmoteer.Ships.Parts.UI.PartProgressBar
OperationalPartComponent
BaseCollider Other Base class for part sub-components that creates a custom physics collider for the part. Cosmoteer.Ships.Parts.Colliders.BaseCollider OperationalChainablePartComponent

Origins of Inheritance

The table below describes different classes that components can inherit from.

All components inherit from at least one of these classes.

More on the game's source code can be read about here.

Types from which a component can be inherited from
Type Code Reference

(what's this?)

Description
PartComponent Cosmoteer.Ships.Parts.PartComponent

The base class for part sub-components

This is the base class for all components that can be attached to parts. They can't be attached to projectiles.
CalloutIconNote.pngInfo
A component might not necessarily inherit from this class directly, it may inherit from another class that inherits from this class.
OperationalPartComponent Cosmoteer.Ships.Parts.OperationalPartComponent

(inherits from PartComponent)

Extends the PartComponent base class to implement on/off "operational" functionality common to many components.

This class is used for part components, that want to have an on/off switch functionality — mainly for the components that depend on power. They can't be attached to projectiles.
CalloutIconNote.pngInfo
Anything that inherits from this class can be made active/inactive based on the state of a toggle, e.g. "IsOperational". Used in many components.
ChainablePartComponent Cosmoteer.Ships.Parts.ChainablePartComponent

(inherits from PartComponent)

The base class for part components that can be chained to other part components.

This class is used for components that can be "chained" to another component. This means they don't move relative to that component.

Used by sprites.

BulletComponent Cosmoteer.Bullets.BulletComponent

(inherits from SceneComponent)

The base class for components that can be attached to bullets.

This class is used for components that can be attached to projectiles. They can't be attached to parts.
BaseBulletDeath Cosmoteer.Bullets.Death.BaseBulletDeath

(inherits from BulletComponent)

The base class for bullet components that cause self-death

This class is used for projectile components that are able to destroy the projectile they are attached to.

See also