LuaAPI.wiki
changeset 612 376d1dcb3114
parent 611 a1d30b3b866c
child 613 50ad270cfcfb
equal deleted inserted replaced
611:a1d30b3b866c 612:376d1dcb3114
   525 Returns the bot level ranging from `0` to `5`. `1` is the strongest bot level and `5` is the weakest one. `0` is for human player.
   525 Returns the bot level ranging from `0` to `5`. `1` is the strongest bot level and `5` is the weakest one. `0` is for human player.
   526 
   526 
   527 === <tt>!GetGearPos(gearUid)</tt> ===
   527 === <tt>!GetGearPos(gearUid)</tt> ===
   528 Get pos of specified gear.
   528 Get pos of specified gear.
   529 
   529 
       
   530 === <tt>!GetGearValues(gearUid)</tt> (0.9.22) ===
       
   531 This returns 12 values associated with the gear, their meaning is often depending on the gear type and many values might be unused for certain gear types.
       
   532 
       
   533 This is returned (all variables are integers):
       
   534 
       
   535 `Angle, Power, WDTimer, Radius, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint`
       
   536 
       
   537 A rough description of some of the parameters:
       
   538 * `Radius`: Effect or collision radius, most of the time
       
   539 * `ImpactSound`: Sound it makes on a collision (see [[Sounds]])
       
   540 * `Tint`: Used by some gear types to determine its colorization. The color is in RGBA format.
       
   541 
       
   542 Example:
       
   543 <code language="lua">
       
   544 -- Get all 12 values in a single line of code:
       
   545 local Angle, Power, WDTimer, Radius, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint = GetGearValues(myGear)
       
   546 </code>
       
   547 
   530 === <tt>!GetVisualGearValues(vgUid)</tt> ===
   548 === <tt>!GetVisualGearValues(vgUid)</tt> ===
   531 This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles. It returns the following values:
   549 This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles. It returns the following values:
   532 X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint 
   550 X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint 
   533 X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, !FrameTicks is usually an animation counter.  State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour.
   551 X, Y typically position, dX, dY typically speed, Angle is usually the rotation angle, Frame is typically the animation frame, !FrameTicks is usually an animation counter.  State can have a variety of values, but is typically bit packed, Timer is usually the gear lifetime and Tint is the colour.
   534 Most visual gears require little to no modification of parameters.
   552 Most visual gears require little to no modification of parameters.
   571 Example:
   589 Example:
   572 
   590 
   573 <code language="lua">    vgear = AddVisualGear(...)
   591 <code language="lua">    vgear = AddVisualGear(...)
   574     DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
   592     DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
   575 
   593 
       
   594 === <tt>!SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint)</tt> (0.9.22) ===
       
   595 Sets various gear value for the specified gear (`gearUid`). The meaining of each value often depends on the gear type. See the documentation on !GetGearValues for a brief description of the gear values.
       
   596 
       
   597 Set `nil` for each value you do not want to change.
       
   598 
       
   599 Example:
       
   600 <code language="lua">
       
   601 -- Paints all RC planes into a white color
       
   602 function onGearAdd(gear)
       
   603     if GetGearType(gear) == gtRCPlane then
       
   604          SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
       
   605     end
       
   606 end
       
   607 </code>
   576 
   608 
   577 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint)</tt> ===
   609 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint)</tt> ===
   578 This allows manipulation of many of the visual gear values. Calling `GetVisualGearValues` first is recommended on most visual gears unless you are controlling all the key values. In the case of `vgtCircle`, the visual gear values are mapped as follows.  X, Y: position.  State: radius. Timer: Thickness.  !FrameTicks: pulsation speed (0 to disable).  dX, dY: min/max pulsation opacity (0-255). Tint: colour, RGBA.
   610 This allows manipulation of many of the visual gear values. Calling `GetVisualGearValues` first is recommended on most visual gears unless you are controlling all the key values. In the case of `vgtCircle`, the visual gear values are mapped as follows.  X, Y: position.  State: radius. Timer: Thickness.  !FrameTicks: pulsation speed (0 to disable).  dX, dY: min/max pulsation opacity (0-255). Tint: colour, RGBA.
   579 Most visual gears require little to no modification of parameters.
   611 Most visual gears require little to no modification of parameters.
   580 
   612