LuaAPI: Rewrite SetGearCollisionMask
authorWuzzy
Tue, 20 Feb 2018 14:29:44 +0000
changeset 1228 460d8f3aaf32
parent 1227 edda2e2b973f
child 1229 ff97ab480e0d
LuaAPI: Rewrite SetGearCollisionMask
LuaAPI.wiki
--- a/LuaAPI.wiki	Tue Feb 20 14:23:37 2018 +0000
+++ b/LuaAPI.wiki	Tue Feb 20 14:29:44 2018 +0000
@@ -134,7 +134,7 @@
 || `lfIce` || Slippery terrain, hogs will slide on it. ||
 || `lfBouncy` || Bouncy terrain, hogs and some other gears will bounce off when they collide with it. ||
 || `lfIndestructible` || Almost indestructible terrain, most weapons will not destroy it. ||
-|| `lfNormal` || Normal destroyable terrain. Note that this is only actually the case when no other land flag is set. ||
+|| `0` || Normal destroyable terrain. Note that this is the case when no other land flag is set. ||
 
 === More constants ===
 More constants are at at [GearTypes Gear Types] , [AmmoTypes Ammo Types], [Sounds], [States], [Sprites], [VisualGearTypes Visual Gear Types].
@@ -777,23 +777,38 @@
 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):
+`mask` is a number between `0x0000` and `0xFFFF` and used as a bitfield, which means you can combine these flags with `bor`. These are the available flags (excerpt):
 
-|| *Flag* || *Effect* ||
+|| *Flag* || *Collision with …* ||
 || `0xFF00` || Terrain ||
-|| `0x0080` || Current hedgehog ||
+|| `0x0080` || Current hedgehog and crates ||
 || `0x000F` || Other hedgehogs ||
 || `0x0070` || Mines and explosives ||
 
 Beware, the collision mask is often set by the engine as well.
 
-Example:
+Examples:
 ```
 SetGearCollisionMask(gear, 0xFF7F)
 -- Ignore collision with current hedgehog
 ```
 
-The full range of flags can be found in the engine source code (in Pascal):
+```
+SetGearCollisionMask(gear, 0xFFFF)
+-- Collide with everything
+```
+
+```
+SetGearCollisionMask(gear, 0x00FF)
+-- Collide with hedgehogs and objects
+```
+
+```
+SetGearCollisionMask(gear, 0x0000)
+-- Collide with nothing
+```
+
+There are actual more flags availbable, but they are not as useful for use in Lua. You can find the full range of flags in the engine source code (in Pascal):
 https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112
 
 === `GetGearCollisionMask(gearUid)` ===