Both sides previous revision
Previous revision
Next revision
|
Previous revision
Next revision
Both sides next revision
|
modding:constructionbasics [2020/06/12 10:12] yoshi [UpdateFn] |
modding:constructionbasics [2020/07/01 00:46] yoshi [UpdateFn] |
</code> | </code> |
==== UpdateFn ==== | ==== UpdateFn ==== |
In this function, the construction is configured and specified. You can use the content of the table ''params'' to configure the construction. It also contains the selection of the user parameters you have specified in the ''params'' list above. See the [[:modding:constructiontypes||list of construction types]] to find out, which additional properties are available in the ''params'' table depending on the construction type. | In this function, the construction is configured and specified. You can use the content of the table ''params'' to configure the construction. It also contains the selection of the user parameters you have specified in the ''params'' list above. See the [[:modding:constructiontypes|list of construction types]] to find out, which additional properties are available in the ''params'' table depending on the construction type. |
| |
The ''updateFn'' returns a data struct with several mandatory and many optional properties. They are described below. Please note, that the return data struct is refered as ''result''. | The ''updateFn'' returns a data struct with several mandatory and many optional properties. They are described below. Please note, that the return data struct is refered as ''result''. |
* ''left'' is set to false, if the object should be placed on the right side of the edge. ''true'' leads to objects on the left side. | * ''left'' is set to false, if the object should be placed on the right side of the edge. ''true'' leads to objects on the left side. |
* ''model'' is a reference to a ''.mdl'' file relative to ''res/models/model''. | * ''model'' is a reference to a ''.mdl'' file relative to ''res/models/model''. |
| |
| Please be aware that it is not possible to add more than one object per edge by script. |
| |
| |
* ''bulldozeCost'' is paid when the construction is demolished. | * ''bulldozeCost'' is paid when the construction is demolished. |
* ''maintenanceCost'' is paid monthly to maintain the infrastructure. | * ''maintenanceCost'' is paid monthly to maintain the infrastructure. |
| |
| === Label List === |
| For models with ''"CUSTOM"'' typed labels, the content can be provided here: |
| <code lua> |
| result.labelText = { |
| [12] = { "Label", "SomeText"} |
| } |
| </code> |
| |
| The ''labelText'' list contains a mapping of keys to value lists. The key number equals the id of the model in ''result.models'' that should be provided with some custom label texts. The list contains the strings. The first string is for the first label of the model, the second for the second model and so on. |
| |
\\ | \\ |
| |
<div page_next>[[:modding:constructiontypes|Construction Types]]</div> | <div page_next>[[:modding:constructiontypes|Construction Types]]</div> |