Difference between revisions of "Code Modding"

From Software Inc.
Jump to navigation Jump to search
Line 15: Line 15:
 
Start by creating a class that implements the ModMeta abstract class, then implement as many classes that inherit from ModBehaviour as you want. Each ModBehaviour implementation will be instantiated once the mod is loaded.
 
Start by creating a class that implements the ModMeta abstract class, then implement as many classes that inherit from ModBehaviour as you want. Each ModBehaviour implementation will be instantiated once the mod is loaded.
  
When you're done, you can either compile your mod and place it in the game's folder, in a subfolder called "DLLMods", or create a new subfolder in the "DLLMods" folder and put your .cs files in that subfolder, and the game will compile them for you. Note that if you let the game compile the C# files for you, you are limited to C# version 3, but using the game's compiler is required if you want your mod on the Steam workshop.
+
When you're done, you can either compile your mod and place it in the game's folder, in a subfolder called "DLLMods", or create a new subfolder in the "DLLMods" folder and put your .cs files in that subfolder, and the game will compile them for you. Note that if you let the game compile the C# files for you, you are limited to C# version 3, but using the game's compiler is required, if you want to upload the mod to the Steam Workshop.
  
 
Here's an example of a mod that let's you change how many floors you can build on, complete with comments:
 
Here's an example of a mod that let's you change how many floors you can build on, complete with comments:

Revision as of 23:03, 9 October 2018

You can load cs scripts or dll files directly in software inc.

A good grasp of Unity3D programming is required.

Setup

To create your own mod start a .NET project targeted at the .NET 3.5 profile. Add a reference to the following libraries:

  • Software Inc_Data\Managed\UnityEngine.UI.dll
  • Software Inc_Data\Managed\UnityEngine.dll
  • Software Inc_Data\Managed\Assembly-CSharp.dll

Start by creating a class that implements the ModMeta abstract class, then implement as many classes that inherit from ModBehaviour as you want. Each ModBehaviour implementation will be instantiated once the mod is loaded.

When you're done, you can either compile your mod and place it in the game's folder, in a subfolder called "DLLMods", or create a new subfolder in the "DLLMods" folder and put your .cs files in that subfolder, and the game will compile them for you. Note that if you let the game compile the C# files for you, you are limited to C# version 3, but using the game's compiler is required, if you want to upload the mod to the Steam Workshop.

Here's an example of a mod that let's you change how many floors you can build on, complete with comments: Floor Mod (Updated to work with Alpha 10.7+)

Entry points

GameSettings.Instance This class contains most of the objects that manage the game
GameSettings.Instance.MyCompany The player's company
GameSettings.Instance.simulation Manages all companies and products
GameSettings.Instance.sRoomManager Manages rooms, furniture and room segments
GameSettings.Instance.sActorManager Manages employees and teams
SelectorController.Instance Manages selection
TimeOfDay.Instance Manages time
HUD.Instance Manages the main HUD and windows
ObjectDatabase.Instance Contains all furniture and room segments
WindowManager Controls windows and has functions to create windows and GUI elements