67 |
67 |
68 == Game events == |
68 == Game events == |
69 === <tt>onNewTurn()</tt> === |
69 === <tt>onNewTurn()</tt> === |
70 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`) |
70 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`) |
71 |
71 |
72 === <tt>onEndTurn()</tt> (0.9.24) === |
72 === <tt>onEndTurn()</tt> === |
73 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. |
73 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. |
74 |
74 |
75 `CurrentHedgehog` holds the gear ID of the hedgehog whose turn just ended. |
75 `CurrentHedgehog` holds the gear ID of the hedgehog whose turn just ended. |
76 |
76 |
77 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. |
77 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. |
78 |
78 |
79 Because this function is called *before* victories are checked, this is useful to set up your victory conditions here. |
79 Because this function is called *before* victories are checked, this is useful to set up your victory conditions here. |
80 |
80 |
81 === <tt>onSkipTurn()</tt> (0.9.24) === |
81 === <tt>onSkipTurn()</tt> === |
82 This function calls when a hog skips its turn. |
82 This function calls when a hog skips its turn. |
83 |
83 |
84 === <tt>onCaseDrop(gear)</tt> (1.0.0) === |
84 === <tt>onCaseDrop(gear)</tt> (1.0.0) === |
85 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. |
85 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. |
86 |
86 |
109 |
109 |
110 === <tt>onUsedAmmo(ammoType)</tt> === |
110 === <tt>onUsedAmmo(ammoType)</tt> === |
111 Called after a weapon has been used completely, with `ammoType` as the used ammo type. |
111 Called after a weapon has been used completely, with `ammoType` as the used ammo type. |
112 |
112 |
113 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. |
113 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. |
114 |
|
115 *Warning:* In 0.9.24 or earlier, you must not manipulate any ammo within this callback, e.g. by using `AddAmmo`. The ammo storage might become garbled otherwise. |
|
116 |
114 |
117 == Controls == |
115 == Controls == |
118 === <tt>onAttack()</tt> === |
116 === <tt>onAttack()</tt> === |
119 This function is called when the current player presses the attack key. |
117 This function is called when the current player presses the attack key. |
120 |
118 |