diff --git a/code/game/machinery/constructable_frame.dm b/code/game/machinery/constructable_frame.dm index 83aa5544d3e..667347e48e5 100644 --- a/code/game/machinery/constructable_frame.dm +++ b/code/game/machinery/constructable_frame.dm @@ -225,6 +225,18 @@ to destroy them and players will be able to make replacements. build_path = "/obj/machinery/power/port_gen/pacman/mrs" origin_tech = "programming=3;powerstorage=5;engineering=5" +/obj/item/weapon/circuitboard/pacman2 + name = "Circuit Board (PACMANII-type Generator)" + build_path = "/obj/machinery/power/port_gen/pacman2" + board_type = "machine" + origin_tech = "programming=3:powerstorage=4;plasmatech=3;engineering=3" + frame_desc = "Requires 1 Matter Bin, 1 Micro-Laser, 2 Pieces of Cable, and 1 Capacitor." + req_components = list( + "/obj/item/weapon/stock_parts/matter_bin" = 1, + "/obj/item/weapon/stock_parts/micro_laser" = 1, + "/obj/item/weapon/cable_coil" = 2, + "/obj/item/weapon/stock_parts/capacitor" = 1) + obj/item/weapon/circuitboard/rdserver name = "Circuit Board (R&D Server)" build_path = "/obj/machinery/r_n_d/server" diff --git a/code/modules/power/pacman2.dm b/code/modules/power/pacman2.dm new file mode 100644 index 00000000000..a648d794149 --- /dev/null +++ b/code/modules/power/pacman2.dm @@ -0,0 +1,175 @@ + +//Baseline portable generator. Has all the default handling. Not intended to be used on it's own (since it generates unlimited power). +/obj/machinery/power/port_gen/pacman2 + name = "Pacman II" + desc = "P.A.C.M.A.N. type II portable generator. Uses liquid plasma as a fuel source." + power_gen = 4500 + var + obj/item/weapon/tank/plasma/P = null + board_path = "/obj/item/weapon/circuitboard/pacman" + emagged = 0 + heat = 0 +/* + process() + if(P) + if(P.air_contents.toxins <= 0) + P.air_contents.toxins = 0 + eject() + else + P.air_contents.toxins -= 0.001 + return +*/ + + HasFuel() + if(P.air_contents.toxins >= 0.1) + return 1 + return 0 + + UseFuel() + P.air_contents.toxins -= 0.01 + return + + 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/weapon/cable_coil(src) + component_parts += new /obj/item/weapon/cable_coil(src) + component_parts += new /obj/item/weapon/stock_parts/capacitor(src) + component_parts += new board_path(src) + RefreshParts() + + RefreshParts() + var/temp_rating = 0 + var/temp_reliability = 0 + for(var/obj/item/weapon/stock_parts/SP in component_parts) + if(istype(SP, /obj/item/weapon/stock_parts/matter_bin)) + //max_coins = SP.rating * SP.rating * 1000 + else if(istype(SP, /obj/item/weapon/stock_parts/micro_laser) || istype(SP, /obj/item/weapon/stock_parts/capacitor)) + temp_rating += SP.rating + for(var/obj/item/weapon/CP in component_parts) + temp_reliability += CP.reliability + reliability = min(round(temp_reliability / 4), 100) + power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2)) + + examine() + ..() + usr << "\blue The generator has [P.air_contents.toxins] units of fuel left, producing [power_gen] per cycle." + if(crit_fail) usr << "\red The generator seems to have broken down." + + handleInactive() + heat -= 2 + if (heat < 0) + heat = 0 + else + for(var/mob/M in viewers(1, src)) + if (M.client && M.machine == src) + src.updateUsrDialog() + + proc + overheat() + explosion(src.loc, 2, 5, 2, -1) + + attackby(var/obj/item/O as obj, var/mob/user as mob) + if(istype(O, /obj/item/weapon/tank/plasma)) + if(P) + user << "\red The generator already has a plasma tank loaded!" + return + P = O + user.drop_item() + O.loc = src + user << "\blue You add the plasma tank to the generator." + else if (istype(O, /obj/item/weapon/card/emag)) + emagged = 1 + emp_act(1) + else if(!active) + if(istype(O, /obj/item/weapon/wrench)) + anchored = !anchored + playsound(src.loc, 'Deconstruct.ogg', 50, 1) + if(anchored) + user << "\blue You secure the generator to the floor." + else + user << "\blue You unsecure the generator from the floor." + makepowernets() + else if(istype(O, /obj/item/weapon/screwdriver)) + open = !open + playsound(src.loc, 'Screwdriver.ogg', 50, 1) + if(open) + user << "\blue You open the access panel." + else + user << "\blue You close the access panel." + else if(istype(O, /obj/item/weapon/crowbar) && !open) + var/obj/machinery/constructable_frame/machine_frame/new_frame = new /obj/machinery/constructable_frame/machine_frame(src.loc) + for(var/obj/item/I in component_parts) + if(I.reliability < 100) + I.crit_fail = 1 + I.loc = src.loc + new_frame.state = 2 + new_frame.icon_state = "box_1" + del(src) + + attack_hand(mob/user as mob) + ..() + if (!anchored) + return + + interact(user) + + attack_ai(mob/user as mob) + interact(user) + + attack_paw(mob/user as mob) + interact(user) + + proc + interact(mob/user) + if (get_dist(src, user) > 1 ) + if (!istype(user, /mob/living/silicon/ai)) + user.machine = null + user << browse(null, "window=port_gen") + return + + user.machine = src + + var/dat = text("[name]
") + if (active) + dat += text("Generator: On
") + else + dat += text("Generator: Off
") + if(P) + dat += text("Currently loaded plasma tank: [P.air_contents.toxins]
") + else + dat += text("No plasma tank currently loaded.
") + dat += text("Power output: - [power_gen * power_output] +
") + dat += text("Heat: [heat]
") + dat += "
Close" + user << browse("[dat]", "window=port_gen") + + Topic(href, href_list) + if(..()) + return + + src.add_fingerprint(usr) + if(href_list["action"]) + if(href_list["action"] == "enable") + if(!active && HasFuel() && !crit_fail) + active = 1 + icon_state = "portgen1" + src.updateUsrDialog() + if(href_list["action"] == "disable") + if (active) + active = 0 + icon_state = "portgen0" + src.updateUsrDialog() + if(href_list["action"] == "lower_power") + if (power_output > 1) + power_output-- + src.updateUsrDialog() + if (href_list["action"] == "higher_power") + if (power_output < 4 || emagged) + power_output++ + src.updateUsrDialog() + if (href_list["action"] == "close") + usr << browse(null, "window=port_gen") + usr.machine = null diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 6774671f16c..68916a4921c 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -102,7 +102,7 @@ display round(lastgen) and plasmatank amount coins = 0 max_coins = 1000 coin_path = "/obj/item/weapon/coin/plasma" - board_path = "/obj/item/weapon/circuitboard/pacman" + board_path = "/obj/item/weapon/circuitboard/pacman2" coin_left = 0 // How much is left of the coin time_per_coin = 1 emagged = 0 @@ -327,4 +327,5 @@ display round(lastgen) and plasmatank amount time_per_coin = 60 board_path = "/obj/item/weapon/circuitboard/pacman/mrs" overheat() - explosion(src.loc, 4, 4, 4, -1) \ No newline at end of file + explosion(src.loc, 4, 4, 4, -1) +