This is an old revision of the document!
Table of Contents
Mod management functions
All these functions are available on your mod object
dofile
Loads and runs a Lua script
Returns true
if the file is inside the mod directory and exists, false
otherwise
boolean myMod:dofile(scriptPath [, args…])
Name | Type | Description |
---|---|---|
scriptPath | string | the relative path to the file, inside the mod directory |
args | any | optional, variables passed on to the target script |
register
Register a new game asset
void myMod:register(assetData])
Name | Type | Description |
---|---|---|
assetData | table | the data defining the new asset. The table must contain at least the asset's type (DataType , see API for the complete list) and its ID (Id ) |
Example
local assetData = { DataType = "ASSET_TYPE", Id = "ASSET_ID", ... } myMod:register(assetData)
override
Override an existing game asset (see Asset Override for a complete explanation)
void myMod:override(assetData])
Name | Type | Description | |
---|---|---|---|
assetData | table | the data defining the overridden asset. The table must contain at least the existing asset's type (Id , see [assets | Assets]] for the complete list) |
Example
local assetData = { Id = "ASSET_ID", ... } myMod:override(assetData)
registerAssetId
Assign an asset ID to an asset in the mod's directory
void myMod:registerAssetId(assetPath, assetId])
Name | Type | Description |
---|---|---|
assetPath | string | the path to the asset |
assetId | string | the ID to assign to the asset |
registerPrefabComponent
Registers a component to a prefab (see Components for a complete explanation)
void myMod:registerPrefabComponent(prefabPath, componentData])
Name | Type | Description |
---|---|---|
prefabPath | string | the path to the prefab |
componentData | table | the data defining the component. The table must contain at least the component's type (DataType , see API for the complete list) |
Example
local componentData = { DataType = "COMPONENT_TYPE", ... } myMod:registerPrefabComponent(prefabPath, componentData)
registerAssetProcessor
Registers an asset processor to a file (see Building Asset Processor for a complete explanation)
void myMod:registerAssetProcessor(filePath, processorData])
Name | Type | Description |
---|---|---|
filePath | string | the path to the file |
processorData | table | the data defining the asset processor. The table must contain at least the processor's type (DataType , see API for the complete list) |
Example
local processorData= { DataType = "PROCESSOR_TYPE", ... } myMod:registerPrefabComponent(filePath, processorData)
configurePrefabFlagList
Configure a prefab with a list of flags
void myMod:configurePrefabFlagList(prefabPath, flagArray])
Name | Type | Description |
---|---|---|
prefabPath | string | the path to the prefab |
flagArray | table | the list of flags to apply on the prefab |
Example
local flagArray = { "BRIDGE", "PLATEFORM" } myMod:configurePrefabFlagList(prefabPath, flagArray)