--- a/LuaAPI.wiki Tue Feb 20 13:55:00 2018 +0000
+++ b/LuaAPI.wiki Tue Feb 20 14:23:37 2018 +0000
@@ -773,6 +773,32 @@
=== <tt>!SetGearPosition(gearUid, x, y)</tt> ===
Places the specified gear exactly at the position (`x`,`y`). Not to be confused with `SetGearPos`.
+=== `SetGearCollisionMask(gearUid, mask)` ===
+Set the collision mask of the given gear with `gearUid`.
+The collision mask defines with which gears and terrain types the gear can collide.
+
+`mask` is a number between `0x0000` and `0xFFFF` and used as a bitfield. The following flags are available (excerpt):
+
+|| *Flag* || *Effect* ||
+|| `0xFF00` || Terrain ||
+|| `0x0080` || Current hedgehog ||
+|| `0x000F` || Other hedgehogs ||
+|| `0x0070` || Mines and explosives ||
+
+Beware, the collision mask is often set by the engine as well.
+
+Example:
+```
+SetGearCollisionMask(gear, 0xFF7F)
+-- Ignore collision with current hedgehog
+```
+
+The full range of flags can be found in the engine source code (in Pascal):
+https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112
+
+=== `GetGearCollisionMask(gearUid)` ===
+Returns the current collision mask of the given gear. See `SetGearCollisionMask` for an explanation of the mask.
+
=== <tt>!SetGearVelocity(gearUid, dx, dy)</tt> ===
Gives the specified gear the velocity of `dx`, `dy`.