Class NOSModule
Nitrous Oxide System (NOS) module for NWH Vehicle Physics 2.
Inherited Members
Namespace: NWH.VehiclePhysics2.Modules
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class NOSModule : VehicleComponent
Remarks
Registers a power modifier on the engine that multiplies output while boost input is held, draining a finite bottle at the configured flow rate. Optional lockouts cover reverse and off-throttle use. Drives the exhaust flash effect while active.
Fields
capacity
Maximum capacity of the NOS bottle in kilograms.
Declaration
[Tooltip("Maximum capacity of the NOS bottle in kilograms.")]
public float capacity
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Refill by setting charge back to capacity. At the default 0.1 kg/s flow: 0.5-1.0 kg is a small bottle (5-10 s), 2.0-3.0 kg standard (20-30 s), 5.0-10.0 kg large (50-100 s).
charge
Current amount of NOS remaining in the bottle in kilograms.
Declaration
[Tooltip("Current amount of NOS remaining in the bottle in kilograms.")]
public float charge
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Drains at the flow rate while active and blocks boost once it hits zero. Writable at runtime for refills and partial bottles.
disableInReverse
Prevents NOS activation when the vehicle is in reverse gear.
Declaration
[Tooltip("Prevents NOS activation when the vehicle is in reverse gear.")]
public bool disableInReverse
Field Value
| Type | Description |
|---|---|
| bool |
disableOffThrottle
Prevents NOS activation when throttle input is below 50%.
Declaration
[Tooltip("Prevents NOS activation when throttle input is below 50%.")]
public bool disableOffThrottle
Field Value
| Type | Description |
|---|---|
| bool |
Remarks
Stands in for the engine load a real system needs before injection is safe. Requires throttle above 0.5.
engineVolumeCoefficient
Unused multiplier for engine sound volume during NOS activation.
Declaration
[Range(1, 3)]
[Tooltip("Serialized for compatibility. Not read at runtime.")]
public float engineVolumeCoefficient
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Retained for serialization compatibility. Not read by any runtime component.
exhaustEmissionCoefficient
Unused multiplier for exhaust smoke particle emission during NOS activation.
Declaration
[Range(1, 3)]
[Tooltip("Serialized for compatibility. Not read at runtime.")]
public float exhaustEmissionCoefficient
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Retained for serialization compatibility. Not read by any runtime component.
flow
Rate of NOS consumption in kilograms per second.
Declaration
[Tooltip("Rate of NOS consumption in kilograms per second.")]
public float flow
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Duration is capacity / flow, so 2 kg at 0.1 kg/s gives 20 s of boost. 0.05 kg/s is a long economy run, 0.1 kg/s standard, 0.2-0.3 kg/s a short high-flow burst.
nosSoundComponent
Sound component for NOS-specific audio effects.
Declaration
[SerializeField]
public NOSSoundComponent nosSoundComponent
Field Value
| Type | Description |
|---|---|
| NOSSoundComponent |
Remarks
Registered with the vehicle's SoundManager by VC_Initialize.
powerCoefficient
Engine power multiplier applied when NOS is active.
Declaration
[Range(1, 5)]
[Tooltip("Engine power multiplier applied when NOS is active. 2.0 = double power, 3.0 = triple power, etc.")]
public float powerCoefficient
Field Value
| Type | Description |
|---|---|
| float |
Remarks
1.5 is a mild system (+50%), 2.0 standard (+100%), 3.0-5.0 competition (+200 to +400%).
Properties
IsUsingNOS
Indicates whether NOS is currently being used.
Declaration
public bool IsUsingNOS { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
True only when the module is enabled, boost is held, charge remains, the engine is running, and the reverse and off-throttle lockouts allow it.
Methods
NOSPowerModifier(float)
Calculates the engine power modifier based on NOS activation state.
Declaration
public float NOSPowerModifier(float DeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | DeltaTime | Physics time step in seconds |
Returns
| Type | Description |
|---|---|
| float | Power multiplier to be applied to engine output. powerCoefficient while NOS is active, scaled down on the final step when the remaining charge covers only part of it, 1.0 otherwise. |
Remarks
Registered on the engine's power modifiers list. Also drains charge and triggers the exhaust flash.
VC_Disable(bool)
Disables the NOS module and unregisters the power modifier from the engine.
Declaration
public override bool VC_Disable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent | True if called by parent component, false otherwise. |
Returns
| Type | Description |
|---|---|
| bool | True if successfully disabled, false otherwise. |
Overrides
VC_Enable(bool)
Enables the NOS module and registers the power modifier with the engine.
Declaration
public override bool VC_Enable(bool calledByParent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | calledByParent | True if called by parent component, false otherwise. |
Returns
| Type | Description |
|---|---|
| bool | True if successfully enabled, false otherwise. |
Overrides
VC_Initialize()
Initializes the NOS module and registers the sound component.
Declaration
protected override void VC_Initialize()
Overrides
VC_SetDefaults()
Sets default values for the NOS module and its sound component.
Declaration
public override void VC_SetDefaults()