From 2feedfa0093e2c30e5a4fe807a37cdaf8db57923 Mon Sep 17 00:00:00 2001 From: Bjorn Neergaard Date: Fri, 27 Nov 2015 21:21:48 -0500 Subject: [PATCH] Update Cryo, NanoUI states, add new contains() helper --- .../components/unary_devices/cryo.dm | 22 +-- code/__HELPERS/unsorted.dm | 12 +- code/game/machinery/alarm.dm | 2 +- code/modules/nano/interaction/admin.dm | 15 +- code/modules/nano/interaction/base.dm | 85 ++++++-- code/modules/nano/interaction/conscious.dm | 15 +- code/modules/nano/interaction/contained.dm | 22 +-- .../nano/interaction/deep_inventory.dm | 12 ++ code/modules/nano/interaction/default.dm | 84 ++++---- code/modules/nano/interaction/inventory.dm | 13 +- .../nano/interaction/inventory_deep.dm | 10 - code/modules/nano/interaction/notcontained.dm | 20 ++ code/modules/nano/interaction/physical.dm | 19 +- code/modules/nano/interaction/self.dm | 11 +- code/modules/nano/interaction/zlevel.dm | 15 +- code/modules/nano/nanoui.dm | 7 +- code/modules/nano/subsystem.dm | 2 +- nano/templates/cryo.tmpl | 187 +++++++++++------- tgstation.dme | 3 +- 19 files changed, 346 insertions(+), 210 deletions(-) create mode 100644 code/modules/nano/interaction/deep_inventory.dm delete mode 100644 code/modules/nano/interaction/inventory_deep.dm create mode 100644 code/modules/nano/interaction/notcontained.dm diff --git a/code/ATMOSPHERICS/components/unary_devices/cryo.dm b/code/ATMOSPHERICS/components/unary_devices/cryo.dm index c70f160d3e1..366ff7cdf63 100644 --- a/code/ATMOSPHERICS/components/unary_devices/cryo.dm +++ b/code/ATMOSPHERICS/components/unary_devices/cryo.dm @@ -65,16 +65,11 @@ if(!NODE1 || !is_operational()) return - if(!on) - updateDialog() - return - if(AIR1) if (occupant) process_occupant() expel_gas() - updateDialog() return 1 /obj/machinery/atmospherics/components/unary/cryo_cell/MouseDrop_T(mob/target, mob/user) @@ -120,17 +115,19 @@ user << "Seems empty." /obj/machinery/atmospherics/components/unary/cryo_cell/attack_hand(mob/user) - if(..() | !user) return + if(..() | !user) + return interact(user) /obj/machinery/atmospherics/components/unary/cryo_cell/interact(mob/user) - if(user == occupant || user.stat || panel_open) return + if(panel_open) + return ui_interact(user) /obj/machinery/atmospherics/components/unary/cryo_cell/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0) SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open) if (!ui) - ui = new(user, src, ui_key, "cryo.tmpl", name, 520, 410) + ui = new(user, src, ui_key, "cryo.tmpl", name, 520, 410, state = notcontained_state) ui.open() /obj/machinery/atmospherics/components/unary/cryo_cell/get_ui_data() @@ -183,8 +180,8 @@ return data /obj/machinery/atmospherics/components/unary/cryo_cell/Topic(href, href_list) - if(..()) return 0 - if(usr == occupant || panel_open) return 0 + if(..()) + return if(href_list["switchOn"]) if(!state_open) @@ -193,9 +190,12 @@ if(href_list["switchOff"]) on = 0 - if(href_list["ejectOccupant"]) + if(href_list["openCell"]) open_machine() + if(href_list["closeCell"]) + close_machine() + if(href_list["ejectBeaker"]) if(beaker) var/obj/item/weapon/reagent_containers/glass/B = beaker diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 7df72ae73e0..5ec646b840f 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -374,7 +374,7 @@ Turf and target are seperate in case you want to teleport some distance from a t var/list/names = list() var/list/pois = list() var/list/namecounts = list() - + for(var/mob/M in mobs) var/name = M.name if (name in names) @@ -1342,4 +1342,12 @@ B --><-- A L += T.contents c_dist++ - return L \ No newline at end of file + return L + +/atom/proc/contains(var/atom/location) + if(!location) + return 0 + for(location, location && location != src, location=location.loc); //semicolon is for the empty statement + if(location == src) + return 1 + return 0 \ No newline at end of file diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 23d7ed07dac..0d8dc0c0e56 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -186,7 +186,7 @@ /obj/machinery/alarm/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 0) SSnano.try_update_ui(user, src, ui_key, ui, force_open = force_open) if (!ui) - ui = new(user, src, ui_key, "air_alarm.tmpl", name, 460, 625) + ui = new(user, src, ui_key, "air_alarm.tmpl", name, 480, 625) ui.open() /obj/machinery/alarm/get_ui_data(mob/user) diff --git a/code/modules/nano/interaction/admin.dm b/code/modules/nano/interaction/admin.dm index fa5baf51941..6ee2859f7ec 100644 --- a/code/modules/nano/interaction/admin.dm +++ b/code/modules/nano/interaction/admin.dm @@ -1,7 +1,12 @@ -/* - This state checks that the user is an admin, end of story -*/ + /** + * NanoUI State: admin_state + * + * Checks that the user is an admin, end-of-story. + **/ + /var/global/datum/topic_state/admin_state/admin_state = new() -/datum/topic_state/admin_state/can_use_topic(var/src_object, var/mob/user) - return check_rights(R_ADMIN, 0, user) ? NANO_INTERACTIVE : NANO_CLOSE +/datum/topic_state/admin_state/can_use_topic(atom/movable/src_object, mob/user) + if (check_rights(R_ADMIN, 0, user)) + return NANO_INTERACTIVE + return NANO_CLOSE diff --git a/code/modules/nano/interaction/base.dm b/code/modules/nano/interaction/base.dm index 43bad6c0e14..07456eb0c62 100644 --- a/code/modules/nano/interaction/base.dm +++ b/code/modules/nano/interaction/base.dm @@ -1,14 +1,47 @@ -/atom/proc/CanUseTopic(var/mob/user, var/datum/topic_state/state) + /** + * NanoUI State + * + * Base state and helpers for states. Just does some sanity checks, implement a state for in-depth checks. + **/ + + /** + * public + * + * Checks if a user can use src_object's NanoUI, under the given state. + * + * required user mob The mob who opened/is using the NanoUI. + * required state datum/topic_state The state to check. + * + * return NANO_state The state of the UI. + **/ +/atom/proc/CanUseTopic(mob/user, datum/topic_state/state) var/src_object = nano_host() return state.can_use_topic(src_object, user) // Check if the state allows interaction. - -/datum/topic_state/proc/can_use_topic(var/src_object, var/mob/user) + /** + * private + * + * Checks if a user can use src_object's NanoUI, and returns the state. + * Can call a mob proc, which allows overrides for each mob. + * + * required src_object atom/movable The object which owns the NanoUI. + * required user mob The mob who opened/is using the NanoUI. + * + * return NANO_state The state of the UI. + **/ +/datum/topic_state/proc/can_use_topic(atom/movable/src_object, mob/user) return NANO_CLOSE // Don't allow interaction by default. + /** + * public + * + * Standard interaction/sanity checks. Different mob types may have overrides. + * + * return NANO_state The state of the UI. + **/ /mob/proc/shared_nano_interaction() - if (!client || src.stat) // Close NanoUIs if mindless or dead/unconcious. + if (!client || stat) // Close NanoUIs if mindless or dead/unconcious. return NANO_CLOSE else if (restrained() || lying || stat || stunned || weakened) // Update NanoUIs if incapicitated but concious. return NANO_UPDATE @@ -26,18 +59,40 @@ return NANO_DISABLED return ..() -/atom/proc/contents_nano_distance(var/src_object, var/mob/living/user) - return user.shared_living_nano_distance(src_object) -/mob/living/proc/shared_living_nano_distance(var/atom/movable/src_object) - if (!(src_object in view(4, src))) // If the src object is not in visable, disable updates +/** + * public + * + * Check the distance for a living mob. + * Really only used for checks outside the context of a mob. + * Otherwise, use shared_living_nano_distance(). + * + * required src_object atom/movable The object which owns the NanoUI. + * required user mob The mob who opened/is using the NanoUI. + * + * return NANO_state The state of the UI. + **/ +/atom/proc/contents_nano_distance(atom/movable/src_object, mob/living/user) + return user.shared_living_nano_distance(src_object) // Just call this mob's check. + + /** + * public + * + * Distance versus interaction check. + * + * required src_object atom/movable The object which owns the NanoUI. + * + * return NANO_state The state of the UI. + **/ +/mob/living/proc/shared_living_nano_distance(atom/movable/src_object) + if (!(src_object in view(4, src))) // If the object is out of view, close it. return NANO_CLOSE var/dist = get_dist(src_object, src) - if (dist <= 1) - return NANO_INTERACTIVE // interactive (green visibility) - else if (dist <= 2) - return NANO_UPDATE // update only (orange visibility) - else if (dist <= 4) - return NANO_DISABLED // no updates, completely disabled (red visibility) - return NANO_CLOSE \ No newline at end of file + if (dist <= 1) // Open and interact if 1-0 tiles away. + return NANO_INTERACTIVE + else if (dist <= 2) // Open and view if 2-3 tiles away. + return NANO_UPDATE + else if (dist <= 4) // Open if 4 tiles away. + return NANO_DISABLED + return NANO_CLOSE // Otherwise, we got nothing. \ No newline at end of file diff --git a/code/modules/nano/interaction/conscious.dm b/code/modules/nano/interaction/conscious.dm index 8d93942a79b..1f96d223666 100644 --- a/code/modules/nano/interaction/conscious.dm +++ b/code/modules/nano/interaction/conscious.dm @@ -1,7 +1,12 @@ -/* - This state only checks if user is conscious. -*/ + /** + * NanoUI State: conscious_state + * + * Only checks if the user is conscious. + **/ + /var/global/datum/topic_state/conscious_state/conscious_state = new() -/datum/topic_state/conscious_state/can_use_topic(var/src_object, var/mob/user) - return user.stat == CONSCIOUS ? NANO_INTERACTIVE : NANO_CLOSE +/datum/topic_state/conscious_state/can_use_topic(atom/movable/src_object, mob/user) + if (user.stat == CONSCIOUS) + return NANO_INTERACTIVE + return NANO_CLOSE diff --git a/code/modules/nano/interaction/contained.dm b/code/modules/nano/interaction/contained.dm index 8fd82ba6b33..eebcab816d6 100644 --- a/code/modules/nano/interaction/contained.dm +++ b/code/modules/nano/interaction/contained.dm @@ -1,18 +1,12 @@ -/* - This state checks if user is somewhere within src_object, as well as the default NanoUI interaction. -*/ + /** + * NanoUI State: contained_state + * + * Checks that the user is an admin, end-of-story. + **/ + /var/global/datum/topic_state/contained_state/contained_state = new() -/datum/topic_state/contained_state/can_use_topic(var/atom/src_object, var/mob/user) +/datum/topic_state/contained_state/can_use_topic(atom/movable/src_object, mob/user) if(!src_object.contains(user)) return NANO_CLOSE - - return user.shared_nano_interaction() - -/atom/proc/contains(var/atom/location) - if(!location) - return 0 - if(location == src) - return 1 - - return contains(location.loc) + return user.shared_nano_interaction(src_object) diff --git a/code/modules/nano/interaction/deep_inventory.dm b/code/modules/nano/interaction/deep_inventory.dm new file mode 100644 index 00000000000..fa6d7746031 --- /dev/null +++ b/code/modules/nano/interaction/deep_inventory.dm @@ -0,0 +1,12 @@ + /** + * NanoUI State: deep_inventory_state + * + * Checks that the src_object is in the user's fist-level (backpack, webbing, etc) inventory. + **/ + +/var/global/datum/topic_state/deep_inventory_state/deep_inventory_state = new() + +/datum/topic_state/deep_inventory_state/can_use_topic(atom/movable/src_object, mob/user) + if(!user.contains(src_object)) + return NANO_CLOSE + return user.shared_nano_interaction() diff --git a/code/modules/nano/interaction/default.dm b/code/modules/nano/interaction/default.dm index 42f2f7fa53d..f01c57a34fe 100644 --- a/code/modules/nano/interaction/default.dm +++ b/code/modules/nano/interaction/default.dm @@ -1,69 +1,61 @@ + /** + * NanoUI State: default_state + * + * Checks a number of things -- mostly phyiscal distance for humans and view for robots. + **/ + /var/global/datum/topic_state/default/default_state = new() +/datum/topic_state/default/can_use_topic(atom/movable/src_object, mob/user) + return user.default_can_use_topic(src_object) // Call the individual mob-overriden procs. -/datum/topic_state/default/can_use_topic(var/src_object, var/mob/user) - return user.default_can_use_topic(src_object) +/mob/proc/default_can_use_topic(atom/movable/src_object) + return NANO_CLOSE // Don't allow interaction by default. - -/mob/proc/default_can_use_topic(var/src_object) - return NANO_CLOSE // By default no mob can do anything with NanoUI - -/mob/dead/observer/default_can_use_topic() +/mob/dead/observer/default_can_use_topic(atom/movable/src_object) if(check_rights(R_ADMIN, 0, src)) - return NANO_INTERACTIVE // Admins are more equal - return NANO_UPDATE // Ghosts can view updates + return NANO_INTERACTIVE // Admins can interact anyway. + return NANO_UPDATE // Ghosts can only view. -/mob/living/silicon/robot/default_can_use_topic(var/src_object) +/mob/living/default_can_use_topic(atom/movable/src_object) + . = shared_nano_interaction(src_object) + if(. > NANO_CLOSE) + if(loc) // Check if the loc exists. + . = min(., loc.contents_nano_distance(src_object, src)) // Check the distance... + if(. == NANO_INTERACTIVE) // Non-human living mobs can only look, not touch. + return NANO_UPDATE + +/mob/living/carbon/human/default_can_use_topic(atom/movable/src_object) + . = shared_nano_interaction(src_object) + if(. > NANO_CLOSE) + . = min(., shared_living_nano_distance(src_object)) // Check the distance... + // If we have telekinesis and remain close enough, allow interaction. + if(. == NANO_UPDATE && dna.check_mutation(TK)) + return NANO_INTERACTIVE + +/mob/living/silicon/robot/default_can_use_topic(atom/movable/src_object) . = shared_nano_interaction() if(. <= NANO_DISABLED) return - // robots can interact with things they can see within their view range + // Robots can interact with anything they can see. if((src_object in view(src)) && get_dist(src_object, src) <= src.client.view) - return NANO_INTERACTIVE // interactive (green visibility) - return NANO_DISABLED // no updates, completely disabled (red visibility) - -/mob/living/silicon/robot/syndicate/default_can_use_topic(var/src_object) - . = ..() - if(. != NANO_INTERACTIVE) - return - - if(istype(get_area(src), /area/syndicate_mothership) || istype(get_area(src), /area/shuttle/syndicate)) // If elsewhere, they can interact with everything on the syndicate shuttle return NANO_INTERACTIVE - if(istype(src_object, /obj/machinery)) // Otherwise they can only interact with emagged machinery - var/obj/machinery/Machine = src_object - if(Machine.emagged) - return NANO_INTERACTIVE - return NANO_UPDATE + return NANO_DISABLED // Otherwise they can keep the UI open. -/mob/living/silicon/ai/default_can_use_topic(var/src_object) +/mob/living/silicon/ai/default_can_use_topic(atom/movable/src_object) . = shared_nano_interaction() - if (. != NANO_INTERACTIVE) + if (. < NANO_INTERACTIVE) return - // If an object is in view of the client and a camera then we can interact with it - if ((src_object in view(eyeobj)) && cameranet.checkTurfVis(get_turf(src_object))) + // The AI can interact with anything it can see nearby, or with cameras. + if ((src_object in view(src)) || ((src_object in view(eyeobj)) && cameranet.checkTurfVis(get_turf(src_object)))) return NANO_INTERACTIVE - return NANO_CLOSE -/mob/living/silicon/pai/default_can_use_topic(var/src_object) +/mob/living/silicon/pai/default_can_use_topic(atom/movable/src_object) + // pAIs can only use themselves and the owner's radio. if((src_object == src || src_object == radio) && !stat) return NANO_INTERACTIVE else return ..() - -/mob/living/default_can_use_topic(var/src_object) - . = shared_nano_interaction(src_object) - if(. != NANO_CLOSE) - if(loc) - . = min(., loc.contents_nano_distance(src_object, src)) - if(NANO_INTERACTIVE) - return NANO_UPDATE - -/mob/living/carbon/human/default_can_use_topic(var/src_object) - . = shared_nano_interaction(src_object) - if(. != NANO_CLOSE) - . = min(., shared_living_nano_distance(src_object)) - if(. == NANO_UPDATE && dna.check_mutation(TK)) // If we have telekinesis and remain close enough, allow interaction. - return NANO_INTERACTIVE diff --git a/code/modules/nano/interaction/inventory.dm b/code/modules/nano/interaction/inventory.dm index 5c8f8ca46c2..8864b5cbdef 100644 --- a/code/modules/nano/interaction/inventory.dm +++ b/code/modules/nano/interaction/inventory.dm @@ -1,11 +1,12 @@ -/* - This state checks that the src_object is somewhere in the user's first-level inventory (in hands, on ear, etc.), but not further down (such as in bags). -*/ + /** + * NanoUI State: inventory_state + * + * Checks that the src_object is in the user's top-level (hand, ear, pocket, belt, etc) inventory. + **/ + /var/global/datum/topic_state/inventory_state/inventory_state = new() -/datum/topic_state/inventory_state/can_use_topic(var/src_object, var/mob/user) +/datum/topic_state/inventory_state/can_use_topic(atom/movable/src_object, mob/user) if(!(src_object in user)) return NANO_CLOSE - - return user.shared_nano_interaction() diff --git a/code/modules/nano/interaction/inventory_deep.dm b/code/modules/nano/interaction/inventory_deep.dm deleted file mode 100644 index 300552e588d..00000000000 --- a/code/modules/nano/interaction/inventory_deep.dm +++ /dev/null @@ -1,10 +0,0 @@ -/* - This state checks if src_object is contained anywhere in the user's inventory, including bags, etc. -*/ -/var/global/datum/topic_state/deep_inventory_state/deep_inventory_state = new() - -/datum/topic_state/deep_inventory_state/can_use_topic(var/src_object, var/mob/user) - if(!user.contains(src_object)) - return NANO_CLOSE - - return user.shared_nano_interaction() diff --git a/code/modules/nano/interaction/notcontained.dm b/code/modules/nano/interaction/notcontained.dm new file mode 100644 index 00000000000..bdad5ba6cfb --- /dev/null +++ b/code/modules/nano/interaction/notcontained.dm @@ -0,0 +1,20 @@ + /** + * NanoUI State: notcontained_state + * + * Checks that the user is not inside src_object, and then makes the default distance checks. + **/ + +/var/global/datum/topic_state/notcontained_state/notcontained_state = new() + +/datum/topic_state/notcontained_state/can_use_topic(atom/movable/src_object, mob/user) + . = user.shared_nano_interaction(src_object) + if(. > NANO_CLOSE) + return min(., user.notcontained_can_use_topic(src_object)) + +/mob/proc/notcontained_can_use_topic(atom/movable/src_object) + return NANO_CLOSE + +/mob/living/notcontained_can_use_topic(atom/movable/src_object) + if(src_object.contains(src)) + return NANO_CLOSE + return shared_living_nano_distance(src_object) diff --git a/code/modules/nano/interaction/physical.dm b/code/modules/nano/interaction/physical.dm index 28762012d4b..deecc3d8124 100644 --- a/code/modules/nano/interaction/physical.dm +++ b/code/modules/nano/interaction/physical.dm @@ -1,18 +1,25 @@ + /** + * NanoUI State: physical_state + * + * Short-circuits the default state to only check physical distance. + **/ + /var/global/datum/topic_state/physical/physical_state = new() -/datum/topic_state/physical/can_use_topic(var/src_object, var/mob/user) +/datum/topic_state/physical/can_use_topic(atom/movable/src_object, mob/user) . = user.shared_nano_interaction(src_object) if(. > NANO_CLOSE) - return min(., user.check_physical_distance(src_object)) + return min(., user.physical_can_use_topic(src_object)) -/mob/proc/check_physical_distance(var/src_object) +/mob/proc/physical_can_use_topic(atom/movable/src_object) return NANO_CLOSE -/mob/dead/observer/check_physical_distance(var/src_object) +/mob/dead/observer/physical_can_use_topic(atom/movable/src_object) return default_can_use_topic(src_object) -/mob/living/check_physical_distance(var/src_object) +/mob/living/physical_can_use_topic(atom/movable/src_object) return shared_living_nano_distance(src_object) -/mob/living/silicon/check_physical_distance(var/src_object) +/mob/living/silicon/physical_can_use_topic(atom/movable/src_object) + // Silicons can always see. return max(NANO_UPDATE, shared_living_nano_distance(src_object)) diff --git a/code/modules/nano/interaction/self.dm b/code/modules/nano/interaction/self.dm index da125df17ee..b2573ce444e 100644 --- a/code/modules/nano/interaction/self.dm +++ b/code/modules/nano/interaction/self.dm @@ -1,9 +1,12 @@ -/* - This state checks that the src_object is the same the as user -*/ + /** + * NanoUI State: self_state + * + * Only checks that the user and src_object are the same. + **/ + /var/global/datum/topic_state/self_state/self_state = new() -/datum/topic_state/self_state/can_use_topic(var/src_object, var/mob/user) +/datum/topic_state/self_state/can_use_topic(atom/movable/src_object, mob/user) if(src_object != user) return NANO_CLOSE return user.shared_nano_interaction() diff --git a/code/modules/nano/interaction/zlevel.dm b/code/modules/nano/interaction/zlevel.dm index e646396743a..c0855e00a4b 100644 --- a/code/modules/nano/interaction/zlevel.dm +++ b/code/modules/nano/interaction/zlevel.dm @@ -1,13 +1,14 @@ -/* - This state checks that the user is on the same Z-level as src_object -*/ + /** + * NanoUI State: z_state + * + * Only checks that the Z-level of the user and src_object are the same. + **/ /var/global/datum/topic_state/z_state/z_state = new() -/datum/topic_state/z_state/can_use_topic(var/src_object, var/mob/user) +/datum/topic_state/z_state/can_use_topic(atom/movable/src_object, mob/user) var/turf/turf_obj = get_turf(src_object) var/turf/turf_usr = get_turf(user) - if(!turf_obj || !turf_usr) + if(!turf_obj || !turf_usr || !(turf_obj.z == turf_usr.z)) return NANO_CLOSE - - return turf_obj.z == turf_usr.z ? NANO_INTERACTIVE : NANO_CLOSE + return NANO_INTERACTIVE diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm index 70bdbb7d2ab..aca852b7261 100644 --- a/code/modules/nano/nanoui.dm +++ b/code/modules/nano/nanoui.dm @@ -407,12 +407,13 @@ if (width && height) // If we have a width and height, use them. window_size = "size=[width]x[height];" update_status(push_update = 0) // Update the window state. - if(status == NANO_CLOSE) return // Bail if we should close. + if (status == NANO_CLOSE) + return // Bail if we should close. user << browse(get_html(), "window=[window_id];[window_size][window_options]") // Open the window. winset(user, "mapwindow.map", "focus=true") // Return keyboard focus to map. winset(user, window_id, "on-close=\"nanoclose \ref[src]\"") // Instruct the client to signal NanoUI when the window is closed. - SSnano.ui_opened(src) // Call the ui_opened handler. + SSnano.ui_opened(src) // Call the opened handler. /** * public @@ -423,7 +424,7 @@ * optional template string The filename of the new template. * optional data list The new initial data. **/ -/datum/nanoui/proc/reinitialise(template, list/data) +/datum/nanoui/proc/reinitialize(template, list/data) if(template) add_template("main", template) // Replace the 'main' template. if(data) diff --git a/code/modules/nano/subsystem.dm b/code/modules/nano/subsystem.dm index f53d04bbf77..481b21c5401 100644 --- a/code/modules/nano/subsystem.dm +++ b/code/modules/nano/subsystem.dm @@ -35,7 +35,7 @@ if (!force_open) // UI is already open; update it. ui.push_data(data) else // Re-open it anyways. - ui.reinitialise(null, data) + ui.reinitialize(null, data) return ui // We found the UI, return it. else return null // We couldn't find a UI. diff --git a/nano/templates/cryo.tmpl b/nano/templates/cryo.tmpl index 43ffff3eda5..b5575944347 100644 --- a/nano/templates/cryo.tmpl +++ b/nano/templates/cryo.tmpl @@ -1,98 +1,139 @@ - -

