LuaGears.wiki
changeset 1785 95f3d64144bd
parent 1784 b08f6f71bfbd
child 1792 3182a44b158e
equal deleted inserted replaced
1784:b08f6f71bfbd 1785:95f3d64144bd
     5 
     5 
     6 <wiki:toc max_depth="3"/>
     6 <wiki:toc max_depth="3"/>
     7 
     7 
     8 == Functions for creating gears ==
     8 == Functions for creating gears ==
     9 
     9 
    10 === <tt>!AddGear(x, y, gearType, state, dx, dy, timer)</tt> ===
    10 === `AddGear(x, y, gearType, state, dx, dy, timer)` ===
    11 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]).  Gears are dynamic objects or events in the world that affect the gameplay, including hedgehogs, projectiles, weapons, land objects, active utilities and a few more esoteric things.
    11 This creates a new gear at position x,y (measured from top left) of kind `gearType` (see [GearTypes Gear Types]).  Gears are dynamic objects or events in the world that affect the gameplay, including hedgehogs, projectiles, weapons, land objects, active utilities and a few more esoteric things.
    12 The initial velocities are `dx` and `dy`. All arguments are numbers. The function returns the `uid` of the gear created. Gears can have multple states at once: `state` is a bitmask, the flag variables can be found in [States].
    12 The initial velocities are `dx` and `dy`. All arguments are numbers. The function returns the `uid` of the gear created. Gears can have multple states at once: `state` is a bitmask, the flag variables can be found in [States].
    13 
    13 
    14 Example:
    14 Example:
    15 
    15 
    16 <code language="lua">    local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
    16 <code language="lua">    local gear = AddGear(0, 0, gtTarget, 0, 0, 0, 0)
    17     FindPlace(gear, true, 0, LAND_WIDTH)</code>
    17     FindPlace(gear, true, 0, LAND_WIDTH)</code>
    18 
    18 
    19 === <tt>!AddVisualGear(x, y, visualGearType, state, critical [, layer])</tt> ===
    19 === `AddVisualGear(x, y, visualGearType, state, critical [, layer])` ===
    20 This attempts to create a new visual gear at position x,y (measured from top left) of kind `visualGearType` (see [VisualGearTypes Visual Gear Types]).  Visual gears are decorational objects which are usually used for purely decorational graphical effects.  They have no effect on gameplay.  Visual gears are not the same as gears, but they share some similarities.
    20 This attempts to create a new visual gear at position x,y (measured from top left) of kind `visualGearType` (see [VisualGearTypes Visual Gear Types]).  Visual gears are decorational objects which are usually used for purely decorational graphical effects.  They have no effect on gameplay.  Visual gears are not the same as gears, but they share some similarities.
    21 
    21 
    22 The function returns the `uid` of the visual gear created or `nil` if creation failed.  There is no guarantee that a visual gear will spawn.  *IMPORTANT: Do not rely on visual gears to spawn*. *Always* be prepared for this function to return `nil`.
    22 The function returns the `uid` of the visual gear created or `nil` if creation failed.  There is no guarantee that a visual gear will spawn.  *IMPORTANT: Do not rely on visual gears to spawn*. *Always* be prepared for this function to return `nil`.
    23 
    23 
    24 Set `critical` to `true` if the visual gear is crucial to gameplay and must always be spawned when in-game.  Use `false` if it is just an effect or eye-candy, and its creation can be skipped when in fast-forward mode (such as when joining a room).
    24 Set `critical` to `true` if the visual gear is crucial to gameplay and must always be spawned when in-game.  Use `false` if it is just an effect or eye-candy, and its creation can be skipped when in fast-forward mode (such as when joining a room).
    35 
    35 
    36 <code language="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
    36 <code language="lua">  -- adds an non-critical explosion at position 1000,1000. Returns 0 if it was not created.
    37     local vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
    37     local vgear = AddVisualGear(1000, 1000, vgtExplosion, 0, false) 
    38 </code>
    38 </code>
    39 
    39 
    40 === <tt>!AddHog(hogname, botlevel, health, hat)</tt> ===
    40 === `AddHog(hogname, botlevel, health, hat)` ===
    41 Adds a new hedgehog for current team (last created one with the `AddTeam` function), with a bot level, an initial health and a hat.
    41 Adds a new hedgehog for current team (last created one with the `AddTeam` function), with a bot level, an initial health and a hat.
    42 
    42 
    43 `botlevel` ranges from `0` to `5`, where `0` denotes a human player and `1` to `5` denote the skill level of a bot, where `1` is strongest and `5` is the weakest. Note that this is the reverse order of how the bot level is displayed in the game. Note that mixing human-controlled and computer-controlled hedgehogs in the same team is not permitted, but it is permitted to use different computer difficulty levels in the same team.
    43 `botlevel` ranges from `0` to `5`, where `0` denotes a human player and `1` to `5` denote the skill level of a bot, where `1` is strongest and `5` is the weakest. Note that this is the reverse order of how the bot level is displayed in the game. Note that mixing human-controlled and computer-controlled hedgehogs in the same team is not permitted, but it is permitted to use different computer difficulty levels in the same team.
    44 
    44 
    45 Returns the gear ID.
    45 Returns the gear ID.
    50 
    50 
    51 <code language="lua">    local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player
    51 <code language="lua">    local player = AddHog("HH 1", 0, 100, "NoHat") -- botlevel 0 means human player
    52     SetGearPosition(player, 1500, 1000)
    52     SetGearPosition(player, 1500, 1000)
    53     -- hint: If you don't call `SetGearPosition`, the hog spawns randomly</code>
    53     -- hint: If you don't call `SetGearPosition`, the hog spawns randomly</code>
    54 
    54 
    55 === <tt>!AddMissionHog(health)</tt> (0.9.25) ===
    55 === `AddMissionHog(health)` (0.9.25) ===
    56 Add a hedgehog for the current team, using the player-chosen team identity when playing in singleplayer missions. The “current team” is the last team that was added with `AddMissionTeam` or `AddTeam`.
    56 Add a hedgehog for the current team, using the player-chosen team identity when playing in singleplayer missions. The “current team” is the last team that was added with `AddMissionTeam` or `AddTeam`.
    57 
    57 
    58 The name and hat match the player's team definition. The hog is also always player-controlled.
    58 The name and hat match the player's team definition. The hog is also always player-controlled.
    59 
    59 
    60 Examples:
    60 Examples:
    70 AddMissionHog(100)
    70 AddMissionHog(100)
    71 AddMissionHog(100)
    71 AddMissionHog(100)
    72 AddHog("My Hardcoded Hog", 0, 100, "NoHat")
    72 AddHog("My Hardcoded Hog", 0, 100, "NoHat")
    73 </code>
    73 </code>
    74 
    74 
    75 === <tt>!SpawnHealthCrate(x, y, [, health])</tt> ===
    75 === `SpawnHealthCrate(x, y, [, health])` ===
    76 Spawns a health crate at the specified position. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land). Set `health` for the initial health contained in the health crate. If not set, the default health (`HealthCaseAmount`) is used. Do not use a negative value for `health`.
    76 Spawns a health crate at the specified position. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land). Set `health` for the initial health contained in the health crate. If not set, the default health (`HealthCaseAmount`) is used. Do not use a negative value for `health`.
    77 
    77 
    78 === <tt>!SpawnSupplyCrate(x, y, ammoType [, amount])</tt> (0.9.24) ===
    78 === `SpawnSupplyCrate(x, y, ammoType [, amount])` (0.9.24) ===
    79 Spawns an ammo or utility crate at the specified position with the given ammo type and an optional amount (default: 1). The crate type is chosen automatically based on the ammo type.
    79 Spawns an ammo or utility crate at the specified position with the given ammo type and an optional amount (default: 1). The crate type is chosen automatically based on the ammo type.
    80 Otherwise, this function behaves like `SpawnAmmoCrate`.
    80 Otherwise, this function behaves like `SpawnAmmoCrate`.
    81 
    81 
    82 === <tt>!SpawnAmmoCrate(x, y, ammoType [, amount])</tt> ===
    82 === `SpawnAmmoCrate(x, y, ammoType [, amount])` ===
    83 Spawns an ammo crate at the specified position with content of `ammoType` (see [AmmoTypes Ammo Types]). Any `ammoType` is permitted, an ammo crate is spawned even if the ammo is normally defined as an utility.
    83 Spawns an ammo crate at the specified position with content of `ammoType` (see [AmmoTypes Ammo Types]). Any `ammoType` is permitted, an ammo crate is spawned even if the ammo is normally defined as an utility.
    84 If `ammoType` is set to `amNothing`, a random weapon (out of the available weapons from the weapon scheme) will be selected. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land). The `amount` parameter specifies the amount of ammo contained in the crate. If `amount` is `nil` or `0`, the value set by `SetAmmo` is used, or if `SetAmmo` has not been used, it falls back to the weapon scheme's value. If `amount` is equal to or greater than `AMMO_INFINITE`, the amount is infinite.
    84 If `ammoType` is set to `amNothing`, a random weapon (out of the available weapons from the weapon scheme) will be selected. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land). The `amount` parameter specifies the amount of ammo contained in the crate. If `amount` is `nil` or `0`, the value set by `SetAmmo` is used, or if `SetAmmo` has not been used, it falls back to the weapon scheme's value. If `amount` is equal to or greater than `AMMO_INFINITE`, the amount is infinite.
    85 
    85 
    86 Note that in Lua missions, the default number of ammo in crates is 0, so it has to be set to at least 1 with `SetAmmo` first, see the example:
    86 Note that in Lua missions, the default number of ammo in crates is 0, so it has to be set to at least 1 with `SetAmmo` first, see the example:
    87 
    87 
    88 Example:
    88 Example:
    89 
    89 
    90 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- grenade ammo crates now contain 1 grenade each
    90 <code language="lua">    SetAmmo(amGrenade, 0, 0, 0, 1) -- grenade ammo crates now contain 1 grenade each
    91     SpawnAmmoCrate(0, 0, amGrenade) -- spawn grenade ammo crate at random position</code>
    91     SpawnAmmoCrate(0, 0, amGrenade) -- spawn grenade ammo crate at random position</code>
    92 
    92 
    93 === <tt>!SpawnUtilityCrate(x, y, ammoType [, amount])</tt> ===
    93 === `SpawnUtilityCrate(x, y, ammoType [, amount])` ===
    94 Spawns an utility crate with some ammo at the specified position. The function behaves almost like `SpawnAmmoCrate`, the differences are 1) the crate looks different and 2) if `ammoType` is set to `amNothing`, a random utility out of the set of available utilities from the weapon scheme is chosen as content.
    94 Spawns an utility crate with some ammo at the specified position. The function behaves almost like `SpawnAmmoCrate`, the differences are 1) the crate looks different and 2) if `ammoType` is set to `amNothing`, a random utility out of the set of available utilities from the weapon scheme is chosen as content.
    95 
    95 
    96 Example:
    96 Example:
    97 
    97 
    98 <code language="lua">    SetAmmo(amLaserSight, 0, 0, 0, 1)
    98 <code language="lua">    SetAmmo(amLaserSight, 0, 0, 0, 1)
    99     SpawnUtilityCrate(0, 0, amLaserSight)</code>
    99     SpawnUtilityCrate(0, 0, amLaserSight)</code>
   100 
   100 
   101 === <tt>!SpawnFakeAmmoCrate(x, y, explode, poison) </tt> ===
   101 === `SpawnFakeAmmoCrate(x, y, explode, poison) ` ===
   102 Spawns a crate at the specified coordinates which looks exactly like a real ammo crate but contains not any ammo. It can be use useful for scripted events or to create a trap. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land).
   102 Spawns a crate at the specified coordinates which looks exactly like a real ammo crate but contains not any ammo. It can be use useful for scripted events or to create a trap. If `x` and `y` are set to 0, the crate will spawn on a random position (but always on land).
   103 `explode` and `poison` are booleans.
   103 `explode` and `poison` are booleans.
   104 If `explode` is `true`, the crate will explode when collected.
   104 If `explode` is `true`, the crate will explode when collected.
   105 If `poison` is `true`, the collector will be poisoned.
   105 If `poison` is `true`, the collector will be poisoned.
   106 
   106 
   107 Example:
   107 Example:
   108 
   108 
   109 <code language="lua">SpawnFakeAmmoCrate(500, 432, false, false) -- Spawns a fake ammo crate at the coordinates (500, 434) without explosion and poison.
   109 <code language="lua">SpawnFakeAmmoCrate(500, 432, false, false) -- Spawns a fake ammo crate at the coordinates (500, 434) without explosion and poison.
   110 </code>
   110 </code>
   111 
   111 
   112 === <tt>!SpawnFakeHealthCrate(x, y, explode, poison) </tt> ===
   112 === `SpawnFakeHealthCrate(x, y, explode, poison) ` ===
   113 Same as `SpawnFakeAmmoCrate`, except the crate will look like a health crate.
   113 Same as `SpawnFakeAmmoCrate`, except the crate will look like a health crate.
   114 
   114 
   115 === <tt>!SpawnFakeUtilityCrate(x, y, explode, poison) </tt> ===
   115 === `SpawnFakeUtilityCrate(x, y, explode, poison) ` ===
   116 Same as `SpawnFakeAmmoCrate`, except the crate will look like an utility crate.
   116 Same as `SpawnFakeAmmoCrate`, except the crate will look like an utility crate.
   117 
   117 
   118 == Functions to get gear properties ==
   118 == Functions to get gear properties ==
   119 
   119 
   120 === <tt>!GetGearType(gearUid)</tt> ===
   120 === `GetGearType(gearUid)` ===
   121 This function returns the [GearTypes gear type] for the specified gear, if it exists.  If it doesn't exist, `nil` is returned.
   121 This function returns the [GearTypes gear type] for the specified gear, if it exists.  If it doesn't exist, `nil` is returned.
   122 
   122 
   123 === <tt>!GetVisualGearType(vgUid)</tt> (0.9.23) ===
   123 === `GetVisualGearType(vgUid)` (0.9.23) ===
   124 This function returns the [VisualGearTypes visual gear type] for the specified visual gear, if it exists.  If it doesn't exist, `nil` is returned.
   124 This function returns the [VisualGearTypes visual gear type] for the specified visual gear, if it exists.  If it doesn't exist, `nil` is returned.
   125 
   125 
   126 === <tt>!GetGearPosition(gearUid)</tt> ===
   126 === `GetGearPosition(gearUid)` ===
   127 Returns x,y coordinates for the specified gear. Not to be confused with `GetGearPos`.
   127 Returns x,y coordinates for the specified gear. Not to be confused with `GetGearPos`.
   128 
   128 
   129 === <tt>GetGearCollisionMask(gearUid)</tt> ===
   129 === `GetGearCollisionMask(gearUid)` ===
   130 Returns the current collision mask of the given gear. See `SetGearCollisionMask` for an explanation of the mask.
   130 Returns the current collision mask of the given gear. See `SetGearCollisionMask` for an explanation of the mask.
   131 
   131 
   132 === <tt>!GetGearRadius(gearUid)</tt> ===
   132 === `GetGearRadius(gearUid)` ===
   133 Returns the `Radius` value for the specified gear. For most [GearTypes gear types] for “projectile” gears (like `gtShell` or `gtGrenade`), the radius refers to the gear's collision radius. This is an invisible circle around the center of the gear which is used for the collision checks. For a few gear types, its radius means something different, see [GearTypes] for a full list.
   133 Returns the `Radius` value for the specified gear. For most [GearTypes gear types] for “projectile” gears (like `gtShell` or `gtGrenade`), the radius refers to the gear's collision radius. This is an invisible circle around the center of the gear which is used for the collision checks. For a few gear types, its radius means something different, see [GearTypes] for a full list.
   134 
   134 
   135 To set the `Radius` value, use `SetGearValues`.
   135 To set the `Radius` value, use `SetGearValues`.
   136 
   136 
   137 === <tt>!GetGearVelocity(gearUid)</tt> ===
   137 === `GetGearVelocity(gearUid)` ===
   138 Returns a tuple of dx,dy values for the specified gear.
   138 Returns a tuple of dx,dy values for the specified gear.
   139 
   139 
   140 === <tt>!GetFlightTime(gearUid)</tt> ===
   140 === `GetFlightTime(gearUid)` ===
   141 Returns the `FlightTime` of the specified gear. The `FlightTime` is a gear varialbe used to store a general time interval. The precise meaning of the `FlightTime` depends on the gear type.
   141 Returns the `FlightTime` of the specified gear. The `FlightTime` is a gear varialbe used to store a general time interval. The precise meaning of the `FlightTime` depends on the gear type.
   142 
   142 
   143 For example: The `FlightTime` of a hedgehog (`gtHedgehog`) is the time since they last have stood on solid ground. For most projectile gear types (i.e. `gtShell`), it stores the time after it has been launched.
   143 For example: The `FlightTime` of a hedgehog (`gtHedgehog`) is the time since they last have stood on solid ground. For most projectile gear types (i.e. `gtShell`), it stores the time after it has been launched.
   144 
   144 
   145 === <tt>!GetGearElasticity(gearUid) </tt> ===
   145 === `GetGearElasticity(gearUid) ` ===
   146 Returns the elasticity of the specified gear. The elasticity normally determines how strong the gear will bounce after collisions, where higher elasticity is for stronger bounces.
   146 Returns the elasticity of the specified gear. The elasticity normally determines how strong the gear will bounce after collisions, where higher elasticity is for stronger bounces.
   147 
   147 
   148 This is also useful for determining if a hog is on a rope or not. If a hog is attached to a rope, or is busy firing one, the elasticity of the rope will be a non-zero number.
   148 This is also useful for determining if a hog is on a rope or not. If a hog is attached to a rope, or is busy firing one, the elasticity of the rope will be a non-zero number.
   149 
   149 
   150 === <tt>!GetGearFriction(gearUid) </tt> ===
   150 === `GetGearFriction(gearUid) ` ===
   151 Returns the friction of the specified gear. The friction normally determines how well the gear will slide on terrain. Higher values are for increased sliding properties.
   151 Returns the friction of the specified gear. The friction normally determines how well the gear will slide on terrain. Higher values are for increased sliding properties.
   152 
   152 
   153 === <tt>!GetHogClan(gearUid)</tt> ===
   153 === `GetHogClan(gearUid)` ===
   154 Returns the clan ID of the specified hedgehog gear.
   154 Returns the clan ID of the specified hedgehog gear.
   155 
   155 
   156 === <tt>!GetHogTeamName(gearUid)</tt> ===
   156 === `GetHogTeamName(gearUid)` ===
   157 Returns the name of the specified gear’s team. `gearUid` can be a hedgehog or a grave.
   157 Returns the name of the specified gear’s team. `gearUid` can be a hedgehog or a grave.
   158 
   158 
   159 === <tt>!GetHogName(gearUid)</tt> ===
   159 === `GetHogName(gearUid)` ===
   160 Returns the name of the specified hedgehog gear.
   160 Returns the name of the specified hedgehog gear.
   161 
   161 
   162 === <tt>!IsHogHidden(gearUid)</tt> (0.9.25) ===
   162 === `IsHogHidden(gearUid)` (0.9.25) ===
   163 Returns true if hedgehog gear is hidden (e.g. via `HideHog` or the !TimeBox), false if it isn't, nil if that hedgehog never existed.
   163 Returns true if hedgehog gear is hidden (e.g. via `HideHog` or the !TimeBox), false if it isn't, nil if that hedgehog never existed.
   164 
   164 
   165 === <tt>!GetEffect(gearUid, effect)</tt> ===
   165 === `GetEffect(gearUid, effect)` ===
   166 Returns the state of given effect for the given hedgehog gear.
   166 Returns the state of given effect for the given hedgehog gear.
   167 
   167 
   168 See `SetEffect` for further details.
   168 See `SetEffect` for further details.
   169 
   169 
   170 === <tt>!GetHogHat(gearUid)</tt> ===
   170 === `GetHogHat(gearUid)` ===
   171 Returns the hat of the specified hedgehog gear.
   171 Returns the hat of the specified hedgehog gear.
   172 
   172 
   173 === <tt>!GetHogFlag(gearUid)</tt> ===
   173 === `GetHogFlag(gearUid)` ===
   174 Returns the name of the flag of the team of the specified hedgehog gear.
   174 Returns the name of the flag of the team of the specified hedgehog gear.
   175 
   175 
   176 === <tt>!GetHogFort(gearUid)</tt> (0.9.23) ===
   176 === `GetHogFort(gearUid)` (0.9.23) ===
   177 Returns the name of the fort of the team of the specified hedgehog gear.
   177 Returns the name of the fort of the team of the specified hedgehog gear.
   178 
   178 
   179 === <tt>!GetHogGrave(gearUid)</tt> ===
   179 === `GetHogGrave(gearUid)` ===
   180 Returns the name of the grave of the team of the specified hedgehog gear.
   180 Returns the name of the grave of the team of the specified hedgehog gear.
   181 
   181 
   182 === <tt>!GetHogVoicepack(gearUid)</tt> ===
   182 === `GetHogVoicepack(gearUid)` ===
   183 Returns the name of the voicepack of the team of the specified hedgehog gear.
   183 Returns the name of the voicepack of the team of the specified hedgehog gear.
   184 
   184 
   185 === <tt>!GetAmmoCount(gearUid, ammoType)</tt> ===
   185 === `GetAmmoCount(gearUid, ammoType)` ===
   186 Returns the ammo count of the specified ammo type for the specified hedgehog gear. If infinite, returns `AMMO_INFINITE`.
   186 Returns the ammo count of the specified ammo type for the specified hedgehog gear. If infinite, returns `AMMO_INFINITE`.
   187 
   187 
   188 === <tt>!GetAmmoTimer(gearUid, ammoType)</tt> (0.9.25) ===
   188 === `GetAmmoTimer(gearUid, ammoType)` (0.9.25) ===
   189 Returns the currently configured ammo timer (in milliseconds) for the given hedgehog gear and specified ammo type. This is the timer which is set by the player by using the timer keys (1-5). For ammo types for which the timer cannot be changed, `nil` is returned.
   189 Returns the currently configured ammo timer (in milliseconds) for the given hedgehog gear and specified ammo type. This is the timer which is set by the player by using the timer keys (1-5). For ammo types for which the timer cannot be changed, `nil` is returned.
   190 
   190 
   191 Example:
   191 Example:
   192 <code lang="lua">GetAmmoTimer(CurrentHedgehog, amGrenade)
   192 <code lang="lua">GetAmmoTimer(CurrentHedgehog, amGrenade)
   193 -- May return 1000, 2000, 3000, 4000 or 5000</code>
   193 -- May return 1000, 2000, 3000, 4000 or 5000</code>
   194 
   194 
   195 === <tt>!IsHogLocal(gearUid)</tt> (0.9.23) ===
   195 === `IsHogLocal(gearUid)` (0.9.23) ===
   196 Returns `true` if the specified hedgehog gear is controlled by a human player on the computer on which Hedgewars runs on (i.e. not over a computer over the network). Also returns `true` if the hog is a member of any of the local clans. Returns `false` otherwise. Returns `nil` if `gearUid` is invalid.
   196 Returns `true` if the specified hedgehog gear is controlled by a human player on the computer on which Hedgewars runs on (i.e. not over a computer over the network). Also returns `true` if the hog is a member of any of the local clans. Returns `false` otherwise. Returns `nil` if `gearUid` is invalid.
   197 
   197 
   198 This is perfect to hide certain captions like weapon messages from enemy eyes.
   198 This is perfect to hide certain captions like weapon messages from enemy eyes.
   199 
   199 
   200 === <tt>!GetGearTarget(gearUid, x, y) </tt> ===
   200 === `GetGearTarget(gearUid, x, y) ` ===
   201 Returns the x and y coordinate of target-based weapons/utilities. 
   201 Returns the x and y coordinate of target-based weapons/utilities. 
   202 <b>Note:</b>: This can’t be used in `onGearAdd()` but must be called after gear creation. 
   202 <b>Note:</b>: This can’t be used in `onGearAdd()` but must be called after gear creation. 
   203 
   203 
   204 === <tt>GetX(gearUid)</tt> ===
   204 === `GetX(gearUid)` ===
   205 Returns x coordinate of the gear.
   205 Returns x coordinate of the gear.
   206 
   206 
   207 === <tt>GetY(gearUid)</tt> ===
   207 === `GetY(gearUid)` ===
   208 Returns y coordinate of the gear.
   208 Returns y coordinate of the gear.
   209 
   209 
   210 === <tt>!GetState(gearUid)</tt> ===
   210 === `GetState(gearUid)` ===
   211 Returns the state of the gear. The gear state is a bitmask which is built out of the variables as shown in [States].
   211 Returns the state of the gear. The gear state is a bitmask which is built out of the variables as shown in [States].
   212 
   212 
   213 This function is usually used in combination with `band` to extract the truth value of a single flag. It is also used together with `SetState` and `bor` in order to activate a single flag.
   213 This function is usually used in combination with `band` to extract the truth value of a single flag. It is also used together with `SetState` and `bor` in order to activate a single flag.
   214 
   214 
   215 Examples:
   215 Examples:
   234 invisiblity to become 1. Then the new bitmask is applied to
   234 invisiblity to become 1. Then the new bitmask is applied to
   235 CurrentHedgehog, thus making it invisible.]]
   235 CurrentHedgehog, thus making it invisible.]]
   236 </code>
   236 </code>
   237 
   237 
   238 
   238 
   239 === <tt>!GetGearMessage(gearUid)</tt> ===
   239 === `GetGearMessage(gearUid)` ===
   240 Returns the message of the gear. This is a bitmask built out of flags seen in [GearMessages].
   240 Returns the message of the gear. This is a bitmask built out of flags seen in [GearMessages].
   241 
   241 
   242 === <tt>!GetTag(gearUid)</tt> ===
   242 === `GetTag(gearUid)` ===
   243 Returns the tag of the specified gear (by `gearUid`). 
   243 Returns the tag of the specified gear (by `gearUid`). 
   244 
   244 
   245 The `Tag` of a gear is just another arbitrary variable to hold the gear's state. The meaning of a tag depends on the gear type. For example, for `gtBall` gears, it specifies the ball color, for `gtAirAttack` gears (airplane) it specifies the direction of the plane, etc. See [GearTypes] for a full list. The returned value will be an integer.
   245 The `Tag` of a gear is just another arbitrary variable to hold the gear's state. The meaning of a tag depends on the gear type. For example, for `gtBall` gears, it specifies the ball color, for `gtAirAttack` gears (airplane) it specifies the direction of the plane, etc. See [GearTypes] for a full list. The returned value will be an integer.
   246 
   246 
   247 Note that the word “tag” here does _not_ refer to the name and health tags you see above hedgehogs, this is something different. 
   247 Note that the word “tag” here does _not_ refer to the name and health tags you see above hedgehogs, this is something different. 
   254 -- Now colorTag stores the tag of ball (in this case a number denoting its color)
   254 -- Now colorTag stores the tag of ball (in this case a number denoting its color)
   255 </code>
   255 </code>
   256 
   256 
   257 The meaning of tags are described in [GearTypes].
   257 The meaning of tags are described in [GearTypes].
   258 
   258 
   259 === <tt>!GetFollowGear()</tt> ===
   259 === `GetFollowGear()` ===
   260 Returns the uid of the gear that is currently being followed.
   260 Returns the uid of the gear that is currently being followed.
   261 
   261 
   262 === <tt>!GetTimer(gearUid)</tt> ===
   262 === `GetTimer(gearUid)` ===
   263 Returns the timer of the gear. This is for example the time it takes for watermelon, mine, etc. to explode. This is also the time used to specify the blowtorch or RC plane time. See [GearTypes] for a full list.
   263 Returns the timer of the gear. This is for example the time it takes for watermelon, mine, etc. to explode. This is also the time used to specify the blowtorch or RC plane time. See [GearTypes] for a full list.
   264 
   264 
   265 === <tt>!GetHealth(gearUid)</tt> ===
   265 === `GetHealth(gearUid)` ===
   266 Returns the health of the gear. Depending on the gear type, the gear's “health” can also refer to other things, see [GearTypes] for a full list.
   266 Returns the health of the gear. Depending on the gear type, the gear's “health” can also refer to other things, see [GearTypes] for a full list.
   267 
   267 
   268 === <tt>!GetHogLevel(gearUid)</tt> ===
   268 === `GetHogLevel(gearUid)` ===
   269 Returns the bot level ranging from `0` to `5`. `1` is the strongest bot level and `5` is the weakest one (this is the reverse of what players see). `0` is for human player.
   269 Returns the bot level ranging from `0` to `5`. `1` is the strongest bot level and `5` is the weakest one (this is the reverse of what players see). `0` is for human player.
   270 
   270 
   271 === <tt>!GetGearPos(gearUid)</tt> ===
   271 === `GetGearPos(gearUid)` ===
   272 Get the `Pos` value of the specified gear. `Pos` is just another arbitrary value to hold the state of the gear, such as `Tag` and `Health`, the meaning depends on the gear type. See [GearTypes] for the conrete meaning of a gear's `Pos` value. 
   272 Get the `Pos` value of the specified gear. `Pos` is just another arbitrary value to hold the state of the gear, such as `Tag` and `Health`, the meaning depends on the gear type. See [GearTypes] for the conrete meaning of a gear's `Pos` value. 
   273 
   273 
   274 *Important*: Pos is *not* related to the gear's position, use `GetGearPosition` for that.
   274 *Important*: Pos is *not* related to the gear's position, use `GetGearPosition` for that.
   275 
   275 
   276 === <tt>!GetGearValues(gearUid)</tt> ===
   276 === `GetGearValues(gearUid)` ===
   277 This returns a bunch of values associated with the gear, their meaning is often depending on the gear type and many values might be unused for certain gear types.
   277 This returns a bunch of values associated with the gear, their meaning is often depending on the gear type and many values might be unused for certain gear types.
   278 
   278 
   279 This is returned (all variables are integers):
   279 This is returned (all variables are integers):
   280 
   280 
   281 `Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint, Damage, Boom`
   281 `Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint, Damage, Boom`
   291 <code language="lua">
   291 <code language="lua">
   292 -- Get all values in a single line of code:
   292 -- Get all values in a single line of code:
   293 local Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint, Damage, Boom, Scale = GetGearValues(myGear)
   293 local Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, nImpactSounds, Tint, Damage, Boom, Scale = GetGearValues(myGear)
   294 </code>
   294 </code>
   295 
   295 
   296 === <tt>!GetVisualGearValues(vgUid)</tt> ===
   296 === `GetVisualGearValues(vgUid)` ===
   297 This returns the typically set visual gear values for the specified visual gear `vgUid`, useful if manipulating things like smoke, bubbles or circles. On success, it returns the following values:
   297 This returns the typically set visual gear values for the specified visual gear `vgUid`, useful if manipulating things like smoke, bubbles or circles. On success, it returns the following values:
   298 
   298 
   299 `X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint, Scale`
   299 `X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint, Scale`
   300 
   300 
   301 The meaning of these values is the same as in `SetVisualGearValues`.
   301 The meaning of these values is the same as in `SetVisualGearValues`.
   309 <code language="lua">-- Return visual gear values
   309 <code language="lua">-- Return visual gear values
   310 local X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint, Scale = GetVisualGearValues(vgUid)
   310 local X, Y, dX, dY, Angle, Frame, FrameTicks, State, Timer, Tint, Scale = GetVisualGearValues(vgUid)
   311 </code>
   311 </code>
   312 
   312 
   313 == Functions to change position and velocity ==
   313 == Functions to change position and velocity ==
   314 === <tt>!SetGearPosition(gearUid, x, y)</tt> ===
   314 === `SetGearPosition(gearUid, x, y)` ===
   315 Places the specified gear exactly at the position (`x`,`y`). Not to be confused with `SetGearPos`.
   315 Places the specified gear exactly at the position (`x`,`y`). Not to be confused with `SetGearPos`.
   316 
   316 
   317 === <tt>!SetGearVelocity(gearUid, dx, dy)</tt> ===
   317 === `SetGearVelocity(gearUid, dx, dy)` ===
   318 Gives the specified gear the velocity of `dx`, `dy`.
   318 Gives the specified gear the velocity of `dx`, `dy`.
   319 
   319 
   320 === <tt>CopyPV(gearUid, gearUid)</tt> ===
   320 === `CopyPV(gearUid, gearUid)` ===
   321 This sets the position and velocity of the second gear to the first one.
   321 This sets the position and velocity of the second gear to the first one.
   322 
   322 
   323 === <tt>!FindPlace(gearUid, fall, left, right[, tryHarder])</tt> ===
   323 === `FindPlace(gearUid, fall, left, right[, tryHarder])` ===
   324 Finds a place for the specified gear between x=`left` and x=`right` and places it there. `tryHarder` is optional, setting it to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
   324 Finds a place for the specified gear between x=`left` and x=`right` and places it there. `tryHarder` is optional, setting it to `true`/`false` will determine whether the engine attempts to make additional passes, even attempting to place gears on top of each other.
   325 
   325 
   326 Example:
   326 Example:
   327 
   327 
   328 <code language="lua">    gear = AddGear(...)
   328 <code language="lua">    gear = AddGear(...)
   329     FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
   329     FindPlace(gear, true, 0, LAND_WIDTH) -- places the gear randomly between 0 and LAND_WIDTH</code>
   330 
   330 
   331 == Functions to modify gears ==
   331 == Functions to modify gears ==
   332 === <tt>!SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom)</tt> ===
   332 === `SetGearValues(gearUid, Angle, Power, WDTimer, Radius, Density, Karma, DirAngle, AdvBounce, ImpactSound, ImpactSounds, Tint, Damage, Boom)` ===
   333 Sets various gear value for the specified gear (`gearUid`). The meaining of each value often depends on the gear type. See the documentation on !GetGearValues for a brief description of the gear values. If `gearUid` is invalid or the gear does not exist, nothing happens.
   333 Sets various gear value for the specified gear (`gearUid`). The meaining of each value often depends on the gear type. See the documentation on !GetGearValues for a brief description of the gear values. If `gearUid` is invalid or the gear does not exist, nothing happens.
   334 
   334 
   335 Set `nil` for each value you do not want to change.
   335 Set `nil` for each value you do not want to change.
   336 
   336 
   337 Example:
   337 Example:
   342          SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
   342          SetGearValues(gear, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xFFFFFFFF)
   343     end
   343     end
   344 end
   344 end
   345 </code>
   345 </code>
   346 
   346 
   347 === <tt>!SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint, Scale)</tt> ===
   347 === `SetVisualGearValues(vgUid, X, Y, dX, dY, Angle, Frame, !FrameTicks, State, Timer, Tint, Scale)` ===
   348 This allows manipulation of the internal state of the visual gear `vgUid`. If `vgUid` is invalid or the `vgUid` does not refer to an existing visual gear, the function does nothing. Thus, you can safely call this function even if you are not sure if the visual gear actually exists.
   348 This allows manipulation of the internal state of the visual gear `vgUid`. If `vgUid` is invalid or the `vgUid` does not refer to an existing visual gear, the function does nothing. Thus, you can safely call this function even if you are not sure if the visual gear actually exists.
   349 
   349 
   350 All visual gear values are numbers. Each visual gear may be using these parameters differently, but the *usual* meaning of these is the following:
   350 All visual gear values are numbers. Each visual gear may be using these parameters differently, but the *usual* meaning of these is the following:
   351 
   351 
   352  * `X`, `Y`: Position
   352  * `X`, `Y`: Position
   377 <code language="lua">  -- set a visual gear to position 1000,1000
   377 <code language="lua">  -- set a visual gear to position 1000,1000
   378     SetVisualGearValues(circleUid, 1000, 1000)</code>
   378     SetVisualGearValues(circleUid, 1000, 1000)</code>
   379 <code language="lua">  -- set the tint of a visual gear to bright red.
   379 <code language="lua">  -- set the tint of a visual gear to bright red.
   380     SetVisualGearValues(circleUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff0000ff)</code>
   380     SetVisualGearValues(circleUid, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff0000ff)</code>
   381 
   381 
   382 === <tt>SetGearCollisionMask(gearUid, mask)</tt> ===
   382 === `SetGearCollisionMask(gearUid, mask)` ===
   383 Set the collision mask of the given gear with `gearUid`.
   383 Set the collision mask of the given gear with `gearUid`.
   384 The collision mask defines with which gears and terrain types the gear can collide.
   384 The collision mask defines with which gears and terrain types the gear can collide.
   385 
   385 
   386 `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:
   386 `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:
   387 
   387 
   409 
   409 
   410 There are actual more flags availbable, but they are not as useful for use in Lua and their constants have not been exposed to Lua. You can find the full range of flags in the engine source code (in Pascal):
   410 There are actual more flags availbable, but they are not as useful for use in Lua and their constants have not been exposed to Lua. You can find the full range of flags in the engine source code (in Pascal):
   411 
   411 
   412 [https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112]
   412 [https://hg.hedgewars.org/hedgewars/file/default/hedgewars/uConsts.pas#l112]
   413 
   413 
   414 === <tt>!SetFlightTime(gearUid, flighttime)</tt> ===
   414 === `SetFlightTime(gearUid, flighttime)` ===
   415 Sets the `FlightTime` of the given gear to `flighttime`. The meaning of `FlightTime` is explained in the section `GetFlightTime`.
   415 Sets the `FlightTime` of the given gear to `flighttime`. The meaning of `FlightTime` is explained in the section `GetFlightTime`.
   416 
   416 
   417 === <tt>!SetGearElasticity(gearUid, Elasticity) </tt> ===
   417 === `SetGearElasticity(gearUid, Elasticity) ` ===
   418 Sets the elasticity of the specified gear. For most gears, the elasticity determines how strong the gear will bounce after collisions, where higher elasticity is for stronger bounces. Recommended are values between `0` and `9999`.
   418 Sets the elasticity of the specified gear. For most gears, the elasticity determines how strong the gear will bounce after collisions, where higher elasticity is for stronger bounces. Recommended are values between `0` and `9999`.
   419 
   419 
   420 === <tt>!SetGearFriction(gearUid, Friction) </tt> ===
   420 === `SetGearFriction(gearUid, Friction) ` ===
   421 Sets the friction of the specified gear. The friction normally determines how well the gear will slide on terrain. Higher values are for increased sliding properties. `0` is for no sliding whatsoever, where `9999` is for very long slides, greater values are not recommended.
   421 Sets the friction of the specified gear. The friction normally determines how well the gear will slide on terrain. Higher values are for increased sliding properties. `0` is for no sliding whatsoever, where `9999` is for very long slides, greater values are not recommended.
   422 
   422 
   423 === <tt>!SetHealth(gearUid, health)</tt> ===
   423 === `SetHealth(gearUid, health)` ===
   424 Sets the health of the specified gear. The “health” of a gear can refer to many things, depending on the gear type.
   424 Sets the health of the specified gear. The “health” of a gear can refer to many things, depending on the gear type.
   425 
   425 
   426 *Hint*: If you like to increase the health of a hedgehog with nice visual effects, consider using `HealHog` instead.
   426 *Hint*: If you like to increase the health of a hedgehog with nice visual effects, consider using `HealHog` instead.
   427 
   427 
   428 Use cases:
   428 Use cases:
   452             -- Turn mine into dud
   452             -- Turn mine into dud
   453             SetHealth(gear, 0)
   453             SetHealth(gear, 0)
   454        end
   454        end
   455     end</code>
   455     end</code>
   456 
   456 
   457 === <tt>HealHog(gearUid, healthBoost[, showMessage[, tint]])</tt> (0.9.24) ===
   457 === `HealHog(gearUid, healthBoost[, showMessage[, tint]])` (0.9.24) ===
   458 Convenience function to increase the health of a hedgehog with default visual effects.
   458 Convenience function to increase the health of a hedgehog with default visual effects.
   459 
   459 
   460 Specifically, this increases the health of the hedgehog gear with the given ID `gearUid` by `healthBoost`, displays some healing particles at the hedgehog and shows the health increae as a message. This is similar to the behavour after taking a health crate, or getting a health boost from vampirism.
   460 Specifically, this increases the health of the hedgehog gear with the given ID `gearUid` by `healthBoost`, displays some healing particles at the hedgehog and shows the health increae as a message. This is similar to the behavour after taking a health crate, or getting a health boost from vampirism.
   461 
   461 
   462 If `showMessage` is false, no message is shown. With `tint` you can set the RGBA color of the particles (default: `0x00FF00FF`).
   462 If `showMessage` is false, no message is shown. With `tint` you can set the RGBA color of the particles (default: `0x00FF00FF`).
   463 
   463 
   464 This function does not affect the poison state, however (see `SetEffect`).
   464 This function does not affect the poison state, however (see `SetEffect`).
   465 
   465 
   466 === <tt>!SetEffect(gearUid, effect, effectState)</tt> ===
   466 === `SetEffect(gearUid, effect, effectState)` ===
   467 Sets the state for one of the effects <tt>heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen</tt> for the specified hedgehog gear.
   467 Sets the state for one of the effects `heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen` for the specified hedgehog gear.
   468 A value of 0 usually means the effect is disabled, values other than that indicate that it is enabled and in some cases specify e.g. the remaining time of that effect.
   468 A value of 0 usually means the effect is disabled, values other than that indicate that it is enabled and in some cases specify e.g. the remaining time of that effect.
   469 
   469 
   470 || *`effect`* || *Description* || *`effectState`* ||
   470 || *`effect`* || *Description* || *`effectState`* ||
   471 || `heInvulnerable` || Wether hog is invulnerable || Any non-zero value turns on invulnerability. `0` turns it off. ||
   471 || `heInvulnerable` || Wether hog is invulnerable || Any non-zero value turns on invulnerability. `0` turns it off. ||
   472 || `hePoisoned` || Poison damage, damages hog each turn. || Amount of damage per turn. Use `0` to disable poisoning. ||
   472 || `hePoisoned` || Poison damage, damages hog each turn. || Amount of damage per turn. Use `0` to disable poisoning. ||
   481         if (GetGearType(gear) == gtHedgehog) and (GetHogLevel(gear) > 0) then
   481         if (GetGearType(gear) == gtHedgehog) and (GetHogLevel(gear) > 0) then
   482             SetEffect(gear, hePoisoned, 1)
   482             SetEffect(gear, hePoisoned, 1)
   483         end
   483         end
   484     end</code>
   484     end</code>
   485 
   485 
   486 === <tt>!SetHogName(gearUid, name)</tt> ===
   486 === `SetHogName(gearUid, name)` ===
   487 Sets the name of the specified hedgehog gear.
   487 Sets the name of the specified hedgehog gear.
   488 
   488 
   489 === <tt>!SetHogTeamName(gearUid, name)</tt> ===
   489 === `SetHogTeamName(gearUid, name)` ===
   490 Sets the team name of the specified gear. The gear can be a hedgehog or grave.
   490 Sets the team name of the specified gear. The gear can be a hedgehog or grave.
   491 
   491 
   492 === <tt>!SetHogHat(gearUid, hat)</tt> ===
   492 === `SetHogHat(gearUid, hat)` ===
   493 Sets the hat of the specified hedgehog gear.
   493 Sets the hat of the specified hedgehog gear.
   494 
   494 
   495 === <tt>!HogTurnLeft(gearUid, boolean)</tt> ===
   495 === `HogTurnLeft(gearUid, boolean)` ===
   496 Faces the specified hog left or right.
   496 Faces the specified hog left or right.
   497 
   497 
   498 Example:
   498 Example:
   499 
   499 
   500 <code language="lua">    HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left 
   500 <code language="lua">    HogTurnLeft(CurrentHedgehog, true) -- turns CurrentHedgehog left 
   501     HogTurnLeft(CurrentHedgehog, false) -- turns CurrentHedgehog right</code>
   501     HogTurnLeft(CurrentHedgehog, false) -- turns CurrentHedgehog right</code>
   502 
   502 
   503 === <tt>!SetGearTarget(gearUid, x, y)</tt> ===
   503 === `SetGearTarget(gearUid, x, y)` ===
   504 Sets the x and y coordinate of target-based weapons/utilities.
   504 Sets the x and y coordinate of target-based weapons/utilities.
   505 *Note*: This can’t be used in onGearAdd() but must be called after gear creation.
   505 *Note*: This can’t be used in onGearAdd() but must be called after gear creation.
   506 
   506 
   507 === <tt>!SetState(gearUid, state)</tt> ===
   507 === `SetState(gearUid, state)` ===
   508 Sets the state of the specified gear to the specified `state`. This is a bitmask made out of the variables as seen in [States].
   508 Sets the state of the specified gear to the specified `state`. This is a bitmask made out of the variables as seen in [States].
   509 
   509 
   510 This function is often used together with `GetState` and the bitmask utility functions `band` and `bnot` in order to manipulate a single flag.
   510 This function is often used together with `GetState` and the bitmask utility functions `band` and `bnot` in order to manipulate a single flag.
   511 
   511 
   512 Examples:
   512 Examples:
   522 SetState(CurrentHedgehog, band(GetState(CurrentHedgehog), bnot(gstInvisible)))
   522 SetState(CurrentHedgehog, band(GetState(CurrentHedgehog), bnot(gstInvisible)))
   523 --[[ The reverse of the above: This function toggles CurrentHedgehog’s
   523 --[[ The reverse of the above: This function toggles CurrentHedgehog’s
   524 gstInvisible flag off, thus making it visible again. ]]
   524 gstInvisible flag off, thus making it visible again. ]]
   525 </code>
   525 </code>
   526 
   526 
   527 === <tt>!SetGearMessage(gearUid, message)</tt> ===
   527 === `SetGearMessage(gearUid, message)` ===
   528 Sets the gear messages of the specified gear. `message` is a bitmask built out of flags seen in [GearMessages].
   528 Sets the gear messages of the specified gear. `message` is a bitmask built out of flags seen in [GearMessages].
   529 
   529 
   530 === <tt>!SetTag(gearUid, tag)</tt> ===
   530 === `SetTag(gearUid, tag)` ===
   531 Sets the `Tag` value of the specified gear (by `gearUid`). The `Tag` value of a gear is simply an extra variable to modify misc. things. The meaning of a tag depends on the gear type. For example, for `gtBall` gears, it specifies the ball color, for `gtAirAttack` gears (airplane) it specifies the direction of the plane, etc. See [GearTypes] for a full list. `tag` has to be an integer.
   531 Sets the `Tag` value of the specified gear (by `gearUid`). The `Tag` value of a gear is simply an extra variable to modify misc. things. The meaning of a tag depends on the gear type. For example, for `gtBall` gears, it specifies the ball color, for `gtAirAttack` gears (airplane) it specifies the direction of the plane, etc. See [GearTypes] for a full list. `tag` has to be an integer.
   532 
   532 
   533 Note that the word “tag” here does _not_ refer to the name and health tags you see above hedgehogs, this is something different. 
   533 Note that the word “tag” here does _not_ refer to the name and health tags you see above hedgehogs, this is something different. 
   534 
   534 
   535 <code language="lua">
   535 <code language="lua">
   539 SetTag(ball, 8) -- 
   539 SetTag(ball, 8) -- 
   540 </code>
   540 </code>
   541 
   541 
   542 The meaning of tags are described in [GearTypes].
   542 The meaning of tags are described in [GearTypes].
   543 
   543 
   544 === <tt>!SetTimer(gearUid, timer)</tt> ===
   544 === `SetTimer(gearUid, timer)` ===
   545 Sets the timer of the specified gear. Also see `GetTimer`.
   545 Sets the timer of the specified gear. Also see `GetTimer`.
   546 
   546 
   547 === <tt>!SetHogLevel(gearUid, level)</tt> ===
   547 === `SetHogLevel(gearUid, level)` ===
   548 Sets the bot level from 0 to 5. `1` is the strongest bot level and `5` is the weakest one (this is the reverse of what players see). `0` means human player.
   548 Sets the bot level from 0 to 5. `1` is the strongest bot level and `5` is the weakest one (this is the reverse of what players see). `0` means human player.
   549 
   549 
   550 === <tt>SetGearAIHints(gearUid, aiHint)</tt> ===
   550 === `SetGearAIHints(gearUid, aiHint)` ===
   551 Set some behaviour hints for computer-controlled hedgehogs for any given gear with `gearUid`.
   551 Set some behaviour hints for computer-controlled hedgehogs for any given gear with `gearUid`.
   552 
   552 
   553 Set `aiHint` to either of:
   553 Set `aiHint` to either of:
   554 
   554 
   555  * `aihUsualProcessing`: AI hogs treat this gear the usual way. This is the default.
   555  * `aihUsualProcessing`: AI hogs treat this gear the usual way. This is the default.
   559 
   559 
   560 <code language="lua">
   560 <code language="lua">
   561 SetGearAIHints(uselessHog, aihDoesntMatter)
   561 SetGearAIHints(uselessHog, aihDoesntMatter)
   562 -- This makes AI hogs stop caring about attacking uselessHog</code>
   562 -- This makes AI hogs stop caring about attacking uselessHog</code>
   563 
   563 
   564 === <tt>!SetGearPos(gearUid, value)</tt> ===
   564 === `SetGearPos(gearUid, value)` ===
   565 Sets the `Pos` value (not the position!) of the specified gear to specified value. See `GetGearPos` for more information.
   565 Sets the `Pos` value (not the position!) of the specified gear to specified value. See `GetGearPos` for more information.
   566 
   566 
   567 === <tt>!HideHog(gearUid)</tt> ===
   567 === `HideHog(gearUid)` ===
   568 Removes a hedgehog from the map. The hidden hedgehog can be restored with `RestoreHog(gearUid)`. Since 0.9.23, returns `true` on success and `false` on failure (if gear does not exist / hog is already hidden).
   568 Removes a hedgehog from the map. The hidden hedgehog can be restored with `RestoreHog(gearUid)`. Since 0.9.23, returns `true` on success and `false` on failure (if gear does not exist / hog is already hidden).
   569 
   569 
   570 Example: 
   570 Example: 
   571 
   571 
   572 <code language="lua">    gear = AddGear(...)
   572 <code language="lua">    gear = AddGear(...)
   573      HideHog(gear) -- Hide the newly created gear.</code>
   573      HideHog(gear) -- Hide the newly created gear.</code>
   574 
   574 
   575 === <tt>!RestoreHog(gearUid)</tt> ===
   575 === `RestoreHog(gearUid)` ===
   576 Restores a previously hidden hedgehog.  Nothing happens if the hedgehog does not exist or is not hidden.
   576 Restores a previously hidden hedgehog.  Nothing happens if the hedgehog does not exist or is not hidden.
   577 
   577 
   578 Example: 
   578 Example: 
   579 
   579 
   580 <code language="lua">    gear = AddGear(...)
   580 <code language="lua">    gear = AddGear(...)
   603 
   603 
   604 <code language="lua">HogSay(CurrentHedgehog, "I wonder what to do …", SAY_THINK) -- thought bubble with text “I wonder what to do …”</code>
   604 <code language="lua">HogSay(CurrentHedgehog, "I wonder what to do …", SAY_THINK) -- thought bubble with text “I wonder what to do …”</code>
   605 <code language="lua">HogSay(CurrentHedgehog, "I'm hungry.", SAY_SAY) -- speech bubble with text “I’m hungry.”</code>
   605 <code language="lua">HogSay(CurrentHedgehog, "I'm hungry.", SAY_SAY) -- speech bubble with text “I’m hungry.”</code>
   606 <code language="lua">HogSay(CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text “I smell CAKE!”</code>
   606 <code language="lua">HogSay(CurrentHedgehog, "I smell CAKE!", SAY_SHOUT) -- exclamatory bubble with text “I smell CAKE!”</code>
   607 
   607 
   608 === <tt>!FollowGear(gearUid)</tt> ===
   608 === `FollowGear(gearUid)` ===
   609 Makes the game client follow the specifiec gear (if it exists). Does not work for visual gears.
   609 Makes the game client follow the specifiec gear (if it exists). Does not work for visual gears.
   610 
   610 
   611 == Functions to delete gears ==
   611 == Functions to delete gears ==
   612 === <tt>!DeleteGear(gearUid)</tt> ===
   612 === `DeleteGear(gearUid)` ===
   613 Deletes a gear.  If the specified gear did not exist, nothing happens.
   613 Deletes a gear.  If the specified gear did not exist, nothing happens.
   614 
   614 
   615 Example:
   615 Example:
   616 
   616 
   617 <code language="lua">    gear = AddGear(...)
   617 <code language="lua">    gear = AddGear(...)
   618     DeleteGear(gear) -- Delete the newly created gear.</code>
   618     DeleteGear(gear) -- Delete the newly created gear.</code>
   619 
   619 
   620 === <tt>!DeleteVisualGear(vgUid)</tt> ===
   620 === `DeleteVisualGear(vgUid)` ===
   621 Deletes a visual gear.  If it does not exist, nothing happens. 
   621 Deletes a visual gear.  If it does not exist, nothing happens. 
   622 
   622 
   623 Note, most visual gears delete themselves after a while.
   623 Note, most visual gears delete themselves after a while.
   624 
   624 
   625 
   625