fix starting ammo

This commit is contained in:
Kistaro Windrider 2025-01-26 12:45:43 -08:00
parent a90caeba85
commit 44c70a028f
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -688,6 +688,8 @@ gun_base = mknew{
-- as an action, assign
-- themselves to the player
function gun_base:action()
local item = self.new()
item.ammo = item.maxammo
if not primary_ship.special_guns then
primary_ship.special_guns = {self.new()}
else
@ -1843,8 +1845,8 @@ function rearm_mode:update()
-- todo: rewrite for three guns
local specs = primary_ship.special_guns
if specs then
specs[1].ammo = specs[1].max_ammo
if (specs[2]) specs[2].ammo = specs[2].max_ammo
specs[1].ammo = specs[1].maxammo
if (specs[2]) specs[2].ammo = specs[2].maxammo
end
primary_ship.hp = min(primary_ship.maxhp, primary_ship.hp + primary_ship.maxhp/2)
primary_ship.xp -= primary_ship.xptarget / 2