LuaAPI.wiki
changeset 612 376d1dcb3114
parent 611 a1d30b3b866c
child 613 50ad270cfcfb
--- a/LuaAPI.wiki	Thu Sep 10 00:22:46 2015 +0000
+++ b/LuaAPI.wiki	Thu Sep 10 00:40:55 2015 +0000
@@ -527,6 +527,24 @@
 === <tt>!GetGearPos(gearUid)</tt> ===
 Get pos of specified gear.
 
+=== <tt>!GetGearValues(gearUid)</tt> (0.9.22) ===
+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.
+
+This is returned (all variables are integers):
+
+`Angle, Power, WDTimer, Radius, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint`
+
+A rough description of some of the parameters:
+* `Radius`: Effect or collision radius, most of the time
+* `ImpactSound`: Sound it makes on a collision (see [[Sounds]])
+* `Tint`: Used by some gear types to determine its colorization. The color is in RGBA format.
+
+Example:
+<code language="lua">
+-- Get all 12 values in a single line of code:
+local Angle, Power, WDTimer, Radius, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint = GetGearValues(myGear)
+</code>
+
 === <tt>!GetVisualGearValues(vgUid)</tt> ===
 This returns the typically set visual gear values, useful if manipulating things like smoke or bubbles or circles. It returns the following values:
 X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint 
@@ -573,6 +591,20 @@
 <code language="lua">    vgear = AddVisualGear(...)
     DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
 
+=== <tt>!SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint)</tt> (0.9.22) ===
+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.
+
+Set `nil` for each value you do not want to change.
+
+Example:
+<code language="lua">
+-- Paints all RC planes into a white color
+function onGearAdd(gear)
+    if GetGearType(gear) == gtRCPlane then
+         SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
+    end
+end
+</code>
 
 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint)</tt> ===
 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.