Table of Contents

Class UpgradeModuleGadget

Namespace
Nautilus.Assets.Gadgets
Assembly
Nautilus.dll
Represents a vehicle module (or upgrade) gadget.
public class UpgradeModuleGadget : Gadget
Inheritance
UpgradeModuleGadget
Inherited Members
Extension Methods

Constructors

UpgradeModuleGadget(ICustomPrefab)

Constructs an equipment gadget.
public UpgradeModuleGadget(ICustomPrefab prefab)

Parameters

prefab ICustomPrefab
The custom prefab to operate on.

Properties

AbsoluteDepth

Wether the depth provided should be absolute or added to the default depth of the vehicle. Default value is false.
public bool AbsoluteDepth { get; set; }

Property Value

bool

Cooldown

Cooldown for this module. Does not work with Toggleable items. May not work with certain vehicles.
public double Cooldown { get; set; }

Property Value

double

CrushDepth

Crush depth of this upgrade. Leave to -1f to disable
public float CrushDepth { get; set; }

Property Value

float

EnergyCost

Energy cost of this item. Should apply to modules of vehicles.
public double EnergyCost { get; set; }

Property Value

double

MaxCharge

Max charge of this item. Should apply to modules of vehicles and to chargeable items.
public double MaxCharge { get; set; }

Property Value

double

delegateOnAdded

This happens when the module is added to the vehicle.

Action that is executed after Nautilus' default action (if there is) on this event.

public Action<Vehicle, int> delegateOnAdded { get; }

Property Value

Action<Vehicle, int>

delegateOnRemoved

This happens when the module is removed from the vehicle.

Action that is executed after Nautilus' default action (if there is) on this event.

public Action<Vehicle, int> delegateOnRemoved { get; }

Property Value

Action<Vehicle, int>

delegateOnToggled

This happens when the module is toggled.
The boolean represents wether the module is on or off.
The delegate is not executed when the module is a selectable, selectableChargeable or a chargeable.

Action that is executed after Nautilus' default action (if there is) on this event.

public Action<Vehicle, int, float, bool> delegateOnToggled { get; }

Property Value

Action<Vehicle, int, float, bool>

delegateOnUsed

This happens when the module is used. The delegate is not run when the module is a toggleable.

Action that is executed after Nautilus' default action (if there is) on this event.

public Action<Vehicle, int, float, float> delegateOnUsed { get; }

Property Value

Action<Vehicle, int, float, float>

Methods

Build()

Where the data actually gets registered to the game.
This is called after prefab register and PostRegisters in Register().
protected override void Build()

WithCooldown(double)

The cooldown of the module when it is used.

Cooldown may not work with certain vehicles.

Does not work with toggleable and passive items.

public UpgradeModuleGadget WithCooldown(double cooldown)

Parameters

cooldown double
Cooldown of the module in seconds.

Returns

UpgradeModuleGadget
A reference to thihs instance after the operation has completed.

WithDepthUpgrade(float, bool)

Sets the crush depth given by this upgrade.
public UpgradeModuleGadget WithDepthUpgrade(float newCrushDepth, bool absolute = false)

Parameters

newCrushDepth float
New crush depth, in meters.
absolute bool
Wether the provided depth should be absolute or added to the default max depth of the vehicle.

Returns

UpgradeModuleGadget
A reference to this instance after the operation has completed.

WithEnergyCost(double)

The energy cost of the item. Usually used for vehicle modules to consume energy. (Seamoth perimeter defense, Seamoth sonar)
public UpgradeModuleGadget WithEnergyCost(double energyCost)

Parameters

energyCost double
Energy cost

Returns

UpgradeModuleGadget
A reference to this instance after the operation has completed.

WithMaxCharge(double)

The maximum charge of the item. Usually used as a multiplier for vehicle modules. (Seamoth defense perimeter, Seatruck defense perimeter)

Example: The Seamoth defense perimeter can be charged by holding the action key to make its damage bigger.

public UpgradeModuleGadget WithMaxCharge(double maxCharge)

Parameters

maxCharge double
Charge multiplier

Returns

UpgradeModuleGadget
A reference to this instance after the operation has completed.

WithOnModuleAdded(Action<Vehicle, int>)

What happens when the module is added to a vehicle ?
This action is run after Nautilus' default action (if the module is a hull, the new hull of the vehicle is automatically updated).
For removed, see also WithOnModuleRemoved(Action<Vehicle, int>).
public UpgradeModuleGadget WithOnModuleAdded(Action<Vehicle, int> onAdded)

Parameters

onAdded Action<Vehicle, int>
Action that occurs when the module is added.

Returns

UpgradeModuleGadget
A reference to this instance after the operation has completed.

WithOnModuleRemoved(Action<Vehicle, int>)

What happens when the module is removed from a vehicle ?
This action is run after Nautilus' default action (if the module is a hull, the new hull of the vehicle is automatically updated).
For added, see also WithOnModuleAdded(Action<Vehicle, int>).
public UpgradeModuleGadget WithOnModuleRemoved(Action<Vehicle, int> onRemoved)

Parameters

onRemoved Action<Vehicle, int>
Action that occurs when the module is removed.

Returns

UpgradeModuleGadget
A reference to this instance after the operation has completed.

WithOnModuleToggled(Action<Vehicle, int, float, bool>)

What happens when the module is toggled ?
This actions is run after Nautilus' default action (energy consumption is automatically set).
For use, see also WithOnModuleUsed(Action<Vehicle, int, float, float>).
public UpgradeModuleGadget WithOnModuleToggled(Action<Vehicle, int, float, bool> onToggled)

Parameters

onToggled Action<Vehicle, int, float, bool>
Action that occurs when the module turns on and when it turns off.
The boolean determines wether it is added or removed (added=true).

Returns

UpgradeModuleGadget
A reference to this instance after the operation has completed.

WithOnModuleUsed(Action<Vehicle, int, float, float>)

What happens when the module is used ?
This action is run after Nautilus' default action (cooldown and energy consumption are automatically set).
For toggle, see also WithOnModuleToggled(Action<Vehicle, int, float, bool>).
public UpgradeModuleGadget WithOnModuleUsed(Action<Vehicle, int, float, float> onUsed)

Parameters

onUsed Action<Vehicle, int, float, float>
Action that occurs when the module is used.

Returns

UpgradeModuleGadget
A reference to this instance after the operation has completed.