-
Notifications
You must be signed in to change notification settings - Fork 16
Creating a Bolt
Tommee J. Armytage edited this page Oct 23, 2023
·
2 revisions
-
Bolts can be added to a part or a trigger.
-
Currently, there are 2 types of bolts.
- Bolt - A bolt that can be screwed in/out. Range 0-8
- Bolt With Nut - A bolt that has a nut on the opposite side of it. Range 0 - 16. Derives from Bolt.
-
See: Creating a part
-
See Bolt Settings for a list of all settings.
-
See Bolt Size for a list of all bolt sizes. (Enum)
-
See Model Type for a list of all bolt types. (Enum)
-
Bolt Constructor Signature
public Bolt(BoltSettings settings, Vector3 position, Vector3 eulerAngles)-
If you aren't using the auto save feature, you will have to save and load bolt data, Bolt data can be saved and loaded from the part or trigger.
-
Creating a bolt would look something like this.
using UnityEngine;
using MSCLoader;
using TommoJProductions.ModApi.Attachable;
public class Demo : Mod
{
...
...
...
public void OnLoad()
{
...
...
...
BoltSettings boltSettings = new BoltSettings()
{
size = BoltSize._9mm, // The size of the bolt.
type = BoltType.longBolt, // The bolt model type.
posDirection = Vector3.right, // The direction the bolt moves when screwed in/out.
posStep = 0.0055f, // How much the bolt moves when screwed in/out
rotDirection = Vector3.forward, // The direction the bolt rotates when screwed in/out.
rotStep = 30f, // How much the bolt rotates when screwed in/out
};
// Create a Bolt array to pass into the part or trigger.
Bolt[] bolts = new Bolt[2]
{
new Bolt(boltSettings, new Vector3(0.0527f, -0.05f, 0.1f), boltRot), // bolt 1 initialization
new Bolt(boltSettings, new Vector3(0.0527f, -0.05f, -0.1f), boltRot), // bolt 2 initialization
};
}
}- Initializing a Part with bolts
part.initPart(triggerData, settings, bolts); - Initializing a Trigger with bolts
Trigger trigger = new Trigger(parent, settings, bolts);