Autonauts Modding
ModTool Class Reference
Inheritance diagram for ModTool:
ModCustom

Public Member Functions

void CreateTool (string UniqueName, string[] NewIngredientsStringArr=null, int[] NewIngredientsAmountArr=null, string[] ObjectsToUseOnArr=null, string[] TilesToUseOnArr=null, string[] ObjectsToProduceArr=null, int[] ObjectsToProduceAmountArr=null, float AnimationDuration=2.0f, string ModelName="", bool UsingCustomModel=true, DynValue CallbackOnComplete=null, bool DestroyTarget=true)
 
- Public Member Functions inherited from ModCustom
void UpdateModelParameters (string UniqueName, float Scale=1f, float RotX=0f, float RotY=0f, float RotZ=0f, float TransX=0f, float TransY=0f, float TransZ=0f)
 
void UpdateModelScale (string UniqueName, float Scale=1f)
 
void UpdateModelScaleSplit (string UniqueName, float ScaleX=1f, float ScaleY=1f, float ScaleZ=1f)
 
void UpdateModelRotation (string UniqueName, float RotX=0f, float RotY=0f, float RotZ=0f)
 
void UpdateModelTranslation (string UniqueName, float TransX=0f, float TransY=0f, float TransZ=0f)
 
void RegisterForCustomCallback (string UniqueName, string CallbackType, DynValue Callback)
 

Member Function Documentation

◆ CreateTool()

void ModTool.CreateTool ( string  UniqueName,
string[]  NewIngredientsStringArr = null,
int[]  NewIngredientsAmountArr = null,
string[]  ObjectsToUseOnArr = null,
string[]  TilesToUseOnArr = null,
string[]  ObjectsToProduceArr = null,
int[]  ObjectsToProduceAmountArr = null,
float  AnimationDuration = 2.0f,
string  ModelName = "",
bool  UsingCustomModel = true,
DynValue  CallbackOnComplete = null,
bool  DestroyTarget = true 
)

Create a custom tool item, one the player can pickup and use on defined objects

Version
135.6
Parameters
UniqueName- String - The unique and corresponding name of the tool - Required
Ingredients- String array - List of ingredients required to make the tool - Defaults to none
IngredientQuantities- Number (integer) array - The amount of each of the ingredients (Must match size of ingredients array) - Defaults to none
ObjectsToUseOn- String array - List of objects this tool works on - Defaults to none
TilesToUseOn- String array - List of tiles this tool works on - Defaults to none
ObjectsToProduce- String array - List of objects to produce once tool has been used - Defaults to none
ObjectsToProduceAmount- Number (integer) array - Amount of each object to produce once tool has been used - Defaults to none
AnimationDuration- Number (float) - How long the animation lasts - Defaults to 2 seconds
ModelName- String - The name/path of the custom model to use or name/path of the in game model to use - Defaults to in game 'Axe' Model
UsingCustomModel- Boolean - True if using a custom model, false if using in game model/default model - Defaults to true
CallbackOnComplete- Function - The function to callback when the tool action is complete [Param 1 is the Unique ID of the Bot/Farmer/User, Param 2 is TileLocation X, Param 3 is Y] - Defaults to none
DestroyTarget- Boolean - Destroy the target object once completed - Defaults to true
Returns
None
Example
ModTool.CreateTool("MagicCowWand", {"Stick"}, {1}, {"AnimalCow"}, {}, {"AnimalSheep", "AnimalChicken"}, {3, 1}, 2.0, "Models/Tools/ToolChiselCrude", false, WandCallback) – Use on Cow, In Game Model
ModTool.CreateTool("MagicCowWand", {"Stick"}, {1}, {"AnimalCow"}, {}, {"AnimalSheep", "AnimalChicken"}, {3, 1}, 2.0, "hammer", true, WandCallback) – Use on Cow, Custom Model
ModTool.CreateTool("GrassCow", {"Stick"}, {1}, {}, {"Empty"}, {"AnimalCow"}, {1}, 2.0, "Models/Tools/ToolChiselCrude", false, WandCallback) – Use on Grass Tile, Produce Cow, In Game Model
Callback example: function WandCallback(UserUID, TileX, TileY, TargetUID, TargetType) Callback params: Actioner UID (Player/Bot UID), Tile X Location, Tile Y Location, Target UID (-1 if target set to destroy), Target Type
Note
Can be used in functions: Creation()

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