User Tools

Site Tools


mod-management-functions

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
mod-management-functions [2020/07/07 17:16]
maxime
mod-management-functions [2020/07/08 10:37]
maxime
Line 21: Line 21:
 Register a new game asset Register a new game asset
  
-''​void **myMod:​register**(//​assetData//​])''​+''​void **myMod:​register**(//​assetData//​)''​
  
 ^ Name ^ Type ^ Description ^ ^ Name ^ Type ^ Description ^
Line 43: Line 43:
 Override an existing game asset (see [[:​asset-override|Asset Override]] for a complete explanation) Override an existing game asset (see [[:​asset-override|Asset Override]] for a complete explanation)
  
-''​void **myMod:​override**(//​assetData//​])''​+''​void **myMod:​override**(//​assetData//​)''​
  
 ^ Name ^ Type ^ Description ^ ^ Name ^ Type ^ Description ^
Line 64: Line 64:
 Assign an asset ID to an asset in the mod's directory Assign an asset ID to an asset in the mod's directory
  
-''​void **myMod:​registerAssetId**(//​assetPath//,​ //assetId//])''​+''​void **myMod:​registerAssetId**(//​assetPath//,​ //​assetId//​)''​
  
 ^ Name ^ Type ^ Description ^ ^ Name ^ Type ^ Description ^
Line 76: Line 76:
 Registers a component to a prefab (see [[:​components|Components]] for a complete explanation) Registers a component to a prefab (see [[:​components|Components]] for a complete explanation)
  
-''​void **myMod:​registerPrefabComponent**(//​prefabPath//,​ //​componentData//​])''​+''​void **myMod:​registerPrefabComponent**(//​prefabPath//,​ //​componentData//​)''​
  
 ^ Name ^ Type ^ Description ^ ^ Name ^ Type ^ Description ^
Line 98: Line 98:
 Registers an asset processor to a file (see [[:​building-asset-processor|Building Asset Processor]] for a complete explanation) Registers an asset processor to a file (see [[:​building-asset-processor|Building Asset Processor]] for a complete explanation)
  
-''​void **myMod:​registerAssetProcessor**(//​filePath//,​ //​processorData//​])''​+''​void **myMod:​registerAssetProcessor**(//​filePath//,​ //​processorData//​)''​
  
 ^ Name ^ Type ^ Description ^ ^ Name ^ Type ^ Description ^
Line 120: Line 120:
 Configure a prefab with a list of flags Configure a prefab with a list of flags
  
-''​void **myMod:​configurePrefabFlagList**(//​prefabPath//,​ //​flagArray//​])''​+''​void **myMod:​configurePrefabFlagList**(//​prefabPath//,​ //​flagArray//​)''​
  
 ^ Name ^ Type ^ Description ^ ^ Name ^ Type ^ Description ^
Line 131: Line 131:
 local flagArray = { "​BRIDGE",​ "​PLATFORM"​ } local flagArray = { "​BRIDGE",​ "​PLATFORM"​ }
 myMod:​configurePrefabFlagList(prefabPath,​ flagArray) myMod:​configurePrefabFlagList(prefabPath,​ flagArray)
 +</​code>​
 +
 +----
 +
 +===== registerClass =====
 +
 +Registers a new data type, or a new type extending an existing one
 +
 +''​void **myMod:​registerClass**(//​classInfo//​)''​
 +
 +^ Name ^ Type ^ Description ^
 +| //''​classInfo''//​ | ''​table''​ | a table containing all info about the new type |
 +
 +==== Example ====
 +
 +Definition of a new component type with two properties, and an init function
 +
 +<code lua>
 +local newClassInfo = {
 +    TypeName = "​MY_CUSTOM_COMPONENT",​
 +    ParentType = "​COMPONENT",​ -- if this field is missing, the new type will be a data type
 +    Properties = {
 +        { Name = "​CurrentRotation",​ Type = "​float",​ Default = 0.0, Flags = { "​SAVE_GAME"​ } },
 +        { Name = "​CurrentPosition",​ Type = "​vec3f"​ }
 +    }
 +}
 +
 +function newClassInfo:​init()
 +    self.CurrentPosition = self:​getOwner():​getGlobalPosition()
 +end
 +
 +myMod:​registerClass(newClassInfo)
 </​code>​ </​code>​
  
Line 139: Line 171:
 Registers a new dynamic enumeration value Registers a new dynamic enumeration value
  
-''​void **myMod:​registerEnumValue **(//​enumeration//,​ //​stringValue//​)''​+''​void **myMod:​registerEnumValue**(//​enumeration//,​ //​stringValue//​)''​
  
 ^ Name ^ Type ^ Description ^ ^ Name ^ Type ^ Description ^
mod-management-functions.txt ยท Last modified: 2020/07/17 14:35 by maxime