LuaAPI.wiki
changeset 912 ea13b02292c5
parent 911 eaafb853db57
child 913 33b5b51f54d6
equal deleted inserted replaced
911:eaafb853db57 912:ea13b02292c5
   739 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`.
   739 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`.
   740 
   740 
   741 === <tt>!SetGearFriction(gearUid, Friction) </tt> ===
   741 === <tt>!SetGearFriction(gearUid, Friction) </tt> ===
   742 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.
   742 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.
   743 
   743 
   744 === <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ===
       
   745 This updates the settings for a specified [AmmoTypes Ammo Type] as of count available for players, spawn probability, availability delay in turns, and the number available in crates. This is supposed to be used in the `onAmmoStoreInit()` event handler.
       
   746 
       
   747 Example:
       
   748 
       
   749 <code language="lua">    SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
       
   750     SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
       
   751 
       
   752 === <tt>!SetAmmoDelay(ammoType, delay)</tt> ===
       
   753 Changes the delay of a specified [AmmoTypes Ammo Type].
       
   754 
       
   755 === <tt>!AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) </tt> ===
       
   756 Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` event handler. In 0.9.16 ammo can be set directly via the optional third parameter, `ammoCount`. A value of 0 will remove the weapon, a value of 100 will give infinite ammo.
       
   757 
       
   758 *Note:* The effectiveness of this function may be limited due to problems with `gfPerHogAmmo` in Lua scripting.
       
   759 
       
   760 === <tt>!GetAmmoName(ammoType)</tt> (0.9.23) ===
       
   761 Returns the localized name for the specified `ammoType`.
       
   762 
       
   763 === <tt>!SetHealth(gearUid, health)</tt> ===
   744 === <tt>!SetHealth(gearUid, health)</tt> ===
   764 Sets the health of the specified gear. The “health” of a gear can refer to many things, depending on the gear type.
   745 Sets the health of the specified gear. The “health” of a gear can refer to many things, depending on the gear type.
   765 
   746 
   766 Use cases:
   747 Use cases:
   767 
   748 
   928 ==== <tt>!SetMaxBuildDistance(distInPx)</tt> (0.9.22) ====
   909 ==== <tt>!SetMaxBuildDistance(distInPx)</tt> (0.9.22) ====
   929 Sets the maximum building distance for of girders and rubber bands in pixels to `distInPx`. If `distInPx` is `0`, the limit is disabled. If called without arguments, the distance will be reset to the default value.
   910 Sets the maximum building distance for of girders and rubber bands in pixels to `distInPx`. If `distInPx` is `0`, the limit is disabled. If called without arguments, the distance will be reset to the default value.
   930 
   911 
   931 ==== <tt>!EndGame()</tt> ====
   912 ==== <tt>!EndGame()</tt> ====
   932 Makes the game end.
   913 Makes the game end.
       
   914 
       
   915 === Ammo ===
       
   916 ==== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ====
       
   917 This updates the settings for a specified [AmmoTypes Ammo Type] as of count available for players, spawn probability, availability delay in turns, and the number available in crates. This is supposed to be used in the `onAmmoStoreInit()` event handler.
       
   918 
       
   919 Example:
       
   920 
       
   921 <code language="lua">    SetAmmo(amShotgun, 9, 0, 0, 0) -- unlimited amount of shotgun ammo for players
       
   922     SetAmmo(amGrenade, 0, 0, 0, 3) -- crates should contain always three grenade</code>
       
   923 
       
   924 ==== <tt>!SetAmmoDelay(ammoType, delay)</tt> ====
       
   925 Changes the delay of a specified [AmmoTypes Ammo Type].
       
   926 
       
   927 ==== <tt>!AddAmmo(gearUid, ammoType, ammoCount) (0.9.16) </tt> ====
       
   928 Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` event handler. In 0.9.16 ammo can be set directly via the optional third parameter, `ammoCount`. A value of 0 will remove the weapon, a value of 100 will give infinite ammo.
       
   929 
       
   930 *Note:* The effectiveness of this function may be limited due to problems with `gfPerHogAmmo` in Lua scripting.
       
   931 
       
   932 ==== <tt>!GetAmmoName(ammoType)</tt> (0.9.23) ====
       
   933 Returns the localized name for the specified `ammoType`.
   933 
   934 
   934 === Map ===
   935 === Map ===
   935 ==== <tt>!MapHasBorder()</tt> ====
   936 ==== <tt>!MapHasBorder()</tt> ====
   936 Returns `true`/`false` if the map has a border or not.
   937 Returns `true`/`false` if the map has a border or not.
   937 
   938