look at me. *look at me.* I'm the gun_base now

This commit is contained in:
Kistaro Windrider 2025-06-01 17:41:07 -07:00
parent 9be828dd5c
commit c514c61b3a
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -730,6 +730,27 @@ gun_base = mknew{
-- cooldown reduction from
-- upgrades, not yet applied
cd_remainder = 0,
veloc = 1,
aim = 0.75, -- down; 0.25, or -0.75, is up
shot_idx = 0,
-- shots: list<list<[3]num>>
-- describing a cycling
-- firing pattern. shot_idx
-- tracks offset into pattern.
-- each nested list: a burst
-- of shots to fire; takes
-- 1 ammo; sequential
-- each shot: angle (turns,
-- relative to `aim`),
-- firing x-offset, velocity;
-- if x-offset is nil, use 0;
-- if velocity is nil, use
-- self.veloc instead
init = function(self)
if (not self.shots) self.shots = {{{0}}}
end
}
-- gun_base subtypes are
@ -754,12 +775,6 @@ function gun_base:peel()
self.munition = mknew(self.munition.new())
end
-- default firing behavior:
-- single shot
function gun_base:actually_shoot(x, y)
self.munition.new{}:spawn_at(x, y)
end
-- upgrade
function gun_base:small_upgrade_opts()
local ret = {
@ -874,29 +889,7 @@ function gun_base:shoot(x, y)
return true
end
trig_gun = mknew(gun_base.new{
veloc = 1,
aim = 0.75, -- down; 0.25, or -0.75, is up
shot_idx = 0,
-- shots: list<list<[3]num>>
-- describing a cycling
-- firing pattern. shot_idx
-- tracks offset into pattern.
-- each nested list: a burst
-- of shots to fire; takes
-- 1 ammo; sequential
-- each shot: angle (turns,
-- relative to `aim`),
-- firing x-offset, velocity;
-- if x-offset is nil, use 0;
-- if velocity is nil, use
-- self.veloc instead
init = function(self)
if (not self.shots) self.shots = {{{0}}}
end
})
function trig_gun:actually_shoot(x, y)
function gun_base:actually_shoot(x, y)
local shots,veloc,aim,munition = self.shots,self.veloc,self.aim,self.munition
local idx = self.shot_idx % #shots + 1
self.shot_idx = idx
@ -955,7 +948,7 @@ zap_p = mknew(zap_e.new{
category = player_blt_cat,
})
zap_gun_e = mknew(trig_gun.new{
zap_gun_e = mknew(gun_base.new{
cooldown = 0x0.0020, -- frames between shots
veloc = 4,
munition = zap_e,
@ -1019,7 +1012,7 @@ blast = mknew(bullet_base.new{
category=player_blt_cat
})
blast_gun = mknew(trig_gun.new{
blast_gun = mknew(gun_base.new{
icon = 13,
cooldown = 0x0.0078, -- 120 frames between shots
aim = -0.75,
@ -1065,7 +1058,7 @@ protron_p = mknew(protron_e.new{
category=player_blt_cat,
})
protron_gun_e = mknew(trig_gun.new{
protron_gun_e = mknew(gun_base.new{
icon = 25,
cooldown = 0x0.0040, -- frames between shots
ammo = nil,
@ -1118,7 +1111,7 @@ vulcan_p = mknew(vulcan_e.new{
category=player_blt_cat
})
vulcan_gun_e = mknew(trig_gun.new{
vulcan_gun_e = mknew(gun_base.new{
icon = 37,
cooldown = 0x0.0003, -- frames between shots
ammo = nil,