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

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()

View File

@@ -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

View File

@@ -172,6 +172,7 @@
/obj/item/stock_parts/cell/crap/empty/Initialize()
. = ..()
charge = 0
update_icon()
/obj/item/stock_parts/cell/upgraded
name = "upgraded power cell"
@@ -195,6 +196,7 @@
/obj/item/stock_parts/cell/secborg/empty/Initialize()
. = ..()
charge = 0
update_icon()
/obj/item/stock_parts/cell/pulse //200 pulse shots
name = "pulse rifle power cell"
@@ -228,6 +230,7 @@
/obj/item/stock_parts/cell/high/empty/Initialize()
. = ..()
charge = 0
update_icon()
/obj/item/stock_parts/cell/super
name = "super-capacity power cell"
@@ -240,6 +243,7 @@
/obj/item/stock_parts/cell/super/empty/Initialize()
. = ..()
charge = 0
update_icon()
/obj/item/stock_parts/cell/hyper
name = "hyper-capacity power cell"
@@ -252,6 +256,7 @@
/obj/item/stock_parts/cell/hyper/empty/Initialize()
. = ..()
charge = 0
update_icon()
/obj/item/stock_parts/cell/bluespace
name = "bluespace power cell"
@@ -265,6 +270,7 @@
/obj/item/stock_parts/cell/bluespace/empty/Initialize()
. = ..()
charge = 0
update_icon()
/obj/item/stock_parts/cell/infinite
name = "infinite-capacity power cell!"
@@ -318,6 +324,7 @@
/obj/item/stock_parts/cell/emproof/empty/Initialize()
. = ..()
charge = 0
update_icon()
/obj/item/stock_parts/cell/emproof/emp_act(severity)
return

View File

@@ -419,3 +419,10 @@
id = "donksofttoyvendor"
build_path = /obj/item/circuitboard/machine/vending/donksofttoyvendor
category = list ("Misc. Machinery")
/datum/design/board/cell_charger
name = "Machine Design (Cell Charger Board)"
desc = "The circuit board for a cell charger."
id = "cell_charger"
build_path = /obj/item/circuitboard/machine/cell_charger
category = list ("Misc. Machinery")

View File

@@ -64,7 +64,7 @@
description = "A refresher course on modern engineering technology."
prereq_ids = list("base")
design_ids = list("solarcontrol", "recharger", "powermonitor", "rped", "pacman", "adv_capacitor", "adv_scanning", "emitter", "high_cell", "adv_matter_bin",
"atmosalerts", "atmos_control", "recycler", "autolathe", "high_micro_laser", "nano_mani", "weldingmask", "mesons", "thermomachine", "tesla_coil", "grounding_rod", "apc_control")
"atmosalerts", "atmos_control", "recycler", "autolathe", "high_micro_laser", "nano_mani", "weldingmask", "mesons", "thermomachine", "tesla_coil", "grounding_rod", "apc_control", "cell_charger")
research_cost = 2500
export_price = 5000