LuaGears.wiki
changeset 2077 514babfbad9e
parent 2047 bc6b4846ab11
child 2089 375b9861ab91
equal deleted inserted replaced
2076:0b6e80767d96 2077:514babfbad9e
    83 </code>
    83 </code>
    84 
    84 
    85 === `SpawnHealthCrate(x, y, [, health])` ===
    85 === `SpawnHealthCrate(x, y, [, health])` ===
    86 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`.
    86 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`.
    87 
    87 
    88 === `SpawnSupplyCrate(x, y, ammoType [, amount])` (0.9.24) ===
    88 === `SpawnSupplyCrate(x, y, ammoType [, amount])` ===
    89 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.
    89 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.
    90 Otherwise, this function behaves like `SpawnAmmoCrate`.
    90 Otherwise, this function behaves like `SpawnAmmoCrate`.
    91 
    91 
    92 === `SpawnAmmoCrate(x, y, ammoType [, amount])` ===
    92 === `SpawnAmmoCrate(x, y, ammoType [, amount])` ===
    93 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.
    93 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.
   160 == General gear properties ==
   160 == General gear properties ==
   161 
   161 
   162 === `GetGearType(gearUid)` ===
   162 === `GetGearType(gearUid)` ===
   163 This function returns the [GearTypes gear type] for the specified gear, if it exists.  If it doesn't exist, `nil` is returned.
   163 This function returns the [GearTypes gear type] for the specified gear, if it exists.  If it doesn't exist, `nil` is returned.
   164 
   164 
   165 === `GetVisualGearType(vgUid)` (0.9.23) ===
   165 === `GetVisualGearType(vgUid)` ===
   166 This function returns the [VisualGearTypes visual gear type] for the specified visual gear, if it exists.  If it doesn't exist, `nil` is returned.
   166 This function returns the [VisualGearTypes visual gear type] for the specified visual gear, if it exists.  If it doesn't exist, `nil` is returned.
   167 
   167 
   168 === `GetState(gearUid)` ===
   168 === `GetState(gearUid)` ===
   169 Returns the state of the gear. The gear state is a bitmask which is built out of the variables as shown in [States].
   169 Returns the state of the gear. The gear state is a bitmask which is built out of the variables as shown in [States].
   170 
   170 
   515 || `heInvulnerable` || Wether hog is invulnerable || Any non-zero value turns on invulnerability. `0` turns it off. ||
   515 || `heInvulnerable` || Wether hog is invulnerable || Any non-zero value turns on invulnerability. `0` turns it off. ||
   516 || `hePoisoned` || Poison damage, damages hog each turn. || Amount of damage per turn. Use `0` to disable poisoning. ||
   516 || `hePoisoned` || Poison damage, damages hog each turn. || Amount of damage per turn. Use `0` to disable poisoning. ||
   517 || `heResurrectable` || Whether to resurrect the hog on death || With a non-zero value, the hedgehog will be resurrected and teleported to a random safe location on death. Resurrection may fail and the hedgehog can still die when there is no or very, very little land left. `0` disables this. ||
   517 || `heResurrectable` || Whether to resurrect the hog on death || With a non-zero value, the hedgehog will be resurrected and teleported to a random safe location on death. Resurrection may fail and the hedgehog can still die when there is no or very, very little land left. `0` disables this. ||
   518 || `heResurrected` || Whether the hedgehog has been resurrected once. This is only a subtle graphical effect. || With a non-zero value, the hedgehog was resurrected, `0` otherwise. ||
   518 || `heResurrected` || Whether the hedgehog has been resurrected once. This is only a subtle graphical effect. || With a non-zero value, the hedgehog was resurrected, `0` otherwise. ||
   519 || `heFrozen` || Freeze level. Frozen hedgehogs skip turn, are heavy and take half damage || The hog is considered frozen if the value is `256` or higher, otherwise not. A number of `256` or higher denotes “how frozen” the hedgehog is, i.e. how long it takes to melt. The freezer sets this to `199999` initially. The value will be reduced by `50000` each round. Being hit by a flame reduces this number by `1000`. The values `0` to `255` are used for the freeze/melt animations. ||
   519 || `heFrozen` || Freeze level. Frozen hedgehogs skip turn, are heavy and take half damage || The hog is considered frozen if the value is `256` or higher, otherwise not. A number of `256` or higher denotes “how frozen” the hedgehog is, i.e. how long it takes to melt. The freezer sets this to `199999` initially. The value will be reduced by `50000` each round. Being hit by a flame reduces this number by `1000`. The values `0` to `255` are used for the freeze/melt animations. ||
   520 || `heArtillery` || If enabled, the hedgehog can't walk (since 0.9.24). || `0` = disabled. `1` = permanently enabled. `2` = temporarily enabled (used by sniper rifle between shots) ||
   520 || `heArtillery` || If enabled, the hedgehog can't walk. || `0` = disabled. `1` = permanently enabled. `2` = temporarily enabled (used by sniper rifle between shots) ||
   521 
   521 
   522 Example (sets all bots poisoned with poison damage of 1):
   522 Example (sets all bots poisoned with poison damage of 1):
   523 
   523 
   524 <code language="lua">    function onGearAdd(gear)
   524 <code language="lua">    function onGearAdd(gear)
   525         if (GetGearType(gear) == gtHedgehog) and (GetHogLevel(gear) > 0) then
   525         if (GetGearType(gear) == gtHedgehog) and (GetHogLevel(gear) > 0) then
   534 Sets the hat of the specified hedgehog gear. `hat` is the hat name, which equals the file name (case-sensitively) without the file name suffix. If the hat file can not be found on the local computer, the hog will wear no hat.
   534 Sets the hat of the specified hedgehog gear. `hat` is the hat name, which equals the file name (case-sensitively) without the file name suffix. If the hat file can not be found on the local computer, the hog will wear no hat.
   535 
   535 
   536 === `GetHogFlag(gearUid)` ===
   536 === `GetHogFlag(gearUid)` ===
   537 Returns the name of the flag of the team of the specified hedgehog gear.
   537 Returns the name of the flag of the team of the specified hedgehog gear.
   538 
   538 
   539 === `GetHogFort(gearUid)` (0.9.23) ===
   539 === `GetHogFort(gearUid)` ===
   540 Returns the name of the fort of the team of the specified hedgehog gear.
   540 Returns the name of the fort of the team of the specified hedgehog gear.
   541 
   541 
   542 === `GetHogGrave(gearUid)` ===
   542 === `GetHogGrave(gearUid)` ===
   543 Returns the name of the grave of the team of the specified hedgehog gear.
   543 Returns the name of the grave of the team of the specified hedgehog gear.
   544 
   544 
   553 
   553 
   554 Example:
   554 Example:
   555 <code lang="lua">GetAmmoTimer(CurrentHedgehog, amGrenade)
   555 <code lang="lua">GetAmmoTimer(CurrentHedgehog, amGrenade)
   556 -- May return 1000, 2000, 3000, 4000 or 5000</code>
   556 -- May return 1000, 2000, 3000, 4000 or 5000</code>
   557 
   557 
   558 === `HealHog(gearUid, healthBoost[, showMessage[, tint]])` (0.9.24) ===
   558 === `HealHog(gearUid, healthBoost[, showMessage[, tint]])` ===
   559 Convenience function to increase the health of a hedgehog with default visual effects.
   559 Convenience function to increase the health of a hedgehog with default visual effects.
   560 
   560 
   561 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.
   561 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.
   562 
   562 
   563 If `showMessage` is false, no message is shown. With `tint` you can set the RGBA color of the particles (default: `0x00FF00FF`).
   563 If `showMessage` is false, no message is shown. With `tint` you can set the RGBA color of the particles (default: `0x00FF00FF`).
   574 
   574 
   575 === `IsHogHidden(gearUid)` (0.9.25) ===
   575 === `IsHogHidden(gearUid)` (0.9.25) ===
   576 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.
   576 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.
   577 
   577 
   578 === `HideHog(gearUid)` ===
   578 === `HideHog(gearUid)` ===
   579 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). You must not hide all hogs at once.
   579 Removes a hedgehog from the map. The hidden hedgehog can be restored with `RestoreHog(gearUid)`. Returns `true` on success and `false` on failure (if gear does not exist / hog is already hidden). You must not hide all hogs at once.
   580 
   580 
   581 Example: 
   581 Example: 
   582 
   582 
   583 <code language="lua">    local gear = AddHog(...)
   583 <code language="lua">    local gear = AddHog(...)
   584      HideHog(gear) -- Hide the newly created gear.</code>
   584      HideHog(gear) -- Hide the newly created gear.</code>
   590 
   590 
   591 <code language="lua">    local gear = AddHog(...)
   591 <code language="lua">    local gear = AddHog(...)
   592      HideHog(gear) -- Hide the newly created gear.
   592      HideHog(gear) -- Hide the newly created gear.
   593      RestoreHog(gear) -- Restore the newly hidden gear.</code>
   593      RestoreHog(gear) -- Restore the newly hidden gear.</code>
   594 
   594 
   595 === `IsHogLocal(gearUid)` (0.9.23) ===
   595 === `IsHogLocal(gearUid)` ===
   596 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.
   596 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.
   597 
   597 
   598 If the game has a mission team (see `AddMissionTeam`), this function behaves a little different: It only may return `true` for hogs in the same clan as the mission team and always returns `false` for hogs from other clans.
   598 If the game has a mission team (see `AddMissionTeam`), this function behaves a little different: It only may return `true` for hogs in the same clan as the mission team and always returns `false` for hogs from other clans.
   599 
   599 
   600 Returns `nil` if `gearUid` is invalid.
   600 Returns `nil` if `gearUid` is invalid.