LuaEvents.wiki
author Wuzzy <Wuzzy@disroot.org>
Mon, 27 May 2024 20:04:26 +0200
changeset 2274 2bba07f0ffd9
parent 2231 f00c578955f7
permissions -rw-r--r--
Fix link in WormsTauntConversions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
     1
#summary List of event handlers in the Lua API
1839
198bfa280caa LuaEvents: Add label
Wuzzy
parents: 1822
diff changeset
     2
#labels !LuaFunctions
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
     3
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
     4
= Lua API: Event handlers =
2087
24d84bcaa5d5 LuaEvents: add newline
Wuzzy
parents: 2077
diff changeset
     5
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
     6
Event handlers are [LuaAPI Lua] functions that Hedgewars calls on certain events. Lua scripts are supposed to _define_ these functions to do something. The functions are then _called_ by Hedgewars when a certain event has occured. For an example of how this works, see [LuaGuide].
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
     7
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
     8
This page is a list of all supported event handlers in Hedgewars.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
     9
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    10
<wiki:toc max_depth="3" />
1756
66b51b8ba202 LuaEvents: Add TOC
Wuzzy
parents: 1753
diff changeset
    11
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    12
== Initialization ==
1949
36b81d9d8a65 LuaEvents: Revert previous commit
Wuzzy
parents: 1948
diff changeset
    13
