Difference between revisions of "Modding"

From Captain of Industry Wiki
Jump to: navigation, search
m (→â€: wrong code formatting syntax...)
Line 16: Line 16:
- Run <code>dotnet build /p:LangVersion=10.0</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.
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 / EntityLayoutParams / EntityLayoutParser  ==
== Layouts / EntityLayoutParams / EntityLayoutParser  ==

Revision as of 10:34, 17 January 2023

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]>'O
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]>'P
   [2][2][2][2][2][2][2][2][3]>@E

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://github.com/altmank/CaptainOfCheats - Example mod using a lot of functionality as a sort of cheat engine