Recharger refactor

This commit is contained in:
Atermonera
2018-06-16 14:15:15 -07:00
committed by VirgoBot
parent dfcdcc9630
commit fe94038e7a
12 changed files with 68 additions and 122 deletions

View File

@@ -23,17 +23,6 @@
var/battery_lock = 0 //If set, weapon cannot switch batteries
/obj/item/weapon/gun/energy/attackby(var/obj/item/A as obj, mob/user as mob)
..()
/obj/item/weapon/gun/energy/switch_firemodes(mob/user)
if(..())
update_icon()
/obj/item/weapon/gun/energy/emp_act(severity)
..()
update_icon()
/obj/item/weapon/gun/energy/New()
..()
if(self_recharge)
@@ -52,6 +41,9 @@
processing_objects.Remove(src)
return ..()
/obj/item/weapon/gun/energy/get_cell()
return power_supply
/obj/item/weapon/gun/energy/process()
if(self_recharge) //Every [recharge_time] ticks, recharge a shot for the battery
if(world.time > last_shot + charge_delay) //Doesn't work if you've fired recently
@@ -75,6 +67,17 @@
charge_tick = 0
return 1
/obj/item/weapon/gun/energy/attackby(var/obj/item/A as obj, mob/user as mob)
..()
/obj/item/weapon/gun/energy/switch_firemodes(mob/user)
if(..())
update_icon()
/obj/item/weapon/gun/energy/emp_act(severity)
..()
update_icon()
/obj/item/weapon/gun/energy/consume_next_projectile()
if(!power_supply) return null
if(!ispath(projectile_type)) return null

View File

@@ -36,6 +36,9 @@
qdel_null(capacitor)
. = ..()
/obj/item/weapon/gun/magnetic/get_cell()
return cell
/obj/item/weapon/gun/magnetic/process()
if(capacitor)
if(cell)