76 Here are some unsorted variables or constants which are available in Lua. You shouldn’t write to most of them. |
76 Here are some unsorted variables or constants which are available in Lua. You shouldn’t write to most of them. |
77 |
77 |
78 || *Identifier* || *Description* || |
78 || *Identifier* || *Description* || |
79 || `LAND_WIDTH` || The width of the landscape in pixels || |
79 || `LAND_WIDTH` || The width of the landscape in pixels || |
80 || `LAND_HEIGHT` || The height of the landscape in pixels || |
80 || `LAND_HEIGHT` || The height of the landscape in pixels || |
|
81 || `LOCALE` || Current locale identifier (e.g. “de” for German) || |
81 || `LeftX` || X coordinate of the leftmost point of the landscape || |
82 || `LeftX` || X coordinate of the leftmost point of the landscape || |
82 || `RightX` || X coordinate of the rightmost point of the landscape || |
83 || `RightX` || X coordinate of the rightmost point of the landscape || |
83 || `TopY` || Y coordinate of the topmost point of the landscape || |
84 || `TopY` || Y coordinate of the topmost point of the landscape || |
84 || `CursorX` || The X position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` || |
85 || `CursorX` || The X position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` || |
85 || `CursorY` || The Y position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` || |
86 || `CursorY` || The Y position of the cursor if the player is choosing a target. Otherwise, this is `-2147483648` || |
775 Set the collision mask of the given gear with `gearUid`. |
776 Set the collision mask of the given gear with `gearUid`. |
776 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. |
777 |
778 |
778 `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 (excerpt): |
779 |
780 |
780 || *Flag* || *Collision with …* || |
781 || *Idntifier* || *Collision with …* || |
781 || `0xFF00` || Terrain || |
782 || `lfLandMask` || Terrain || |
782 || `0x0080` || Current hedgehog and crates || |
783 || `lfCurrentHog` || Current hedgehog and crates || |
783 || `0x000F` || Other hedgehogs || |
784 || `lfHHMask` || Hedgehogs except current hedgehog || |
784 || `0x0070` || Mines and explosives || |
785 || `lfNotHHObjMask` || `not lfNotHHObjMask` || |
|
786 || `lfAllObjMask` || Mines and explosives || |
785 |
787 |
786 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. |
787 |
789 |
788 Examples: |
790 Examples: |
789 <code language="lua">SetGearCollisionMask(gear, 0xFF7F) |
791 <code language="lua">SetGearCollisionMask(gear, bnot(lfCurrentHegehog)) |
790 -- Ignore collision with current hedgehog</code> |
792 -- Ignore collision with current hedgehog</code> |
791 |
793 |
792 <code language="lua">SetGearCollisionMask(gear, 0xFFFF) |
794 <code language="lua">SetGearCollisionMask(gear, 0xFFFF) |
793 -- Collide with everything</code> |
795 -- Collide with everything</code> |
794 |
796 |
795 <code language="lua">SetGearCollisionMask(gear, 0x00FF) |
797 <code language="lua">SetGearCollisionMask(gear, bor(bor(lfHHMask, lfCurrentHog), lfAllObjMask)) |
796 -- Collide with hedgehogs and objects</code> |
798 -- Collide with hedgehogs and objects</code> |
797 |
799 |
798 <code language="lua">SetGearCollisionMask(gear, 0x0000) |
800 <code language="lua">SetGearCollisionMask(gear, 0x0000) |
799 -- Collide with nothing</code> |
801 -- Collide with nothing</code> |
800 |
802 |