LuaEvents.wiki
changeset 1795 12e1aa6294d7
parent 1775 9a5472760632
child 1822 fc9a202d27ba
equal deleted inserted replaced
1794:7b07726d12f3 1795:12e1aa6294d7
    84 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.
    84 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.
    85 
    85 
    86 === <tt>onAchievementsDeclaration()</tt> ===
    86 === <tt>onAchievementsDeclaration()</tt> ===
    87 This function is called after the stats for the stats screen (after the game) have been generated. You are supposed to call `DeclareAchievement` here.
    87 This function is called after the stats for the stats screen (after the game) have been generated. You are supposed to call `DeclareAchievement` here.
    88 
    88 
       
    89 === <tt>onHogAttack(ammoType)</tt> ===
       
    90 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. 
       
    91 
       
    92 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.
       
    93 
    89 === <tt>onUsedAmmo(ammoType)</tt> ===
    94 === <tt>onUsedAmmo(ammoType)</tt> ===
    90 Called after a weapon has been used completely, with `ammoType` as the used ammo type.
    95 Called after a weapon has been used completely, with `ammoType` as the used ammo type.
    91 
    96 
    92 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.
    97 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.
    93 
    98 
    94 *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.
    99 *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.
    95 
   100 
    96 == Controls ==
   101 == Controls ==
    97 === <tt>onAttack()</tt> ===
   102 === <tt>onAttack()</tt> ===
    98 This function is called when your Hedgehog attacks.
   103 This function is called when you press the attack key.
    99 
   104 
   100 === <tt>onHJump()</tt> ===
   105 === <tt>onHJump()</tt> ===
   101 This function is called when you press the high jump key.
   106 This function is called when you press the high jump key.
   102 
   107 
   103 === <tt>onLJump()</tt> ===
   108 === <tt>onLJump()</tt> ===
   122 This function is called when you release the attack key.
   127 This function is called when you release the attack key.
   123 
   128 
   124 === <tt>onDownUp()</tt> ===
   129 === <tt>onDownUp()</tt> ===
   125 This function is called when you release the down key.
   130 This function is called when you release the down key.
   126  
   131  
   127 === <tt>onHogAttack(ammoType)</tt> ===
       
   128 This function is called when you press the attack key. Beginning with 0.9.21, the parameter `ammoType` is provided. It contains the ammo type of the weapon used for the attack. 
       
   129 
       
   130 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.
       
   131 
       
   132 === <tt>onLeftUp()</tt> ===
   132 === <tt>onLeftUp()</tt> ===
   133 This function is called when you release the left key.
   133 This function is called when you release the left key.
   134 
   134 
   135 === <tt>onPreciseUp()</tt> ===
   135 === <tt>onPreciseUp()</tt> ===
   136 This function is called when you release the precise key.
   136 This function is called when you release the precise key.