From bee2954d7b56a3fa4b121f190388176fb4fc20dd Mon Sep 17 00:00:00 2001 From: Tigercat2000 Date: Thu, 5 May 2016 22:05:39 -0700 Subject: [PATCH] Ports holomap blueprints from tg/vg. Changes: - Clicking "view structural data" in the station blueprints menu will show you ghost images of where things like disposal pipes, wires, atmospherics pipes, and other power machinery are originally supposed to go. Note, this will show you the ghost images over turfs even if the machinery is destroyed. --- code/ATMOSPHERICS/atmospherics.dm | 1 + code/game/objects/items/blueprints.dm | 50 +++++++++++++++++++++++++-- code/game/objects/objs.dm | 13 +++++++ code/game/turfs/turf.dm | 22 +++++++++++- code/modules/power/cable.dm | 1 + code/modules/power/power.dm | 1 + code/modules/recycling/disposal.dm | 2 ++ 7 files changed, 87 insertions(+), 3 deletions(-) diff --git a/code/ATMOSPHERICS/atmospherics.dm b/code/ATMOSPHERICS/atmospherics.dm index edc45b22e23..adb9d60ab1f 100644 --- a/code/ATMOSPHERICS/atmospherics.dm +++ b/code/ATMOSPHERICS/atmospherics.dm @@ -16,6 +16,7 @@ Pipelines + Other Objects -> Pipe network idle_power_usage = 0 active_power_usage = 0 power_channel = ENVIRON + on_blueprints = TRUE var/nodealert = 0 var/can_unwrench = 0 diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index 6dd269176b3..70ede0a075d 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -41,7 +41,7 @@ if(href_list["create_area"]) if(get_area_type()==AREA_SPACE) create_area() - updateUsrDialog() + //One-use area creation permits. @@ -77,6 +77,12 @@ icon_state = "blueprints" fluffnotice = "Property of Nanotrasen. For heads of staff only. Store in high-secure storage." w_class = 3 + var/list/showing = list() + var/client/viewing + +/obj/item/areaeditor/blueprints/Destroy() + clear_viewer() + return ..() /obj/item/areaeditor/blueprints/attack_self(mob/user as mob) @@ -85,6 +91,11 @@ if(get_area_type() == AREA_STATION) . += "

According to the [src], you are now in \"[sanitize(A.name)]\".

" . += "

You may move an amendment to the drawing.

" + if(!viewing) + . += "

View structural data

" + else + . += "

Refresh structural data

" + . += "

Hide structural data

" var/datum/browser/popup = new(user, "blueprints", "[src]", 700, 500) popup.set_content(.) popup.open() @@ -97,8 +108,43 @@ if(get_area_type()!=AREA_STATION) return edit_area() - updateUsrDialog() + if(href_list["view_blueprints"]) + set_viewer(usr, "You flip the blueprints over to view the complex information diagram.") + if(href_list["hide_blueprints"]) + clear_viewer(usr, "You flip the blueprints over to view the simple information diagram.") + if(href_list["refresh"]) + clear_viewer(usr) + set_viewer(usr) + attack_self(usr) +/obj/item/areaeditor/blueprints/proc/get_images(turf/T, viewsize) + . = list() + for(var/tt in RANGE_TURFS(viewsize, T)) + var/turf/TT = tt + if(TT.blueprint_data) + . += TT.blueprint_data + +/obj/item/areaeditor/blueprints/proc/set_viewer(mob/user, message = "") + if(user && user.client) + if(viewing) + clear_viewer() + viewing = user.client + showing = get_images(get_turf(user), viewing.view) + viewing.images |= showing + if(message) + to_chat(user, message) + +/obj/item/areaeditor/blueprints/proc/clear_viewer(mob/user, message = "") + if(viewing) + viewing.images -= showing + viewing = null + showing.Cut() + if(message) + to_chat(user, message) + +/obj/item/areaeditor/blueprints/dropped(mob/user) + ..() + clear_viewer() /obj/item/areaeditor/proc/get_area() var/turf/T = get_turf(usr) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 9f6688b69f6..a8579613604 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -23,6 +23,19 @@ // Reagent ID => friendly name var/list/reagents_to_log=list() + var/on_blueprints = FALSE //Are we visible on the station blueprints at roundstart? + var/force_blueprints = FALSE //forces the obj to be on the blueprints, regardless of when it was created. + +/obj/New() + . = ..() + + if(on_blueprints && isturf(loc)) + var/turf/T = loc + if(force_blueprints) + T.add_blueprints(src) + else + T.add_blueprints_preround(src) + /obj/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/state = default_state) // Calling Topic without a corresponding window open causes runtime errors if(!nowindow && ..()) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 7c0035cc445..1db6cba37d6 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -29,6 +29,8 @@ var/image/obscured //camerachunks + var/list/blueprint_data //for the station blueprints, images of objects eg: pipes + var/list/footstep_sounds = list() var/shoe_running_volume = 50 var/shoe_walking_volume = 20 @@ -161,6 +163,7 @@ var/old_dynamic_lighting = dynamic_lighting var/list/old_affecting_lights = affecting_lights var/old_lighting_overlay = lighting_overlay + var/old_blueprint_data = blueprint_data if(air_master) air_master.remove_from_active(src) @@ -170,6 +173,7 @@ if(istype(W, /turf/simulated)) W:Assimilate_Air() W.RemoveLattice() + W.blueprint_data = old_blueprint_data for(var/turf/space/S in range(W,1)) S.update_starlight() @@ -384,4 +388,20 @@ return 1 /turf/proc/can_lay_cable() - return can_have_cabling() & !intact \ No newline at end of file + return can_have_cabling() & !intact + +/turf/proc/add_blueprints(atom/movable/AM) + var/image/I = new + I.appearance = AM.appearance + I.appearance_flags = RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM + I.loc = src + I.dir = AM.dir + I.alpha = 128 + + if(!blueprint_data) + blueprint_data = list() + blueprint_data += I + +/turf/proc/add_blueprints_preround(atom/movable/AM) + if(!ticker || ticker.current_state != GAME_STATE_PLAYING) + add_blueprints(AM) \ No newline at end of file diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 07a908bb6d1..8208635f577 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -25,6 +25,7 @@ By design, d1 is the smallest direction and d2 is the highest /obj/structure/cable level = 1 anchored =1 + on_blueprints = TRUE var/datum/powernet/powernet name = "power cable" desc = "A flexible superconducting cable for heavy-duty power transfer" diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 91502e270a6..7aa54d3429b 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -10,6 +10,7 @@ name = null icon = 'icons/obj/power.dmi' anchored = 1.0 + on_blueprints = TRUE var/datum/powernet/powernet = null use_power = 0 idle_power_usage = 0 diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 4301d393391..cb3737824e0 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -14,6 +14,7 @@ icon_state = "disposal" anchored = 1 density = 1 + on_blueprints = TRUE var/datum/gas_mixture/air_contents // internal reservoir var/mode = 1 // item mode 0=off 1=charging 2=charged var/flush = 0 // true if flush handle is pulled @@ -656,6 +657,7 @@ anchored = 1 density = 0 + on_blueprints = TRUE level = 1 // underfloor only var/dpdir = 0 // bitmask of pipe directions dir = 0 // dir will contain dominant direction for junction pipes