User Tools

Site Tools


custom-classes

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
custom-classes [2020/07/08 11:18] maximecustom-classes [2022/03/29 20:36] (current) – added creacting custom classes guides minotorious
Line 1: Line 1:
-====== Custom classes ======+====== Custom Classes ======
  
 You can define new types with the ''mod:registerClass'' function. This function allows you to create new data types, or extend existing core classes. You can define new types with the ''mod:registerClass'' function. This function allows you to create new data types, or extend existing core classes.
Line 9: Line 9:
 ---- ----
  
-===== Extendable classes =====+===== Extendable Classes =====
  
 Some core types are flagged as **Extendable** in the documentation. This means an extendable type can be used as parent type when creating a custom type. In addition to new functions, you can override some base functions existing in the parent type, flagged as **Virtual function**. When extend a virtual function, define a new function for your custom type with the same type and parameters. You can call the parent function using the keyword ''super''. Some core types are flagged as **Extendable** in the documentation. This means an extendable type can be used as parent type when creating a custom type. In addition to new functions, you can override some base functions existing in the parent type, flagged as **Virtual function**. When extend a virtual function, define a new function for your custom type with the same type and parameters. You can call the parent function using the keyword ''super''.
Line 22: Line 22:
 ---- ----
  
-===== Custom components =====+===== Custom Components =====
  
 For custom types extending ''[[api:component|COMPONENT]]'', you can override some base functions that are automatically called for all components: For custom types extending ''[[api:component|COMPONENT]]'', you can override some base functions that are automatically called for all components:
Line 34: Line 34:
      
 You can see an example of component definition in the mod Example 02 in ''scripts/component/COMP_ANTENNA.lua'' You can see an example of component definition in the mod Example 02 in ''scripts/component/COMP_ANTENNA.lua''
 +
 +----
 +
 +===== Guides on Custom Classes =====
 +
 +  * [[custom-data|Creating a Custom DATA Object]]
 +  * [[custom-asset|Creating a Custom ASSET Object]]
 +  * [[custom-building-function|Creating a Custom BUILDING_FUNCTION]]
 +  * [[custom-mandate|Creating a Custom MANDATE]]
custom-classes.txt · Last modified: 2022/03/29 20:36 by minotorious

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki