Carded AIs can no longer access cameras through camera consoles.

Also includes fixes for hidden uplinks.
This commit is contained in:
PsiOmega
2015-02-03 21:21:58 +01:00
parent 21a0aa05e5
commit 566f6a104e
6 changed files with 47 additions and 43 deletions

View File

@@ -128,6 +128,10 @@
//don't need to check if the camera works for AI because the AI jumps to the camera location and doesn't actually look through cameras.
if(isAI(user))
var/mob/living/silicon/ai/A = user
// Only allow non-carded AIs to view because the interaction with the eye gets all wonky otherwise.
if(!A.is_in_chassis())
return 0
A.eyeobj.setLoc(get_turf(C))
A.client.eye = A.eyeobj
return 1

View File

@@ -187,17 +187,9 @@ Class Procs:
/obj/machinery/Topic(href, href_list, var/nowindow = 0, var/checkrange = 1)
if(..())
return 1
if(!can_be_used_by(usr, be_close = checkrange))
return 1
add_fingerprint(usr)
return 0
/obj/machinery/proc/can_be_used_by(mob/user, be_close = 1)
if(!interact_offline && stat & (NOPOWER|BROKEN))
return 0
if(user.can_interact_with_interface(src, be_close) != STATUS_INTERACTIVE)
return 0
return 1
return 0
////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -108,6 +108,9 @@ datum/nano_item_lists
return pick(random_items)
/obj/item/device/uplink/Topic(href, href_list)
if(..())
return 1
if(href_list["buy_item"] == "random")
var/datum/uplink_item/UI = chooseRandomItem()
href_list["buy_item"] = UI.reference
@@ -208,10 +211,10 @@ datum/nano_item_lists
// The purchasing code.
/obj/item/device/uplink/hidden/Topic(href, href_list)
if (usr.stat || usr.restrained())
return
return 1
if (!( istype(usr, /mob/living/carbon/human)))
return 0
return 1
var/mob/user = usr
var/datum/nanoui/ui = nanomanager.get_open_ui(user, src, "main")
if ((usr.contents.Find(src.loc) || (in_range(src.loc, usr) && istype(src.loc.loc, /turf))))

View File

@@ -16,11 +16,14 @@
var/damtype = "brute"
var/force = 0
/obj/Topic(href, href_list, var/nowindow = 0)
/obj/Topic(href, href_list, var/nowindow = 0, var/checkrange = 1)
// Calling Topic without a corresponding window open causes runtime errors
if(nowindow)
if(!nowindow && ..())
return 1
if(usr.can_interact_with_interface(src, checkrange) != STATUS_INTERACTIVE)
return 1
add_fingerprint(usr)
return 0
return ..()
/obj/item/proc/is_used_on(obj/O, mob/user)

View File

@@ -766,5 +766,8 @@ var/list/ai_verbs_default = list(
return 1
return 0
/mob/living/silicon/ai/proc/is_in_chassis()
return istype(loc, /turf)
#undef AI_CHECK_WIRELESS
#undef AI_CHECK_RADIO

View File

@@ -183,36 +183,37 @@ nanoui is used to open and update nano browser uis
if(!T || !(z == T.z || (T.z in config.player_levels)))
return STATUS_CLOSE
// If loc is a turf then we're an operational AI chassi
if(istype(loc, /turf))
// If an object is in view then we can interact with it
if(src_object in view(client.view, src))
return STATUS_INTERACTIVE
// If we're installed in a chassi, rather than transfered to an inteliCard or other container, then check if we have camera view
if(is_in_chassis())
//stop AIs from leaving windows open and using then after they lose vision
//apc_override is needed here because AIs use their own APC when powerless
if(cameranet && !cameranet.checkTurfVis(get_turf(src_object)))
return apc_override ? STATUS_INTERACTIVE : STATUS_CLOSE
return STATUS_INTERACTIVE
// If the loc isn't a turf then the AI has been transfered to an inteliCard (or other container). Objects must now be in view to be interacted with.
if(src_object in view(client.view, src))
return STATUS_INTERACTIVE
return STATUS_CLOSE
/mob/living/proc/shared_living_nano_interaction(var/atom/movable/src_object)
if(!isturf(src_object.loc) && src_object.loc != src)
return STATUS_CLOSE
var/dist = get_dist(src_object, src)
if (dist > 4)
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)
else if (!(src_object in view(4, src))) // If the src object is not in visable, disable updates
return STATUS_DISABLED
return STATUS_INTERACTIVE
/mob/living/proc/shared_living_nano_distance(var/src_object)
/mob/living/proc/shared_living_nano_distance(var/atom/movable/src_object)
if(!isturf(src_object.loc))
if(src.contents.Find(src_object.loc)) // This is a hidden uplink
return STATUS_INTERACTIVE
if(src_object.loc != src)
return STATUS_CLOSE
if (!(src_object in view(4, src))) // If the src object is not in visable, disable updates
return STATUS_CLOSE
var/dist = get_dist(src_object, src)
if (dist <= 1)
return STATUS_INTERACTIVE // interactive (green visibility)
@@ -220,22 +221,20 @@ nanoui is used to open and update nano browser uis
return STATUS_UPDATE // update only (orange visibility)
else if (dist <= 4)
return STATUS_DISABLED // no updates, completely disabled (red visibility)
return STATUS_CLOSE
/mob/living/can_interact_with_interface(var/src_object)
/mob/living/can_interact_with_interface(var/src_object, var/be_close = 1)
. = shared_living_nano_interaction(src_object)
if(. == STATUS_INTERACTIVE)
if(. == STATUS_INTERACTIVE && be_close)
. = shared_living_nano_distance(src_object)
if(STATUS_INTERACTIVE)
return STATUS_UPDATE
/mob/living/carbon/human/can_interact_with_interface(var/src_object, var/be_close = 1)
. = shared_living_nano_interaction(src_object)
if(. == STATUS_INTERACTIVE)
if (istype(src_object, /obj/item/device/uplink/hidden)) // You know what if they have the uplink open let them use the UI
return STATUS_INTERACTIVE // Will build in distance checks on the topics for sanity.
if(be_close)
if(. == STATUS_INTERACTIVE && be_close)
. = shared_living_nano_distance(src_object)
if(. == STATUS_DISABLED && (TK in mutations))
if(. == STATUS_UPDATE && (TK in mutations)) // If we have telekinesis and remain close enough, allow interaction.
return STATUS_INTERACTIVE
/**