Update upgradable machinery New code

This commit is contained in:
Markolie
2015-07-30 22:19:32 +02:00
parent d349beec3c
commit f939800c68
22 changed files with 317 additions and 173 deletions
+17 -6
View File
@@ -33,13 +33,24 @@
New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/micro_laser(src)
component_parts += new /obj/item/stack/cable_coil(src)
component_parts += new /obj/item/stack/cable_coil(src)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new board_path(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
component_parts += new /obj/item/stack/cable_coil(null)
component_parts += new /obj/item/stack/cable_coil(null)
component_parts += new /obj/item/weapon/stock_parts/capacitor(null)
component_parts += new board_path(null)
RefreshParts()
/obj/machinery/power/port_gen/pacman2/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/weapon/stock_parts/micro_laser/ultra(null)
component_parts += new /obj/item/stack/cable_coil(null)
component_parts += new /obj/item/stack/cable_coil(null)
component_parts += new /obj/item/weapon/stock_parts/capacitor/super(null)
component_parts += new board_path(null)
RefreshParts()
RefreshParts()
var/temp_rating = 0
+17 -6
View File
@@ -116,12 +116,23 @@
/obj/machinery/power/port_gen/pacman/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
component_parts += new /obj/item/weapon/stock_parts/micro_laser(src)
component_parts += new /obj/item/stack/cable_coil(src, 1)
component_parts += new /obj/item/stack/cable_coil(src, 1)
component_parts += new /obj/item/weapon/stock_parts/capacitor(src)
component_parts += new board_path(src)
component_parts += new /obj/item/weapon/stock_parts/matter_bin(null)
component_parts += new /obj/item/weapon/stock_parts/micro_laser(null)
component_parts += new /obj/item/stack/cable_coil(null, 1)
component_parts += new /obj/item/stack/cable_coil(null, 1)
component_parts += new /obj/item/weapon/stock_parts/capacitor(null)
component_parts += new board_path(null)
RefreshParts()
/obj/machinery/power/port_gen/pacman/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/weapon/stock_parts/micro_laser/ultra(null)
component_parts += new /obj/item/stack/cable_coil(null, 1)
component_parts += new /obj/item/stack/cable_coil(null, 1)
component_parts += new /obj/item/weapon/stock_parts/capacitor/super(null)
component_parts += new board_path(null)
RefreshParts()
/obj/machinery/power/port_gen/pacman/Destroy()
+29 -12
View File
@@ -42,6 +42,35 @@
component_parts += new /obj/item/weapon/stock_parts/capacitor(null)
component_parts += new /obj/item/stack/cable_coil(null, 5)
RefreshParts()
setup()
return
/obj/machinery/power/smes/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/smes(null)
component_parts += new /obj/item/weapon/stock_parts/cell/hyper(null)
component_parts += new /obj/item/weapon/stock_parts/cell/hyper(null)
component_parts += new /obj/item/weapon/stock_parts/cell/hyper(null)
component_parts += new /obj/item/weapon/stock_parts/cell/hyper(null)
component_parts += new /obj/item/weapon/stock_parts/cell/hyper(null)
component_parts += new /obj/item/weapon/stock_parts/capacitor/super(null)
component_parts += new /obj/item/stack/cable_coil(null, 5)
RefreshParts()
return
/obj/machinery/power/smes/RefreshParts()
var/IO = 0
var/C = 0
for(var/obj/item/weapon/stock_parts/capacitor/CP in component_parts)
IO += CP.rating
input_level_max = 200000 * IO
output_level_max = 200000 * IO
for(var/obj/item/weapon/stock_parts/cell/PC in component_parts)
C += PC.maxcharge
capacity = C / (15000) * 1e6
/obj/machinery/power/smes/proc/setup()
spawn(5)
if(!powernet)
connect_to_network()
@@ -60,18 +89,6 @@
if(!terminal.powernet)
terminal.connect_to_network()
updateicon()
return
/obj/machinery/power/smes/RefreshParts()
var/IO = 0
var/C = 0
for(var/obj/item/weapon/stock_parts/capacitor/CP in component_parts)
IO += CP.rating
input_level_max = 200000 * IO
output_level_max = 200000 * IO
for(var/obj/item/weapon/stock_parts/cell/PC in component_parts)
C += PC.maxcharge
capacity = C / (15000) * 1e6
/obj/machinery/power/smes/proc/updateicon()
overlays.Cut()