LuaAPI.wiki
changeset 1302 3083c0d7e422
parent 1301 d4d6bc1dc1de
child 1303 3a0bedfe5c75
equal deleted inserted replaced
1301:d4d6bc1dc1de 1302:3083c0d7e422
   774 
   774 
   775 === `SetGearCollisionMask(gearUid, mask)` ===
   775 === `SetGearCollisionMask(gearUid, mask)` ===
   776 Set the collision mask of the given gear with `gearUid`.
   776 Set the collision mask of the given gear with `gearUid`.
   777 The collision mask defines with which gears and terrain types the gear can collide.
   777 The collision mask defines with which gears and terrain types the gear can collide.
   778 
   778 
   779 `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):
   779 `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:
   780 
   780 
   781 || *Idntifier* || *Collision with …* ||
   781 || *Identifier* || *Value* || *Collision with …* ||
   782 || `lfLandMask` || Terrain ||
   782 || `lfLandMask` || || Terrain ||
   783 || `lfCurrentHog` || Current hedgehog and crates ||
   783 || `lfCurrentHog` || || Current hedgehog and crates ||
   784 || `lfHHMask` || Hedgehogs except current hedgehog ||
   784 || `lfHHMask` || || Any hedgehogs ||
   785 || `lfNotHHObjMask` || `not lfNotHHObjMask` ||
   785 || `lfNotHHObjMask` || || Objects, not hogs (e.g. mines, explosives) ||
   786 || `lfAllObjMask` || Mines and explosives ||
   786 || `lfAllObjMask` || || Hedgehogs and objects ||
   787 
   787 
   788 Beware, the collision mask is often set by the engine as well.
   788 Beware, the collision mask is often set by the engine as well.
   789 
   789 
   790 Examples:
   790 Examples:
   791 <code language="lua">SetGearCollisionMask(gear, bnot(lfCurrentHegehog))
   791 <code language="lua">SetGearCollisionMask(gear, bnot(lfCurrentHegehog))
   792 -- Ignore collision with current hedgehog</code>
   792 -- Ignore collision with current hedgehog</code>
   793 
   793 
   794 <code language="lua">SetGearCollisionMask(gear, 0xFFFF)
   794 <code language="lua">SetGearCollisionMask(gear, 0xFFFF)
   795 -- Collide with everything</code>
   795 -- Collide with everything</code>
   796 
   796 
   797 <code language="lua">SetGearCollisionMask(gear, bor(bor(lfHHMask, lfCurrentHog), lfAllObjMask))
   797 <code language="lua">SetGearCollisionMask(gear, lfAllObjMask)
   798 -- Collide with hedgehogs and objects</code>
   798 -- Collide with hedgehogs and objects</code>
   799 
   799 
   800 <code language="lua">SetGearCollisionMask(gear, 0x0000)
   800 <code language="lua">SetGearCollisionMask(gear, 0x0000)
   801 -- Collide with nothing</code>
   801 -- Collide with nothing</code>
   802 
   802