786 || `0x0070` || Mines and explosives || |
786 || `0x0070` || Mines and explosives || |
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 ``` |
791 <code language="lua">SetGearCollisionMask(gear, 0xFF7F) |
792 SetGearCollisionMask(gear, 0xFF7F) |
792 -- Ignore collision with current hedgehog</code> |
793 -- Ignore collision with current hedgehog |
793 |
794 ``` |
794 <code language="lua">SetGearCollisionMask(gear, 0xFFFF) |
795 |
795 -- Collide with everything</code> |
796 ``` |
796 |
797 SetGearCollisionMask(gear, 0xFFFF) |
797 <code language="lua">SetGearCollisionMask(gear, 0x00FF) |
798 -- Collide with everything |
798 -- Collide with hedgehogs and objects</code> |
799 ``` |
799 |
800 |
800 <code language="lua">SetGearCollisionMask(gear, 0x0000) |
801 ``` |
801 -- Collide with nothing</code> |
802 SetGearCollisionMask(gear, 0x00FF) |
|
803 -- Collide with hedgehogs and objects |
|
804 ``` |
|
805 |
|
806 ``` |
|
807 SetGearCollisionMask(gear, 0x0000) |
|
808 -- Collide with nothing |
|
809 ``` |
|
810 |
802 |
811 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): |
803 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): |
812 https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112 |
804 https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112 |
813 |
805 |
814 === `GetGearCollisionMask(gearUid)` === |
806 === `GetGearCollisionMask(gearUid)` === |
972 * `aihUsualProcessing`: AI hogs treat this gear the usual way. This is the default. |
964 * `aihUsualProcessing`: AI hogs treat this gear the usual way. This is the default. |
973 * `aihDoesntMatter`: AI hogs don't bother attacking this gear intentionally. |
965 * `aihDoesntMatter`: AI hogs don't bother attacking this gear intentionally. |
974 |
966 |
975 Example: |
967 Example: |
976 |
968 |
977 ``` |
969 <code language="lua"> |
978 SetGearAIHints(uselessHog, aihDoesntMatter) |
970 SetGearAIHints(uselessHog, aihDoesntMatter) |
979 -- This makes AI hogs stop caring about attacking uselessHog |
971 -- This makes AI hogs stop caring about attacking uselessHog</code> |
980 ``` |
|
981 |
972 |
982 === <tt>!SetGearPos(gearUid, value) (0.9.18-dev)</tt> === |
973 === <tt>!SetGearPos(gearUid, value) (0.9.18-dev)</tt> === |
983 Sets the `Pos` value (not the position!) of the specified gear to specified value. See `GetGearPos` for more information. |
974 Sets the `Pos` value (not the position!) of the specified gear to specified value. See `GetGearPos` for more information. |
984 |
975 |
985 == Gameplay functions == |
976 == Gameplay functions == |
1476 |
1467 |
1477 Currently, this actually just triggers a console output, but it might be changed later. The idea is to track multiplayer records. |
1468 Currently, this actually just triggers a console output, but it might be changed later. The idea is to track multiplayer records. |
1478 |
1469 |
1479 Example: |
1470 Example: |
1480 |
1471 |
1481 ``` |
1472 <code language="lua">DeclareAchievement("height reached", teamname, "ClimbHome", -score)</code> |
1482 DeclareAchievement("height reached", teamname, "ClimbHome", -score) |
|
1483 ``` |
|
1484 |
|
1485 Records a team's best height in !ClimbHome. |
1473 Records a team's best height in !ClimbHome. |
1486 |
1474 |
1487 === <tt>!ParseCommand(string)</tt> === |
1475 === <tt>!ParseCommand(string)</tt> === |
1488 Makes the game client parse and execute the specified internal game engine command. |
1476 Makes the game client parse and execute the specified internal game engine command. |
1489 |
1477 |