Cell chargers are now buildable and (upgradable!) machines.

This commit is contained in:
Dax Dupont
2018-02-12 18:15:18 +01:00
committed by CitadelStationBot
parent b6d5173420
commit a0feb17597
5 changed files with 47 additions and 8 deletions
+27 -7
View File
@@ -8,8 +8,10 @@
idle_power_usage = 5
active_power_usage = 60
power_channel = EQUIP
circuit = /obj/item/circuitboard/machine/cell_charger
var/obj/item/stock_parts/cell/charging = null
var/chargelevel = -1
var/charge_rate = 500
/obj/machinery/cell_charger/proc/updateicon()
cut_overlays()
@@ -28,7 +30,7 @@
to_chat(user, "Current charge: [round(charging.percent(), 1)]%.")
/obj/machinery/cell_charger/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stock_parts/cell))
if(istype(W, /obj/item/stock_parts/cell) && !panel_open)
if(stat & BROKEN)
to_chat(user, "<span class='warning'>[src] is broken!</span>")
return
@@ -52,17 +54,31 @@
user.visible_message("[user] inserts a cell into [src].", "<span class='notice'>You insert a cell into [src].</span>")
chargelevel = -1
updateicon()
else if(istype(W, /obj/item/wrench))
if(charging)
to_chat(user, "<span class='warning'>Remove the cell first!</span>")
else
if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W))
return
if(default_deconstruction_crowbar(W))
return
if(!charging && default_unfasten_wrench(user, W))
return
<<<<<<< HEAD
anchored = !anchored
to_chat(user, "<span class='notice'>You [anchored ? "attach" : "detach"] [src] [anchored ? "to" : "from"] the ground</span>")
playsound(src.loc, W.usesound, 75, 1)
else
=======
>>>>>>> 0b718fa... Cell chargers are now buildable and (upgradable!) machines. (#35517)
return ..()
/obj/machinery/cell_charger/deconstruct()
if(charging)
charging.forceMove(drop_location())
return ..()
/obj/machinery/cell_charger/Destroy()
QDEL_NULL(charging)
return ..()
/obj/machinery/cell_charger/proc/removecell()
charging.update_icon()
@@ -102,6 +118,10 @@
..(severity)
/obj/machinery/cell_charger/RefreshParts()
charge_rate = 500
for(var/obj/item/stock_parts/capacitor/C in component_parts)
charge_rate *= C.rating
/obj/machinery/cell_charger/process()
if(!charging || !anchored || (stat & (BROKEN|NOPOWER)))
@@ -109,8 +129,8 @@
if(charging.percent() >= 100)
return
use_power(200) //this used to use CELLRATE, but CELLRATE is fucking awful. feel free to fix this properly!
charging.give(175) //inefficiency.
use_power(charge_rate)
charging.give(charge_rate) //this is 2558, efficient batteries exist
updateicon()
@@ -85,6 +85,11 @@
build_path = /obj/machinery/recharger
req_components = list(/obj/item/stock_parts/capacitor = 1)
/obj/item/circuitboard/machine/cell_charger
name = "Cell Charger (Machine Board)"
build_path = /obj/machinery/cell_charger
req_components = list(/obj/item/stock_parts/capacitor = 1)
/obj/item/circuitboard/machine/cyborgrecharger
name = "Cyborg Recharger (Machine Board)"
build_path = /obj/machinery/recharge_station