From 375d02bca4c452eb8734a10d536668ee8fa7bfd2 Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Tue, 9 Aug 2016 15:24:49 +1000 Subject: [PATCH 1/9] First commit. Deployment works. Deconstruction has problems. --- code/game/objects/items/stacks/sheets/sheet_types.dm | 3 ++- code/game/turfs/simulated/floor.dm | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 0b99edde497..763ea7bdf93 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -112,7 +112,8 @@ var/global/list/datum/stack_recipe/plasteel_recipes = list( new /datum/stack_recipe("AI core", /obj/structure/AIcore, 4, time = 50, one_per_turf = 1), new /datum/stack_recipe("Surgery Table", /obj/machinery/optable, 5, time = 50, one_per_turf = 1, on_floor = 1), new /datum/stack_recipe("Metal crate", /obj/structure/closet/crate, 10, time = 50, one_per_turf = 1), - new /datum/stack_recipe("Mass Driver frame", /obj/machinery/mass_driver_frame, 3, time = 50, one_per_turf = 1) + new /datum/stack_recipe("Mass Driver frame", /obj/machinery/mass_driver_frame, 3, time = 50, one_per_turf = 1), + new /datum/stack_recipe("Mech Recharge Bay", /turf/simulated/floor/mech_bay_recharge_floor, 2, time = 50, one_per_turf = 1), ) /obj/item/stack/sheet/plasteel diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index b8a6635225a..a3ca17f7287 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -146,6 +146,8 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," else if(istype(src, /turf/simulated/floor/wood)) to_chat(user, "You forcefully pry off the planks, destroying them in the process.") + else if(istype(src, /turf/simulated/floor/mech_bay_recharge_floor)) + to_chat(user, "You hack apart the mech bay recharge station, destroying it in the process.") //there is probably a better way to do this, but I don't know it. else if(!builtin_tile) to_chat(user, "You are unable to pry up \the [src] with a crowbar.") return 1 From f9a91eba5527ad9a3adfd6ad457330a9376994b5 Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Thu, 11 Aug 2016 12:03:50 +1000 Subject: [PATCH 2/9] Added the attackby proc to mech_bay.dm instead of an else in floor.dm --- code/game/mecha/mech_bay.dm | 16 ++++++++++++++++ code/game/turfs/simulated/floor.dm | 2 -- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 46c92271308..eb00f7d5eba 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -22,6 +22,22 @@ recharging_mecha = null return ..() + +/turf/simulated/floor/mech_bay_recharge_floor/attackby(obj/item/C as obj, mob/user as mob, params) + if(!C || !user) // I don't know what these do, they're leftovers from floor.dm + return 1 + if(..()) // Ditto + return 1 + if(intact && istype(C, /obj/item/weapon/screwdriver)) //Can't be a crowbar, because otherwise the attackby() for floor.dm intercepts the call + to_chat(user, "You disassemble the mech bay recharge station.") + Destroy() //calls the proc above that stops the machine from working + make_plating() //turns the floor back into uncovered plates + //how to get back the plasteel? + playsound(src, 'sound/items/Crowbar.ogg', 80, 1) + return 1 + return 0 + + /turf/simulated/floor/mech_bay_recharge_floor/Entered(var/obj/mecha/mecha, atom/OL, ignoreRest = 0) . = ..() if(istype(mecha)) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index a3ca17f7287..b8a6635225a 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -146,8 +146,6 @@ var/list/icons_to_ignore_at_floor_init = list("damaged1","damaged2","damaged3"," else if(istype(src, /turf/simulated/floor/wood)) to_chat(user, "You forcefully pry off the planks, destroying them in the process.") - else if(istype(src, /turf/simulated/floor/mech_bay_recharge_floor)) - to_chat(user, "You hack apart the mech bay recharge station, destroying it in the process.") //there is probably a better way to do this, but I don't know it. else if(!builtin_tile) to_chat(user, "You are unable to pry up \the [src] with a crowbar.") return 1 From ae17b3861d62833785fa3fa71ee0a7f4c2d77141 Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Thu, 11 Aug 2016 14:16:05 +1000 Subject: [PATCH 3/9] Fixes where the dropped metal appears and use qdel instead of destroy --- code/game/mecha/mech_bay.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index eb00f7d5eba..5d947fde38e 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -12,6 +12,9 @@ nitrogen = 0.01 temperature = TCMB + +///turf/simulated/floor/mech_bay_recharge_floor/BeforeChange() //I'm told this is a better thing to call this request by. Undefinied proc error though. + /turf/simulated/floor/mech_bay_recharge_floor/Destroy() if(recharge_console && recharge_console.recharge_floor == src) recharge_console.recharge_floor = null @@ -28,11 +31,11 @@ return 1 if(..()) // Ditto return 1 - if(intact && istype(C, /obj/item/weapon/screwdriver)) //Can't be a crowbar, because otherwise the attackby() for floor.dm intercepts the call + if(intact && istype(C, /obj/item/weapon/screwdriver)) //Can't be a crowbar, because otherwise the attackby() for floor.dm intercepts the call, I think to_chat(user, "You disassemble the mech bay recharge station.") - Destroy() //calls the proc above that stops the machine from working + new /obj/item/stack/sheet/plasteel(src, 2) + qdel() //calls the proc above that stops the machine from working - Not required with BeforeChange, but that isn't working. make_plating() //turns the floor back into uncovered plates - //how to get back the plasteel? playsound(src, 'sound/items/Crowbar.ogg', 80, 1) return 1 return 0 From b4ce7576131cbb900154bbc5106e25fcab1eca9f Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Fri, 12 Aug 2016 15:09:32 +1000 Subject: [PATCH 4/9] Ported TG's mechbay. Functional. Still can't make/break mechbay floors. No nanoUI yet. Unsure what the effects of commenting that line in admin.dm is. --- code/game/mecha/mech_bay.dm | 277 +++++++++--------------------------- code/modules/admin/admin.dm | 4 +- 2 files changed, 66 insertions(+), 215 deletions(-) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index 5d947fde38e..b4f6748bde8 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -2,9 +2,6 @@ name = "Mech Bay Recharge Station" icon = 'icons/mecha/mech_bay.dmi' icon_state = "recharge_floor" - var/obj/machinery/mech_bay_recharge_port/recharge_port - var/obj/machinery/computer/mech_bay_power_console/recharge_console - var/obj/mecha/recharging_mecha = null /turf/simulated/floor/mech_bay_recharge_floor/airless icon_state = "recharge_floor_asteroid" @@ -12,82 +9,6 @@ nitrogen = 0.01 temperature = TCMB - -///turf/simulated/floor/mech_bay_recharge_floor/BeforeChange() //I'm told this is a better thing to call this request by. Undefinied proc error though. - -/turf/simulated/floor/mech_bay_recharge_floor/Destroy() - if(recharge_console && recharge_console.recharge_floor == src) - recharge_console.recharge_floor = null - recharge_console = null - if(recharge_port && recharge_port.recharge_floor == src) - recharge_port.recharge_floor = null - recharge_port = null - recharging_mecha = null - return ..() - - -/turf/simulated/floor/mech_bay_recharge_floor/attackby(obj/item/C as obj, mob/user as mob, params) - if(!C || !user) // I don't know what these do, they're leftovers from floor.dm - return 1 - if(..()) // Ditto - return 1 - if(intact && istype(C, /obj/item/weapon/screwdriver)) //Can't be a crowbar, because otherwise the attackby() for floor.dm intercepts the call, I think - to_chat(user, "You disassemble the mech bay recharge station.") - new /obj/item/stack/sheet/plasteel(src, 2) - qdel() //calls the proc above that stops the machine from working - Not required with BeforeChange, but that isn't working. - make_plating() //turns the floor back into uncovered plates - playsound(src, 'sound/items/Crowbar.ogg', 80, 1) - return 1 - return 0 - - -/turf/simulated/floor/mech_bay_recharge_floor/Entered(var/obj/mecha/mecha, atom/OL, ignoreRest = 0) - . = ..() - if(istype(mecha)) - mecha.occupant_message("Initializing power control devices.") - init_devices() - if(recharge_console && recharge_port) - recharging_mecha = mecha - recharge_console.mecha_in(mecha) - return - else if(!recharge_console) - mecha.occupant_message("Control console not found. Terminating.") - else if(!recharge_port) - mecha.occupant_message("Power port not found. Terminating.") - return - -/turf/simulated/floor/mech_bay_recharge_floor/Exited(atom) - . = ..() - if(atom == recharging_mecha) - recharging_mecha = null - if(recharge_console) - recharge_console.mecha_out() - return - -/turf/simulated/floor/mech_bay_recharge_floor/proc/init_devices() - if(!recharge_console) - recharge_console = locate() in range(1,src) - if(!recharge_port) - recharge_port = locate() in get_step(src, WEST) - - if(recharge_console) - recharge_console.recharge_floor = src - if(recharge_port) - recharge_console.recharge_port = recharge_port - if(recharge_port) - recharge_port.recharge_floor = src - if(recharge_console) - recharge_port.recharge_console = recharge_console - return - -/* // temporary fix for broken icon until somebody gets around to make these player-buildable -/turf/simulated/floor/mech_bay_recharge_floor/attackby(obj/item/C as obj, mob/user as mob) - ..() - if(floor_type) - icon_state = "recharge_floor" - else - icon_state = "support_lattice" */ - /obj/machinery/mech_bay_recharge_port name = "Mech Bay Power Port" density = 1 @@ -95,9 +16,12 @@ dir = EAST icon = 'icons/mecha/mech_bay.dmi' icon_state = "recharge_port" - var/turf/simulated/floor/mech_bay_recharge_floor/recharge_floor + var/obj/mecha/recharging_mecha var/obj/machinery/computer/mech_bay_power_console/recharge_console - var/datum/global_iterator/mech_bay_recharger/pr_recharger + var/max_charge = 50 + var/on = 0 + var/repairability = 0 //What's this? I don't think this is a thing on paradise + var/turf/recharging_turf = null /obj/machinery/mech_bay_recharge_port/New() ..() @@ -110,8 +34,7 @@ component_parts += new /obj/item/weapon/stock_parts/capacitor(null) component_parts += new /obj/item/stack/cable_coil(null, 1) RefreshParts() - - pr_recharger = new /datum/global_iterator/mech_bay_recharger(null,0) + recharging_turf = get_step(loc, dir) // this is new. It picks the turf based on the direction the recharger is facing by the looks of it. Still needs to be a recharge_floor /obj/machinery/mech_bay_recharge_port/upgraded/New() ..() @@ -129,17 +52,7 @@ var/MC for(var/obj/item/weapon/stock_parts/capacitor/C in component_parts) MC += C.rating - if(pr_recharger) - pr_recharger.max_charge = MC * 10 - if(recharge_console) - recharge_console.voltage = MC * 10 - -/obj/machinery/mech_bay_recharge_port/Destroy() - qdel(pr_recharger) - pr_recharger = null - recharge_console.recharge_port = null - recharge_floor.recharge_port = null - return ..() + max_charge = MC * 25 /obj/machinery/mech_bay_recharge_port/attackby(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "recharge_port-o", "recharge_port", I)) @@ -151,70 +64,49 @@ if(exchange_parts(user, I)) return - default_deconstruction_crowbar(I) + if(default_deconstruction_crowbar(I)) + return + return ..() -/obj/machinery/mech_bay_recharge_port/proc/start_charge(var/obj/mecha/recharging_mecha) - if(stat&(NOPOWER|BROKEN)) - recharging_mecha.occupant_message("Power port not responding. Terminating.") - return 0 - else - if(recharging_mecha.cell) - recharging_mecha.occupant_message("Now charging...") - pr_recharger.start(list(src,recharging_mecha)) - return 1 + +/obj/machinery/mech_bay_recharge_port/process() + if(stat & NOPOWER || !recharge_console) + return + if(!recharging_mecha) + recharging_mecha = locate(/obj/mecha) in recharging_turf + if(recharging_mecha) + recharge_console.update_icon() + if(recharging_mecha && recharging_mecha.cell) + if(recharging_mecha.cell.charge < recharging_mecha.cell.maxcharge) + var/delta = min(max_charge, recharging_mecha.cell.maxcharge - recharging_mecha.cell.charge) + recharging_mecha.give_power(delta) + use_power(delta*150) else - return 0 - -/obj/machinery/mech_bay_recharge_port/proc/stop_charge() - if(recharge_console && !recharge_console.stat) - update_icon() - pr_recharger.stop() - return - -/obj/machinery/mech_bay_recharge_port/proc/active() - if(pr_recharger.active()) - return 1 - else - return 0 + recharge_console.update_icon() + if(recharging_mecha.loc != recharging_turf) + recharging_mecha = null + recharge_console.update_icon() + return //This was missing... Is it not needed? Appeared in the original, but not in the port. Added it back in, to be safe. -/obj/machinery/mech_bay_recharge_port/power_change() - if(powered()) - stat &= ~NOPOWER - else - spawn(rand(0, 15)) - stat |= NOPOWER - pr_recharger.stop() - return - -/obj/machinery/mech_bay_recharge_port/proc/set_voltage(new_voltage) - if(new_voltage && isnum(new_voltage)) - pr_recharger.max_charge = new_voltage - return 1 - else - return 0 - -/datum/global_iterator/mech_bay_recharger - delay = 20 - var/max_charge = 50 - check_for_null = 0 //since port.stop_charge() must be called. The checks are made in process() - -/datum/global_iterator/mech_bay_recharger/process(var/obj/machinery/mech_bay_recharge_port/port, var/obj/mecha/mecha) - if(!port) - return 0 - if(mecha && mecha in port.recharge_floor) - if(!mecha.cell) - return - var/delta = min(max_charge, mecha.cell.maxcharge - mecha.cell.charge) - if(delta>0) - mecha.give_power(delta) - port.use_power(delta*150) +/obj/machinery/computer/mech_bay_power_console/proc/reconnect() + if(recharge_port) + return + recharge_port = locate(/obj/machinery/mech_bay_recharge_port) in range(1) + if(!recharge_port ) + for(var/D in cardinal) + var/turf/A = get_step(src, D) + A = get_step(A, D) + recharge_port = locate(/obj/machinery/mech_bay_recharge_port) in A + if(recharge_port) + break + if(recharge_port) + if(!recharge_port.recharge_console) + recharge_port.recharge_console = src else - mecha.occupant_message("Fully charged.") - port.stop_charge() - else - port.stop_charge() - return + recharge_port = null + + /obj/machinery/computer/mech_bay_power_console name = "mech bay power control console" @@ -225,82 +117,35 @@ icon_screen = "recharge_comp" light_color = LIGHT_COLOR_FADEDPURPLE circuit = /obj/item/weapon/circuitboard/mech_bay_power_console - var/autostart = 1 - var/voltage = 50 - var/turf/simulated/floor/mech_bay_recharge_floor/recharge_floor var/obj/machinery/mech_bay_recharge_port/recharge_port -/obj/machinery/computer/mech_bay_power_console/Destroy() - recharge_port.recharge_console = null - recharge_floor.recharge_console = null - return ..() - -/obj/machinery/computer/mech_bay_power_console/proc/mecha_in(var/obj/mecha/mecha) - if(stat&(NOPOWER|BROKEN)) - mecha.occupant_message("Control console not responding. Terminating...") - return - if(recharge_port && autostart) - var/answer = recharge_port.start_charge(mecha) - if(answer) - recharge_port.set_voltage(voltage) - update_icon() - return - -/obj/machinery/computer/mech_bay_power_console/proc/mecha_out() - if(recharge_port) - recharge_port.stop_charge() - update_icon() - return - -/obj/machinery/computer/mech_bay_power_console/power_change() - ..() - if(stat & BROKEN) - update_icon() - if(recharge_port) - recharge_port.stop_charge() - else if(powered()) - update_icon() - stat &= ~NOPOWER - else - spawn(rand(0, 15)) - update_icon() - stat |= NOPOWER - if(recharge_port) - recharge_port.stop_charge() - -/obj/machinery/computer/mech_bay_power_console/set_broken() - ..() - if(recharge_port) - recharge_port.stop_charge() /obj/machinery/computer/mech_bay_power_console/update_icon() - if(!recharge_floor || !recharge_floor.recharging_mecha || !recharge_floor.recharging_mecha.cell || !(recharge_floor.recharging_mecha.cell.charge < recharge_floor.recharging_mecha.cell.maxcharge)) + if(!recharge_port || !recharge_port.recharging_mecha || !recharge_port.recharging_mecha.cell || !(recharge_port.recharging_mecha.cell.charge < recharge_port.recharging_mecha.cell.maxcharge) || stat & (NOPOWER|BROKEN)) icon_screen = "recharge_comp" else icon_screen = "recharge_comp_on" ..() + /obj/machinery/computer/mech_bay_power_console/attack_hand(mob/user as mob) if(..()) return - if(!recharge_floor || !recharge_port) - var/turf/simulated/floor/mech_bay_recharge_floor/F = locate() in range(1,src) - if(F) - F.init_devices() ui_interact(user) /obj/machinery/computer/mech_bay_power_console/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) var/list/data = list() - data["has_floor"] = recharge_floor - data["has_port"] = recharge_port - if(recharge_floor && recharge_floor.recharging_mecha && recharge_floor.recharging_mecha.cell) - data["has_mech"] = 1 - data["mecha_name"] = recharge_floor.recharging_mecha || "None" - data["mecha_charge"] = isnull(recharge_floor.recharging_mecha) ? 0 : recharge_floor.recharging_mecha.cell.charge - data["mecha_maxcharge"] = isnull(recharge_floor.recharging_mecha) ? 0 : recharge_floor.recharging_mecha.cell.maxcharge - data["mecha_charge_percentage"] = isnull(recharge_floor.recharging_mecha) ? 0 : round(recharge_floor.recharging_mecha.cell.percent()) - else - data["has_mech"] = 0 + if(recharge_port && !qdeleted(recharge_port)) + data["recharge_port"] = list("mech" = null) + if(recharge_port.recharging_mecha && !qdeleted(recharge_port.recharging_mecha)) + data["recharge_port"]["mech"] = list("health" = recharge_port.recharging_mecha.health, "maxhealth" = initial(recharge_port.recharging_mecha.health), "cell" = null) + if(recharge_port.recharging_mecha.cell && !qdeleted(recharge_port.recharging_mecha.cell)) + data["recharge_port"]["mech"]["cell"] = list( + "critfail" = recharge_port.recharging_mecha.cell.crit_fail, + "charge" = recharge_port.recharging_mecha.cell.charge, + "maxcharge" = recharge_port.recharging_mecha.cell.maxcharge + ) +/* Need to update the nanoUI for these new data types. ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if(!ui) // the ui does not exist, so we'll create a new() one @@ -312,3 +157,9 @@ ui.open() // auto update every Master Controller tick ui.set_auto_update(1) + return data +*/ + +/obj/machinery/computer/mech_bay_power_console/initialize() + reconnect() + update_icon() //this the right place for it? Otherwise the computer sits there with a black screen. \ No newline at end of file diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 233cc931831..d0eab325481 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -897,8 +897,8 @@ var/gamma_ship_location = 1 // 0 = station , 1 = space toArea = locate(/area/shuttle/gamma/space) fromArea.move_contents_to(toArea) - for(var/turf/simulated/floor/mech_bay_recharge_floor/F in toArea) - F.init_devices() +// for(var/turf/simulated/floor/mech_bay_recharge_floor/F in toArea) +// F.init_devices() for(var/obj/machinery/power/apc/A in toArea) A.init() From 37a9c6756045ac92f202beff1e0a49f16ba9a91a Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Mon, 15 Aug 2016 15:58:23 +1000 Subject: [PATCH 5/9] Corrected points Fox raised. Updated nanoUI for the new screen. --- code/game/mecha/mech_bay.dm | 19 +++++++++---------- .../items/stacks/sheets/sheet_types.dm | 1 - code/modules/admin/admin.dm | 3 --- nano/templates/mech_bay_console.tmpl | 14 +------------- 4 files changed, 10 insertions(+), 27 deletions(-) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index b4f6748bde8..da8ca9787b9 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -20,7 +20,6 @@ var/obj/machinery/computer/mech_bay_power_console/recharge_console var/max_charge = 50 var/on = 0 - var/repairability = 0 //What's this? I don't think this is a thing on paradise var/turf/recharging_turf = null /obj/machinery/mech_bay_recharge_port/New() @@ -59,6 +58,7 @@ return if(default_change_direction_wrench(user, I)) + recharging_turf = get_step(loc, dir) return if(exchange_parts(user, I)) @@ -86,7 +86,6 @@ if(recharging_mecha.loc != recharging_turf) recharging_mecha = null recharge_console.update_icon() - return //This was missing... Is it not needed? Appeared in the original, but not in the port. Added it back in, to be safe. /obj/machinery/computer/mech_bay_power_console/proc/reconnect() @@ -140,12 +139,13 @@ if(recharge_port.recharging_mecha && !qdeleted(recharge_port.recharging_mecha)) data["recharge_port"]["mech"] = list("health" = recharge_port.recharging_mecha.health, "maxhealth" = initial(recharge_port.recharging_mecha.health), "cell" = null) if(recharge_port.recharging_mecha.cell && !qdeleted(recharge_port.recharging_mecha.cell)) - data["recharge_port"]["mech"]["cell"] = list( - "critfail" = recharge_port.recharging_mecha.cell.crit_fail, - "charge" = recharge_port.recharging_mecha.cell.charge, - "maxcharge" = recharge_port.recharging_mecha.cell.maxcharge - ) -/* Need to update the nanoUI for these new data types. + data["has_mech"] = 1 //Copied + data["mecha_name"] = recharge_port.recharging_mecha || "None" + data["mecha_charge"] = isnull(recharge_port.recharging_mecha) ? 0 : recharge_port.recharging_mecha.cell.charge + data["mecha_maxcharge"] = isnull(recharge_port.recharging_mecha) ? 0 : recharge_port.recharging_mecha.cell.maxcharge + data["mecha_charge_percentage"] = isnull(recharge_port.recharging_mecha) ? 0 : round(recharge_port.recharging_mecha.cell.percent()) + else + data["has_mech"] = 0 //Copied ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if(!ui) // the ui does not exist, so we'll create a new() one @@ -158,8 +158,7 @@ // auto update every Master Controller tick ui.set_auto_update(1) return data -*/ /obj/machinery/computer/mech_bay_power_console/initialize() reconnect() - update_icon() //this the right place for it? Otherwise the computer sits there with a black screen. \ No newline at end of file + update_icon() \ No newline at end of file diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 763ea7bdf93..76ac7cc252e 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -113,7 +113,6 @@ var/global/list/datum/stack_recipe/plasteel_recipes = list( new /datum/stack_recipe("Surgery Table", /obj/machinery/optable, 5, time = 50, one_per_turf = 1, on_floor = 1), new /datum/stack_recipe("Metal crate", /obj/structure/closet/crate, 10, time = 50, one_per_turf = 1), new /datum/stack_recipe("Mass Driver frame", /obj/machinery/mass_driver_frame, 3, time = 50, one_per_turf = 1), - new /datum/stack_recipe("Mech Recharge Bay", /turf/simulated/floor/mech_bay_recharge_floor, 2, time = 50, one_per_turf = 1), ) /obj/item/stack/sheet/plasteel diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index d0eab325481..9fe2e6e911c 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -897,9 +897,6 @@ var/gamma_ship_location = 1 // 0 = station , 1 = space toArea = locate(/area/shuttle/gamma/space) fromArea.move_contents_to(toArea) -// for(var/turf/simulated/floor/mech_bay_recharge_floor/F in toArea) -// F.init_devices() - for(var/obj/machinery/power/apc/A in toArea) A.init() diff --git a/nano/templates/mech_bay_console.tmpl b/nano/templates/mech_bay_console.tmpl index cd80983469a..2a4cf5d6085 100644 --- a/nano/templates/mech_bay_console.tmpl +++ b/nano/templates/mech_bay_console.tmpl @@ -1,22 +1,10 @@

