LuaAPI.wiki
changeset 1648 77f8cfe4ee8d
parent 1647 4185517621d5
child 1649 c22e796992aa
equal deleted inserted replaced
1647:4185517621d5 1648:77f8cfe4ee8d
    80 || `LAND_WIDTH` || The width of the landscape in pixels. Not available before `onGameStart` ||
    80 || `LAND_WIDTH` || The width of the landscape in pixels. Not available before `onGameStart` ||
    81 || `LAND_HEIGHT` || The height of the landscape in pixels. Not available before `onGameStart` ||
    81 || `LAND_HEIGHT` || The height of the landscape in pixels. Not available before `onGameStart` ||
    82 || `LeftX` || X coordinate of the leftmost point of the landscape. Not available before `onGameStart` ||
    82 || `LeftX` || X coordinate of the leftmost point of the landscape. Not available before `onGameStart` ||
    83 || `RightX` || X coordinate of the rightmost point of the landscape. Not available before `onGameStart` ||
    83 || `RightX` || X coordinate of the rightmost point of the landscape. Not available before `onGameStart` ||
    84 || `TopY` || Y coordinate of the topmost point of the landscape. Not available before `onGameStart` ||
    84 || `TopY` || Y coordinate of the topmost point of the landscape. Not available before `onGameStart` ||
    85 || `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 equals `NO_CURSOR` ||
    86 || `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 equals `NO_CURSOR` ||
    87 || `WaterLine` || The y position of the water, used to determine at which position stuff drowns. Use `SetWaterLine` to change. ||
    87 || `WaterLine` || The y position of the water, used to determine at which position stuff drowns. Use `SetWaterLine` to change. ||
    88 || `ClansCount` || Number of clans, including defeated ones (a clan is a group of teams with same color) ||
    88 || `ClansCount` || Number of clans, including defeated ones (a clan is a group of teams with same color) ||
    89 || `TeamsCount` || Number of teams, including defeated ones ||
    89 || `TeamsCount` || Number of teams, including defeated ones ||
    90 || `TurnTimeLeft` || Number of game ticks (milliseconds) left until the current turn ends. To set this value, use `SetTurnTimeLeft` ||
    90 || `TurnTimeLeft` || Number of game ticks (milliseconds) left until the current turn ends. To set this value, use `SetTurnTimeLeft` ||
    91 || `ReadyTimeLeft` || Remaining ready time in millseconds, 0 if turn in progress. To set this value, use `SetReadyTimeLeft` ||
    91 || `ReadyTimeLeft` || Remaining ready time in millseconds, 0 if turn in progress. To set this value, use `SetReadyTimeLeft` ||
   440 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.
   440 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.
   441 Otherwise, this function behaves like `SpawnAmmoCrate`.
   441 Otherwise, this function behaves like `SpawnAmmoCrate`.
   442 
   442 
   443 === <tt>!SpawnAmmoCrate(x, y, ammoType [, amount])</tt> ===
   443 === <tt>!SpawnAmmoCrate(x, y, ammoType [, amount])</tt> ===
   444 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.
   444 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.
   445 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 `100` or greater, the amount is infinite.
   445 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.
   446 
   446 
   447 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:
   447 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:
   448 
   448 
   449 Example:
   449 Example:
   450 
   450 
  1163 <code language="lua">
  1163 <code language="lua">
  1164 -- Appends a text to the ammo tooltip of the bazooka but leaves name and main description intact
  1164 -- Appends a text to the ammo tooltip of the bazooka but leaves name and main description intact
  1165 SetAmmoTexts(amBazooka, "This weapon deals double the damage than usually.")</code>
  1165 SetAmmoTexts(amBazooka, "This weapon deals double the damage than usually.")</code>
  1166 
  1166 
  1167 ==== <tt>!AddAmmo(gearUid, ammoType, ammoCount)</tt> ====
  1167 ==== <tt>!AddAmmo(gearUid, ammoType, ammoCount)</tt> ====
  1168 Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` event handler. `ammoCount` is an optional parameter. If this is set, the ammo will **not** be added, but instead set to `ammoCount`. A value of 0 will remove the weapon, a value of 100 will give infinite ammo.
  1168 Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` event handler. `ammoCount` is an optional parameter. If this is set, the ammo will **not** be added, but instead set to `ammoCount`. A value of `0` will remove the weapon, a value of `AMMO_INFINITE` will give infinite ammo.
  1169 
  1169 
  1170 ==== <tt>!GetAmmoName(ammoType [, ignoreOverwrite ])</tt> (0.9.23) ====
  1170 ==== <tt>!GetAmmoName(ammoType [, ignoreOverwrite ])</tt> (0.9.23) ====
  1171 Returns the localized name for the specified `ammoType`, taking an ammo name overwritten by `SetAmmoTexts` into account. If `ignoreOverwrite` is `true`, this function will always return the original ammo name of the weapon and ignores names which may have been overwritten by `SetAmmoTexts`.
  1171 Returns the localized name for the specified `ammoType`, taking an ammo name overwritten by `SetAmmoTexts` into account. If `ignoreOverwrite` is `true`, this function will always return the original ammo name of the weapon and ignores names which may have been overwritten by `SetAmmoTexts`.
  1172 
  1172 
  1173 === Map ===
  1173 === Map ===