Skip to main content

Mod.rules

Mod.rules

Example taken from \Cosmoteer\Standard Mods\huge_ships

ID = cosmoteer.huge_ships
Name = "Huge Ships"
Version = 1.0.0
CompatibleGameVersions = ["0.20.19"]
ModifiesMultiplayer = true
Logo = "logo.png"
Author = "Walternate Realities"
Description = "Increases the maximum ship size from 120x120 to 1000x1000\n\n"\
              "<red>WARNING: Your computer probably can't handle ships this large! Use with caution!</red>"
Actions
[
	{
		Action = Overrides
		OverrideIn = "<ships/base_ship.rules>"
		Overrides
		{
			MaxBorders
			{
				Left = -500
				Right = 500
				Top = -500
				Bottom = 500
			}
		}
	}
]

Header Block

Field value Meaning
ID author_name.mod_name Every mod must have an ID that is used to uniquely identify the mod and differentiate it from other mods. In order to avoid ID conflicts with other mods, you *must* follow the "author_name.mod_name" format.
Do *not* use "cosmoteer" as your author name -- that is reserved for official mods only!
Name "Example Mod" You must give a human-readable name for your mod. This is what will be shown in the user interface.
Version 1.0.0 The version of the mod that will be shown in the user interface. This is optional.
CompatibleGameVersions ["0.20.19"] This is a list of Cosmoteer versions that this mod is known to be compatible with.
If this mod is turned on and it isn't known to be compatible with the version of Cosmoteer that the player is running, a warning will be displayed. When upgrading the game, mods that aren't known to be compatible with the new version will also be automatically disabled.
ModifiesMultiplayer
true / false
This should be set to true for any mod that makes gameplay changes that could affect multiplayer games. Setting this to false *MAY* make it possible to play with someone else who doesn't have this mod, so long as this mod doesn't actually make any gameplay changes. (Setting this to false will NOT magically allow you to play with someone who doesn't have this mod; it will just make the error less informative.) If omitted, the default is true.
Author author_name The name of the mod creator(s) that will be shown in the user interface. This is optional.
Logo logo.png
Description "ASDASD.\n"\ A longer description of what your mod does to the game. This is optional.
\n add a linebreak
\ after " is just for formating your text in modfile
StringsFolder strings Mods can define their own per-language string files. The values in a string file (such as en.rules) will add to and override any values in the base string file (such as Data\strings\en.rules).
Each language supported should have its own string file named after the two-letter 639-1 language code for that language.

Actions Block 

This block must contain the following:

Actions
[
	... // replace with your Action
]
Actions
Action Function
Add "Add" actions can also be used to add named data fields to existing files or {} groups
AddMany The "AddMany" action is similar to the "Add" action, but it can add multiple data fields to a single [] list, and it can't add named data fields.
AddBase The "AddBase" action adds a reference to the inheritance list of an existing {} group or [] list.
The "Remove" action deletes a vanilla data field from the game data.
The "RemoveMany" action is just like the "Remove" action, but it allows you to remove multiple data fields without having to create a separate action for each data field you want to remove.
Replace The "Replace" action changes a vanilla data field to a modded data field.
Overrides The "Overrides" action allows multiple *named* data fields to be modified, or new named fields to be added.
Add

Example what you can do with Add

{
	// The "Add" action adds a new data field to an existing [] list.
	Action = Add

	// This is the file and [] list in it to which the data will be added.
	AddTo = "<builtin_ships/builtins.rules>/Ships"

	// If this is set to true, the 'AddTo' will be created if it doesn't exist.
	// This is optional and will default to false.
	CreateIfNotExisting = false

	// If this is set to true, this action will do nothing if the 'AddTo' doesn't exist instead of giving an error.
	// This is optional and will default to false.
	IgnoreIfNotExisting = false

	// This is the data field to add to the [] list.
	// This data field can be any kind of data, including single values
	// [] lists, {} groups (like below), or even references to other files.
	ToAdd
	{
		File = "Arclight.ship.png"
		Faction = cabal
		Tags = [combat]
		Tier = 3
		Difficulty = 2 // (Note: Difficulty is currently unused but may be used in the future, so you should still specify a difficulty between 1-3.)
	}
}

This is our target file:
./data/gui/game/crew/crew_gui.rules

...
TargetLineDim
{
	LineSprite
	{
		Texture
		{
			File = "./Data/gui/line_arrow.png"
			SampleMode = Linear
			MipLevels = max
			UMode = Wrap
		}
		VertexColor = [0, 183, 255, 96]
	}
	LineThickness = .4
	LineUPerLength = -2
}
...

Other example of add, in this case we will add an additional item to the EditorGroups

{
	Action = Add
	AddTo = "<gui/game/designer/build_gui.rules>/EditorGroups"
	CreateIfNotExisting = false
	IgnoreIfNotExisting = false
	Name = Science
	ToAdd
	{
		NameKey = "EditorGroups/Science"
		Icon
		{
			Texture
			{
				File = "images/group_science.png"
				MipLevels = 2
				SampleMode = Linear
			}
		}
	}
}

The result will look like this:

image.png

AddMany

Example what you can do with AddMany

{
	Action = AddMany
    // This is the [] list to which we want to add data fields.
    AddTo = "<ships/terran/terran.rules>/Terran/Parts"
	// If this is set to true, the 'AddTo' will be created if it doesn't exist.
	// This is optional and will default to false.
	CreateIfNotExisting = false
	// If this is set to true, this action will do nothing if the 'AddTo' doesn't exist instead of giving an error.
	// This is optional and will default to false.
	IgnoreIfNotExisting = false
    // These are the data fields we want to add to the [] list.
    ManyToAdd = 
	[
    	&<ships/crew_3x3/crew_3x3.rules>/Part
    	&<ships/crew_4x4/crew_4x4.rules>/Part
	]
}

The Target her is the Parts list in terran.rules where all buildable parts are stored.

Terran : <../base_ship.rules>
{
	ID = cosmoteer.terran
    // Ship IDs must always be in the form of "author_name.ship_name".
    // If making your own mod, do *not* use "cosmoteer" as your author name, because it may conflict with future vanilla ships.
	OtherIDs = [Terran, PlayerShips, cosmoteer.ancient]
	NameKey = "ShipClasses/Terran"
	DefaultPartID = cosmoteer.corridor
	DefaultDoorID = door
	JunkBlocksWeaponLOS = false
	ExternalWalls = &<walls/external walls.rules>
	ExternalRoofWalls = &<walls/external roof walls.rules>
	AssociateCollectNuggetJobWithPart = general_jobs
	AssociateEjectNuggetJobWithPart = general_jobs
	AssociateSalvageJobWithPart = general_jobs
	SalvagingDisabledSuppressesResourceDrops = true

	Parts
	[
		// Basic.
		&<corridor/corridor.rules>/Part

		// Energy weapons.
		&<laser_blaster_small/laser_blaster_small.rules>/Part
		...
    	// Your Add Many will applied with in this list.
        // So it will look like this:
		&<ships/crew_3x3/crew_3x3.rules>/Part
    	&<ships/crew_4x4/crew_4x4.rules>/Part        
    ]
...
AddBase

Example what you can do with AddBase

{
	// The "AddBase" action adds a reference to the inheritance list of an existing {} group or [] list.
	Action = AddBase
    // The {} group or [] list which should inherit from the below BaseToAdd.
    AddBaseTo = "<ships/terran/control_room_small/control_room_small.rules>/Part/Components"
    // If this is set to true, this action will do nothing if the 'AddBaseTo' doesn't exist instead of giving an error.
    // This is optional and will default to false.
    IgnoreIfNotExisting = false
    // The file, {} group, or [] list which the above AddBaseTo should inherit from.
    BaseToAdd = &<control_room_small_components.rules>
}
Remove

Example what you can do with Remove

// Remove the DestroyedEffects/HitEffects component from the reactor
// to prevent it from causing collateral damage when it is destroyed.
{
	// The "Remove" action deletes a vanilla data field from the game data.
	Action = Remove
	// This is the file and data field in it that should be removed.
	// This works with any kind of data field, including single values {} groups, [] lists, and references.
	Remove = "<ships/terran/reactor_small/reactor_small.rules>/Part/Components/DestroyedEffects/HitEffects"
	// If this is set to true, this action will do nothing if the 'Remove' doesn't exist instead of giving an error.
	// This is optional and will default to false.
	IgnoreIfNotExisting = false
}
RemoveMany

Example what you can do with RemoveMany

// Remove the CommandConsumer components from cannons and railguns.
{
	// The "RemoveMany" action is just like the "Remove" action, but it allows
	// you to remove multiple data fields without having to create a separate action
	// for each data field you want to remove.
	Action = RemoveMany
	// This contains the list of data fields you want to remove.
	RemoveMany
	[
		"<ships/terran/cannon_med/cannon_med.rules>/Part/Components/CommandConsumer"
		"<ships/terran/cannon_large/cannon_large.rules>/Part/Components/CommandConsumer"
		"<ships/terran/railgun_loader/railgun_loader.rules>/Part/Components/CommandConsumer"
		"<ships/terran/railgun_accelerator/railgun_accelerator.rules>/Part/Components/CommandConsumer"
		"<ships/terran/railgun_launcher/railgun_launcher.rules>/Part/Components/CommandConsumer"
		// Note that we could have easily combined this RemoveMany action
		// with the above Remove action by simply adding the reactor's
		// DestroyedEffects/HitEffects component to this list. The only reason I didn't
		// do that was to demonstrate the single-value Remove action.
	]
	// If this is set to true, then if any of the above 'RemoveMany' don't exist then they will be skipped instead of giving an error.
	// This is optional and will default to false.
	IgnoreIfNotExisting = false
}
Replace

Example what you can do with Replace

// Increase starting funds on "Builder" economic difficulty to 200,000.
{
	// The "Replace" action changes a vanilla data field to a modded data field.
	Action = Replace
	// This is the file and data field in it that should be replaced.
	Replace = "<modes/career/career.rules>/EconDifficultyLevels/1/StartingMoney"
	// If this is set to true, this action will do nothing if the 'Replace' doesn't exist instead of giving an error.
	// This is optional and will default to false.
	IgnoreIfNotExisting = false
	// This is the value that the above data field should be replaced with.
	// This works with single values (like below), but you can also
	// replace entire {} groups, [] lists, and file references as well.
	With = 200000
}
Overrides

Example what you can do with Overrides

// Increase money and fame rewards on "Builder" economic difficulty to 300% each.
{
	// The "Overrides" action allows multiple *named* data fields
	// to be modified, or new named fields to be added.
	Action = Overrides
	// This is the file or {} group whose named data fields we want to override.
	OverrideIn = "<modes/career/career.rules>/EconDifficultyLevels/1"
	// If this is set to true, the 'OverrideIn' will be created if it doesn't exist.
	// This is optional and will default to false.
	CreateIfNotExisting = false
	// If this is set to true, this action will do nothing if the 'OverrideIn' doesn't exist instead of giving an error.
	// This is optional and will default to false.
	IgnoreIfNotExisting = false
	// This contains all of the data fields in the above file or {} group
	// whose values we want to override. If such a data field doesn't
	// already exist, it will be added instead of modified.
	Overrides
		{
		MoneyRewardFactor = 300%
		FameRewardFactor = 300%
		// Note that we could have easily combined this Overrides action
		// with the above Replace action by simply adding
		// "StartingMoney = 200000" to this Overrides section. The only
		// reason I didn't do that was to demonstrate the single-value Replace action.
		// In general, you will probably find it more convenient to use
		// an Overrides action instead of a Replace action, but Overrides
		// can only be used on *named* data fields inside a file or {} group, while the Replace
		// action can be used on unnamed data fields inside [] groups as well.
		}
}