# HG changeset patch
# User Wuzzy
# Date 1441845655 0
# Node ID 376d1dcb3114cd5d1cf3b392edda389ee8805cc1
# Parent a1d30b3b866c8061d441b56561374c09372334c9
SetGearValues, GetGearValues
diff -r a1d30b3b866c -r 376d1dcb3114 LuaAPI.wiki
--- 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 @@
=== !GetGearPos(gearUid) ===
Get pos of specified gear.
+=== !GetGearValues(gearUid) (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:
+
+-- Get all 12 values in a single line of code:
+local Angle, Power, WDTimer, Radius, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint = GetGearValues(myGear)
+
+
=== !GetVisualGearValues(vgUid) ===
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 @@
vgear = AddVisualGear(...)
DeleteVisualGear(vgear) -- Delete the newly created visual gear.
+=== !SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint) (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:
+
+-- 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
+
=== !SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint) ===
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.