We have items: STR_PISTOL (weapon), STR_PISTOL_CLIP (ammo item for our weapon, clip size is N - let it be 12 for example).
Possible situations:
1.
mapBlocks:
items:
STR_PISTOL:
- [1, 1, 1]
Result: there is 1 item in the tile - a pistol with no ammo loaded.
2.
mapBlocks:
items:
STR_PISTOL, {STR_PISTOL_CLIP}:
- [1, 1, 1]
Result: there is a pistol with ammo item loaded, ammo quantity is 12.
3.
mapBlocks:
items:
STR_PISTOL, {STR_PISTOL_CLIP, 9}:
- [1, 1, 1]
Result: there is a pistol with ammo item loaded, ammo quantity is 9.
4.
mapBlocks:
items:
STR_PISTOL, {STR_RIFLE_CLIP}:
- [1, 1, 1]
Result: there are 2 separate items in the tile - a pistol with no ammo loaded and a rifle clip. Because STR_RIFLE_CLIP is not compatible ammo for STR_PISTOL.
5.
mapBlocks:
items:
STR_PISTOL, {STR_RIFLE}, {STR_PISTOL_CLIP}:
- [1, 1, 1]
Result: there are 3 separate items in the tile - a pistol with no ammo loaded, a rifle with no ammo loaded and a pistol clip. Because STR_RIFLE is not compatible ammo for STR_PISTOL and STR_PISTOL_CLIP is defined as ammo item for ammo slot #2, but STR_PISTOL have only 1 ammo slot.
6. Now we have multiammo gun with 3 ammo slots.
mapBlocks:
items:
STR_MULTIAMMO_GUN, {STR_MULTIAMMO_GUN_CLIP_A}, {}, {STR_MULTIAMMO_GUN_CLIP_C, 3}:
- [1, 1, 1]
Result: there is a multiammo gun in the tile. It is loaded with STR_MULTIAMMO_GUN_CLIP_A in ammo slot #1, ammo quantity is default for this ammo item. Ammo slot #2 is empty. Ammo slot #3: there is STR_MULTIAMMO_GUN_CLIP_C loaded, ammo quantity is 3.
Ammo quantity cannot be negative or zero. When trying to set ammo quantity bigger than ammo item clipSize, it will return item clipSize.
This conception gonna be useful in situations when you
- find a treasure;
- exploring an old battlefield;
- trying to rob military stores;
- in any situation when you need a loaded weapon on your map.