Cryo Cell Status

- +

Occupant

- {{if !data.hasOccupant}} -
Cell Unoccupied
- {{else}} -
- {{:data.occupant.name}} =>  - {{if data.occupant.stat == 0}} - Conscious - {{else data.occupant.stat == 1}} - Unconscious +
+
+ Occupant: +
+
+ {{if data.hasOccupant}} + {{:data.occupant.name}} {{else}} - DEAD + No Occupant {{/if}}
- - {{if data.occupant.stat < 2}} -
-
Health:
+
+ {{if data.hasOccupant}} +
+
+ State: +
+
+ {{if data.occupant.stat == 0}} + Conscious + {{else data.occupant.stat == 1}} + Unconscious + {{else}} + DEAD + {{/if}} +
+
+
+
+ Temperature: +
+
+ {{:helper.round(data.occupant.bodyTemperature)}} K +
+
+ {{/if}} + {{if data.occupant.stat < 2}} +
+
+ Health: +
+
{{if data.occupant.health >= 0}} {{:helper.displayBar(data.occupant.health, 0, data.occupant.maxHealth, 'good')}} {{else}} - {{:helper.displayBar(data.occupant.health, 0, data.occupant.minHealth, 'average alignRight')}} + {{:helper.displayBar(data.occupant.health, 0, data.occupant.minHealth, 'average')}} {{/if}} -
{{:helper.round(data.occupant.health)}}
+ {{:helper.round(data.occupant.health)}}
- -
-
=> Brute Damage:
+
+
+
+ Brute: +
+
{{:helper.displayBar(data.occupant.bruteLoss, 0, data.occupant.maxHealth, 'bad')}} -
{{:helper.round(data.occupant.bruteLoss)}}
+ {{:helper.round(data.occupant.bruteLoss)}}
- -
-
=> Resp. Damage:
+
+
+
+ Respiratory: +
+
{{:helper.displayBar(data.occupant.oxyLoss, 0, data.occupant.maxHealth, 'bad')}} -
{{:helper.round(data.occupant.oxyLoss)}}
+ {{:helper.round(data.occupant.oxyLoss)}}
- -
-
=> Toxin Damage:
+
+
+
+ Toxin: +
+
{{:helper.displayBar(data.occupant.toxLoss, 0, data.occupant.maxHealth, 'bad')}} -
{{:helper.round(data.occupant.toxLoss)}}
+ {{:helper.round(data.occupant.toxLoss)}}
- -
-
=> Burn Severity:
+
+
+
+ Burn: +
+
{{:helper.displayBar(data.occupant.fireLoss, 0, data.occupant.maxHealth, 'bad')}} -
{{:helper.round(data.occupant.fireLoss)}}
+ {{:helper.round(data.occupant.fireLoss)}}
- {{/if}} +
{{/if}} -
-
-
Cell Temperature:
+
+