=== <tt>onGameInit()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    14
This function is called before the game loads its resources. One can read and modify various [LuaGlobals#Game_variables game variables] here. These variables will become globally available after `onGameInit` has been invoked, but changing them has only an effect in `onGameInit`.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    15
1822
fc9a202d27ba LuaEvents: Update onGameInit info
Wuzzy
parents: 1795
diff changeset
    16
Most game variables are optional, but for missions, `Theme` must be set by the scripter if you want to use a random map, rather than an image map. All other variables do not need to be set by the scripter and have default values. For a list of game variables that can be set here, see [LuaGlobals#Game_variables].
fc9a202d27ba LuaEvents: Update onGameInit info
Wuzzy
parents: 1795
diff changeset
    17
fc9a202d27ba LuaEvents: Update onGameInit info
Wuzzy
parents: 1795
diff changeset
    18
If you want to add teams or hogs manually, you have to do it here. If you want to draw your own map using `AddPoint` and `FlushPoints`, you have to do this within this function as well.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    19
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    20
=== <tt>onGameStart()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    21
This function is called when the first round starts.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    22
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    23
Can be used to show the mission and for more setup, for example initial target spawning.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    24
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    25
At this stage, the global variables `LeftX`, `RightX`, `TopY`, `LAND_WIDTH` and `LAND_HEIGHT` become available.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    26
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    27
=== <tt>onPreviewInit()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    28
This function is called when the map preview in the frontend is initialized. This happens when the script is selected or you change a map generator parameter.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    29
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    30
It is useful for scripts which create their own maps (see `AddPoint` and `FlushPoints`). If you create a map in this function, a preview will be generated from this map and is exposed to the frontend.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    31
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    32
=== <tt>onParameters()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    33
This function is called when the script parameters (as specified in the game scheme) become available. The script parameter string is stored in the global variable `ScriptParam`.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    34
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    35
Please note that it is normally not safe to call many of the other functions inside this function, this function is called very early in the game, only use this to initialize variables and other internal stuff like that.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    36
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    37
*Tip*: If you use the Params library  (`/Scripts/Params.lua`), you can make the task of dissecting the string into useful values a bit easier, but it’s not required. (The Params library is not documented yet, however).
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    38
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    39
*Tip*: If you use this callback, make sure to document the interpretation of the parameters so others know how to set the parameters properly.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    40
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    41
=== <tt>onAmmoStoreInit()</tt> ===
1972
71f061ea3941 LuaEvents: Add ammo initialization hints
Wuzzy
parents: 1949
diff changeset
    42
This function is called when the game is initialized to request the available ammo, ammo probabilities and other ammo settings. Use `SetAmmo` here.
71f061ea3941 LuaEvents: Add ammo initialization hints
Wuzzy
parents: 1949
diff changeset
    43
71f061ea3941 LuaEvents: Add ammo initialization hints
Wuzzy
parents: 1949
diff changeset
    44
If you add this event handler, then the weapon scheme (in a multiplayer game) will be ignored, and the settings of all ammos be initialized to the following values:
71f061ea3941 LuaEvents: Add ammo initialization hints
Wuzzy
parents: 1949
diff changeset
    45
1973
05be23a15de9 LuaEvents: fix syntax
Wuzzy
parents: 1972
diff changeset
    46
 * Initial ammo: 0
05be23a15de9 LuaEvents: fix syntax
Wuzzy
parents: 1972
diff changeset
    47
 * Crate probability: 0
05be23a15de9 LuaEvents: fix syntax
Wuzzy
parents: 1972
diff changeset
    48
 * Number in crate: 0
05be23a15de9 LuaEvents: fix syntax
Wuzzy
parents: 1972
diff changeset
    49
 * Delay: 0
1972
71f061ea3941 LuaEvents: Add ammo initialization hints
Wuzzy
parents: 1949
diff changeset
    50
71f061ea3941 LuaEvents: Add ammo initialization hints
Wuzzy
parents: 1949
diff changeset
    51
If this event handler is *not* present, then the game will use the weapon scheme that the player selected (in multiplayer games). In missions, all ammos are always initialized at 0 by default, even without this event handler.
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    52
2223
4e49d93377fd LuaEvents: Rewrite onNewAmmoStore help
Wuzzy
parents: 2114
diff changeset
    53
=== <tt>onNewAmmoStore(teamOrClanIndex, hogIndex)</tt> ===
4e49d93377fd LuaEvents: Rewrite onNewAmmoStore help
Wuzzy
parents: 2114
diff changeset
    54
This function is identical to `onAmmoStoreInit` in functionality, but is called once per ammo store.  This allows different ammo sets for each clan, team or hedgehog depending on the mode.
4e49d93377fd LuaEvents: Rewrite onNewAmmoStore help
Wuzzy
parents: 2114
diff changeset
    55
4e49d93377fd LuaEvents: Rewrite onNewAmmoStore help
Wuzzy
parents: 2114
diff changeset
    56
 * If `gfSharedAmmo` is set, then `teamOrClanIndex` is the clan index and `hogIndex` is `-1`. The function will be called once for each clan.
4e49d93377fd LuaEvents: Rewrite onNewAmmoStore help
Wuzzy
parents: 2114
diff changeset
    57
 * If `gfPerHogAmmo` is set, then`teamOrClanIndex` is the team index and `hogIndex` is the hog index in that team. The function will be called once for each hedgehog.
4e49d93377fd LuaEvents: Rewrite onNewAmmoStore help
Wuzzy
parents: 2114
diff changeset
    58
 * If neither is set, then `teamsOrClanIndex` is the team index and `hogIndex` is `-1`. The function will be called once for each team.
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    59
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    60
These indexes can be used to look up details of the clan/team/hedgehog prior to gear creation. Routines to do these lookups will be created as needed.
2223
4e49d93377fd LuaEvents: Rewrite onNewAmmoStore help
Wuzzy
parents: 2114
diff changeset
    61
If you add this hook, the expectation is that you will call `SetAmmo` appropriately. Any values from `onAmmoStoreInit` are ignored.
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    62
1775
9a5472760632 LuaEvents: move tick events to new section
Wuzzy
parents: 1774
diff changeset
    63
== Time events ==
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    64
=== <tt>onGameTick()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    65
This function is called on every game tick, i.e. 1000 times a second. If you just need to check on something periodically, consider `onGameTick20`.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    66
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    67
=== <tt>onGameTick20()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    68
This function is called every 20 game ticks, which equals 50 times a second. It reduces Lua overhead for simple monitoring that doesn’t need to happen every single tick.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    69
1775
9a5472760632 LuaEvents: move tick events to new section
Wuzzy
parents: 1774
diff changeset
    70
== Game events ==
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    71
=== <tt>onNewTurn()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    72
This function calls at the start of every turn. You can set `ReadyTimeLeft` here to change the ready time for this turn. (See also: `Ready`)
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    73
2077
514babfbad9e Remove outdated legacy hints as clutter
Wuzzy <almikes@aol.com>
parents: 1973
diff changeset
    74
=== <tt>onEndTurn()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    75
This function calls at the end of every turn. The end of a turn is defined as the point of time after the current hedgehog lost control and all the important gears are either gone or have settled.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    76
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    77
`CurrentHedgehog` holds the gear ID of the hedgehog whose turn just ended.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    78
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    79
This function is called at one of the earliest possible moment after the end of a turn. After this callback, Hedgewars then performs all the other stuff between turns. This includes things like: Applying poison or Sudden Death damage, calculating total hog damage, rising the water in Sudden Death, dropping a crate, checking victory, giving control to the next hog.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    80
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    81
Because this function is called *before* victories are checked, this is useful to set up your victory conditions here.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    82
2077
514babfbad9e Remove outdated legacy hints as clutter
Wuzzy <almikes@aol.com>
parents: 1973
diff changeset
    83
=== <tt>onSkipTurn()</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    84
This function calls when a hog skips its turn.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    85
2231
f00c578955f7 LuaEvents: remove version numbers
Wuzzy
parents: 2223
diff changeset
    86
=== <tt>onCaseDrop(gear)</tt> ===
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    87
This function calls between two turns right after the moment at which the game *might* drop a crate according to the game scheme settings. It does not matter if it actually wants to drop a crate.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    88
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    89
If a crate was dropped, `gear` is the crate gear that was dropped, if no crate was dropped, `gear` is `nil`.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    90
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    91
This function is useful to add custom crate drops as well.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
    92
1774
086bebb89963 LuaEvents: Edited via web interface
Wuzzy
parents: 1770
diff changeset
    93
=== <tt>onSuddenDeath()</tt> ===
086bebb89963 LuaEvents: Edited via web interface
Wuzzy
parents: 1770
diff changeset
    94
This function is called on the start of Sudden Death.
086bebb89963 LuaEvents: Edited via web interface
Wuzzy
parents: 1770
diff changeset
    95
2231
f00c578955f7 LuaEvents: remove version numbers
Wuzzy
parents: 2223
diff changeset
    96
=== <tt>onGameResult(winningClan)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    97
This function calls when the game ends with a winner or in a draw. If a clan wins, `winningClan` is the clan ID of the winning clan. If the game ends in a draw, `winningClan` is set to -1.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
    98
1774
086bebb89963 LuaEvents: Edited via web interface
Wuzzy
parents: 1770
diff changeset
    99
=== <tt>onAchievementsDeclaration()</tt> ===
086bebb89963 LuaEvents: Edited via web interface
Wuzzy
parents: 1770
diff changeset
   100
This function is called after the stats for the stats screen (after the game) have been generated. You are supposed to call `DeclareAchievement` here.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   101
1795
12e1aa6294d7 LuaEvents: Fix onAttack, onHogAttack
Wuzzy
parents: 1775
diff changeset
   102
=== <tt>onHogAttack(ammoType)</tt> ===
12e1aa6294d7 LuaEvents: Fix onAttack, onHogAttack
Wuzzy
parents: 1775
diff changeset
   103
This function is called when a hedgehog attacks. Beginning with 0.9.21, the parameter `ammoType` is provided. It contains the ammo type of the weapon used for the attack. 
12e1aa6294d7 LuaEvents: Fix onAttack, onHogAttack
Wuzzy
parents: 1775
diff changeset
   104
12e1aa6294d7 LuaEvents: Fix onAttack, onHogAttack
Wuzzy
parents: 1775
diff changeset
   105
Note: If you want to detect when a turn was skipped, use `onSkipTurn()`. There is no guarantee that `onHogAttack(amSkip)` is called in such an event.
12e1aa6294d7 LuaEvents: Fix onAttack, onHogAttack
Wuzzy
parents: 1775
diff changeset
   106
2231
f00c578955f7 LuaEvents: remove version numbers
Wuzzy
parents: 2223
diff changeset
   107
=== <tt>onHogSwitch(oldHog)</tt> ===
1921
e65b834f2dd9 LuaEvents: Add onHogSwitch
Wuzzy
parents: 1888
diff changeset
   108
Called when hogs have been switched using the “switch hedgehog” utility. `oldHog` is the gear ID of the previous hedgehog and the current hedgehog gear ID is stored in `CurrentHedgehog`.
e65b834f2dd9 LuaEvents: Add onHogSwitch
Wuzzy
parents: 1888
diff changeset
   109
e65b834f2dd9 LuaEvents: Add onHogSwitch
Wuzzy
parents: 1888
diff changeset
   110
Note: If you want to detect when a turn was skipped, use `onSkipTurn()`. There is no guarantee that `onHogAttack(amSkip)` is called in such an event.
e65b834f2dd9 LuaEvents: Add onHogSwitch
Wuzzy
parents: 1888
diff changeset
   111
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   112
=== <tt>onUsedAmmo(ammoType)</tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   113
Called after a weapon has been used completely, with `ammoType` as the used ammo type.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   114
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   115
For example, it is called right after a bazooka is fired, when both shots of a shotgun have been fired, when extra time is used, or when all 4 shots of a portable portal device have been fired. It is also called when using a multi-shot ammo has been aborted by changing the weapon selection mid-way, because this still uses up the ammo.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   116
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   117
== Controls ==
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   118
=== <tt>onAttack()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   119
This function is called when the current player presses the attack key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   120
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   121
=== <tt>onHJump()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   122
This function is called when the current player presses the high jump key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   123
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   124
=== <tt>onLJump()</tt> ===
1869
b08437e1e087 LuaEvents: typofix
Wuzzy
parents: 1868
diff changeset
   125
This function is called when the current player presses the long jump key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   126
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   127
=== <tt>onPrecise()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   128
This function is called when the current player presses the precise key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   129
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   130
=== <tt>onLeft()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   131
This function is called when the current player presses the left key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   132
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   133
=== <tt>onRight()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   134
This function is called when the current player presses the right key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   135
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   136
=== <tt>onUp()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   137
This function is called when the current player presses the up key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   138
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   139
=== <tt>onDown()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   140
This function is called when the current player presses the down key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   141
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   142
=== <tt>onAttackUp()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   143
This function is called when the current player releases the attack key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   144
1874
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   145
=== <tt>onLeftUp()</tt> ===
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   146
This function is called when the current player releases the left key.
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   147
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   148
=== <tt>onRightUp()</tt> ===
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   149
This function is called when the current player releases the right key.
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   150
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   151
=== <tt>onDownUp()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   152
This function is called when the current player releases the down key.
1874
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   153
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   154
=== <tt>onUpUp()</tt> ===
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   155
This function is called when you release the up key. 
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   156
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   157
=== <tt>onPreciseUp()</tt> ===
1868
02c1ba88f908 LuaEvents: Clarify description of control events
Wuzzy
parents: 1867
diff changeset
   158
This function is called when the current player releases the precise key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   159
1874
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   160
=== <tt>onSwitch()</tt> ===
048c71a203c8 LuaEvents: Fix description of onSwitch
Wuzzy
parents: 1869
diff changeset
   161
This function is called when the current player presses the switch key.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   162
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   163
=== <tt>onSetWeapon(msgParam)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   164
It is get called when a weapon is selected or switched.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   165
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   166
`msgParam` tells you which ammo type was selected.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   167
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   168
=== <tt>onSlot(msgParam)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   169
This function is called when one of the weapon slot keys has been pressed.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   170
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   171
`msgParam` tells the slot number minus 1 (i.e. `0` is for slot number 1, `1` is for slot number 2, etc.).
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   172
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   173
=== <tt>onTaunt(msgParam)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   174
This function is called when the player uses an animated emote for example by using the chat commands `/wave`, `/juggle`, etc.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   175
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   176
`msgParam` tells you which animation was played:
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   177
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   178
|| *`msgParam`* || *Animation* || *Associated chat command* ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   179
|| 0 || Rolling up || `/rollup` ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   180
|| 1 || Sad face || `/sad` ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   181
|| 2 || Waving hand || `/wave` ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   182
|| 3 || Stupid winner's grin / “Awesome” face || `/hurrah` ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   183
|| 4 || Peeing || `/ilovelotsoflemonade` ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   184
|| 5 || Shrug || `/shrug` ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   185
|| 6 || Juggling || `/juggle` ||
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   186
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   187
=== <tt>onTimer(msgParam)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   188
This function is called when one of the timer keys is pressed.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   189
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   190
`msgParams` tells the set timer in seconds (i.e. `3` for the 3 seconds timer key).
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   191
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   192
=== <tt>onScreenResize()</tt> ===
2092
132b6ed4e724 LuaEvents: vgtHealthTag plural
Wuzzy
parents: 2087
diff changeset
   193
This function is called when you resize the screen. Useful place to put a redraw function for any `vgtHealthTag`s you're using.
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   194
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   195
== Gears ==
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   196
=== <tt>onGearAdd(gearUid)</tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   197
This function is called when a new gear is added. Useful in combination with `GetGearType(gearUid)`.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   198
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   199
=== <tt>onGearDelete(gearUid)</tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   200
This function is called when a new gear is deleted. Useful in combination with `GetGearType(gearUid)`.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   201
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   202
=== <tt>onVisualGearAdd(vgUid)</tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   203
This function is called when a new visual gear is added. Useful in combination with `GetVisualGearType(vgUid)`.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   204
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   205
=== <tt>onVisualGearDelete(vgUid)</tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   206
This function is called when a new visual gear is deleted. Useful in combination with `GetVisualGearType(vgUid)`.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   207
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   208
=== <tt>onGearDamage(gearUid, damage)</tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   209
This function is called when a gear is damaged.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   210
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   211
Example:
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   212
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   213
<code language="lua">    function onGearDamage(gear, damage)
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   214
        if (GetGearType(gear) === gtHedgehog) then
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   215
            -- adds a message saying, e.g. "Hoggy H took 25 points of damage"
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   216
            AddCaption(GetHogName(gear) .. ' took ' .. damage .. ' points of damage')
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   217
        end
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   218
    end</code>
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   219
=== <tt>onGearResurrect(gearUid, spawnedVGear) </tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   220
This function is called when a gear is resurrected due to the hog effect `heResurrectable` being set (see `SetEffect`) and/or being an AI hog when the game modifier “AI Survival” (`gfAISurvival`) is active. It is *not* called when a hog was resurrected by the resurrector tool you can use in the game.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   221
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   222
`spawnedVGear` is a visual gear handle of the “resurrection effect”. You can use this handle to modify or delete the resurrection animation.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   223
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   224
=== <tt>onGearWaterSkip(gear)</tt> ===
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   225
This function is called when the gear `gear` skips over water.
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   226
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   227
=== <tt>onHogHide(gearUid)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   228
This function is called when a hedgehog with the gear ID `gearUid` is hidden (removed from the map).
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   229
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   230
=== <tt>onHogRestore(gearUid)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   231
This function is called when a hedgehog with the specified gear ID `gearUid` is restored (unhidden).
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   232
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   233
== Map changes ==
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   234
=== <tt>onSpritePlacement(spriteId, centerX, centerY)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   235
This function is called when a [Sprites Sprite] has been placed.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   236
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   237
`spriteID` is the type of the sprite, you find a list at [Sprites Sprites]. `centerX` and `centerY` are the coordinates of the center of the sprite.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   238
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   239
=== <tt>onGirderPlacement(frameIdx, centerX, centerY)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   240
This function is called when a girder has been placed.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   241
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   242
`frameIdx` is used for the length and orientation of the girder. The possible values are explained in `PlaceGirder`. `centerX` and `centerY` are the coordinates of the girder’s center.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   243
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   244
=== <tt>onRubberPlacement(frameIdx, centerX, centerY)</tt> ===
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   245
This function is called when a rubber has been placed.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   246
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   247
`frameIdx` is used for the rubber orientation. The possible values are explained in `PlaceRubber`. `centerX` and `centerY` are the coordinates of the rubber’s center.
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   248
1770
729bef6b40da LuaEvents: Restructure events into sections
Wuzzy
parents: 1769
diff changeset
   249
=== <tt>onSpecialPoint(x, y, flags)</tt> ===
1768
43762534f5ab LuaEvents: Remove note to 0.9.23
Wuzzy
parents: 1756
diff changeset
   250
This is used while a special hand-drawn map is loaded. The engine is building these hand-drawn maps by reading points from the map definition. Optionally, some of these points may be “special”. These are not actually drawn on the map, but are used to store additional information for a position on the map. Special points currently need to be added manually in the map, the in-game editor is not able to add those yet.
2114
cbb1fde40368 LuaEvents: Fix special flags value
Wuzzy
parents: 2092
diff changeset
   251
Now, when such a special point at the coordinates `x` and `y` with an assigned value of `flags` is added, this function is called. `flags` is a whole number between `0` and `127` inclusive.
1749
91756d20ce3e Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff changeset
   252
2077
514babfbad9e Remove outdated legacy hints as clutter
Wuzzy <almikes@aol.com>
parents: 1973
diff changeset
   253
This function is used in Racer and !TechRacer to define waypoints.