LuaAPI.wiki
changeset 175 2455fbbab5e8
parent 174 701ab6df45b5
child 176 c480b9c21241
equal deleted inserted replaced
174:701ab6df45b5 175:2455fbbab5e8
   146 
   146 
   147 <blockquote>This function is called when you press the down key.
   147 <blockquote>This function is called when you press the down key.
   148 </blockquote>
   148 </blockquote>
   149 
   149 
   150 === <tt>onAttackUp()</tt> (0.9.17) ===
   150 === <tt>onAttackUp()</tt> (0.9.17) ===
       
   151 
       
   152 <blockquote>This function is called when you release the attack key.</blockquote>
       
   153 
   151 === <tt>onDownUp()</tt> (0.9.17) ===
   154 === <tt>onDownUp()</tt> (0.9.17) ===
       
   155 
       
   156 <blockquote>This function is called when you release the down key.</blockquote>
       
   157  
   152 === <tt>onHogAttack()</tt> (0.9.17) ===
   158 === <tt>onHogAttack()</tt> (0.9.17) ===
       
   159 
       
   160 <blockquote>This function is called when you press the attack key.</blockquote>
       
   161 
   153 === <tt>onLeftUp()</tt> (0.9.17) ===
   162 === <tt>onLeftUp()</tt> (0.9.17) ===
       
   163 
       
   164 <blockquote>This function is called when you release the left key.</blockquote>
       
   165 
   154 === <tt>onPreciseUp()</tt> (0.9.17) ===
   166 === <tt>onPreciseUp()</tt> (0.9.17) ===
       
   167 
       
   168 <blockquote>This function is called when you release the precise key.</blockquote>
       
   169 
   155 === <tt>onRightUp()</tt> (0.9.17) ===
   170 === <tt>onRightUp()</tt> (0.9.17) ===
       
   171 
       
   172 <blockquote>This function is called when you release the right key.</blockquote>
       
   173 
   156 === <tt>onSetWeapon()</tt> (0.9.17) ===
   174 === <tt>onSetWeapon()</tt> (0.9.17) ===
       
   175 
       
   176 <blockquote>It is get called when a weapon is selected or switched.</blockquote>
       
   177 
   157 === <tt>onSlot()</tt> (0.9.17) ===
   178 === <tt>onSlot()</tt> (0.9.17) ===
       
   179 
       
   180 <blockquote>This function is called when a weapon slot (row in the weapon menu) is selected.</blockquote>
       
   181 
   158 === <tt>onSwitch()</tt> (0.9.17) ===
   182 === <tt>onSwitch()</tt> (0.9.17) ===
       
   183 
       
   184 <blockquote>This function is called when a hog is switched to another.</blockqoute>
       
   185 
   159 === <tt>onTaunt()</tt> (0.9.17) ===
   186 === <tt>onTaunt()</tt> (0.9.17) ===
       
   187 
       
   188 <blockquote>This function is called when the player uses an animated   emote for example "/wave, /juggle and etc.</blockquote>
       
   189 
   160 === <tt>onTimer()</tt> (0.9.17) ===
   190 === <tt>onTimer()</tt> (0.9.17) ===
       
   191 
       
   192 <blockquote>This function is called when one of the timer keys is pressed.</blockquote>
       
   193 
   161 === <tt>onUpUp()</tt> (0.9.17) ===
   194 === <tt>onUpUp()</tt> (0.9.17) ===
   162 
   195 
       
   196 <blockquote>This function is called when you release the up key.</blockquote>
   163 
   197 
   164 == Functions for creating gears ==
   198 == Functions for creating gears ==
   165 
   199 
   166 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> ===
   200 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> ===
   167 
   201 
   406   * Starting Flying Saucer (gtJetpack) with only 50% fuel.
   440   * Starting Flying Saucer (gtJetpack) with only 50% fuel.
   407   * Setting all the mines to duds.
   441   * Setting all the mines to duds.
   408   * (And more!)
   442   * (And more!)
   409 
   443 
   410 <code lang="lua">    function onGearAdd(gear)
   444 <code lang="lua">    function onGearAdd(gear)
   411        if (!GetGearType(gear) == gtRCPlane) then
   445        if (!GetGearType(gear) == gtRCPlaane) then
   412             !SetHealth(gear, 10)
   446             !SetHealth(gear, 10)
   413        end
   447        end
   414        if (!GetGearType(gear) == gtJetpack) then
   448        if (!GetGearType(gear) == gtJetpack) then
   415             !SetHealth(gear, 1000)
   449             !SetHealth(gear, 1000)
   416        end
   450        end