Skip to content

BoltWithNut

Tommo J. Phillips edited this page Oct 22, 2023 · 3 revisions

BoltWithNut

Namespace: TommoJProductions.ModApi.Attachable

public class BoltWithNut : Bolt

Inheritance ObjectBoltBoltWithNut

Fields

ignoreInput

if , scrolling on this bolt will do nothing.

public bool ignoreInput;

Properties

nut

The add nut.

public Bolt nut { get; }

Property Value

Bolt

settings

The base bolt settings for this bolt

public virtual BoltSettings settings { get; }

Property Value

BoltSettings

boltWithNutSettings

Bolt with Nut specific settings. derived from BoltSettings.

public BoltWithNutSettings boltWithNutSettings { get; }

Property Value

BoltWithNutSettings

tightness

The total tightness of the bolt and nut.

public virtual int tightness { get; set; }

Property Value

Int32

maxTightness

The max tightness of the bolt and nut.

public virtual int maxTightness { get; }

Property Value

Int32

wait

The bolt waiting value. when true, the bolt has been tightened/loosened and is waiting for x amount of time base on the tool used before continuing to update the model transform, play the bolt audio, invoke events bolt tighten/loosen events.

public virtual bool wait { get; set; }

Property Value

Boolean

scrollInput

The last scroll input.

public virtual int scrollInput { get; set; }

Property Value

Int32

isTight

Returns true if this bolt is tight.

public virtual bool isTight { get; }

Property Value

Boolean

isLoose

Returns true if this bolt is loose.

public virtual bool isLoose { get; }

Property Value

Boolean

startPosition

The start position of the bolt.

public virtual Vector3 startPosition { get; set; }

Property Value

Vector3

startEulerAngles

The start rotation of the bolt.

public virtual Vector3 startEulerAngles { get; set; }

Property Value

Vector3

positionVectorStep

The position vector step (direction * step). How much and in what direction does the bolt move per tightness step.

public virtual Vector3 positionVectorStep { get; }

Property Value

Vector3

rotationVectorStep

The rotation vector (direction * step). How much and in what direction does the bolt rotate per tightness step.

public virtual Vector3 rotationVectorStep { get; }

Property Value

Vector3

boltID

The Bolts ID

public string boltID { get; }

Property Value

String

model

The bolt model

public GameObject model { get; }

Property Value

GameObject

callback

The callback

public BoltCallback callback { get; }

Property Value

BoltCallback

routine

the bolt func routine.

public Coroutine routine { get; }

Property Value

Coroutine

Constructors

BoltWithNut(BoltWithNutSettings, Vector3, Vector3)

Initialies this bolt.

public BoltWithNut(BoltWithNutSettings settings, Vector3 position, Vector3 eulerAngles)

Parameters

settings BoltWithNutSettings
the settings for the bolt.

position Vector3
the position of the bolt

eulerAngles Vector3
the rotation of the bolt.

BoltWithNut(Int32, BoltWithNutSettings, Vector3, Vector3)

Initialies this bolt with a tightness value.

public BoltWithNut(int tightness, BoltWithNutSettings settings, Vector3 position, Vector3 eulerAngles)

Parameters

tightness Int32
The the tightness of the bolt.

settings BoltWithNutSettings
the settings for the bolt.

position Vector3
the position of the bolt

eulerAngles Vector3
the rotation of the bolt.

BoltWithNut(BoltWithNutSettings, Vector3, Vector3, Nullable<Single>)

Initialies this bolt with a nut offset overload. only use if you intend on this bolt having an 'add nut'

public BoltWithNut(BoltWithNutSettings settings, Vector3 position, Vector3 eulerAngles, Nullable<float> nutOffsetOverride)

Parameters

settings BoltWithNutSettings
the settings for the bolt.

position Vector3
the position of the bolt

eulerAngles Vector3
the rotation of the bolt.

nutOffsetOverride Nullable<Single>
the nut offset overload

BoltWithNut(Int32, BoltWithNutSettings, Vector3, Vector3, Nullable<Single>)

Initialies this bolt with a tightness value and a nut offset overload. only use if you intend on this bolt having an 'add nut'

public BoltWithNut(int tightness, BoltWithNutSettings settings, Vector3 position, Vector3 eulerAngles, Nullable<float> nutOffsetOverride)

Parameters

tightness Int32
The the tightness of the bolt.

settings BoltWithNutSettings
the settings for the bolt.

position Vector3
the position of the bolt

eulerAngles Vector3
the rotation of the bolt.

nutOffsetOverride Nullable<Single>
the nut offset overload

Methods

init(BoltWithNutSettings, Vector3, Vector3, Int32, Nullable<Single>)

Initializes this bolt. assigns field values with an option of setting a overload for nut offset. Called in Constructors. Use only if this bolt is using add nut, otherwise this does nothing extra.

 void init(BoltWithNutSettings settings, Vector3 position, Vector3 eulerAngles, int tightness, Nullable<float> nutOffsetOverride)

Parameters

settings BoltWithNutSettings
The settings for the bolt.

position Vector3
the position of the bolt

eulerAngles Vector3
the rotation of the bolt.

tightness Int32
The the tightness of the bolt.

nutOffsetOverride Nullable<Single>
the nut offset overload

createBolt(Int32, Transform)

inits bolt and add nut.

public virtual void createBolt(int tightness, Transform parent)

Parameters

tightness Int32
bolt tightness

parent Transform
the parent for the bolt.

activateBolt(Boolean)

De/Activates the bolt.

public virtual void activateBolt(bool active)

Parameters

active Boolean
Activate the bolt or not.

updateModelPosition()

Updates the model position and rotation based on start and tightness values.

public virtual void updateModelPosition()

Events

onScrew

Represents the post onscrew event. occurs when this bolt is screwed in or out. called after all other bolt events are called. Bolt.onLoose, Bolt.onTight.

public event Action onScrew;

onLoose

Represents the on loose event. occurs when this bolt becomes loose (screwed to loose state)

public event Action onLoose;

onTight

Represents the on tight event. occurs when this bolt becomes tight (screwed to tight state)

public event Action onTight;

outLoose

Represents the out loose event. occurs when this bolt was loose but was screw in (screwed from loose state)

public event Action outLoose;

outTight

Represents the out tight event. occurs when this bolt was tight but was screw out. (screwed from tight state)

public event Action outTight;

Clone this wiki locally