Modding: Difference between revisions
Fix bulleted lists |
|||
| (8 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
'''PAGE IS WIP AND UNDER CONSTRUCTION!''' | '''THIS PAGE IS WIP AND UNDER CONSTRUCTION!''' | ||
Modding is an exciting endeavor! Hopefully this page can serve as a quick-start on how you can do it to! | Modding is an exciting endeavor! Hopefully this page can serve as a quick-start on how you can do it to! | ||
| Line 5: | Line 5: | ||
== Requirements == | == Requirements == | ||
* .NET Framework - https://dotnet.microsoft.com/en-us/download/dotnet-framework/net462 | |||
== Quick Start == | == Quick Start == | ||
# Clone https://github.com/MaFi-Games/Captain-of-industry-modding into a directory (<code>git clone https://github.com/MaFi-Games/Captain-of-industry-modding.git</code>) | |||
# Navigate to the directory and into <code>src/ExampleMod</code> | |||
# Run <code>dotnet build /p:LangVersion=10.0</code> | |||
We're using <code>/p:LangVersion=10.0</code> for building mod, as otherwise it'll throw errors about too new language features being used. You can also edit <code>ExampleMod.csproj</code> to contain <code><LangVersion>10.0</LangVersion></code> in the first <code>PropertyGroup</code>. | |||
== Layouts / <code>EntityLayoutParams</code> / <code>EntityLayoutParser</code> == | |||
Layouts of structures such as machines or storages are based on a ASCII format passed as list of strings. | |||
Example furnace: | |||
[2][2][2][3][3][3][3][3][2]>~Y | |||
[2][2][3][5][5][7][7][4][3] | |||
A~>[2][2][3][5][5][7][7][4][3]>'V | |||
B~>[2][2][3][5][5][7][7][4][3]>'W | |||
[2][2][2][3][3][7][7][4][3] | |||
[2][2][2][2][2][2][2][2][3]>@E | |||
<code>A~></code> and <code>B~></code> are In Ports, they accept products. | |||
<code>>@E</code> is exhaust | |||
<code>>~Y</code> is slag exit | |||
<code>>'</code> are Out Ports, they emit products | |||
The <code>></code> indicates the direction of the port. They can be one of the following: | |||
* <code>></code> | |||
* <code><</code> | |||
* <code>^</code> | |||
* <code>v</code> | |||
There is also a <code>+</code> port type, but meaning is unclear as of yet. | |||
<code>[1]</code> - <code>[9]</code> (<code>[n]</code> essentially) are height units, they define the "hitbox" of the building, how many squares it takes up and where pipes/transports can and cannot pass. | |||
Example Chemical Plant: | |||
<pre> | |||
~E>[7][8][7][6][5][5][5] | |||
[7][7][7][6][5][5][5] | |||
#D>[6][6][6][6][5][5][5]>X@ | |||
@A>[5][5][5][5][5][5][5]>Y# | |||
@B>[5][5][5][5][5][5][5] | |||
@C>[5][5][5][5][5][5][5] | |||
[5][5][5][5][5][5][5] | |||
</pre> | |||
Example Unit storage: | |||
<pre> | |||
[4][4][4][4][4] | |||
# >4A[4][4][4]X4> # | |||
[4][4][4][4][4] | |||
# >4B[4][4][4]Y4> # | |||
[4][4][4][4][4] | |||
</pre> | |||
(Wrapped on the left and right with whitespace? Why?) | |||
Example Loose storage: | |||
<pre> | |||
" [6][6][6][6][6] ", | |||
" ~ >6A[6][6][6]X6> ~ ", | |||
" [6][6][6][6][6] ", | |||
" ~ >6B[6][6][6]Y6> ~ ", | |||
" [6][6][6][6][6] " | |||
</pre> | |||
Example Fluid storage: | |||
<pre> | |||
" [5][5][5][5][5] ", | |||
" @ >5A[5][5][5]X5> @ ", | |||
" [5][5][5][5][5] ", | |||
" @ >5B[5][5][5]Y5> @ ", | |||
" [5][5][5][5][5] " | |||
</pre> | |||
With this, we can establish: | |||
* <code>#</code> is for transport belts | |||
* <code>~</code> is for loose storage belts | |||
* <code>'</code> is for melted materials (i.e. a blast furnace), and | |||
* <code>@</code> is for pipes | |||
You can use the in-game console command <code>print_entity_layout <string></code> to print the entity layout of a structure. | |||
<strong>Notice: Some structures in the game use a "old" format of the layout, rather than the current format.</strong> | |||
== References / Samples == | == References / Samples == | ||
* https://github.com/MaFi-Games/Captain-of-industry-modding - Official quick-start template | |||
* https://coie.keranik.com/releases - Example mod using a lot of functionality as a sort of cheat engine | |||
Latest revision as of 00:04, 23 January 2026
THIS PAGE IS WIP AND UNDER CONSTRUCTION!
Modding is an exciting endeavor! Hopefully this page can serve as a quick-start on how you can do it to!
Requirements
- .NET Framework - https://dotnet.microsoft.com/en-us/download/dotnet-framework/net462
Quick Start
- Clone https://github.com/MaFi-Games/Captain-of-industry-modding into a directory (
git clone https://github.com/MaFi-Games/Captain-of-industry-modding.git) - Navigate to the directory and into
src/ExampleMod - Run
dotnet build /p:LangVersion=10.0
We're using /p:LangVersion=10.0 for building mod, as otherwise it'll throw errors about too new language features being used. You can also edit ExampleMod.csproj to contain <LangVersion>10.0</LangVersion> in the first PropertyGroup.
Layouts / EntityLayoutParams / EntityLayoutParser
Layouts of structures such as machines or storages are based on a ASCII format passed as list of strings.
Example furnace:
[2][2][2][3][3][3][3][3][2]>~Y [2][2][3][5][5][7][7][4][3] A~>[2][2][3][5][5][7][7][4][3]>'V B~>[2][2][3][5][5][7][7][4][3]>'W [2][2][2][3][3][7][7][4][3] [2][2][2][2][2][2][2][2][3]>@E
A~> and B~> are In Ports, they accept products.
>@E is exhaust
>~Y is slag exit
>' are Out Ports, they emit products
The > indicates the direction of the port. They can be one of the following:
><^v
There is also a + port type, but meaning is unclear as of yet.
[1] - [9] ([n] essentially) are height units, they define the "hitbox" of the building, how many squares it takes up and where pipes/transports can and cannot pass.
Example Chemical Plant:
~E>[7][8][7][6][5][5][5] [7][7][7][6][5][5][5] #D>[6][6][6][6][5][5][5]>X@ @A>[5][5][5][5][5][5][5]>Y# @B>[5][5][5][5][5][5][5] @C>[5][5][5][5][5][5][5] [5][5][5][5][5][5][5]
Example Unit storage:
[4][4][4][4][4] # >4A[4][4][4]X4> # [4][4][4][4][4] # >4B[4][4][4]Y4> # [4][4][4][4][4]
(Wrapped on the left and right with whitespace? Why?)
Example Loose storage:
" [6][6][6][6][6] ", " ~ >6A[6][6][6]X6> ~ ", " [6][6][6][6][6] ", " ~ >6B[6][6][6]Y6> ~ ", " [6][6][6][6][6] "
Example Fluid storage:
" [5][5][5][5][5] ", " @ >5A[5][5][5]X5> @ ", " [5][5][5][5][5] ", " @ >5B[5][5][5]Y5> @ ", " [5][5][5][5][5] "
With this, we can establish:
#is for transport belts~is for loose storage belts'is for melted materials (i.e. a blast furnace), and@is for pipes
You can use the in-game console command print_entity_layout <string> to print the entity layout of a structure.
Notice: Some structures in the game use a "old" format of the layout, rather than the current format.
References / Samples
- https://github.com/MaFi-Games/Captain-of-industry-modding - Official quick-start template
- https://coie.keranik.com/releases - Example mod using a lot of functionality as a sort of cheat engine