From 7ed305d2d9ec6a22481d935d4bb120047f8d8385 Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sat, 3 May 2025 16:06:16 -0700 Subject: [PATCH] Ammo quantity upgrade prototype Not yet tested. Will crash until I also get rate_upgrade_opt up. --- vacuum_gambit.p8 | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/vacuum_gambit.p8 b/vacuum_gambit.p8 index 23d08ed..7b02fc5 100644 --- a/vacuum_gambit.p8 +++ b/vacuum_gambit.p8 @@ -676,7 +676,8 @@ bullet_base = mknew{ } gun_base = mknew{ shoot_ready = -32768, - icon = 20 + icon = 20, + ammobonus = 1, } -- gun_base subtypes are @@ -707,6 +708,38 @@ function gun_base:actually_shoot(x, y) self.munition.new{}:spawn_at(x, y) end +-- upgrade +function gun_base:small_upgrade_opts() + local ret = { + self:ammo_upgrade_opt(), + self:rate_upgrade_opt(), + } + local s = self.special_upgrade_opt + if (s) add(ret, s(self)) + return ret +end + +function gun_base:ammo_upgrade_opt() + local a=self.maxammo + local x=a\10+self.ammobonus + return { + icon=self.icon, + hdr=self.hdr, + body=[[----------AMMO + + more shots. + + is: ]]..tostr(a)..[[ + add: ]]..tostr(x)..[[ +---------- +total: ]]..tostr(a+x), + action=function() + self.maxammo+=x + self.ammo+=x + end, + } +end + function bullet_base:hitship(_) self:die() return true