Autonauts Modding
ModVariable Class Reference

Public Member Functions

void SetVariableFarmerAction (string ActionString, string TargetTypeString, string ToolTypeString, int Int)
 
int GetVariableFarmerActionAsInt (string ActionString, string TargetTypeString, string ToolTypeString, bool CheckValid=true)
 
string GetVariableFarmerActionOnTilesAsName (string ActionString, string TileTypeString, string ToolTypeString)
 
void SetVariableFarmerActionOnTiles (string ActionString, string TileTypeString, string ToolTypeString, int Int)
 
int GetVariableFarmerActionOnTilesAsInt (string ActionString, string TileTypeString, string ToolTypeString, bool CheckValid=true)
 
int GetVariableForObjectAsInt (string NewTypeString, string VariableName, bool CheckValid=true)
 
float GetVariableForObjectAsFloat (string NewTypeString, string VariableName, bool CheckValid=true)
 
string GetVariableForObjectAsString (string NewTypeString, string VariableName, bool CheckValid=true)
 
void SetVariableForObjectAsInt (string NewTypeString, string VariableName, int Int)
 
void SetVariableForObjectAsIntFromString (string NewTypeString, string VariableName, string StringInt)
 
void SetVariableForObjectAsFloat (string NewTypeString, string VariableName, float Float)
 
void SetVariableForObjectAsString (string NewTypeString, string VariableName, string String)
 
void SetVariableForStorageAmount (string NewTypeString, int Int)
 
void SetVariableForBuildingUpgrade (string ObjectTypeFromString, string ObjectTypeToString)
 
void SetIngredientsForRecipe (string NewObjectResultString, string[] NewIngredientsStringArr, int[] NewIngredientsAmountArr, int ResultAmount)
 
void SetIngredientsForRecipeSpecific (string NewConverterString, string NewObjectResultString, string[] NewIngredientsStringArr=null, int[] NewIngredientsAmountArr=null, int ResultAmount=1)
 
void SetIngredientsForRecipeSpecificDoubleResults (string NewConverterString, string NewObjectResultString1, string NewObjectResultString2, string[] NewIngredientsStringArr, int[] NewIngredientsAmountArr, int ResultAmount1=1, int ResultAmount2=1)
 
string[] GetIngredientsForRecipe (string NewObjectResultString)
 
int[] GetIngredientsAmountForRecipe (string NewObjectResultString)
 
void AddRecipeToConverter (string NewConverterString, string NewObjectResultString, int ResultAmount=1)
 
bool RemoveRecipeFromConverter (string NewConverterString, string NewObjectResultString)
 

Member Function Documentation

◆ AddRecipeToConverter()

void ModVariable.AddRecipeToConverter ( string  NewConverterString,
string  NewObjectResultString,
int  ResultAmount = 1 
)

Add an existing Recipe to a specific converter

Version
135.10
Parameters
NewConverterString- String - The Converter this applies to - Required
NewObjectResultString- String - Object Type - Required
ResultAmount- Number (integer) - Amount of object to spawn - Defaults to 1
Returns
None
Example
ModVariable.AddRecipeToConverter("Workbench", "Berries", 3)
Note
Can be used in functions: BeforeLoad()

◆ GetIngredientsAmountForRecipe()

int [] ModVariable.GetIngredientsAmountForRecipe ( string  NewObjectResultString)

Get Ingredients Amount for Recipe

Version
134.19
Parameters
NewObjectResultString- String - Object Type
Returns
Number (integer) - Each ingredient amount
Example
ModVariable.GetIngredientsAmountForRecipe("BasicWorker")
Note
Can be used in functions: BeforeLoad()

◆ GetIngredientsForRecipe()

string [] ModVariable.GetIngredientsForRecipe ( string  NewObjectResultString)

Get Ingredients for Recipe

Version
134.19
Parameters
NewObjectResultString- String - Object Type
Returns
String (Array) - Each ingredient
Example
ModVariable.GetIngredientsForRecipe("BasicWorker")
Note
Can be used in functions: BeforeLoad()

◆ GetVariableFarmerActionAsInt()

