mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-16 17:44:25 +01:00
Recharger refactor
This commit is contained in:
@@ -19,6 +19,9 @@
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/device/electronic_assembly/get_cell()
|
||||
return battery
|
||||
|
||||
/obj/item/device/assembly/electronic_assembly/proc/toggle_open(mob/user)
|
||||
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
|
||||
opened = !opened
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
processing_objects -= src
|
||||
return ..()
|
||||
|
||||
/obj/item/weapon/cell/get_cell()
|
||||
return src
|
||||
|
||||
/obj/item/weapon/cell/process()
|
||||
if(self_recharge)
|
||||
if(world.time >= last_use + charge_delay)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
var/obj/item/weapon/cell/device/cell
|
||||
var/enabled = 0
|
||||
|
||||
/obj/item/weapon/shield_diffuser/update_icon()
|
||||
if(enabled)
|
||||
icon_state = "hdiffuser_on"
|
||||
else
|
||||
icon_state = "hdiffuser_off"
|
||||
|
||||
/obj/item/weapon/shield_diffuser/New()
|
||||
cell = new(src)
|
||||
@@ -24,6 +19,9 @@
|
||||
processing_objects.Remove(src)
|
||||
. = ..()
|
||||
|
||||
/obj/item/weapon/shield_diffuser/get_cell()
|
||||
return cell
|
||||
|
||||
/obj/item/weapon/shield_diffuser/process()
|
||||
if(!enabled)
|
||||
return
|
||||
@@ -34,6 +32,12 @@
|
||||
if(istype(S) && cell.checked_use(10 KILOWATTS * CELLRATE))
|
||||
qdel(S)
|
||||
|
||||
/obj/item/weapon/shield_diffuser/update_icon()
|
||||
if(enabled)
|
||||
icon_state = "hdiffuser_on"
|
||||
else
|
||||
icon_state = "hdiffuser_off"
|
||||
|
||||
/obj/item/weapon/shield_diffuser/attack_self()
|
||||
enabled = !enabled
|
||||
update_icon()
|
||||
|
||||
Reference in New Issue
Block a user