Merge pull request #31671 from kingofkosmos/altclickejectidfromcomputers

ID ejecting from computers by alt-clicking
This commit is contained in:
Jordan Brown
2017-10-14 19:47:52 -04:00
committed by GitHub
3 changed files with 78 additions and 40 deletions
+51 -31
View File
@@ -45,6 +45,11 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
light_color = LIGHT_COLOR_BLUE
/obj/machinery/computer/card/examine(mob/user)
..()
if(scan || modify)
to_chat(user, "<span class='notice'>Alt-click to eject the ID card.</span>")
/obj/machinery/computer/card/Initialize()
. = ..()
change_position_cooldown = CONFIG_GET(number/id_console_jobslot_delay)
@@ -69,6 +74,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
return
modify = idcard
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
updateUsrDialog()
else
return ..()
@@ -349,38 +355,9 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
usr.set_machine(src)
switch(href_list["choice"])
if ("modify")
if (modify)
GLOB.data_core.manifest_modify(modify.registered_name, modify.assignment)
modify.update_label()
modify.forceMove(drop_location())
modify.verb_pickup()
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
modify = null
region_access = null
head_subordinates = null
else
var/obj/item/I = usr.get_active_held_item()
if (istype(I, /obj/item/card/id))
if (!usr.transferItemToLoc(I,src))
return
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
modify = I
authenticated = 0
eject_id_modify(usr)
if ("scan")
if (scan)
scan.forceMove(drop_location())
scan.verb_pickup()
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
scan = null
else
var/obj/item/I = usr.get_active_held_item()
if (istype(I, /obj/item/card/id))
if (!usr.transferItemToLoc(I,src))
return
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
scan = I
authenticated = 0
eject_id_scan(usr)
if ("auth")
if ((!( authenticated ) && (scan || issilicon(usr)) && (modify || mode)))
if (check_access(scan))
@@ -550,6 +527,49 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
updateUsrDialog()
return
/obj/machinery/computer/card/AltClick(mob/user)
if(user.canUseTopic(src))
if(scan)
eject_id_scan(user)
if(modify)
eject_id_modify(user)
/obj/machinery/computer/card/proc/eject_id_scan(mob/user)
if(scan)
scan.forceMove(drop_location())
user.put_in_hands(scan)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
scan = null
else //switching the ID with the one you're holding
var/obj/item/I = user.get_active_held_item()
if(istype(I, /obj/item/card/id))
if(!user.transferItemToLoc(I,src))
return
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
scan = I
authenticated = FALSE
updateUsrDialog()
/obj/machinery/computer/card/proc/eject_id_modify(mob/user)
if(modify)
GLOB.data_core.manifest_modify(modify.registered_name, modify.assignment)
modify.update_label()
modify.forceMove(drop_location())
user.put_in_hands(modify)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
modify = null
region_access = null
head_subordinates = null
else //switching the ID with the one you're holding
var/obj/item/I = user.get_active_held_item()
if(istype(I, /obj/item/card/id))
if (!user.transferItemToLoc(I,src))
return
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
modify = I
authenticated = FALSE
updateUsrDialog()
/obj/machinery/computer/card/proc/get_subordinates(rank)
for(var/datum/job/job in SSjob.occupations)
if(rank in job.department_head)
+25 -9
View File
@@ -23,6 +23,11 @@
light_color = LIGHT_COLOR_RED
/obj/machinery/computer/secure_data/examine(mob/user)
..()
if(scan)
to_chat(user, "<span class='notice'>Alt-click to eject the ID card.</span>")
/obj/machinery/computer/secure_data/syndie
icon_keyboard = "syndie_key"
@@ -41,6 +46,8 @@
return
scan = O
to_chat(user, "<span class='notice'>You insert [O].</span>")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
updateUsrDialog()
else
to_chat(user, "<span class='warning'>There's already an ID card in the console.</span>")
else
@@ -301,15 +308,7 @@ What a mess.*/
active2 = null
if("Confirm Identity")
if(scan)
usr.put_in_hands(scan)
scan = null
else
var/obj/item/I = usr.is_holding_item_of_type(/obj/item/card/id)
if(I)
if(!usr.transferItemToLoc(I, src))
return
scan = I
eject_id(usr)
if("Log Out")
authenticated = null
@@ -790,3 +789,20 @@ What a mess.*/
if(!record2 || record2 == active2)
return 1
return 0
/obj/machinery/computer/secure_data/AltClick(mob/user)
if(user.canUseTopic(src) && scan)
eject_id(user)
/obj/machinery/computer/secure_data/proc/eject_id(mob/user)
if(scan)
user.put_in_hands(scan)
scan = null
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
else //switching the ID with the one you're holding
var/obj/item/I = user.is_holding_item_of_type(/obj/item/card/id)
if(I)
if(!user.transferItemToLoc(I, src))
return
scan = I
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
@@ -57,6 +57,7 @@
else
stored_card2 = I
to_chat(user, "<span class='notice'>You insert \the [I] into \the [src].</span>")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
return TRUE
@@ -93,6 +94,7 @@
P.event_idremoved(1, slot)
to_chat(user, "<span class='notice'>You remove the card[ejected>1 ? "s" : ""] from \the [src].</span>")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
return TRUE
return FALSE