int ModVariable.GetVariableFarmerActionAsInt ( string  ActionString,
string  TargetTypeString,
string  ToolTypeString,
bool  CheckValid = true 
)

Get Variable (Action 'to' TargetType 'using' ToolType - returns Int)(FARMER BASED ON OBJECTS)

Version
134.19
Parameters
ActionString- String - Farmer State Action
TargetTypeString- String - Object Type (Target)
ToolTypeString- String - Tool Type
CheckValid- Boolean - Force check for validity - Defaults to true
Returns
Number (integer) - Amount of actions required
Example
ModVariable.GetVariableFarmerActionAsInt("Chopping", "TreeCoconut", "Rock", true)
Note
Can be used in functions: BeforeLoad()

◆ GetVariableFarmerActionOnTilesAsInt()

int ModVariable.GetVariableFarmerActionOnTilesAsInt ( string  ActionString,
string  TileTypeString,
string  ToolTypeString,
bool  CheckValid = true 
)

Get Variable (Action 'to' TargetType 'using' ToolType - returns Int)(FARMER BASED ON TILES)

Version
134.19
Parameters
ActionString- String - Farmer State Action
TileTypeString- String - Object Type (Target)
ToolTypeString- String - Tool Type
CheckValid- Boolean - Force check for validity - Defaults to true
Returns
Number (integer) - Amount of actions required
Example
ModVariable.SetVariableFarmerActionOnTiles("Mining", "Coal", "ToolPickStone", 20)
Note
Can be used in functions: BeforeLoad()

◆ GetVariableFarmerActionOnTilesAsName()

string ModVariable.GetVariableFarmerActionOnTilesAsName ( string  ActionString,
string  TileTypeString,
string  ToolTypeString 
)

Get Variable Name (STRING)(FARMER BASED ON TILES)

Version
134.19
Parameters
ActionString- String - Farmer State Action
TileTypeString- String - Object Type (Target)
ToolTypeString- String - Tool Type
Returns
String - Name of the Action
Example
ModVariable.GetVariableFarmerActionOnTilesAsName("Mining", "Coal", "ToolPickStone")
Note
Can be used in functions: BeforeLoad()

◆ GetVariableForObjectAsFloat()

float ModVariable.GetVariableForObjectAsFloat ( string  NewTypeString,
string  VariableName,
bool  CheckValid = true 
)

Get Variable (float) (Object 'with' VariableName 'set to' float)

Version
134.19
Parameters
NewTypeString- String - Object Type
VariableName- String - Variable
CheckValid- Boolean - Force check for validity - Defaults to true
Returns
Number (float) - Variable amount
Example
ModVariable.GetVariableForObjectAsFloat("WorkerDriveMk1", "SpeedScale")
Note
Can be used in functions: BeforeLoad()

◆ GetVariableForObjectAsInt()

int ModVariable.GetVariableForObjectAsInt ( string  NewTypeString,
string  VariableName,
bool  CheckValid = true 
)

Get Variable (INT) (Object 'with' VariableName 'set to' Int)

Version
134.19
Parameters
NewTypeString- String - Object Type
VariableName- String - Variable
CheckValid- Boolean - Force check for validity - Defaults to true
Returns
Number (integer) - Variable amount
Example
ModVariable.GetVariableForObjectAsInt("ToolAxe", "MaxUsage")
Note
Can be used in functions: BeforeLoad()

◆ GetVariableForObjectAsString()

string ModVariable.GetVariableForObjectAsString ( string  NewTypeString,
string  VariableName,
bool  CheckValid = true 
)

Get Variable (STRING) (Object 'with' VariableName 'set to' String)

Version
134.19
Parameters
NewTypeString- String - Object Type
VariableName- String - Variable
CheckValid- Boolean - Force check for validity - Defaults to true
Returns
String - Variable as String
Example
ModVariable.GetVariableForObjectAsString("WorkingSoundName", "WorkerWorkingClockwork")
Note
Can be used in functions: BeforeLoad()

◆ RemoveRecipeFromConverter()

bool ModVariable.RemoveRecipeFromConverter ( string  NewConverterString,
string  NewObjectResultString 
)

Removes an existing Recipe from a specific converter

