LuaGameplay: Make it clear that AddAmmo can add or set ammo draft
authorWuzzy
Sun, 08 Sep 2019 21:55:45 +0100
changeset 1970 c85f6f3bb16c
parent 1969 93991afec8b1
child 1971 210ad26e9e94
LuaGameplay: Make it clear that AddAmmo can add or set ammo
LuaGameplay.wiki
--- a/LuaGameplay.wiki	Fri Aug 23 20:15:08 2019 +0300
+++ b/LuaGameplay.wiki	Sun Sep 08 21:55:45 2019 +0100
@@ -173,10 +173,14 @@
 -- Appends a text to the ammo tooltip of the bazooka but leaves name and main description intact
 SetAmmoTexts(amBazooka, "This weapon deals double the damage than usually.")</code>
 
-=== <tt>!AddAmmo(gearUid, ammoType, ammoCount)</tt> ===
-Adds `ammoType` to the specified gear. The amount added is determined by the arguments passed via `SetAmmo()` in the `onAmmoStoreInit()` [LuaEvents 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.
+=== <tt>!AddAmmo(gearUid, ammoType [, ammoCount])</tt> ===
+Adds or sets the amount of ammo to the specified hedgehog gear.
 
-Note: By default, ammo is per-team, so calling `AddAmmo` for a hedgehog will give the ammo for the whole team. The game flags `gfPerHogAmmo` and `gfSharedAmmo` change how ammo is managed in the game, so these game flags also affect `AddAmmo`.
+If `ammoCount` is `nil`, then X ammos of the type `ammoType` will be added to `gearUid`, where X is determined by the `numberInCrate` argument passed via `SetAmmo()` in the `onAmmoStoreInit()` [LuaEvents event handler]. Note that `numberInCrate` defaults to 0 if `SetAmmo()` was not called for the ammo type before.
+
+If `ammoCount` is a number, the ammo will *not* be added, but instead set to `ammoCount`. A value of `0` will remove the ammo, a value of `AMMO_INFINITE` will set it to infinite.
+
+Note: By default, ammo is per-team, so calling `AddAmmo` for a hedgehog will add/set the ammo for the whole team. The game flags `gfPerHogAmmo` and `gfSharedAmmo` change how ammo is managed in the game, so these game flags also affect `AddAmmo`.
 
 === <tt>!GetAmmoName(ammoType [, ignoreOverwrite ])</tt> (0.9.23) ===
 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`.