User Tools

Site Tools

Urban Games

modding:constructionbasics

Differences

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

Link to this comparison view

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/07 21:39]
yoshi
Line 173: Line 173:
 </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''.
Line 203: Line 203:
  
 <div tip 100%> <div tip 100%>
-There are two additional properties ''params.paramX'' and ''params.paramY'' that are controlled by keyboard keys. Per default the keys are <span key>O</span>/<span key>P</span> and <span key>Ü</span>/<span key>+</span>. They each have steps of 2π/32 so that 32 steps can be mapped to a full rotation around an axis.+There are two additional properties ''params.paramX'' and ''params.paramY'' that are controlled by keyboard keys. Per default the keys are <span key>O</span>/<span key>P</span> and <span key>Ü</span>/<span key>+</span> or <span key>[</span>/<span key>]</span> (depending on keyboard layout). They each have steps of 2π/32 so that 32 steps can be mapped to a full rotation around an axis.
  
 To support rotation around all three axis, encapsulate the transformation matrix of the model with the ''rotateTransf'' function  To support rotation around all three axis, encapsulate the transformation matrix of the model with the ''rotateTransf'' function 
Line 303: Line 303:
   * ''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.
  
  
Line 392: Line 394:
   * ''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>
modding/constructionbasics.txt · Last modified: 2021/07/04 01:11 by yoshi