diff --git a/wadsrc/static/zscript/actors/inventory_util.zs b/wadsrc/static/zscript/actors/inventory_util.zs index 6b65b64205..e1820a86da 100644 --- a/wadsrc/static/zscript/actors/inventory_util.zs +++ b/wadsrc/static/zscript/actors/inventory_util.zs @@ -814,6 +814,46 @@ extend class Actor } } + + int GetAmmoCapacity(class type) + { + if (type != NULL) + { + let item = FindInventory(type); + if (item != NULL) + { + return item.MaxAmount; + } + else + { + return GetDefaultByType(type).MaxAmount; + } + } + return 0; + } + + void SetAmmoCapacity(class type, int amount) + { + if (type != NULL) + { + let item = FindInventory(type); + if (item != NULL) + { + item.MaxAmount = amount; + } + else + { + item = GiveInventoryType(type); + if (item != NULL) + { + item.MaxAmount = amount; + item.Amount = 0; + } + } + } + } + +