mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- added Get/SetAmmoCapacity ZScript functions
This commit is contained in:
parent
63bba40d7d
commit
519ecbe8eb
1 changed files with 40 additions and 0 deletions
|
@ -814,6 +814,46 @@ extend class Actor
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int GetAmmoCapacity(class<Ammo> type)
|
||||
{
|
||||
if (type != NULL)
|
||||
{
|
||||
let item = FindInventory(type);
|
||||
if (item != NULL)
|
||||
{
|
||||
return item.MaxAmount;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetDefaultByType(type).MaxAmount;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetAmmoCapacity(class<Ammo> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue