Hang up holocalls with an action

This commit is contained in:
CitadelStationBot
2017-06-06 10:34:58 -05:00
parent 629a417177
commit 98e2a659f4
3 changed files with 25 additions and 15 deletions
+15
View File
@@ -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)
+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