Cell

+
+
+
+ Power: +
+
+ {{:helper.link('On', 'power', {'switchOn': 1}, data.isOperating ? 'selected' : null)}} + {{:helper.link('Off', 'close', {'switchOff': 1}, data.isOperating ? null : 'selected')}} +
+
+
+
+ Temperature: +
+
{{:data.cellTemperature}} K
-
- -

Cryo Cell Operation

-
-
- Cryo Cell Status: -
-
- {{:helper.link('On', 'power', {'switchOn': 1}, data.isOperating ? 'selected' : null)}} - {{:helper.link('Off', 'close', {'switchOff': 1}, data.isOperating ? null : 'selected')}} -
-
- {{:helper.link('Eject Occupant', 'arrowreturnthick-1-s', {'ejectOccupant' : 1}, data.hasOccupant ? null : 'disabled')}} +
+
+ Door: +
+
+ {{:helper.link('Open', 'unlocked', {'openCell' : 1}, data.isOpen ? 'disabled' : null)}} + {{:helper.link('Close', 'locked', {'closeCell' : 1}, data.isOpen ? null : 'disabled')}} +
-
 
-
-
- Beaker: -
-
- {{if data.isBeakerLoaded}} - {{for data.beakerContents}} - {{:value.volume}} units of {{:value.name}}
- {{empty}} - Beaker is empty - {{/for}} - {{else}} - No beaker loaded - {{/if}} -
-
- {{:helper.link('Eject Beaker', 'eject', {'ejectBeaker' : 1}, data.isBeakerLoaded ? null : 'disabled')}} +

Beaker

+
+ {{:helper.link('Eject Beaker', 'eject', {'ejectBeaker' : 1}, data.isBeakerLoaded ? null : 'disabled')}} +
+
+ Contents: +
+
+ {{if data.isBeakerLoaded}} + {{for data.beakerContents}} + {{:value.volume}} units of {{:value.name}}
+ {{empty}} + Beaker Empty + {{/for}} + {{else}} + No Beaker Loaded + {{/if}} +
\ No newline at end of file diff --git a/tgstation.dme b/tgstation.dme index f11c80c6602..4aa53f2696a 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1360,9 +1360,10 @@ #include "code\modules\nano\interaction\base.dm" #include "code\modules\nano\interaction\conscious.dm" #include "code\modules\nano\interaction\contained.dm" +#include "code\modules\nano\interaction\deep_inventory.dm" #include "code\modules\nano\interaction\default.dm" #include "code\modules\nano\interaction\inventory.dm" -#include "code\modules\nano\interaction\inventory_deep.dm" +#include "code\modules\nano\interaction\notcontained.dm" #include "code\modules\nano\interaction\physical.dm" #include "code\modules\nano\interaction\self.dm" #include "code\modules\nano\interaction\zlevel.dm"