Class UpgradeModuleGadget
Represents a vehicle upgrade module 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
Whether the crush depth provided (if any) should be absolute or added to the default depth of the vehicle.
Default value is false.
public bool AbsoluteDepth { get; set; }
Property Value
Cooldown
Defines the cooldown of this upgrade module after being activated. Applicable for non-toggleable vehicle modules,
with some potential limitations.
public double Cooldown { get; set; }
Property Value
CrushDepth
Defines the crush depth of this upgrade module. Default value is -1. Only used when values are above 0.
public float CrushDepth { get; set; }
Property Value
EnergyCost
Defines the energy cost of this upgrade module when activated. Applicable for all usable vehicle modules.
public double EnergyCost { get; set; }
Property Value
Remarks
For chargeable modules, this defines the number of units of energy expended per second.
MaxCharge
Defines the max charge in units of energy of this upgrade module when activated.
Applicable for chargeable vehicle modules.
public double MaxCharge { get; set; }
Property Value
delegateOnAdded
The Action that is executed after the vehicle module is added, called after default events.
public Action<Vehicle, int> delegateOnAdded { get; }
Property Value
delegateOnRemoved
The Action that is executed after the vehicle module is removed.
public Action<Vehicle, int> delegateOnRemoved { get; }
Property Value
delegateOnToggled
The Action that is executed when the module is toggled. Only applies to toggleable vehicle modules.
public Action<Vehicle, int, float, bool> delegateOnToggled { get; }
Property Value
Remarks
The boolean represents whether the module is on or off.
delegateOnUsed
The Action that is executed when the module is used. Applies to non-toggleable vehicle modules.
public Action<Vehicle, int, float, float> delegateOnUsed { get; }
Property Value
Methods
Build()
Where the data actually gets registered to the game.
This is called after prefab register and PostRegisters in Register().
This is called after prefab register and PostRegisters in Register().
protected override void Build()
WithCooldown(double)
Sets the cooldown of the module after it is used.
public UpgradeModuleGadget WithCooldown(double cooldown)
Parameters
cooldown
double- The cooldown of the module in seconds.
Returns
- UpgradeModuleGadget
- A reference to this instance after the operation has been completed.
Remarks
Does not work with toggleable or passive items, and may not be implemented by all vehicles.
WithDepthUpgrade(float, bool)
Sets the crush depth given by this upgrade.
public UpgradeModuleGadget WithDepthUpgrade(float newCrushDepth, bool absolute = false)
Parameters
newCrushDepth
float- The new crush depth in meters.
absolute
bool- Whether 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 been completed.
WithEnergyCost(double)
Sets the energy cost of this upgrade module when used.
public UpgradeModuleGadget WithEnergyCost(double energyCost)
Parameters
energyCost
double- The energy cost per use (or per second for chargeable modules).
Returns
- UpgradeModuleGadget
- A reference to this instance after the operation has been completed.
Remarks
For chargeable modules, this defines the number of units of energy expended per second
towards the total charge.
WithMaxCharge(double)
Sets the maximum charge of an upgrade module, in units of energy.
public UpgradeModuleGadget WithMaxCharge(double maxCharge)
Parameters
maxCharge
double- The maximum charge in total units of energy that can be expended.
Returns
- UpgradeModuleGadget
- A reference to this instance after the operation has been completed.
Remarks
This is used for the Seamoth and Seatruck Perimeter Defense Module to provide a strength modifier
based on how long the player holds the key.
WithOnModuleAdded(Action<Vehicle, int>)
Defines extra functionality when this upgrade module is added.
public UpgradeModuleGadget WithOnModuleAdded(Action<Vehicle, int> onAdded)
Parameters
Returns
- UpgradeModuleGadget
- A reference to this instance after the operation has been completed.
WithOnModuleRemoved(Action<Vehicle, int>)
Defines extra functionality when this upgrade module is removed.
public UpgradeModuleGadget WithOnModuleRemoved(Action<Vehicle, int> onRemoved)
Parameters
Returns
- UpgradeModuleGadget
- A reference to this instance after the operation has been completed.
WithOnModuleToggled(Action<Vehicle, int, float, bool>)
Defines extra functionality when this upgrade module is toggled.
public UpgradeModuleGadget WithOnModuleToggled(Action<Vehicle, int, float, bool> onToggled)
Parameters
Returns
- UpgradeModuleGadget
- A reference to this instance after the operation has been completed.
Remarks
The boolean represents whether it is being added or removed.
WithOnModuleUsed(Action<Vehicle, int, float, float>)
Defines extra functionality when this upgrade module is used, for non-toggleable modules.
public UpgradeModuleGadget WithOnModuleUsed(Action<Vehicle, int, float, float> onUsed)
Parameters
Returns
- UpgradeModuleGadget
- A reference to this instance after the operation has been completed.
Remarks
The first
float
represents the current quick slot charge, and the second one represents the charge scalar.