LuaAPI.wiki
changeset 1511 3c0c822ecdb9
parent 1510 b402473a77ba
child 1512 06e3cd099d4b
equal deleted inserted replaced
1510:b402473a77ba 1511:3c0c822ecdb9
   402 
   402 
   403 <code language="lua">    local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
   403 <code language="lua">    local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
   404     FindPlace(gear, true, 0, LAND_WIDTH)</code>
   404     FindPlace(gear, true, 0, LAND_WIDTH)</code>
   405 
   405 
   406 === <tt>!AddVisualGear(x, y, visualGearType, state, critical [, layer])</tt> ===
   406 === <tt>!AddVisualGear(x, y, visualGearType, state, critical [, layer])</tt> ===
   407 This creates a new visual gear at position x,y (measured from top left) of kind `visualGearType` (see [VisualGearTypes Visual Gear Types]). The function returns the `uid` of the visual gear created.  Set `critical` to `true` if the visual gear is crucial to game play. Use `false` if it is just an effect, and can be skipped when in fast-forward mode (such as when joining a room). A critical visual gear will always be created, a non-critical one may fail. Most visual gears delete themselves. You can set an optional `layer` to specify which visual gears get drawn on top.
   407 This attempts to create a new visual gear at position x,y (measured from top left) of kind `visualGearType` (see [VisualGearTypes Visual Gear Types]).  Visual gears are decorational objects which are usually used for purely decorational graphical effects. They have no effect on gameplay.
       
   408 
       
   409 The function returns the `uid` of the visual gear created or `nil` if creation failed.  There is no guarantee the visual gear will actually spawn.  **IMPORTANT: Do not rely on visual gears to spawn**.
       
   410 
       
   411 Set `critical` to `true` if the visual gear is crucial to gameplay and must always be displayed in-game.  Use `false` if it is just an effect, and its creation be skipped when in fast-forward mode (such as when joining a room).  Most visual gears delete themselves. You can set an optional `layer` to specify which visual gears get drawn on top.
   408 
   412 
   409 Example:
   413 Example:
   410 
   414 
   411 <code language="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
   415 <code language="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
   412     vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
   416     vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false)