Ammo quantity upgrade prototype
Not yet tested. Will crash until I also get rate_upgrade_opt up.
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user