preview
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
preview [2019/10/02 15:56] – polymorphgames | preview [2020/04/22 11:50] – vjraymon | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
+ | Since 1.5, Foundation allows to mod Custom component and links it to a fbx (see Exemple02) | ||
- | :!: Please do not upload mods for Foundation 1.4 to mod.io before | + | The following LUA code computes and returns |
- | ===== How to Access | + | function MY_CUSTOM_COMPONENT: |
- | Contact developer | + | local raycastResult |
+ | |||
+ | -- Raycast from the _globalPosition + 1000 | ||
+ | -- to _globalPosition - 1000 | ||
+ | -- only on objects with a WATER flag | ||
+ | local FromPosition | ||
+ | local ToPosition | ||
+ | if not self: | ||
+ | | ||
+ | | ||
+ | 2 ^ OBJECT_FLAG.WATER: | ||
+ | | ||
+ | MyMod: | ||
+ | .. tostring(_globalPosition)) | ||
+ | return _globalPosition[2] | ||
+ | else | ||
+ | return raycastResult[" | ||
+ | end | ||
+ | end | ||
- | ===== Generated Documentation ===== | + | You can do the same with the ground by replacing OBJECT_FLAG.WATER by OBJECT_FLAG.GROUND |
- | * [[preview: | + | |
- | * [[preview: | + | |
- | * [[api: | + | |
- | ===== New Features ===== | + | If the water (or the ground) is not found (for instance when the _globalPosition out of the map) then a warning is edited in the logs, and the code return the Y of the _globalPosition. |
- | * [[#Building part function|Building part functions are now assets, declared individually.]] | + | |
- | * [[preview: | + | |
- | * [[#Resource type list|A resource can now have multiple resource types]] | + | |
- | * [[preview: | + | |
- | ===== Migration Notes ===== | ||
- | ==== Building part function ==== | ||
- | For assets from type '' | ||
- | Migration example for the //Example 02// mod: | ||
- | <file lua building_parts.lua> | ||
- | mod: | ||
- | DataType = " | ||
- | ... | ||
- | -- OLD | ||
- | -- BuildingFunction = { | ||
- | -- DataType = " | ||
- | -- WorkerCapacity = 4, | ||
- | -- RelatedJob = { Job = " | ||
- | -- ResourceProduced = { | ||
- | -- { Resource = " | ||
- | -- } | ||
- | -- }, | ||
- | |||
- | -- NEW | ||
- | BuildingFunction = " | ||
- | |||
- | ... | ||
- | }) | ||
- | |||
- | -- ALSO NEW | ||
- | mod: | ||
- | DataType = " | ||
- | Id = " | ||
- | WorkerCapacity = 4, | ||
- | RelatedJob = { Job = " | ||
- | ResourceProduced = { | ||
- | { Resource = " | ||
- | } | ||
- | }) | ||
- | </ | ||
- | |||
- | ==== Resource type list ==== | ||
- | The enumeration '' | ||
- | |||
- | Another change is that resource, markets, granaries and warehouses can now have multiple resource types. This, combined with new customizable resource types, will be useful to customize where resources can be stocked and sold. This means that the property '' | ||
- | |||
- | For example, before this change, the wine was a resource of type '' | ||
- | |||
- | Migration example: | ||
- | <file lua> | ||
- | mod: | ||
- | DataType = " | ||
- | ... | ||
- | |||
- | -- OLD | ||
- | -- ResourceType = " | ||
- | |||
- | -- NEW | ||
- | ResourceTypeList = { | ||
- | " | ||
- | " | ||
- | } | ||
- | |||
- | ... | ||
- | }) | ||
- | </ |