Version
136.19
Parameters
NewConverterString- String - The Converter this applies to - Required
NewObjectResultString- String - Object Recipe Type - Required
Returns
Boolean - True if removed recipe
Example
ModVariable.RemoveRecipeFromConverter("Workbench", "Berries")
Note
Can be used in functions: BeforeLoad()

◆ SetIngredientsForRecipe()

void ModVariable.SetIngredientsForRecipe ( string  NewObjectResultString,
string[]  NewIngredientsStringArr,
int[]  NewIngredientsAmountArr,
int  ResultAmount 
)

Create a Recipe by settings ingredients

Version
134.19
Parameters
NewObjectResultString- String - Object Type
NewIngredientsStringArr- String (Array) - Each ingredient
NewIngredientsAmountArr- Number (integer) - Each ingredient amount
ResultAmount- Number (integer) - Amount of object to spawn
Returns
None
Example
ModVariable.SetIngredientsForRecipe("Berries", {"Stick"}, {1}, 10)
Note
Can be used in functions: BeforeLoad()

◆ SetIngredientsForRecipeSpecific()

void ModVariable.SetIngredientsForRecipeSpecific ( string  NewConverterString,
string  NewObjectResultString,
string[]  NewIngredientsStringArr = null,
int[]  NewIngredientsAmountArr = null,
int  ResultAmount = 1 
)

Create a Recipe by settings ingredients ONLY for a specific converter

Version
134.19
Parameters
NewConverterString- String - The Converter this applies to - Required
NewObjectResultString- String - Object Type - Required
NewIngredientsStringArr- String (Array) - Each ingredient - Required
NewIngredientsAmountArr- Number (integer) - Each ingredient amount - Required
ResultAmount- Number (integer) - Amount of object to spawn - Defaults to 1
Returns
None
Example
ModVariable.SetIngredientsForRecipeSpecific("Workbench", "BasicWorker", {"Berries","Pole","Plank"}, {4,2,1}, 1)
Note
Can be used in functions: BeforeLoad()

◆ SetIngredientsForRecipeSpecificDoubleResults()

void ModVariable.SetIngredientsForRecipeSpecificDoubleResults ( string  NewConverterString,
string  NewObjectResultString1,
string  NewObjectResultString2,
string[]  NewIngredientsStringArr,
int[]  NewIngredientsAmountArr,
int  ResultAmount1 = 1,
int  ResultAmount2 = 1 
)

Create a Recipe by settings ingredients with a double result for a specific converter

Version
136.26
Parameters
NewConverterString- String - The Converter this applies to - Required
NewObjectResultString1- String - Object Type to produce (1) - Required
NewObjectResultString2- String - Object Type to produce (2) - Required
NewIngredientsStringArr- String (Array) - Each ingredient - Required
NewIngredientsAmountArr- Number (integer) - Each ingredient amount - Required
ResultAmount1- Number (integer) - Amount of object (1) to spawn - Defaults to 1
ResultAmount2- Number (integer) - Amount of object (2) to spawn - Defaults to 1
Returns
None
Example
ModVariable.SetIngredientsForRecipeSpecificDoubleResults("Workbench", "AnimalCow", "AnimalSheep", {"Berries","Pole","Plank"}, {4,2,1}, 2, 3)
This produces 2xAnimalCow and 3xAnimalSheep provided ingredients 4xBerries,2xPole,1xPlank on the Workbench converter This changes the recipe for AnimalCow ONLY, AnimalSheep will use previous recipe, it's purely an extra output in this case
Note
Can be used in functions: BeforeLoad()

◆ SetVariableFarmerAction()

void ModVariable.SetVariableFarmerAction ( string  ActionString,
string  TargetTypeString,
string  ToolTypeString,
int  Int 
)

Set Variable (Action 'to' TargetType 'using' ToolType 'takes' Int)(FARMER BASED ON OBJECTS)

Version
134.19
Parameters
ActionString- String - Farmer State Action
TargetTypeString- String - Object Type (Target)
ToolTypeString- String - Tool Type
Int- Number (integer) - Amount of actions required
Returns
None
Example
ModVariable.SetVariableFarmerAction("Chopping", "TreeCoconut", "Rock", 32)
Note
Can be used in functions: BeforeLoad()

◆ SetVariableFarmerActionOnTiles()

void ModVariable.SetVariableFarmerActionOnTiles ( string  ActionString,
string  TileTypeString,
string  ToolTypeString,
int  Int 
)

Set Variable (Action 'on' NewType 'using' ToolType 'takes' Int)(FARMER BASED ON TILES)

Version
134.19
Parameters
ActionString- String - Farmer State Action
TileTypeString- String - Object Type (Target)
ToolTypeString- String - Tool Type
Int- Number (integer) - Amount of actions required
Returns
None
Example
ModVariable.SetVariableFarmerActionOnTiles("Mining", "Coal", "ToolPickStone", 20)
Note
Can be used in functions: BeforeLoad()

◆ SetVariableForBuildingUpgrade()

void ModVariable.SetVariableForBuildingUpgrade ( string  ObjectTypeFromString,
string  ObjectTypeToString 
)

Sets the "UpgradeTo" and "UpgradeFrom" as one simple setter

Version
135.15
Parameters
ObjectTypeFromString- String - Object Type of Building to upgrade 'from'
ObjectTypeToString- String - Object Type of Building to upgrade 'to'
Returns
None
Example
ModVariable.SetVariableForBuildingUpgrade("StorageGeneric", "StorageGenericMedium")
Note
Can be used in functions: BeforeLoad()

◆ SetVariableForObjectAsFloat()

void ModVariable.SetVariableForObjectAsFloat ( string  NewTypeString,
string  VariableName,
float  Float 
)

Set Variable (float) (Object 'with' VariableName 'set to' float)

Version
134.19
Parameters
NewTypeString- String - Object Type
VariableName- String - Variable
float- Number (float) - Value to set
Returns
None
Example
ModVariable.SetVariableForObjectAsFloat("WorkerDriveMk1", "SpeedScale", 0.5f)
Note
Can be used in functions: BeforeLoad()

◆ SetVariableForObjectAsInt()

void ModVariable.SetVariableForObjectAsInt ( string  NewTypeString,
string  VariableName,
int  Int 
)

Set Variable (INT) (Object 'with' VariableName 'set to' Int)

Version
134.19
Parameters
NewTypeString- String - Object Type
VariableName- String - Variable
Int- Number (integer) - Value to set
Returns
None
Example
ModVariable.SetVariableForObjectAsInt("ToolAxe", "MaxUsage", 50)
Note
Can be used in functions: BeforeLoad()

◆ SetVariableForObjectAsIntFromString()

void ModVariable.SetVariableForObjectAsIntFromString ( string  NewTypeString,
string  VariableName,
string  StringInt 
)

Set Variable (INT) From String (Object 'with' VariableName 'set to' Int)

Version
137.17
Parameters
NewTypeString- String - Object Type
VariableName- String - Variable
Int- Number (integer) - Value to set
Returns
None
Example
ModVariable.SetVariableForObjectAsIntFromString("Hut", "RepairObject", "Plank")
Note
Can be used in functions: BeforeLoad()

◆ SetVariableForObjectAsString()

void ModVariable.SetVariableForObjectAsString ( string  NewTypeString,
string  VariableName,
string  String 
)

Set Variable (STRING) (Object 'with' VariableName 'set to' String)

Version
134.19
Parameters
NewTypeString- String - Object Type
VariableName- String - Variable
String- String - Value to set
Returns
None
Example
ModVariable.SetVariableForObjectAsString("WorkerDriveMk0", "MoveSoundName", "WorkerCrudeMove")
Note
Can be used in functions: BeforeLoad()

◆ SetVariableForStorageAmount()

void ModVariable.SetVariableForStorageAmount ( string  NewTypeString,
int  Int 
)

Set Storage Amount for type

Version
134.19
Parameters
NewTypeString- String - Object Type
Int- Number (integer) - Value of each storage
Returns
None
Example
ModVariable.SetVariableForStorageAmount("Plank", 200)
Note
Can be used in functions: BeforeLoad()

The documentation for this class was generated from the following file: