look at me. *look at me.* I'm the gun_base now
This commit is contained in:
parent
9be828dd5c
commit
c514c61b3a
@ -730,6 +730,27 @@ gun_base = mknew{
|
|||||||
-- cooldown reduction from
|
-- cooldown reduction from
|
||||||
-- upgrades, not yet applied
|
-- upgrades, not yet applied
|
||||||
cd_remainder = 0,
|
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
|
-- gun_base subtypes are
|
||||||
@ -754,12 +775,6 @@ function gun_base:peel()
|
|||||||
self.munition = mknew(self.munition.new())
|
self.munition = mknew(self.munition.new())
|
||||||
end
|
end
|
||||||
|
|
||||||
-- default firing behavior:
|
|
||||||
-- single shot
|
|
||||||
function gun_base:actually_shoot(x, y)
|
|
||||||
self.munition.new{}:spawn_at(x, y)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- upgrade
|
-- upgrade
|
||||||
function gun_base:small_upgrade_opts()
|
function gun_base:small_upgrade_opts()
|
||||||
local ret = {
|
local ret = {
|
||||||
@ -874,29 +889,7 @@ function gun_base:shoot(x, y)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
trig_gun = mknew(gun_base.new{
|
function gun_base:actually_shoot(x, y)
|
||||||
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)
|
|
||||||
local shots,veloc,aim,munition = self.shots,self.veloc,self.aim,self.munition
|
local shots,veloc,aim,munition = self.shots,self.veloc,self.aim,self.munition
|
||||||
local idx = self.shot_idx % #shots + 1
|
local idx = self.shot_idx % #shots + 1
|
||||||
self.shot_idx = idx
|
self.shot_idx = idx
|
||||||
@ -955,7 +948,7 @@ zap_p = mknew(zap_e.new{
|
|||||||
category = player_blt_cat,
|
category = player_blt_cat,
|
||||||
})
|
})
|
||||||
|
|
||||||
zap_gun_e = mknew(trig_gun.new{
|
zap_gun_e = mknew(gun_base.new{
|
||||||
cooldown = 0x0.0020, -- frames between shots
|
cooldown = 0x0.0020, -- frames between shots
|
||||||
veloc = 4,
|
veloc = 4,
|
||||||
munition = zap_e,
|
munition = zap_e,
|
||||||
@ -1019,7 +1012,7 @@ blast = mknew(bullet_base.new{
|
|||||||
category=player_blt_cat
|
category=player_blt_cat
|
||||||
})
|
})
|
||||||
|
|
||||||
blast_gun = mknew(trig_gun.new{
|
blast_gun = mknew(gun_base.new{
|
||||||
icon = 13,
|
icon = 13,
|
||||||
cooldown = 0x0.0078, -- 120 frames between shots
|
cooldown = 0x0.0078, -- 120 frames between shots
|
||||||
aim = -0.75,
|
aim = -0.75,
|
||||||
@ -1065,7 +1058,7 @@ protron_p = mknew(protron_e.new{
|
|||||||
category=player_blt_cat,
|
category=player_blt_cat,
|
||||||
})
|
})
|
||||||
|
|
||||||
protron_gun_e = mknew(trig_gun.new{
|
protron_gun_e = mknew(gun_base.new{
|
||||||
icon = 25,
|
icon = 25,
|
||||||
cooldown = 0x0.0040, -- frames between shots
|
cooldown = 0x0.0040, -- frames between shots
|
||||||
ammo = nil,
|
ammo = nil,
|
||||||
@ -1118,7 +1111,7 @@ vulcan_p = mknew(vulcan_e.new{
|
|||||||
category=player_blt_cat
|
category=player_blt_cat
|
||||||
})
|
})
|
||||||
|
|
||||||
vulcan_gun_e = mknew(trig_gun.new{
|
vulcan_gun_e = mknew(gun_base.new{
|
||||||
icon = 37,
|
icon = 37,
|
||||||
cooldown = 0x0.0003, -- frames between shots
|
cooldown = 0x0.0003, -- frames between shots
|
||||||
ammo = nil,
|
ammo = nil,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user