mtr_addon:nte:js:train
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
mtr_addon:nte:js:train [2024/02/06 22:30] – создано weryskok | mtr_addon:nte:js:train [2024/04/09 17:45] (current) – weryskok | ||
---|---|---|---|
Line 20: | Line 20: | ||
} | } | ||
</ | </ | ||
+ | |||
In general, the parameters are the same as those required for regular resourcepacks for MTR, except for the '' | In general, the parameters are the same as those required for regular resourcepacks for MTR, except for the '' | ||
Line 33: | Line 34: | ||
===== Global Environment ===== | ===== Global Environment ===== | ||
+ | |||
All trains of the same type use the same working environment (global variables and etc). | All trains of the same type use the same working environment (global variables and etc). | ||
Line 38: | Line 40: | ||
===== Called Functions ===== | ===== Called Functions ===== | ||
+ | |||
Your script should include the following functions that the NTE will call as needed: | Your script should include the following functions that the NTE will call as needed: | ||
+ | |||
<code javascript> | <code javascript> | ||
function create(ctx, state, train) { ... } | function create(ctx, state, train) { ... } | ||
Line 47: | Line 51: | ||
^ Functions ^ Description ^ | ^ Functions ^ Description ^ | ||
| '' | | '' | ||
- | | '' | + | | '' |
- | | '' | + | | '' |
The NTE calls these functions with three parameters, each of which is described below. | The NTE calls these functions with three parameters, each of which is described below. | ||
Line 60: | Line 64: | ||
===== TrainScriptContext ===== | ===== TrainScriptContext ===== | ||
+ | |||
The following functions are called to **control rendering**. The functions for rendering models should be called each time '' | The following functions are called to **control rendering**. The functions for rendering models should be called each time '' | ||
+ | |||
* <code javascript> | * <code javascript> | ||
TrainScriptContext.drawCarModel(model: | TrainScriptContext.drawCarModel(model: | ||
</ | </ | ||
- | * Requests | + | * Requests NTE to render the car model. |
* '' | * '' | ||
* '' | * '' | ||
Line 79: | Line 85: | ||
Call the following functions to **play sounds**. Call only when you need to start playback, repeated calls will cause multiple sounds to stack. | Call the following functions to **play sounds**. Call only when you need to start playback, repeated calls will cause multiple sounds to stack. | ||
+ | |||
* <code javascript> | * <code javascript> | ||
TrainScriptContext.playCarSound(sound: | TrainScriptContext.playCarSound(sound: | ||
Line 89: | Line 96: | ||
In addition, there is a set of functions to **aid development and debugging**. | In addition, there is a set of functions to **aid development and debugging**. | ||
+ | |||
* <code javascript> | * <code javascript> | ||
TrainScriptContext.setDebugInfo(key: | TrainScriptContext.setDebugInfo(key: | ||
</ | </ | ||
- | * Output debugging information in the upper left corner of the screen. You need to enable "Show JS debug info" in settings | + | * Output debugging information in the upper left corner of the screen. You need to enable "Show JS debug info" in NTE Settings |
^ Functions And Objects ^ Description ^ | ^ Functions And Objects ^ Description ^ | ||
Line 104: | Line 112: | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | + | | '' |
| '' | | '' | ||
| '' | | '' | ||
Line 149: | Line 157: | ||
===== PathData ===== | ===== PathData ===== | ||
+ | |||
^ Functions And Objects ^ Description ^ | ^ Functions And Objects ^ Description ^ | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | + | | '' |
| '' | | '' | ||
===== PlatformInfo ===== | ===== PlatformInfo ===== | ||
+ | |||
^ Functions And Objects ^ Description ^ | ^ Functions And Objects ^ Description ^ | ||
| '' | | '' | ||
Line 167: | Line 177: | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | + | | '' |
| '' | | '' | ||
===== Source ===== | ===== Source ===== | ||
- | | + | |
+ | | ||
mtr_addon/nte/js/train.1707258624.txt.gz · Last modified: 2024/02/06 22:30 by weryskok