LuaGameplay.wiki
changeset 1796 8b10d405a1a0
parent 1794 7b07726d12f3
child 1797 e8c8ffe6e22b
equal deleted inserted replaced
1795:12e1aa6294d7 1796:8b10d405a1a0
   302 
   302 
   303 === <tt>!SetNextWeapon()</tt> ===
   303 === <tt>!SetNextWeapon()</tt> ===
   304 This function makes the current hedgehog switch to the next weapon in list of available weapons. It can be used for example in trainings to pre-select a weapon.
   304 This function makes the current hedgehog switch to the next weapon in list of available weapons. It can be used for example in trainings to pre-select a weapon.
   305 
   305 
   306 === <tt>!SetInputMask(mask)</tt> ===
   306 === <tt>!SetInputMask(mask)</tt> ===
   307 Masks specified player input. This means that Hedgewars ignores certain player inputs, such as walking or jumping.
   307 Masks specified player input. `mask` is a gear message bitmask (see [GearMessages]). This means that Hedgewars ignores certain player inputs, such as walking or jumping. However, the controls [LuaEvents event functions] such as `onAttack` or `onLeft` will still be called, even when masked.
   308 
   308 
   309 Example: 
   309 Example: 
   310 <code language="lua">    -- masks the long and high jump commands
   310 <code language="lua">    -- masks the long and high jump commands, making it impossible to jump
   311 SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) 
   311 SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump))) 
   312     -- clears input mask, allowing player to take actions
   312     -- clears input mask, allowing player to take actions
   313     SetInputMask(0xFFFFFFFF) 
   313     SetInputMask(0xFFFFFFFF) 
   314 		</code>
   314 		</code>
   315 *Note*: Using the input mask is an effective way to script uninterrupted cinematics, or create modes such as No Jumping.
   315 *Note*: Using the input mask is an effective way to script uninterrupted cinematics, or create modes such as No Jumping.