--- a/LuaAPI.wiki Sun Nov 21 16:01:30 2010 +0000
+++ b/LuaAPI.wiki Sat Dec 04 20:09:56 2010 +0000
@@ -1,3 +1,4 @@
+#labels 80
<wiki:toc max_depth="3" />
== Global available Constants ==
@@ -78,6 +79,16 @@
<code lang="lua"> local gear = !AddGear(0, 0, gtTarget, 0, 0, 0, 0)
!FindPlace(gear, true, 0, LAND_WIDTH)</code>
+
+=== <tt>!AddVisualGear(x, y, viusalGearType, state, critical)</tt> ===
+
+<blockquote>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. False if it is just an effect, and can be skipped when in fastforward (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.
+</blockquote>
+Example:
+
+<code lang="lua"> vgear = !AddVisualGear(1000, 1000, vgtExplosion, 0, false) -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
+</code>
+
=== <tt>!SpawnHealthCrate(x, y)</tt> (0.9.14) ===
<blockquote>Spawns a health crate at the specified position.
@@ -167,8 +178,48 @@
<blockquote>returns the bot level from 0 to 5. 0 means human player.
</blockquote>
+
+=== <tt>!GetVisualGearValues(vgUid)</tt> ===
+
+<blockquote>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
+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.
+Most visual gears require little to no modification of parameters.
+</blockquote>
+Example:
+
+<code lang="lua"> !GetVisualGearValues(vgUid) -- return visual gear values
+</code>
+
== Functions to modify gears ==
+=== <tt>!DeleteGear(gearUid)</tt> ===
+
+<blockquote>Deletes a Gear</blockquote>
+Example:
+
+<code lang="lua"> gear = !AddGear(…)
+ !DeleteGear(gear) -- Delete the newly created gear.</code>
+
+=== <tt>!DeleteVisualGear(vgUid)</tt> ===
+
+<blockquote>Deletes a Visual Gear. Note, most visual gears delete themselves.</blockquote>
+Example:
+
+<code lang="lua"> vgear = !AddVisualGear(…)
+ !DeleteVisualGear(vgear) -- Delete the newly created visual gear.</code>
+
+
+=== <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint)</tt> ===
+
+<blockquote>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.
+Most visual gears require little to no modification of parameters.
+</blockquote>
+Example:
+
+<code lang="lua"> !SetVisualGearValues(circleUid, 1000,1000, 20, 200, 0, 0, 100, 50, 3, 0xff0000ff) -- set a circle to position 1000,1000 pulsing from opacity 20 to 200 (8%-78%), radius of 50, 3px thickness, bright red.
+</code>
+
=== <tt>!FindPlace(gearUid, fall, left, right)</tt> ===
<blockquote>Finds a place for the specified gear between x=left and x=right and places it there.