-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTutorial_MyMod.cs
More file actions
38 lines (31 loc) · 1.73 KB
/
Tutorial_MyMod.cs
File metadata and controls
38 lines (31 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using UnityEngine;
public class MyMod : FortressCraftMod
{
public ushort MyModMachineType = ModManager.mModMappings.CubesByKey["MyAuthorID.MyModMachine"].CubeType;
public override ModRegistrationData Register()
{
ModRegistrationData modRegistrationData = new ModRegistrationData();
modRegistrationData.RegisterEntityHandler("MyAuthorID.MyModMachine");
modRegistrationData.RegisterEntityUI("MyAutherID.MyModMachine", new MyModMachineWindow());
//It's nice to be able to confirm in the log that the mod registered properly and to know what version it is
//Remember to increment it though if you change versions
//This is strictly a nicety that I do with all my mods
//It's helpful when trying to debug user's problems when you can see what mod version is in use from the log
Debug.Log("My Mod V1 Registered!");
//Register Network Commands for the machine
UIManager.NetworkCommandFunctions.Add("MyAuthorID.MyModMachineInterface", new UIManager.HandleNetworkCommand(MyModMachineWindow.HandleNetworkCommand));
return modRegistrationData;
}
public override ModCreateSegmentEntityResults CreateSegmentEntity(ModCreateSegmentEntityParameters parameters)
{
ModCreateSegmentEntityResults result = new ModCreateSegmentEntityResults();
//Assumes that all value entries are handled by the same machine!
if (parameters.Cube == MyModMachineType)
{
//You can set what object model will be spawned in for the machine
parameters.ObjectType = SpawnableObjectEnum.Conveyor;
result.Entity = new MyModMachine(parameters);
}
return result;
}
}