Subsystems

-
-
- Recharge Station: -
-
- {{if data.has_floor}} - OK - {{else}} - ERROR - {{/if}} -
-
Power Port:
- {{if data.has_port}} + {{if data.recharge_port}} OK {{else}} ERROR From 58b1b3a7cd9c17b45db79ab8d25b127a108e2f83 Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Thu, 18 Aug 2016 13:15:04 +1000 Subject: [PATCH 6/9] Addresses crazylemon's comments. I found no issues testing it either. --- code/game/mecha/mech_bay.dm | 67 +++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index da8ca9787b9..e56831508e0 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -1,4 +1,4 @@ -/turf/simulated/floor/mech_bay_recharge_floor +/turf/simulated/floor/mech_bay_recharge_floor //I'll remove this in a future PR, as it requires map changes. name = "Mech Bay Recharge Station" icon = 'icons/mecha/mech_bay.dmi' icon_state = "recharge_floor" @@ -20,7 +20,7 @@ var/obj/machinery/computer/mech_bay_power_console/recharge_console var/max_charge = 50 var/on = 0 - var/turf/recharging_turf = null + var/turf/recharging_turf = null //this isn't the actual turf, it's just the space in front of the recharge port /obj/machinery/mech_bay_recharge_port/New() ..() @@ -33,7 +33,7 @@ component_parts += new /obj/item/weapon/stock_parts/capacitor(null) component_parts += new /obj/item/stack/cable_coil(null, 1) RefreshParts() - recharging_turf = get_step(loc, dir) // this is new. It picks the turf based on the direction the recharger is facing by the looks of it. Still needs to be a recharge_floor + recharging_turf = get_step(loc, dir) /obj/machinery/mech_bay_recharge_port/upgraded/New() ..() @@ -46,6 +46,7 @@ component_parts += new /obj/item/weapon/stock_parts/capacitor/super(null) component_parts += new /obj/item/stack/cable_coil(null, 1) RefreshParts() + recharging_turf = get_step(loc, dir) /obj/machinery/mech_bay_recharge_port/RefreshParts() var/MC @@ -65,9 +66,16 @@ return if(default_deconstruction_crowbar(I)) + recharge_console.recharge_port = null + recharge_console.update_icon() return return ..() +/obj/machinery/mech_bay_recharge_port/Destroy() + if(recharge_console) + recharge_console.recharge_port = null + recharge_console.update_icon() + return ..() /obj/machinery/mech_bay_recharge_port/process() if(stat & NOPOWER || !recharge_console) @@ -88,25 +96,6 @@ recharge_console.update_icon() -/obj/machinery/computer/mech_bay_power_console/proc/reconnect() - if(recharge_port) - return - recharge_port = locate(/obj/machinery/mech_bay_recharge_port) in range(1) - if(!recharge_port ) - for(var/D in cardinal) - var/turf/A = get_step(src, D) - A = get_step(A, D) - recharge_port = locate(/obj/machinery/mech_bay_recharge_port) in A - if(recharge_port) - break - if(recharge_port) - if(!recharge_port.recharge_console) - recharge_port.recharge_console = src - else - recharge_port = null - - - /obj/machinery/computer/mech_bay_power_console name = "mech bay power control console" density = 1 @@ -126,6 +115,31 @@ icon_screen = "recharge_comp_on" ..() +/obj/machinery/computer/mech_bay_power_console/proc/reconnect() + if(recharge_port) + return + recharge_port = locate(/obj/machinery/mech_bay_recharge_port) in range(1) + if(!recharge_port) + for(var/D in cardinal) + var/turf/A = get_step(src, D) + A = get_step(A, D) + recharge_port = locate(/obj/machinery/mech_bay_recharge_port) in A + if(recharge_port) + if(!recharge_port.recharge_console) + break + else + recharge_port = null + if(recharge_port) + if(!recharge_port.recharge_console) + recharge_port.recharge_console = src + else + recharge_port = null + + +/obj/machinery/computer/mech_bay_power_console/Destroy() + if(recharge_port) + recharge_port.recharge_console = null + return ..() /obj/machinery/computer/mech_bay_power_console/attack_hand(mob/user as mob) if(..()) @@ -134,18 +148,20 @@ /obj/machinery/computer/mech_bay_power_console/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) var/list/data = list() + if(!recharge_port) + reconnect() if(recharge_port && !qdeleted(recharge_port)) data["recharge_port"] = list("mech" = null) if(recharge_port.recharging_mecha && !qdeleted(recharge_port.recharging_mecha)) data["recharge_port"]["mech"] = list("health" = recharge_port.recharging_mecha.health, "maxhealth" = initial(recharge_port.recharging_mecha.health), "cell" = null) if(recharge_port.recharging_mecha.cell && !qdeleted(recharge_port.recharging_mecha.cell)) - data["has_mech"] = 1 //Copied + data["has_mech"] = 1 data["mecha_name"] = recharge_port.recharging_mecha || "None" data["mecha_charge"] = isnull(recharge_port.recharging_mecha) ? 0 : recharge_port.recharging_mecha.cell.charge data["mecha_maxcharge"] = isnull(recharge_port.recharging_mecha) ? 0 : recharge_port.recharging_mecha.cell.maxcharge data["mecha_charge_percentage"] = isnull(recharge_port.recharging_mecha) ? 0 : round(recharge_port.recharging_mecha.cell.percent()) else - data["has_mech"] = 0 //Copied + data["has_mech"] = 0 ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if(!ui) // the ui does not exist, so we'll create a new() one @@ -161,4 +177,5 @@ /obj/machinery/computer/mech_bay_power_console/initialize() reconnect() - update_icon() \ No newline at end of file + update_icon() + return ..() \ No newline at end of file From 6929409c70cab4c43fbf666d956b56337033d652 Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Thu, 18 Aug 2016 13:20:55 +1000 Subject: [PATCH 7/9] Left a comma in sheet_types.dm --- code/game/objects/items/stacks/sheets/sheet_types.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 76ac7cc252e..0b99edde497 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -112,7 +112,7 @@ var/global/list/datum/stack_recipe/plasteel_recipes = list( new /datum/stack_recipe("AI core", /obj/structure/AIcore, 4, time = 50, one_per_turf = 1), new /datum/stack_recipe("Surgery Table", /obj/machinery/optable, 5, time = 50, one_per_turf = 1, on_floor = 1), new /datum/stack_recipe("Metal crate", /obj/structure/closet/crate, 10, time = 50, one_per_turf = 1), - new /datum/stack_recipe("Mass Driver frame", /obj/machinery/mass_driver_frame, 3, time = 50, one_per_turf = 1), + new /datum/stack_recipe("Mass Driver frame", /obj/machinery/mass_driver_frame, 3, time = 50, one_per_turf = 1) ) /obj/item/stack/sheet/plasteel From 2a6f3f3984a16253c400eed59873c0727886aabd Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Thu, 18 Aug 2016 14:42:08 +1000 Subject: [PATCH 8/9] Removed silly comments. --- code/game/mecha/mech_bay.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index e56831508e0..fcb9e59a3a3 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -1,4 +1,4 @@ -/turf/simulated/floor/mech_bay_recharge_floor //I'll remove this in a future PR, as it requires map changes. +/turf/simulated/floor/mech_bay_recharge_floor name = "Mech Bay Recharge Station" icon = 'icons/mecha/mech_bay.dmi' icon_state = "recharge_floor" @@ -20,7 +20,7 @@ var/obj/machinery/computer/mech_bay_power_console/recharge_console var/max_charge = 50 var/on = 0 - var/turf/recharging_turf = null //this isn't the actual turf, it's just the space in front of the recharge port + var/turf/recharging_turf = null /obj/machinery/mech_bay_recharge_port/New() ..() From 501b872331a85a5dc0783c3a17a8b23f9e5d985e Mon Sep 17 00:00:00 2001 From: GeneralChaos81 Date: Thu, 18 Aug 2016 14:56:08 +1000 Subject: [PATCH 9/9] Removed double-up of destroy code in disassemble --- code/game/mecha/mech_bay.dm | 2 -- 1 file changed, 2 deletions(-) diff --git a/code/game/mecha/mech_bay.dm b/code/game/mecha/mech_bay.dm index fcb9e59a3a3..f60a37be397 100644 --- a/code/game/mecha/mech_bay.dm +++ b/code/game/mecha/mech_bay.dm @@ -66,8 +66,6 @@ return if(default_deconstruction_crowbar(I)) - recharge_console.recharge_port = null - recharge_console.update_icon() return return ..()