diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm index 6945729b5f..7767ecd307 100644 --- a/code/game/objects/items/devices/aicard.dm +++ b/code/game/objects/items/devices/aicard.dm @@ -67,7 +67,7 @@ /obj/item/device/aicard/Topic(href, href_list) var/mob/U = usr - if (!(get_turf(U) == get_turf(src)) || U.machine != src)//If they are not in range of 1 or less or their machine is not the card (ie, clicked on something else). + if (get_dist(get_turf(U),get_turf(src)) > 1 || U.machine != src)//If they are not in range of 1 or less or their machine is not the card (ie, clicked on something else). U << browse(null, "window=aicard") U.unset_machine() return diff --git a/code/modules/clothing/spacesuits/rig/modules/computer.dm b/code/modules/clothing/spacesuits/rig/modules/computer.dm index 7b7e2374d4..71293ef450 100644 --- a/code/modules/clothing/spacesuits/rig/modules/computer.dm +++ b/code/modules/clothing/spacesuits/rig/modules/computer.dm @@ -138,11 +138,15 @@ if(ai_card) if(istype(ai_card, /obj/item/device/aicard)) - if(integrated_ai && integrated_ai.client) + if(integrated_ai && !integrated_ai.stat) if(user) user << "You cannot eject your currently stored AI. Purge it manually." return 0 - del(ai_card) + user << "You purge the remaining scraps of data from your previous AI, freeing it for use." + if(integrated_ai) + integrated_ai.ghostize() + del(integrated_ai) + if(ai_card) del(ai_card) else if(user) user.put_in_hands(ai_card) else diff --git a/code/modules/nano/nanoui.dm b/code/modules/nano/nanoui.dm index b4d2015538..91e97c0cb5 100644 --- a/code/modules/nano/nanoui.dm +++ b/code/modules/nano/nanoui.dm @@ -11,7 +11,7 @@ nanoui is used to open and update nano browser uis #define STATUS_UPDATE 1 // ORANGE Visability #define STATUS_DISABLED 0 // RED Visability -/datum/nanoui +/datum/nanoui // the user who opened this ui var/mob/user // the object this ui "belongs" to @@ -103,13 +103,13 @@ nanoui is used to open and update nano browser uis add_script("libraries.min.js") // A JS file comprising of jQuery, doT.js and jQuery Timer libraries (compressed together) add_script("nano_utility.js") // The NanoUtility JS, this is used to store utility functions. add_script("nano_template.js") // The NanoTemplate JS, this is used to render templates. - add_script("nano_state_manager.js") // The NanoStateManager JS, it handles updates from the server and passes data to the current state - add_script("nano_state.js") // The NanoState JS, this is the base state which all states must inherit from - add_script("nano_state_default.js") // The NanoStateDefault JS, this is the "default" state (used by all UIs by default), which inherits from NanoState + add_script("nano_state_manager.js") // The NanoStateManager JS, it handles updates from the server and passes data to the current state + add_script("nano_state.js") // The NanoState JS, this is the base state which all states must inherit from + add_script("nano_state_default.js") // The NanoStateDefault JS, this is the "default" state (used by all UIs by default), which inherits from NanoState add_script("nano_base_callbacks.js") // The NanoBaseCallbacks JS, this is used to set up (before and after update) callbacks which are common to all UIs add_script("nano_base_helpers.js") // The NanoBaseHelpers JS, this is used to set up template helpers which are common to all UIs add_stylesheet("shared.css") // this CSS sheet is common to all UIs - add_stylesheet("icons.css") // this CSS sheet is common to all UIs + add_stylesheet("icons.css") // this CSS sheet is common to all UIs /** * Set the current status (also known as visibility) of this ui. @@ -127,7 +127,7 @@ nanoui is used to open and update nano browser uis update() else status = state - if (push_update || status == 0) + if (push_update || status == 0) push_data(null, 1) // Update the UI, force the update in case the status is 0, data is null so that previous data is used /** @@ -138,7 +138,7 @@ nanoui is used to open and update nano browser uis * @return nothing */ /datum/nanoui/proc/update_status(var/push_update = 0) - if (istype(user, /mob/living/silicon/ai)) + if (istype(user, /mob/living/silicon/ai) || (get_dist(get_turf(user),get_turf(src_object)) <= 1)) set_status(STATUS_INTERACTIVE, push_update) // interactive (green visibility) else if (istype(user, /mob/living/silicon/robot)) if (src_object in view(7, user)) // robots can see and interact with things they can see within 7 tiles @@ -151,12 +151,12 @@ nanoui is used to open and update nano browser uis if (dist > 4) close() return - + if ((allowed_user_stat > -1) && (user.stat > allowed_user_stat)) set_status(STATUS_DISABLED, push_update) // no updates, completely disabled (red visibility) else if (user.restrained() || user.lying) set_status(STATUS_UPDATE, push_update) // update only (orange visibility) - else if (istype(src_object, /obj/item/device/uplink/hidden)) // You know what if they have the uplink open let them use the UI + else if (istype(src_object, /obj/item/device/uplink/hidden)) // You know what if they have the uplink open let them use the UI set_status(STATUS_INTERACTIVE, push_update) // Will build in distance checks on the topics for sanity. else if (!(src_object in view(4, user))) // If the src object is not in visable, set status to 0 set_status(STATUS_DISABLED, push_update) // interactive (green visibility) @@ -203,7 +203,7 @@ nanoui is used to open and update nano browser uis "showMap" = show_map, "mapZLevel" = map_z_level, "user" = list("name" = user.name) - ) + ) return config_data /** @@ -215,12 +215,12 @@ nanoui is used to open and update nano browser uis */ /datum/nanoui/proc/get_send_data(var/list/data) var/list/config_data = get_config_data() - + var/list/send_data = list("config" = config_data) - + if (!isnull(data)) send_data["data"] = data - + return send_data /** @@ -267,11 +267,11 @@ nanoui is used to open and update nano browser uis */ /datum/nanoui/proc/add_template(key, filename) templates[key] = filename - + /** * Set the layout key for use in the frontend Javascript * The layout key is the basic layout key for the page - * Two files are loaded on the client based on the layout key varable: + * Two files are loaded on the client based on the layout key varable: * -> a template in /nano/templates with the filename "layout_.tmpl * -> a CSS stylesheet in /nano/css with the filename "layout_.css * @@ -301,7 +301,7 @@ nanoui is used to open and update nano browser uis */ /datum/nanoui/proc/set_auto_update_content(nstate) auto_update_content = nstate - + /** * Set the state key for use in the frontend Javascript * @@ -310,8 +310,8 @@ nanoui is used to open and update nano browser uis * @return nothing */ /datum/nanoui/proc/set_state_key(nstate_key) - state_key = nstate_key - + state_key = nstate_key + /** * Toggle showing the map ui * @@ -321,7 +321,7 @@ nanoui is used to open and update nano browser uis */ /datum/nanoui/proc/set_show_map(nstate) show_map = nstate - + /** * Toggle showing the map ui * @@ -352,15 +352,15 @@ nanoui is used to open and update nano browser uis // before the UI opens, add the layout files based on the layout key add_stylesheet("layout_[layout_key].css") add_template("layout", "layout_[layout_key].tmpl") - + var/head_content = "" - + for (var/filename in scripts) head_content += " " - + for (var/filename in stylesheets) head_content += " " - + var/template_data_json = "{}" // An empty JSON object if (templates.len > 0) template_data_json = list2json(templates) @@ -378,7 +378,7 @@ nanoui is used to open and update nano browser uis [head_content] - +