Cement Files (.cmt) - HueSamai/CementSource GitHub Wiki
Cement files (files with the .cmt) store info about a mod. It doesn't contain any of the mod files itself, just info. It is worth to mention in code, the class which handles Cement files is called ModFile.
This is needed for Cement to load dependencies of a mod, but mod creators can also add custom parameters to store keybind info or other settings for a mod, as certain parameters are loaded into the mod menu to be edited.
The first section of this page talks about the syntax of a Cement file, and the second, about the reserved parameters that Cement uses to store and read information about a mod.
Cement files are case sensitive, meaning it matters if you use a lower or upper case letter.
Syntax
Cement files are made up of parameters, separated by new lines. Each parameter is composed of three sections: the attributes, the name and the value. The parameter name, acts as the key, to which we can access the parameter value from, and the attributes give us additional info about a parameter.
Attributes
Attributes are a way to give additional information about a parameter. One easy example of this to understand, is the mod menu. The mod menu identifies which parameters are editable, by looking for all parameters tagged with the 'Editable' attribute. The mod menu also uses attributes to check what data type a specific parameter is. For instance, if a parameter has a 'Float', 'Integer', 'String', or 'Boolean' attribute, it will handle how the values are read from the user.
These are how attributes are declared in a parameter:
[Editable] [Float]
Each attribute's name is surrounded with square brackets, and comes before the parameter name. You can have any number of attributes.
Parameter name and value
Next we must define a parameter name for our parameter. A parameter name is a way to identify, which parameter we want to access the value of. For instance, the 'Name' parameter is used by Cement to store the name of a mod. So in code, we can just ask an instance ModFile class to tell us the value of the 'Name' parameter. A parameter name can consist out of any characters except, equal signs or spaces.
After the parameter name comes an '=' sign, to let Cement know the characters after the equal sign is the value of the parameter. The parameter value can include all characters, however, it is standard to use commas to separate items in a list, for instance the 'Links' parameter in Cement, which stores all the links to dependencies.
IMPORTANT NOTE: whitespace is removed after attributes but not before and after the '=' sign.
Here's an example of a completed Cement parameter:
[Editable] [Boolean] UseCustomMenu=true
In this example, the parameter has two attributes, 'Editable' and 'Boolean', it has a name of 'UseCustomMenu', and a value of 'true'.
An example of a Cement file, with multiple parameters
This Cement file comes from the Gore mod.
Name=Gore
Author=dotpy
Message=This is a custom message!
[Editable] [Float] VelocityThreshold=14
Links=https://raw.githubusercontent.com/HueSamai/Gore/master/Gore.dll,https://raw.githubusercontent.com/HueSamai/Gore/master/gore
LatestVersion=https://raw.githubusercontent.com/HueSamai/Gore/master/version
Parameters used by Cement
Now that you understand the syntax behind Cement, we need to go over all the reserved parameters and attributes Cement uses to store and read info about mods.
If a parameter is required for Cement to load your mod, a '(*)' will be put next to the name, otherwise if it is not required but recommended a '(!)' will be put next to it.
Name(*)
Stores the name of a mod.
Author(*)
Stores the author(s) of a mod.
Links(*)
Stores the links to dependencies of a mod, with each link being separated by a ','.
LatestVersion(*)
Stores a link which contains the latest version of a mod. This is used by cement to see if the mod should be updated or not.
Message(!)
Stores the message that gets displayed on the Cement Summary. The Message value can also be a link which returns the message that needs to be displayed. Cement figures out by itself if your Message value is a link or a message, without you having to tell it.
CementFile(!)
Stores a link which will return the contents of the Cement file. This allows you to add another dependency to 'Links' or maybe change a parameter name, or add a new parameter for storing a new setting, without users having to install a new Cement file.
CurrentVersion
Stores the current version of the mod installed. This parameter should NEVER be shipped with a mod. It is used by Cement to check if the mod is up to date, for the current user it is installed for. The Clear Cache button works by setting this value to nothing, to force all the mods to be installed again.
The Editable attribute
The 'Editable' attribute tells Cement that this parameter should be able to be edited in the mod menu. This allows mod creators to add custom setting parameters, and display them in the mod menu. For instance, this is used by the Cinematic mod for all the keybinds.
The Boolean, String, Integer, and Float attributes
These attributes are used to tell the mod menu which type a parameter with the Editable attribute is. If none of these are found on the parameter, the mod menu will default it to be a string value.