From 1bf07a3065a68ff6554994d7c1be53df586abb02 Mon Sep 17 00:00:00 2001 From: Giacomand Date: Mon, 14 Oct 2013 17:23:53 +0100 Subject: [PATCH] * The AI can now use alt click to get a list of objects and the turf for easy access. * The AI can interact with all the items in the list. * The AI can use this for several things: * Since the list will not dissappear for the AI, until there's no camera coverage, they can use it to bookmark a single tile to interact while not having to look at it. * They can also use this to quickly jump to the listed turf. * They can interact with objects under other objects. * Made the CTRL Click on the APC directly use the toggle_breaker() proc. --- code/_onclick/ai.dm | 16 ++++++++++++---- code/_onclick/click.dm | 7 +++++-- code/modules/mob/mob.dm | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index 50c1122b312..7a91b87767a 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -45,7 +45,7 @@ if(modifiers["ctrl"]) CtrlClickOn(A) return - + if(control_disabled || stat || world.time <= next_move) return next_move = world.time + 9 @@ -113,11 +113,12 @@ else Topic("aiDisable=4", list("aiDisable"="4"), 1) -/obj/machinery/power/apc/AICtrlClick() // turns off APCs. - Topic("breaker=1", list("breaker"="1"), 0) // 0 meaning no window (consistency! wait...) +/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs. + toggle_breaker() -/atom/proc/AIAltClick() +/atom/proc/AIAltClick(var/mob/living/silicon/ai/user) + AltClick(user) return /obj/machinery/door/airlock/AIAltClick() // Eletrifies doors. @@ -128,3 +129,10 @@ // disable/6 is not in Topic; disable/5 disables both temporary and permenant shock Topic("aiDisable=5", list("aiDisable"="5"), 1) return + +// +// Override TurfAdjacent for AltClicking +// + +/mob/living/silicon/ai/TurfAdjacent(var/turf/T) + return (cameranet && cameranet.checkTurfVis(T)) \ No newline at end of file diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 5ece365899c..a4774005035 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -55,7 +55,7 @@ if(modifiers["ctrl"]) CtrlClickOn(A) return - + if(stat || paralysis || stunned || weakened) return @@ -243,7 +243,7 @@ /atom/proc/AltClick(var/mob/user) var/turf/T = get_turf(src) - if(T && T.Adjacent(user)) + if(T && user.TurfAdjacent(T)) if(user.listed_turf == T) user.listed_turf = null else @@ -251,6 +251,9 @@ user.client.statpanel = T.name return +/mob/proc/TurfAdjacent(var/turf/T) + return T.Adjacent(src) + /* Misc helpers diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d1331a4e860..019baa2e5cf 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -656,7 +656,7 @@ note dizziness decrements automatically in the mob's Life() proc. stat(null,"MasterController-ERROR") if(listed_turf && client) - if(get_dist(listed_turf,src) > 1) + if(!TurfAdjacent(listed_turf)) listed_turf = null else statpanel(listed_turf.name, null, listed_turf)