refactoring altclick interaction to allow parent calls without forcing the turf contents stat menu open.
This commit is contained in:
+8
-3
@@ -114,7 +114,8 @@
|
||||
/mob/living/silicon/ai/CtrlClickOn(var/atom/A)
|
||||
A.AICtrlClick(src)
|
||||
/mob/living/silicon/ai/AltClickOn(var/atom/A)
|
||||
A.AIAltClick(src)
|
||||
if(!A.AIAltClick(src))
|
||||
altclick_listed_turf(A)
|
||||
|
||||
/*
|
||||
The following criminally helpful code is just the previous code cleaned up;
|
||||
@@ -125,9 +126,10 @@
|
||||
/* Atom Procs */
|
||||
/atom/proc/AICtrlClick()
|
||||
return
|
||||
|
||||
/atom/proc/AIAltClick(mob/living/silicon/ai/user)
|
||||
AltClick(user)
|
||||
return
|
||||
return AltClick(user)
|
||||
|
||||
/atom/proc/AIShiftClick()
|
||||
return
|
||||
/atom/proc/AICtrlShiftClick()
|
||||
@@ -151,6 +153,7 @@
|
||||
shock_perm(usr)
|
||||
else
|
||||
shock_restore(usr)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/door/airlock/AIShiftClick() // Opens and closes doors!
|
||||
if(obj_flags & EMAGGED)
|
||||
@@ -185,10 +188,12 @@
|
||||
return
|
||||
toggle_on()
|
||||
add_fingerprint(usr)
|
||||
return TRUE
|
||||
|
||||
/* Holopads */
|
||||
/obj/machinery/holopad/AIAltClick(mob/living/silicon/ai/user)
|
||||
hangup_all_calls()
|
||||
return TRUE
|
||||
|
||||
//
|
||||
// Override TurfAdjacent for AltClicking
|
||||
|
||||
+12
-14
@@ -353,8 +353,17 @@
|
||||
Unused except for AI
|
||||
*/
|
||||
/mob/proc/AltClickOn(atom/A)
|
||||
A.AltClick(src)
|
||||
return
|
||||
if(!A.AltClick(src))
|
||||
altclick_listed_turf(A)
|
||||
|
||||
/mob/proc/altclick_listed_turf(atom/A)
|
||||
var/turf/T = get_turf(A)
|
||||
if(T == A.loc || T == A)
|
||||
if(T == listed_turf)
|
||||
listed_turf = null
|
||||
else if(TurfAdjacent(T))
|
||||
listed_turf = T
|
||||
client.statpanel = T.name
|
||||
|
||||
/mob/living/carbon/AltClickOn(atom/A)
|
||||
if(!stat && mind && iscarbon(A) && A != src)
|
||||
@@ -366,18 +375,7 @@
|
||||
..()
|
||||
|
||||
/atom/proc/AltClick(mob/user)
|
||||
SEND_SIGNAL(src, COMSIG_CLICK_ALT, user)
|
||||
var/turf/T = get_turf(src)
|
||||
if(T && user.TurfAdjacent(T))
|
||||
user.listed_turf = T
|
||||
user.client.statpanel = T.name
|
||||
|
||||
// Use this instead of /mob/proc/AltClickOn(atom/A) where you only want turf content listing without additional atom alt-click interaction
|
||||
/atom/proc/AltClickNoInteract(mob/user, atom/A)
|
||||
var/turf/T = get_turf(A)
|
||||
if(T && user.TurfAdjacent(T))
|
||||
user.listed_turf = T
|
||||
user.client.statpanel = T.name
|
||||
. = SEND_SIGNAL(src, COMSIG_CLICK_ALT, user)
|
||||
|
||||
/mob/proc/TurfAdjacent(turf/T)
|
||||
return T.Adjacent(src)
|
||||
|
||||
@@ -110,7 +110,8 @@
|
||||
/mob/living/silicon/robot/CtrlClickOn(atom/A)
|
||||
A.BorgCtrlClick(src)
|
||||
/mob/living/silicon/robot/AltClickOn(atom/A)
|
||||
A.BorgAltClick(src)
|
||||
if(!A.BorgAltClick(src))
|
||||
altclick_listed_turf(A)
|
||||
|
||||
/atom/proc/BorgCtrlShiftClick(mob/living/silicon/robot/user) //forward to human click if not overridden
|
||||
CtrlShiftClick(user)
|
||||
@@ -154,20 +155,17 @@
|
||||
..()
|
||||
|
||||
/atom/proc/BorgAltClick(mob/living/silicon/robot/user)
|
||||
AltClick(user)
|
||||
return
|
||||
return AltClick(user)
|
||||
|
||||
/obj/machinery/door/airlock/BorgAltClick(mob/living/silicon/robot/user) // Eletrifies doors. Forwards to AI code.
|
||||
if(get_dist(src,user) <= user.interaction_range)
|
||||
AIAltClick()
|
||||
else
|
||||
..()
|
||||
return AIAltClick()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/turretid/BorgAltClick(mob/living/silicon/robot/user) //turret lethal on/off. Forwards to AI code.
|
||||
if(get_dist(src,user) <= user.interaction_range)
|
||||
AIAltClick()
|
||||
else
|
||||
..()
|
||||
return AIAltClick()
|
||||
return ..()
|
||||
|
||||
/*
|
||||
As with AI, these are not used in click code,
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
moved = FALSE
|
||||
user.update_action_buttons(TRUE)
|
||||
to_chat(user, "<span class='notice'>Action button positions have been reset.</span>")
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(datum/hud/owner_hud)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
ShiftClickOn(A)
|
||||
return
|
||||
if(modifiers["alt"])
|
||||
AltClickNoInteract(src, A)
|
||||
altclick_listed_turf(A)
|
||||
return
|
||||
if(modifiers["ctrl"])
|
||||
CtrlClickOn(A)
|
||||
|
||||
Reference in New Issue
Block a user