To create your first mod, go to your installation folder (the one containing
Logic_World.exe), then create
a folder under the
GameData folder called
Navigate to the folder you just made and create a new file called
manifest.succ, then open it with a text editor.
This file will contain data about your mod like its name and its version:
ID: me.johndoe.mymod Name: My cool mod Author: John Doe Version: 1.0.0
Next we are going to create a simple new component. To do this, we first need to define the component using a SUCC file.
components folder, and under it create a new file called
First, we need to give the component and ID. This ID is a simple and short text identifier, it should be as short as possible while still making clear what the component is. You don't need to worry about making it unique, as long as your mod doesn't contain two components with the same ID.
We will then add this component to the "Logic" column in the components menu:
Finally we will define the component's prefab, which is the component's "shape" including input and output pegs:
prefab: blocks: - color: (0, 174, 209) # The block's RGB color inputs: - position: (-0.25, 0.5, -0.5) # The position of the peg, relative to the center of the component rotation: (-90, 0, 0) # The rotation of this input peg length: 0.6 # The length of the peg, 0.6 is the standard length - position: (0.25, 0.5, -0.5) rotation: (-90, 0, 0) length: 0.6 outputs: - position: (0, 0.5, 0.5) rotation: (90, 0, 0)
Save the file, and at this point you should be ready to fire up the game! If all goes well, you should be able to load a save and place down your component.
You will quickly notice that it's not exciting at all though, since the inputs don't do anything. This is because so far we've only defined what the component looks like, but not what it does. There are two ways of doing this (C# scripts and LogicScript scripts), but for now we're going for the latter.
Go back to your mod's folder and create a new folder called
scripts. Open it and create a file called
andgate.lsx, then open it with a text editor.
This file will contain LogicScript code indicating the behaviour of the component. LogicScript syntax and usage is unfortunately out of the scope of this tutorial (you can check the LSX primer for more info), so for now you can copy and paste this simple bit of code:
any out = in & in end
Now go back to the
components.succ file and add this line at the end:
This will inform the game to use the LSX file that we just wrote when updating the component, making it react to its inputs.
Now, restart the game and load back into your world, then hook up a couple switches to both of your component's inputs and you should see its output update accordingly!