Merge pull request #1437 from Citadel-Station-13/upstream-merge-28100

[MIRROR] Hang up holocalls with an action
This commit is contained in:
LetterJay
2017-06-06 13:30:19 -05:00
committed by GitHub
3 changed files with 38 additions and 22 deletions
+28 -7
View File
@@ -1,4 +1,3 @@
#define HOLOPAD_MAX_DIAL_TIME 200
/mob/camera/aiEye/remote/holo/setLoc()
@@ -16,6 +15,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
@@ -43,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
@@ -140,6 +147,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 +171,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)
+10
View File
@@ -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()
-15
View File
@@ -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