From 98e2a659f4224e98874c2bf243182624571f3974 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Tue, 6 Jun 2017 10:34:58 -0500 Subject: [PATCH 1/2] Hang up holocalls with an action --- code/datums/holocall.dm | 15 +++++++++++++++ code/datums/holocall.dm.rej | 10 ++++++++++ code/game/machinery/hologram.dm | 15 --------------- 3 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 code/datums/holocall.dm.rej diff --git a/code/datums/holocall.dm b/code/datums/holocall.dm index 8ad760ef8e..ccfb39637c 100644 --- a/code/datums/holocall.dm +++ b/code/datums/holocall.dm @@ -16,6 +16,7 @@ var/mob/camera/aiEye/remote/holo/eye //user's eye, once connected var/obj/effect/overlay/holo_pad_hologram/hologram //user's hologram, once connected + var/datum/action/innate/end_holocall/hangup //hangup action var/call_start_time @@ -140,6 +141,8 @@ user.reset_perspective(eye) eye.setLoc(H.loc) + hangup = new(eye, src) + //Checks the validity of a holocall and qdels itself if it's not. Returns TRUE if valid, FALSE otherwise /datum/holocall/proc/Check() for(var/I in dialed_holopads) @@ -162,3 +165,15 @@ if(!.) testing("Holocall Check fail") qdel(src) + +/datum/action/innate/end_holocall + name = "End Holocall" + button_icon_state = "camera_off" + var/datum/holocall/hcall + +/datum/action/innate/end_holocall/New(Target, datum/holocall/HC) + ..() + hcall = HC + +/datum/action/innate/end_holocall/Activate() + hcall.Disconnect(hcall.calling_holopad) diff --git a/code/datums/holocall.dm.rej b/code/datums/holocall.dm.rej new file mode 100644 index 0000000000..08110adedc --- /dev/null +++ b/code/datums/holocall.dm.rej @@ -0,0 +1,10 @@ +diff a/code/datums/holocall.dm b/code/datums/holocall.dm (rejected hunks) +@@ -42,6 +43,8 @@ + + //cleans up ALL references :) + /datum/holocall/Destroy() ++ QDEL_NULL(hangup) ++ + var/user_good = !QDELETED(user) + if(user_good) + user.reset_perspective() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index e58b5e8468..d0303d47f6 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -105,26 +105,11 @@ Possible to do for anyone motivated enough: return return ..() -/obj/machinery/holopad/proc/CheckCallClose() - for(var/I in holo_calls) - var/datum/holocall/HC = I - if(usr == HC.eye) - HC.Disconnect(HC.calling_holopad) //disconnect via clicking the called holopad - return TRUE - return FALSE - -/obj/machinery/holopad/Click(location,control,params) - if(!CheckCallClose()) - return ..() - /obj/machinery/holopad/AltClick(mob/living/carbon/human/user) if(isAI(user)) hangup_all_calls() return - if(!CheckCallClose()) - interact(user) - /obj/machinery/holopad/interact(mob/living/carbon/human/user) //Carn: Hologram requests. if(!istype(user)) return From 8273877b23a44f7e52578173deeef9d8a6f2baa9 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Tue, 6 Jun 2017 13:05:38 -0500 Subject: [PATCH 2/2] Update holocall.dm --- code/datums/holocall.dm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/code/datums/holocall.dm b/code/datums/holocall.dm index ccfb39637c..4e7490f8ee 100644 --- a/code/datums/holocall.dm +++ b/code/datums/holocall.dm @@ -1,4 +1,3 @@ - #define HOLOPAD_MAX_DIAL_TIME 200 /mob/camera/aiEye/remote/holo/setLoc() @@ -44,15 +43,22 @@ //cleans up ALL references :) /datum/holocall/Destroy() - if(!QDELETED(user)) + QDEL_NULL(hangup) + + var/user_good = !QDELETED(user) + if(user_good) user.reset_perspective() - if(user.client) + user.remote_control = null + + if(!QDELETED(eye)) + if(user_good && user.client) for(var/datum/camerachunk/chunk in eye.visibleCameraChunks) chunk.remove(eye) - user.remote_control = null - user = null - QDEL_NULL(eye) - + qdel(eye) + eye = null + + user = null + if(hologram) hologram.HC = null hologram = null