From b8a7ca7d1b35efc837e070b917906b446bf58954 Mon Sep 17 00:00:00 2001 From: Markolie Date: Tue, 28 Jul 2015 21:04:44 +0200 Subject: [PATCH] Update NanoUI to be up-to-date with Bay --- code/__DEFINES/machines.dm | 2 - code/game/machinery/computer/crew.dm | 2 +- code/game/machinery/doors/airlock.dm | 4 +- code/game/machinery/machinery.dm | 2 +- code/game/machinery/portable_turret.dm | 8 ++- code/game/machinery/turret_control.dm | 6 ++ code/game/objects/items/devices/PDA/PDA.dm | 17 ++++- .../objects/items/devices/sensor_device.dm | 2 +- code/game/objects/items/devices/uplinks.dm | 9 ++- code/game/objects/objs.dm | 5 +- code/modules/mob/living/silicon/ai/life.dm | 4 -- code/modules/mob/living/silicon/ai/nano.dm | 2 +- code/modules/mob/living/silicon/pai/pai.dm | 12 ++++ code/modules/nano/interaction/admin.dm | 7 ++ code/modules/nano/interaction/base.dm | 19 ++++++ code/modules/nano/interaction/contained.dm | 18 +++++ .../default.dm} | 67 +++++++------------ code/modules/nano/interaction/inventory.dm | 10 +++ code/modules/nano/interaction/zlevel.dm | 13 ++++ code/modules/nano/modules/crew_monitor.dm | 17 ++--- code/modules/nano/modules/nano_module.dm | 12 ++++ code/modules/nano/nanoexternal.dm | 2 +- code/modules/nano/nanoui.dm | 17 +++-- nano/templates/door_control.tmpl | 8 +-- paradise.dme | 8 ++- 25 files changed, 182 insertions(+), 91 deletions(-) create mode 100644 code/modules/nano/interaction/admin.dm create mode 100644 code/modules/nano/interaction/base.dm create mode 100644 code/modules/nano/interaction/contained.dm rename code/modules/nano/{nanointeraction.dm => interaction/default.dm} (60%) create mode 100644 code/modules/nano/interaction/inventory.dm create mode 100644 code/modules/nano/interaction/zlevel.dm create mode 100644 code/modules/nano/modules/nano_module.dm diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index 893847bfa75..88772bb8d76 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -24,8 +24,6 @@ #define HYDRO_SPEED_MULTIPLIER 1 -#define NANO_IGNORE_DISTANCE 1 - // multitool_topic() shit #define MT_ERROR -1 #define MT_UPDATE 1 diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index f7f0e7a8fa1..68f9f03f0d4 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -8,7 +8,7 @@ active_power_usage = 500 light_color = LIGHT_COLOR_DARKBLUE circuit = "/obj/item/weapon/circuitboard/crew" - var/obj/nano_module/crew_monitor/crew_monitor + var/datum/nano_module/crew_monitor/crew_monitor /obj/machinery/computer/crew/New() crew_monitor = new(src) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 72946cc4ef2..abb034886ed 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -635,7 +635,7 @@ About the new airlock wires panel: ..(user) return -/obj/machinery/door/airlock/CanUseTopic(var/mob/user, href_list) +/obj/machinery/door/airlock/CanUseTopic(var/mob/user) if(!issilicon(user)) return STATUS_CLOSE @@ -652,7 +652,7 @@ About the new airlock wires panel: user << "Unable to interface: Connection refused." return STATUS_CLOSE - return STATUS_INTERACTIVE + return ..() /obj/machinery/door/airlock/Topic(href, href_list, var/nowindow = 0) if(..()) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 171f49c116d..34a67e0607a 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -299,7 +299,7 @@ Class Procs: return 0 -/obj/machinery/CanUseTopic(var/mob/user, var/be_close) +/obj/machinery/CanUseTopic(var/mob/user) if(!interact_offline && (stat & (NOPOWER|BROKEN))) return STATUS_CLOSE diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index e79d7721a26..5ebcb512d72 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -71,7 +71,8 @@ /obj/machinery/porta_turret/New() ..() - req_access = list() + if(req_access && req_access.len) + req_access.Cut() req_one_access = list(access_security, access_heads) //Sets up a spark system @@ -83,7 +84,8 @@ /obj/machinery/porta_turret/centcom/New() ..() - req_one_access = list() + if(req_one_access && req_one_access.len) + req_one_access.Cut() req_access = list(access_cent_specops) /obj/machinery/porta_turret/proc/setup() @@ -231,7 +233,7 @@ var/list/turret_icons usr << "\The [src] has to be secured first!" return STATUS_CLOSE - return STATUS_INTERACTIVE + return ..() /obj/machinery/porta_turret/Topic(href, href_list, var/nowindow = 0) if(..()) diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm index 2b465b66bcb..798fc855f29 100644 --- a/code/game/machinery/turret_control.dm +++ b/code/game/machinery/turret_control.dm @@ -73,6 +73,12 @@ return 1 return 0 + +/obj/machinery/turretid/CanUseTopic(mob/user) + if(isLocked(user)) + return STATUS_CLOSE + + return ..() /obj/machinery/turretid/attackby(obj/item/weapon/W, mob/user) if(stat & BROKEN) diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index f7af05b808d..4f1ddfd166f 100755 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -506,7 +506,7 @@ var/global/list/obj/item/device/pda/PDAs = list() if (!ui) // the ui does not exist, so we'll create a new() one // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm - ui = new(user, src, ui_key, "pda.tmpl", title, 630, 600) + ui = new(user, src, ui_key, "pda.tmpl", title, 630, 600, state = inventory_state) // when the ui is first opened this is the data it will use ui.set_initial_data(data) @@ -815,6 +815,21 @@ var/global/list/obj/item/device/pda/PDAs = list() return 1 // return 1 tells it to refresh the UI in NanoUI +/obj/item/device/pda/verb/verb_reset_pda() + set category = "Object" + set name = "Reset PDA" + set src in usr + + if(issilicon(usr)) + return + + if(can_use(usr)) + mode = 0 + nanomanager.update_uis(src) + usr << "You press the reset button on \the [src]." + else + usr << "You cannot do this while restrained." + /obj/item/device/pda/proc/remove_id() if (id) if (ismob(loc)) diff --git a/code/game/objects/items/devices/sensor_device.dm b/code/game/objects/items/devices/sensor_device.dm index 5db0bdc47f4..730f81f0bdb 100644 --- a/code/game/objects/items/devices/sensor_device.dm +++ b/code/game/objects/items/devices/sensor_device.dm @@ -6,7 +6,7 @@ w_class = 2.0 slot_flags = SLOT_BELT origin_tech = "biotech=3;materials=3;magnets=3" - var/obj/nano_module/crew_monitor/crew_monitor + var/datum/nano_module/crew_monitor/crew_monitor /obj/item/device/sensor_device/New() crew_monitor = new(src) diff --git a/code/game/objects/items/devices/uplinks.dm b/code/game/objects/items/devices/uplinks.dm index 36e6f356a63..22cebb08654 100644 --- a/code/game/objects/items/devices/uplinks.dm +++ b/code/game/objects/items/devices/uplinks.dm @@ -24,6 +24,9 @@ var/list/world_uplinks = list() var/job = null var/show_descriptions = 0 +/obj/item/device/uplink/nano_host() + return loc + /obj/item/device/uplink/New() ..() welcome = ticker.mode.uplink_welcome @@ -202,7 +205,7 @@ var/list/world_uplinks = list() if (!ui) // the ui does not exist, so we'll create a new() one // for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm - ui = new(user, src, ui_key, "uplink.tmpl", title, 700, 600) + ui = new(user, src, ui_key, "uplink.tmpl", title, 700, 600, state = inventory_state) // when the ui is first opened this is the data it will use ui.set_initial_data(data) // open the new ui window @@ -294,8 +297,8 @@ var/list/world_uplinks = list() qdel(S) user << "Teleporter refunded." else - user << "This teleporter is already used, or is currently being used." - + user << "This teleporter is already used, or is currently being used." + // PRESET UPLINKS // A collection of preset uplinks. // diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 0882cff2921..73d78a19fe4 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -23,15 +23,14 @@ // Reagent ID => friendly name var/list/reagents_to_log=list() -/obj/Topic(href, href_list, var/nowindow = 0, var/datum/topic_state/custom_state = default_state) +/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 && ..()) return 1 // In the far future no checks are made in an overriding Topic() beyond if(..()) return // Instead any such checks are made in CanUseTopic() - var/obj/host = nano_host() - if(host.CanUseTopic(usr, href_list, custom_state) == STATUS_INTERACTIVE) + if(CanUseTopic(usr, state, href_list) == STATUS_INTERACTIVE) CouldUseTopic(usr) return 0 diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 8d7e99f423b..fd4d2a24f26 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -23,10 +23,6 @@ death() return - if (src.machine) - if (!( src.machine.check_eye(src) )) - src.reset_view(null) - // Handle power damage (oxy) if(src:aiRestorePowerRoutine != 0) // Lost power diff --git a/code/modules/mob/living/silicon/ai/nano.dm b/code/modules/mob/living/silicon/ai/nano.dm index 588849116ce..bc624882f45 100644 --- a/code/modules/mob/living/silicon/ai/nano.dm +++ b/code/modules/mob/living/silicon/ai/nano.dm @@ -1,5 +1,5 @@ /mob/living/silicon/ai - var/obj/nano_module/crew_monitor/crew_monitor + var/datum/nano_module/crew_monitor/crew_monitor /mob/living/silicon/ai/proc/init_subsystems() crew_monitor = new(src) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 76a265a7c95..835a4f3e240 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -268,6 +268,18 @@ src.reset_view(C) return 1 +/mob/living/silicon/pai/verb/reset_record_view() + set category = "pAI Commands" + set name = "Reset Records Software" + + securityActive1 = null + securityActive2 = null + security_cannotfind = 0 + medicalActive1 = null + medicalActive2 = null + medical_cannotfind = 0 + nanomanager.update_uis(src) + usr << "You reset your record-viewing software." /mob/living/silicon/pai/cancel_camera() set category = "pAI Commands" diff --git a/code/modules/nano/interaction/admin.dm b/code/modules/nano/interaction/admin.dm new file mode 100644 index 00000000000..412ebbc1260 --- /dev/null +++ b/code/modules/nano/interaction/admin.dm @@ -0,0 +1,7 @@ +/* + This 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) ? STATUS_INTERACTIVE : STATUS_CLOSE diff --git a/code/modules/nano/interaction/base.dm b/code/modules/nano/interaction/base.dm new file mode 100644 index 00000000000..c52248026a4 --- /dev/null +++ b/code/modules/nano/interaction/base.dm @@ -0,0 +1,19 @@ +/datum/proc/nano_host() + return src + +/datum/proc/CanUseTopic(var/mob/user, var/datum/topic_state/state) + var/src_object = nano_host() + return state.can_use_topic(src_object, user) + +/datum/topic_state/proc/href_list(var/mob/user) + return list() + +/datum/topic_state/proc/can_use_topic(var/src_object, var/mob/user) + return STATUS_CLOSE + +/mob/proc/shared_nano_interaction() + if (src.stat || !client) + return STATUS_CLOSE // no updates, close the interface + else if (restrained() || lying || stat || stunned || weakened) + return STATUS_UPDATE // update only (orange visibility) + return STATUS_INTERACTIVE diff --git a/code/modules/nano/interaction/contained.dm b/code/modules/nano/interaction/contained.dm new file mode 100644 index 00000000000..3c84734104a --- /dev/null +++ b/code/modules/nano/interaction/contained.dm @@ -0,0 +1,18 @@ +/* + This state checks if user is somewhere within src_object, as well as the default NanoUI interaction. +*/ +/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) + if(!src_object.contains(user)) + return STATUS_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) diff --git a/code/modules/nano/nanointeraction.dm b/code/modules/nano/interaction/default.dm similarity index 60% rename from code/modules/nano/nanointeraction.dm rename to code/modules/nano/interaction/default.dm index 6380d1faeef..74866333c1c 100644 --- a/code/modules/nano/nanointeraction.dm +++ b/code/modules/nano/interaction/default.dm @@ -1,39 +1,36 @@ -/atom/movable/proc/nano_host() - return src +/var/global/datum/topic_state/default/default_state = new() -/obj/nano_module/nano_host() - return loc +/datum/topic_state/default/href_list(var/mob/user) + return list() +/datum/topic_state/default/can_use_topic(var/src_object, var/mob/user) + return user.default_can_use_topic(src_object) -/atom/movable/proc/CanUseTopic(var/mob/user, href_list, var/datum/topic_state/custom_state) - return user.can_use_topic(nano_host(), custom_state) - - -/mob/proc/can_use_topic(var/mob/user, var/datum/topic_state/custom_state) +/mob/proc/default_can_use_topic(var/src_object) return STATUS_CLOSE // By default no mob can do anything with NanoUI -/mob/dead/observer/can_use_topic() +/mob/dead/observer/default_can_use_topic() if(check_rights(R_ADMIN, 0, src)) return STATUS_INTERACTIVE // Admins are more equal return STATUS_UPDATE // Ghosts can view updates -/mob/living/silicon/pai/can_use_topic(var/src_object) +/mob/living/silicon/pai/default_can_use_topic(var/src_object) if(src_object == src && !stat) return STATUS_INTERACTIVE else return ..() -/mob/living/silicon/robot/can_use_topic(var/src_object, var/datum/topic_state/custom_state) +/mob/living/silicon/robot/default_can_use_topic(var/src_object) if(stat || !client) return STATUS_CLOSE if(lockcharge || stunned || weakened) return STATUS_DISABLED // robots can interact with things they can see within their view range - if(!(custom_state.flags & NANO_IGNORE_DISTANCE) && (src_object in view(src))) + if((src_object in view(src)) && get_dist(src_object, src) <= src.client.view) return STATUS_INTERACTIVE // interactive (green visibility) return STATUS_DISABLED // no updates, completely disabled (red visibility) -/mob/living/silicon/robot/syndicate/can_use_topic(var/src_object) +/mob/living/silicon/robot/syndicate/default_can_use_topic(var/src_object) . = ..() if(. != STATUS_INTERACTIVE) return @@ -48,7 +45,7 @@ return STATUS_INTERACTIVE return STATUS_UPDATE -/mob/living/silicon/ai/can_use_topic(var/src_object) +/mob/living/silicon/ai/default_can_use_topic(var/src_object) if(!client || check_unable(1)) return STATUS_CLOSE // Prevents the AI from using Topic on admin levels (by for example viewing through the court/thunderdome cameras) @@ -69,22 +66,13 @@ return apc_override ? STATUS_INTERACTIVE : STATUS_CLOSE return STATUS_INTERACTIVE - return STATUS_CLOSE + return STATUS_CLOSE -/mob/living/proc/shared_living_nano_interaction(var/src_object) - if (src.stat != CONSCIOUS) - return STATUS_CLOSE // no updates, close the interface - else if (restrained() || lying || stat || stunned || weakened) - return STATUS_UPDATE // update only (orange visibility) - return STATUS_INTERACTIVE +//Some atoms such as vehicles might have special rules for how mobs inside them interact with NanoUI. +/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(!isturf(src_object.loc)) - if(src_object.loc == src) // Item in the inventory - return STATUS_INTERACTIVE - if(src.contents.Find(src_object.loc)) // A hidden uplink inside an item - return STATUS_INTERACTIVE - if (!(src_object in view(4, src))) // If the src object is not in visable, disable updates return STATUS_CLOSE @@ -97,24 +85,17 @@ return STATUS_DISABLED // no updates, completely disabled (red visibility) return STATUS_CLOSE -/mob/living/can_use_topic(var/src_object, var/datum/topic_state/custom_state) - . = shared_living_nano_interaction(src_object) - if(. == STATUS_INTERACTIVE && !(custom_state.flags & NANO_IGNORE_DISTANCE)) - . = shared_living_nano_distance(src_object) +/mob/living/default_can_use_topic(var/src_object) + . = shared_nano_interaction(src_object) + if(. == STATUS_INTERACTIVE) + if(loc) + . = loc.contents_nano_distance(src_object, src) if(STATUS_INTERACTIVE) return STATUS_UPDATE -/mob/living/carbon/human/can_use_topic(var/src_object, var/datum/topic_state/custom_state) - . = shared_living_nano_interaction(src_object) - if(. == STATUS_INTERACTIVE && !(custom_state.flags & NANO_IGNORE_DISTANCE)) +/mob/living/carbon/human/default_can_use_topic(var/src_object) + . = shared_nano_interaction(src_object) + if(. == STATUS_INTERACTIVE) . = shared_living_nano_distance(src_object) if(. == STATUS_UPDATE && (TK in mutations)) // If we have telekinesis and remain close enough, allow interaction. return STATUS_INTERACTIVE - -/var/global/datum/topic_state/default_state = new() - -/datum/topic_state - var/flags = 0 - -/datum/topic_state/proc/href_list(var/mob/user) - return list() \ No newline at end of file diff --git a/code/modules/nano/interaction/inventory.dm b/code/modules/nano/interaction/inventory.dm new file mode 100644 index 00000000000..ccfbb695a99 --- /dev/null +++ b/code/modules/nano/interaction/inventory.dm @@ -0,0 +1,10 @@ +/* + 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). +*/ +/var/global/datum/topic_state/inventory_state/inventory_state = new() + +/datum/topic_state/inventory_state/can_use_topic(var/src_object, var/mob/user) + if(!(src_object in user)) + return STATUS_CLOSE + + return user.shared_nano_interaction() diff --git a/code/modules/nano/interaction/zlevel.dm b/code/modules/nano/interaction/zlevel.dm new file mode 100644 index 00000000000..15052bc6636 --- /dev/null +++ b/code/modules/nano/interaction/zlevel.dm @@ -0,0 +1,13 @@ +/* + This state checks that the user is on the same Z-level as src_object +*/ + +/var/global/datum/topic_state/z_state/z_state = new() + +/datum/topic_state/z_state/can_use_topic(var/src_object, var/mob/user) + var/turf/turf_obj = get_turf(src_object) + var/turf/turf_usr = get_turf(user) + if(!turf_obj || !turf_usr) + return STATUS_CLOSE + + return turf_obj.z == turf_usr.z ? STATUS_INTERACTIVE : STATUS_CLOSE diff --git a/code/modules/nano/modules/crew_monitor.dm b/code/modules/nano/modules/crew_monitor.dm index c27c0446395..57a968f828e 100644 --- a/code/modules/nano/modules/crew_monitor.dm +++ b/code/modules/nano/modules/crew_monitor.dm @@ -1,29 +1,24 @@ -/obj/nano_module/crew_monitor +/datum/nano_module/crew_monitor name = "Crew monitor" var/list/tracked = new -/obj/nano_module/crew_monitor/Topic(href, href_list) +/datum/nano_module/crew_monitor/Topic(href, href_list) if(..()) return - var/turf/T = get_turf(src) + var/turf/T = get_turf(host) if (!T || !(T.z in config.player_levels)) usr << "Unable to establish a connection: You're too far away from the station!" return 0 if(href_list["close"] ) var/mob/user = usr var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, "main") - usr.unset_machine() ui.close() return 0 - if(href_list["update"]) - src.updateDialog() - return 1 -/obj/nano_module/crew_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) - user.set_machine(src) +/datum/nano_module/crew_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) src.scan() var/data[0] - var/turf/T = get_turf(src) + var/turf/T = get_turf(host) var/list/crewmembers = list() for(var/obj/item/clothing/under/C in src.tracked) @@ -79,7 +74,7 @@ // should make the UI auto-update; doesn't seem to? ui.set_auto_update(1) -/obj/nano_module/crew_monitor/proc/scan() +/datum/nano_module/crew_monitor/proc/scan() for(var/mob/living/carbon/human/H in mob_list) if(istype(H.w_uniform, /obj/item/clothing/under)) var/obj/item/clothing/under/C = H.w_uniform diff --git a/code/modules/nano/modules/nano_module.dm b/code/modules/nano/modules/nano_module.dm new file mode 100644 index 00000000000..d33b59528f9 --- /dev/null +++ b/code/modules/nano/modules/nano_module.dm @@ -0,0 +1,12 @@ +/datum/nano_module + var/name + var/host + +/datum/nano_module/New(var/host) + src.host = host + +/datum/nano_module/nano_host() + return host ? host : src + +/datum/nano_module/proc/can_still_topic(var/datum/topic_state/state = default_state) + return CanUseTopic(usr, state) == STATUS_INTERACTIVE diff --git a/code/modules/nano/nanoexternal.dm b/code/modules/nano/nanoexternal.dm index b029019f1a3..08f9deffa9f 100644 --- a/code/modules/nano/nanoexternal.dm +++ b/code/modules/nano/nanoexternal.dm @@ -37,7 +37,7 @@ * * @return nothing */ -/atom/movable/proc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/nano_ui/master_ui = null, var/datum/topic_state/custom_state = null) +/datum/proc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/nano_ui/master_ui = null, var/datum/topic_state/state = default_state) return // Used by the Nano UI Manager (/datum/nanomanager) to track UIs opened by this mob diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm index 592644ba17b..7d5ebc18868 100644 --- a/code/modules/nano/nanoui.dm +++ b/code/modules/nano/nanoui.dm @@ -10,7 +10,7 @@ nanoui is used to open and update nano browser uis // the user who opened this ui var/mob/user // the object this ui "belongs" to - var/atom/movable/src_object + var/datum/src_object // the title of this ui var/title // the key of this ui, this is to allow multiple (different) uis for each src_object @@ -55,7 +55,7 @@ nanoui is used to open and update nano browser uis // Relationship between a master interface and its children. Used in update_status var/datum/nanoui/master_ui var/list/datum/nanoui/children = list() - var/datum/topic_state/custom_state = null + var/datum/topic_state/state = null /** * Create a new nanoui instance. @@ -71,7 +71,7 @@ nanoui is used to open and update nano browser uis * * @return /nanoui new nanoui object */ -/datum/nanoui/New(nuser, nsrc_object, nui_key, ntemplate_filename, ntitle = 0, nwidth = 0, nheight = 0, var/atom/nref = null, var/datum/nanoui/master_ui = null, var/datum/topic_state/custom_state = default_state) +/datum/nanoui/New(nuser, nsrc_object, nui_key, ntemplate_filename, ntitle = 0, nwidth = 0, nheight = 0, var/atom/nref = null, var/datum/nanoui/master_ui = null, var/datum/topic_state/state = default_state) user = nuser src_object = nsrc_object ui_key = nui_key @@ -80,7 +80,7 @@ nanoui is used to open and update nano browser uis src.master_ui = master_ui if(master_ui) master_ui.children += src - src.custom_state = custom_state + src.state = state // add the passed template filename as the "main" template, this is required add_template("main", ntemplate_filename) @@ -140,8 +140,7 @@ nanoui is used to open and update nano browser uis * @return nothing */ /datum/nanoui/proc/update_status(var/push_update = 0) - var/atom/movable/host = src_object.nano_host() - var/new_status = host.CanUseTopic(user, list(), custom_state) + var/new_status = src_object.CanUseTopic(user, state) if(master_ui) new_status = min(new_status, master_ui.status) @@ -177,7 +176,7 @@ nanoui is used to open and update nano browser uis /datum/nanoui/proc/get_config_data() var/list/config_data = list( "title" = title, - "srcObject" = list("name" = src_object.name), + "srcObject" = list("name" = "[src_object]"), "stateKey" = state_key, "status" = status, "autoUpdateLayout" = auto_update_layout, @@ -467,7 +466,7 @@ nanoui is used to open and update nano browser uis set_map_z_level(text2num(href_list["mapZLevel"])) map_update = 1 - if ((src_object && src_object.Topic(href, href_list, 0, custom_state)) || map_update) + if ((src_object && src_object.Topic(href, href_list, 0, state)) || map_update) nanomanager.update_uis(src_object) // update all UIs attached to src_object /** @@ -494,4 +493,4 @@ nanoui is used to open and update nano browser uis * @return nothing */ /datum/nanoui/proc/update(var/force_open = 0) - src_object.ui_interact(user, ui_key, src, force_open, master_ui, custom_state) + src_object.ui_interact(user, ui_key, src, force_open, master_ui, state) diff --git a/nano/templates/door_control.tmpl b/nano/templates/door_control.tmpl index 82f29825dbf..3c8dc66afb7 100644 --- a/nano/templates/door_control.tmpl +++ b/nano/templates/door_control.tmpl @@ -50,9 +50,9 @@ Electrified Status:
- {{:helper.link('Offline' , null, {'command' : 'electrify_permanently', 'activate' : "0" }, null, data.electrified == 0 ? 'selected' : null)}} + {{:helper.link('Offline' , null, {'command' : 'electrify_permanently', 'activate' : "0" }, data.electrified == 0 ? 'selected' : null)}} {{:helper.link(data.electrified <= 0 ? 'Temporary (30s)' : 'Temporary (' + data.electrified +'s)', null, {'command' : 'electrify_temporary', 'activate' : "1"}, null, data.electrified > 0 ? 'redButton' : null)}} - {{:helper.link('Permanent', null, {'command' : 'electrify_permanently', 'activate' : "1"}, null, data.electrified == -1 ? 'redButton' : null)}} + {{:helper.link('Permanent', null, {'command' : 'electrify_permanently', 'activate' : "1"}, data.electrified == -1 ? 'redButton' : null)}}
@@ -62,8 +62,8 @@ {{for data.commands}} {{:value.name}}: - {{:helper.link(value.enabled, null, {'command' : value.command, 'activate' : value.act ? 1 : 0}, null, value.active ? 'selected' : null)}} - {{:helper.link(value.disabled,null, {'command' : value.command, 'activate' : value.act ? 0 : 1}, null,!value.active ? (value.danger ? 'redButton' : 'selected') : null)}} + {{:helper.link(value.enabled, null, {'command' : value.command, 'activate' : value.act ? 1 : 0}, value.active ? 'selected' : null)}} + {{:helper.link(value.disabled, null, {'command' : value.command, 'activate' : value.act ? 0 : 1}, !value.active ? (value.danger ? 'redButton' : 'selected') : null)}} {{/for}} diff --git a/paradise.dme b/paradise.dme index 7e7ae3846cf..4b6229b447e 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1470,11 +1470,17 @@ #include "code\modules\nano\JSON Reader.dm" #include "code\modules\nano\JSON Writer.dm" #include "code\modules\nano\nanoexternal.dm" -#include "code\modules\nano\nanointeraction.dm" #include "code\modules\nano\nanomanager.dm" #include "code\modules\nano\nanomapgen.dm" #include "code\modules\nano\nanoui.dm" +#include "code\modules\nano\interaction\admin.dm" +#include "code\modules\nano\interaction\base.dm" +#include "code\modules\nano\interaction\contained.dm" +#include "code\modules\nano\interaction\default.dm" +#include "code\modules\nano\interaction\inventory.dm" +#include "code\modules\nano\interaction\zlevel.dm" #include "code\modules\nano\modules\crew_monitor.dm" +#include "code\modules\nano\modules\nano_module.dm" #include "code\modules\ninja\energy_katana.dm" #include "code\modules\ninja\suit\gloves.dm" #include "code\modules\ninja\suit\head.dm"