User Tools

Site Tools


mod-functions:mod

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mod-functions:mod [2020/01/23 13:48] maximemod-functions:mod [2020/05/06 16:32] (current) – removed maxime
Line 1: Line 1:
-====== Mod management functions ====== 
  
-===== dofile ===== 
- 
-Loads and runs a Lua script 
- 
-<code lua> 
-local result = myMod:dofile(scriptPath [, args]) 
-</code> 
- 
-Parameters: 
-  * ''scriptPath '' (string): the relative path to the file, inside the mod directory 
-  * ''args'' (optional): variables passed on to the target script 
- 
-Return: 
-  * ''success'' (boolean): true if the file is inside the mod directory and exists, false otherwise 
- 
----- 
- 
-===== register ===== 
- 
-Register a new game asset 
- 
-<code lua> 
-local assetData = { 
-    DataType = "ASSET_TYPE", 
-    Id = "ASSET_ID", 
-    ... 
-} 
-myMod:register(assetData) 
-</code> 
- 
-Parameters: 
-  * ''assetData'' (table): the data defining the new asset. The table must contain at least the asset's type (''DataType'', see [[api|API]] for the complete list) and its ID (''Id''). 
- 
----- 
- 
-===== override ===== 
- 
-Override an existing game asset (see [[asset-override|Asset Override]] for a complete explanation) 
- 
-<code lua> 
-local assetData = { 
-    Id = "ASSET_ID", 
-    ... 
-} 
-myMod:override(assetData) 
-</code> 
- 
-Parameters: 
-  * ''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). 
- 
----- 
- 
-===== registerAssetId ===== 
- 
-Assign an asset ID to an asset in the mod's directory 
- 
-<code lua> 
-myMod:registerAssetId(assetPath, assetId) 
-</code> 
- 
-Parameters: 
-  * ''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|Components]] for a complete explanation) 
- 
-<code lua> 
-local componentData = { 
-    DataType = "COMPONENT_TYPE", 
-    ... 
-} 
-myMod:registerPrefabComponent(prefabPath, componentData) 
-</code> 
- 
-Parameters: 
-  * ''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|API]] for the complete list). 
- 
----- 
- 
-===== registerAssetProcessor ===== 
- 
-Registers an asset processor to a file (see [[building-asset-processor|Building Asset Processor]] for a complete explanation) 
- 
-<code lua> 
-local processorData= { 
-    DataType = "PROCESSOR_TYPE", 
-    ... 
-} 
-myMod:registerPrefabComponent(filePath, processorData) 
-</code> 
- 
-Parameters: 
-  * ''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|API]] for the complete list). 
- 
----- 
- 
-===== configurePrefabFlagList ===== 
- 
-Configure a prefab with a list of flags 
- 
-<code lua> 
-local flagArray = { "BRIDGE", "PLATEFORM" } 
-myMod:configurePrefabFlagList(prefabPath, flagArray) 
-</code> 
- 
-Parameters: 
-  * ''prefabPath'' (string): the path to the prefab 
-  * ''flagArray'' (table): the list of flags to apply on the prefab 
mod-functions/mod.1579805316.txt.gz · Last modified: 2020/01/23 13:48 by maxime

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki