From 63da5ffb138ab9e29b19ca8441da3b451d04f573 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Mon, 11 Nov 2019 17:10:14 +0100
Subject: [PATCH] ID console fixes and other tweaks.
---
code/__DEFINES/is_helpers.dm | 2 +
code/game/machinery/computer/apc_control.dm | 4 +-
code/game/machinery/computer/card.dm | 306 +++++++++---------
.../game/machinery/computer/communications.dm | 4 +-
code/game/objects/items/cards_ids.dm | 3 +
code/game/objects/items/devices/PDA/PDA.dm | 58 +++-
code/game/objects/items/storage/wallets.dm | 15 +
code/modules/cargo/bounty_console.dm | 58 ++--
code/modules/cargo/console.dm | 2 +-
code/modules/cargo/expressconsole.dm | 2 +-
code/modules/jobs/access.dm | 6 +
code/modules/mob/living/carbon/human/human.dm | 2 +-
.../mob/living/carbon/human/human_helpers.dm | 20 +-
.../mob/living/simple_animal/simple_animal.dm | 4 +-
code/modules/mob/mob.dm | 4 -
code/modules/mob/mob_helpers.dm | 14 +
.../computers/item/computer.dm | 15 +
.../modular_computers/file_system/program.dm | 13 +-
.../file_system/programs/card.dm | 2 +-
.../modular_computers/hardware/card_slot.dm | 11 +
code/modules/shuttle/emergency.dm | 4 +-
code/modules/shuttle/special.dm | 2 +-
.../code/game/machinery/computer/card.dm | 3 -
tgstation.dme | 1 -
24 files changed, 309 insertions(+), 246 deletions(-)
delete mode 100644 modular_citadel/code/game/machinery/computer/card.dm
diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm
index 70010eeffc..f7f519f105 100644
--- a/code/__DEFINES/is_helpers.dm
+++ b/code/__DEFINES/is_helpers.dm
@@ -199,6 +199,8 @@ GLOBAL_LIST_INIT(heavyfootmob, typecacheof(list(
#define isitem(A) (istype(A, /obj/item))
+#define isidcard(I) (istype(I, /obj/item/card/id))
+
#define isstructure(A) (istype(A, /obj/structure))
#define ismachinery(A) (istype(A, /obj/machinery))
diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm
index 6d505c8f95..8ddbd68c7b 100644
--- a/code/game/machinery/computer/apc_control.dm
+++ b/code/game/machinery/computer/apc_control.dm
@@ -92,9 +92,7 @@
if(!usr || !usr.canUseTopic(src) || stat || QDELETED(src))
return
if(href_list["authenticate"])
- var/obj/item/card/id/ID = usr.get_active_held_item()
- if(!istype(ID))
- ID = usr.get_idcard()
+ var/obj/item/card/id/ID = usr.get_idcard(TRUE)
if(ID && istype(ID))
if(check_access(ID))
authenticated = TRUE
diff --git a/code/game/machinery/computer/card.dm b/code/game/machinery/computer/card.dm
index 9539dc281d..93b71b27e2 100644
--- a/code/game/machinery/computer/card.dm
+++ b/code/game/machinery/computer/card.dm
@@ -4,6 +4,11 @@
//increase the slots of many jobs.
GLOBAL_VAR_INIT(time_last_changed_position, 0)
+#define JOB_ALLOWED 1
+#define JOB_COOLDOWN -2
+#define JOB_MAX_POSITIONS -1 // Trying to reduce the number of slots below that of current holders of that job, or trying to open more slots than allowed
+#define JOB_DENIED 0
+
/obj/machinery/computer/card
name = "identification console"
desc = "You can use this to manage jobs and ID access."
@@ -29,7 +34,8 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
"Head of Security",
"Chief Engineer",
"Research Director",
- "Chief Medical Officer")
+ "Chief Medical Officer",
+ "Quartermaster")
//The scaling factor of max total positions in relation to the total amount of people on board the station in %
var/max_relative_positions = 30 //30%: Seems reasonable, limit of 6 @ 20 players
@@ -44,8 +50,14 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
light_color = LIGHT_COLOR_BLUE
+/obj/machinery/computer/card/proc/get_jobs()
+ return get_all_jobs()
+
+/obj/machinery/computer/card/centcom/get_jobs()
+ return get_all_centcom_jobs()
+
/obj/machinery/computer/card/examine(mob/user)
- ..()
+ . = ..()
if(inserted_scan_id || inserted_modify_id)
to_chat(user, "Alt-click to eject the ID card.")
@@ -53,33 +65,24 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
. = ..()
change_position_cooldown = CONFIG_GET(number/id_console_jobslot_delay)
-/obj/machinery/computer/card/examine(mob/user)
- . = ..()
- if(inserted_scan_id || inserted_modify_id)
- to_chat(user, "Alt-click to eject the ID card.")
-
/obj/machinery/computer/card/attackby(obj/I, mob/user, params)
- if(istype(I, /obj/item/card/id))
- if(!inserted_scan_id)
+ if(isidcard(I))
+ if(check_access(I) && !inserted_scan_id)
if(id_insert(user, I, inserted_scan_id))
inserted_scan_id = I
- return
- if(!inserted_modify_id)
+ updateUsrDialog()
+ else if(!inserted_modify_id)
if(id_insert(user, I, inserted_modify_id))
inserted_modify_id = I
- return
- else
- to_chat(user, "There's already an ID card in the console!")
+ updateUsrDialog()
else
return ..()
/obj/machinery/computer/card/Destroy()
if(inserted_scan_id)
- qdel(inserted_scan_id)
- inserted_scan_id = null
+ QDEL_NULL(inserted_scan_id)
if(inserted_modify_id)
- qdel(inserted_modify_id)
- inserted_modify_id = null
+ QDEL_NULL(inserted_modify_id)
return ..()
/obj/machinery/computer/card/handle_atom_del(atom/A)
@@ -111,10 +114,10 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if((job.total_positions <= GLOB.player_list.len * (max_relative_positions / 100)))
var/delta = (world.time / 10) - GLOB.time_last_changed_position
if((change_position_cooldown < delta) || (opened_positions[job.title] < 0))
- return 1
- return -2
- return -1
- return 0
+ return JOB_ALLOWED
+ return JOB_COOLDOWN
+ return JOB_MAX_POSITIONS
+ return JOB_DENIED
//Logic check for Topic() if you can close the job
/obj/machinery/computer/card/proc/can_close_job(datum/job/job)
@@ -123,34 +126,44 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if(job.total_positions > job.current_positions)
var/delta = (world.time / 10) - GLOB.time_last_changed_position
if((change_position_cooldown < delta) || (opened_positions[job.title] > 0))
- return 1
- return -2
- return -1
- return 0
+ return JOB_ALLOWED
+ return JOB_COOLDOWN
+ return JOB_MAX_POSITIONS
+ return JOB_DENIED
-/obj/machinery/computer/card/proc/id_insert(mob/user, obj/item/card/id/I, target)
- if(istype(I))
- if(target)
- to_chat(user, "There's already an ID card in the console!")
- return FALSE
- if(!user.transferItemToLoc(I, src))
- return FALSE
- user.visible_message("[user] inserts an ID card into the console.", \
- "You insert the ID card into the console.")
- playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
- updateUsrDialog()
- return TRUE
+/obj/machinery/computer/card/proc/id_insert(mob/user, obj/item/inserting_item, obj/item/target)
+ var/obj/item/card/id/card_to_insert = inserting_item
+ var/holder_item = FALSE
+
+ if(!isidcard(card_to_insert))
+ card_to_insert = inserting_item.RemoveID()
+ holder_item = TRUE
+
+ if(!card_to_insert || !user.transferItemToLoc(card_to_insert, src))
+ return FALSE
+
+ if(target)
+ if(holder_item && inserting_item.InsertID(target))
+ playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
+ else
+ id_eject(user, target)
+
+ user.visible_message("[user] inserts \the [card_to_insert] into \the [src].",
+ "You insert \the [card_to_insert] into \the [src].")
+ playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
+ updateUsrDialog()
+ return TRUE
/obj/machinery/computer/card/proc/id_eject(mob/user, obj/target)
if(!target)
- to_chat(user, "There's no ID card in the console!")
+ to_chat(user, "That slot is empty!")
return FALSE
else
target.forceMove(drop_location())
if(!issilicon(user) && Adjacent(user))
user.put_in_hands(target)
- user.visible_message("[user] gets an ID card from the console.", \
- "You get the ID card from the console.")
+ user.visible_message("[user] gets \the [target] from \the [src].", \
+ "You get \the [target] from \the [src].")
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
updateUsrDialog()
return TRUE
@@ -162,86 +175,68 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if(inserted_modify_id)
if(id_eject(user, inserted_modify_id))
inserted_modify_id = null
- authenticated = FALSE
+ updateUsrDialog()
return
if(inserted_scan_id)
if(id_eject(user, inserted_scan_id))
inserted_scan_id = null
- authenticated = FALSE
+ updateUsrDialog()
return
/obj/machinery/computer/card/ui_interact(mob/user)
. = ..()
- var/dat
- if(!SSticker)
- return
+ var/list/dat = list()
if (mode == 1) // accessing crew manifest
- var/crew = ""
+ dat += "Crew Manifest:
Please use security record computer to modify entries.
"
for(var/datum/data/record/t in sortRecord(GLOB.data_core.general))
- crew += t.fields["name"] + " - " + t.fields["rank"] + "
"
- dat = "Crew Manifest:
Please use security record computer to modify entries.
[crew]Print
Access ID modification console.
"
+ dat += {"[t.fields["name"]] - [t.fields["rank"]]
"}
+ dat += "Print
Access ID modification console.
"
else if(mode == 2)
// JOB MANAGEMENT
- dat = "Return"
- dat += " || Confirm Identity: "
- var/S
- if(inserted_scan_id)
- S = html_encode(inserted_scan_id.name)
- else
- S = "--------"
- dat += "[S]"
- dat += "
"
- dat += "| Job | Slots | Open job | Close job | Prioritize |
"
- var/ID
- if(inserted_scan_id && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
- ID = 1
- else
- ID = 0
+ dat += {"Return
+ | Job | Slots |
+ Open job | Close job | Prioritize |
"}
for(var/datum/job/job in SSjob.occupations)
dat += ""
if(job.title in blacklisted)
continue
- dat += "| [job.title] | "
- dat += "[job.current_positions]/[job.total_positions] | "
- dat += ""
+ dat += {" | [job.title] |
+ [job.current_positions]/[job.total_positions] |
+ "}
switch(can_open_job(job))
- if(1)
- if(ID)
+ if(JOB_ALLOWED)
+ if(authenticated == 2)
dat += "Open Position "
else
dat += "Open Position"
- if(-1)
- dat += "Denied"
- if(-2)
+ if(JOB_COOLDOWN)
var/time_to_wait = round(change_position_cooldown - ((world.time / 10) - GLOB.time_last_changed_position), 1)
var/mins = round(time_to_wait / 60)
var/seconds = time_to_wait - (60*mins)
dat += "Cooldown ongoing: [mins]:[(seconds < 10) ? "0[seconds]" : "[seconds]"]"
- if(0)
+ else
dat += "Denied"
dat += " | "
switch(can_close_job(job))
- if(1)
- if(ID)
+ if(JOB_ALLOWED)
+ if(authenticated == 2)
dat += "Close Position"
else
dat += "Close Position"
- if(-1)
- dat += "Denied"
- if(-2)
+ if(-JOB_COOLDOWN)
var/time_to_wait = round(change_position_cooldown - ((world.time / 10) - GLOB.time_last_changed_position), 1)
var/mins = round(time_to_wait / 60)
var/seconds = time_to_wait - (60*mins)
dat += "Cooldown ongoing: [mins]:[(seconds < 10) ? "0[seconds]" : "[seconds]"]"
- if(0)
+ else
dat += "Denied"
dat += " | "
switch(job.total_positions)
if(0)
dat += "Denied"
else
- if(ID)
+ if(authenticated == 2)
if(job in SSjob.prioritized_jobs)
dat += "Deprioritize"
else
@@ -255,57 +250,35 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
dat += " |
"
dat += "
"
else
- var/header = ""
-
- var/target_name
- var/target_owner
- var/target_rank
- if(inserted_modify_id)
- target_name = html_encode(inserted_modify_id.name)
- else
- target_name = "--------"
- if(inserted_modify_id && inserted_modify_id.registered_name)
- target_owner = html_encode(inserted_modify_id.registered_name)
- else
- target_owner = "--------"
- if(inserted_modify_id && inserted_modify_id.assignment)
- target_rank = html_encode(inserted_modify_id.assignment)
- else
- target_rank = "Unassigned"
-
- var/scan_name
- if(inserted_scan_id)
- scan_name = html_encode(inserted_scan_id.name)
- else
- scan_name = "--------"
+ var/list/header = list()
+ var/scan_name = inserted_scan_id ? html_encode(inserted_scan_id.name) : "--------"
+ var/target_name = inserted_modify_id ? html_encode(inserted_modify_id.name) : "--------"
+ var/target_owner = (inserted_modify_id && inserted_modify_id.registered_name) ? html_encode(inserted_modify_id.registered_name) : "--------"
+ var/target_rank = (inserted_modify_id && inserted_modify_id.assignment) ? html_encode(inserted_modify_id.assignment) : "Unassigned"
if(!authenticated)
- header += "
Please insert the cards into the slots
"
- header += "Target: [target_name]
"
- header += "Confirm Identity: [scan_name]
"
+ header += {"
Please insert the cards into the slots
+ Target: [target_name]
+ Confirm Identity: [scan_name]
"}
else
- header += ""
+ header += {""}
header += "
"
- var/jobs_all = ""
- var/list/alljobs = list("Unassigned")
- alljobs += (istype(src, /obj/machinery/computer/card/centcom)? get_all_centcom_jobs() : get_all_jobs()) + "Custom"
- for(var/job in alljobs)
- jobs_all += "[replacetext(job, " ", " ")] " //make sure there isn't a line break in the middle of a job
-
-
var/body
if (authenticated && inserted_modify_id)
-
- var/carddesc = text("")
- var/jobs = text("")
- if( authenticated == 2)
+ var/list/carddesc = list()
+ var/list/jobs = list()
+ if (authenticated == 2)
+ var/list/jobs_all = list()
+ for(var/job in (list("Unassigned") + get_jobs() + "Custom"))
+ jobs_all += "[replacetext(job, " ", " ")] " //make sure there isn't a line break in the middle of a job
carddesc += {""}
- carddesc += ""
- carddesc += "Assignment: "
+ carddesc += {"
+ Assignment: "}
jobs += "[target_rank]" //CHECK THIS
@@ -338,18 +311,18 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
carddesc += "registered_name: [target_owner]"
jobs += "Assignment: [target_rank] (Demote)"
- var/accesses = ""
- if(istype(src, /obj/machinery/computer/card/centcom))
+ var/list/accesses = list()
+ if(istype(src, /obj/machinery/computer/card/centcom)) //REE
accesses += "Central Command:
"
for(var/A in get_all_centcom_access())
if(A in inserted_modify_id.access)
- accesses += "[replacetext(get_centcom_access_desc(A), " ", " ")] "
+ accesses += "[replacetext(get_centcom_access_desc(A), " ", " ")] "
else
accesses += "[replacetext(get_centcom_access_desc(A), " ", " ")] "
else
- accesses += "Access
"
- accesses += ""
- accesses += ""
+ accesses += {"Access
+ "
- body = "[carddesc]
[jobs]
[accesses]" //CHECK THIS
+ body = "[carddesc.Join()]
[jobs]
[accesses.Join()]
" //CHECK THIS
- else
- body = "{Log in}
"
- body += "Access Crew Manifest"
+ else if (!authenticated)
+ body = {"Log In
+ Access Crew Manifest
"}
if(!target_dept)
- body += "
Job Management"
+ body += "
Job Management
"
- dat = "[header][body]
"
+ dat = list("", header.Join(), body, "
")
var/datum/browser/popup = new(user, "id_com", src.name, 900, 620)
- popup.set_content(dat)
+ popup.set_content(dat.Join())
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open()
@@ -393,25 +366,31 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
usr.set_machine(src)
switch(href_list["choice"])
if ("inserted_modify_id")
- if (inserted_modify_id)
+ if (inserted_modify_id && !usr.get_active_held_item())
if(id_eject(usr, inserted_modify_id))
inserted_modify_id = null
- else
- var/mob/M = usr
- var/obj/item/card/id/I = M.get_idcard(TRUE)
- if(id_insert(usr, I, inserted_modify_id))
- inserted_modify_id = I
+ updateUsrDialog()
+ return
+ if(usr.get_id_in_hand())
+ var/obj/item/held_item = usr.get_active_held_item()
+ var/obj/item/card/id/id_to_insert = held_item.GetID()
+ if(id_insert(usr, held_item, inserted_modify_id))
+ inserted_modify_id = id_to_insert
+ updateUsrDialog()
if ("inserted_scan_id")
- if (inserted_scan_id)
+ if (inserted_scan_id && !usr.get_active_held_item())
if(id_eject(usr, inserted_scan_id))
inserted_scan_id = null
- else
- var/mob/M = usr
- var/obj/item/card/id/I = M.get_idcard(TRUE)
- if(id_insert(usr, I, inserted_scan_id))
- inserted_scan_id = I
+ updateUsrDialog()
+ return
+ if(usr.get_id_in_hand())
+ var/obj/item/held_item = usr.get_active_held_item()
+ var/obj/item/card/id/id_to_insert = held_item.GetID()
+ if(id_insert(usr, held_item, inserted_modify_id))
+ inserted_scan_id = id_to_insert
+ updateUsrDialog()
if ("auth")
- if ((!( authenticated ) && (inserted_scan_id || issilicon(usr)) && (inserted_modify_id || mode)))
+ if ((!( authenticated ) && (inserted_scan_id || issilicon(usr)) || mode))
if (check_access(inserted_scan_id))
region_access = list()
head_subordinates = list()
@@ -519,7 +498,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if("make_job_available")
// MAKE ANOTHER JOB POSITION AVAILABLE FOR LATE JOINERS
- if(inserted_scan_id && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
+ if(authenticated && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
var/edit_job_target = href_list["job"]
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j)
@@ -536,7 +515,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if("make_job_unavailable")
// MAKE JOB POSITION UNAVAILABLE FOR LATE JOINERS
- if(inserted_scan_id && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
+ if(authenticated && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
var/edit_job_target = href_list["job"]
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j)
@@ -554,7 +533,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
if ("prioritize_job")
// TOGGLE WHETHER JOB APPEARS AS PRIORITIZED IN THE LOBBY
- if(inserted_scan_id && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
+ if(authenticated && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
var/priority_target = href_list["job"]
var/datum/job/j = SSjob.GetJob(priority_target)
if(!j)
@@ -641,4 +620,9 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
target_dept = 6
icon_screen = "idqm"
- light_color = LIGHT_COLOR_ORANGE
\ No newline at end of file
+ light_color = LIGHT_COLOR_ORANGE
+
+#undef JOB_ALLOWED
+#undef JOB_COOLDOWN
+#undef JOB_MAX_POSITIONS
+#undef JOB_DENIED
\ No newline at end of file
diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm
index f3612078d6..b5cb066b3a 100755
--- a/code/game/machinery/computer/communications.dm
+++ b/code/game/machinery/computer/communications.dm
@@ -70,9 +70,7 @@
if("login")
var/mob/M = usr
- var/obj/item/card/id/I = M.get_active_held_item()
- if(!istype(I))
- I = M.get_idcard()
+ var/obj/item/card/id/I = M.get_idcard(TRUE)
if(I && istype(I))
if(check_access(I))
diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm
index 0e422a3fe9..09a119eeb4 100644
--- a/code/game/objects/items/cards_ids.dm
+++ b/code/game/objects/items/cards_ids.dm
@@ -203,6 +203,9 @@
/obj/item/card/id/GetID()
return src
+/obj/item/card/id/RemoveID()
+ return src
+
/*
Usage:
update_label()
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index 92d936e0d4..75eeb16f86 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -200,6 +200,18 @@ GLOBAL_LIST_EMPTY(PDAs)
/obj/item/pda/GetID()
return id
+/obj/item/pda/RemoveID()
+ return do_remove_id()
+
+/obj/item/pda/InsertID(obj/item/inserting_item)
+ var/obj/item/card/inserting_id = inserting_item.RemoveID()
+ if(!inserting_id)
+ return
+ insert_id(inserting_id)
+ if(id == inserting_id)
+ return TRUE
+ return FALSE
+
/obj/item/pda/update_icon(alert = FALSE, new_overlays = FALSE)
if(new_overlays)
set_new_overlays()
@@ -688,15 +700,27 @@ GLOBAL_LIST_EMPTY(PDAs)
return
/obj/item/pda/proc/remove_id()
-
if(issilicon(usr) || !usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
+ do_remove_id(usr)
- if (id)
- usr.put_in_hands(id)
- to_chat(usr, "You remove the ID from the [name].")
- id = null
- update_icon()
+/obj/item/pda/proc/do_remove_id(mob/user)
+ if(!id)
+ return
+ if(user)
+ user.put_in_hands(id)
+ to_chat(user, "You remove the ID from the [name].")
+ else
+ id.forceMove(get_turf(src))
+
+ . = id
+ id = null
+ update_icon()
+
+ if(ishuman(loc))
+ var/mob/living/carbon/human/H = loc
+ if(H.wear_id == src)
+ H.sec_hud_set_ID()
/obj/item/pda/proc/msg_input(mob/living/U = usr)
var/t = stripped_input(U, "Please enter message", name)
@@ -878,17 +902,25 @@ GLOBAL_LIST_EMPTY(PDAs)
if(istype(C))
I = C
- if(I && I.registered_name)
- if(!user.transferItemToLoc(I, src))
- return FALSE
- var/obj/old_id = id
- id = I
- if(old_id)
- user.put_in_hands(old_id)
+ if(I?.registered_name)
+ insert_id(I, user)
update_icon()
playsound(src, 'sound/machines/button.ogg', 50, 1)
return TRUE
+/obj/item/pda/proc/insert_id(obj/item/card/id/inserting_id, mob/user)
+ var/obj/old_id = id
+ id = inserting_id
+ if(ishuman(loc))
+ var/mob/living/carbon/human/human_wearer = loc
+ if(human_wearer.wear_id == src)
+ human_wearer.sec_hud_set_ID()
+ if(old_id)
+ if(user)
+ user.put_in_hands(old_id)
+ else
+ old_id.forceMove(get_turf(src))
+
// access to status display signals
/obj/item/pda/attackby(obj/item/C, mob/user, params)
if(istype(C, /obj/item/cartridge) && !cartridge)
diff --git a/code/game/objects/items/storage/wallets.dm b/code/game/objects/items/storage/wallets.dm
index 7a6899ad15..891a4689d0 100644
--- a/code/game/objects/items/storage/wallets.dm
+++ b/code/game/objects/items/storage/wallets.dm
@@ -68,6 +68,21 @@
/obj/item/storage/wallet/GetID()
return front_id
+/obj/item/storage/wallet/RemoveID()
+ if(!front_id)
+ return
+ . = front_id
+ front_id.forceMove(get_turf(src))
+
+/obj/item/storage/wallet/InsertID(obj/item/inserting_item)
+ var/obj/item/card/inserting_id = inserting_item.RemoveID()
+ if(!inserting_id)
+ return FALSE
+ attackby(inserting_id)
+ if(inserting_id in contents)
+ return TRUE
+ return FALSE
+
/obj/item/storage/wallet/GetAccess()
if(LAZYLEN(combined_access))
return combined_access
diff --git a/code/modules/cargo/bounty_console.dm b/code/modules/cargo/bounty_console.dm
index 2e5d943dd6..45260f4926 100644
--- a/code/modules/cargo/bounty_console.dm
+++ b/code/modules/cargo/bounty_console.dm
@@ -1,5 +1,7 @@
#define PRINTER_TIMEOUT 10
+
+
/obj/machinery/computer/bounty
name = "Nanotrasen bounty console"
desc = "Used to check and claim bounties offered by Nanotrasen"
@@ -24,9 +26,9 @@
for(var/datum/bounty/B in GLOB.bounties_list)
if(B.claimed)
continue
- info += "[B.name]
"
- info += "- Reward: [B.reward_string()]
"
- info += "- Completed: [B.completion_string()]
"
+ info += {"[B.name]
+ - Reward: [B.reward_string()]
+ - Completed: [B.completion_string()]
"}
/obj/machinery/computer/bounty/ui_interact(mob/user)
. = ..()
@@ -34,39 +36,36 @@
if(!GLOB.bounties_list.len)
setup_bounties()
- var/dat = ""
- dat += "Refresh"
- dat += "Print Paper"
- dat += "Credits: [SSshuttle.points]
"
- dat += {""}
- dat += "| Name | Description | Reward | Completion | Status |
"
+ var/list/dat = list({"Refresh
+ Print Paper
+ Credits: [SSshuttle.points]
+
+ | Name | Description | Reward | Completion | Status |
"})
for(var/datum/bounty/B in GLOB.bounties_list)
- var/background
- if(B.can_claim())
- background = "'background-color:#4F7529;'"
- else if(B.claimed)
- background = "'background-color:#294675;'"
+ if(B.claimed)
+ dat += ""
+ else if(B.can_claim())
+ dat += "
"
else
- background = "'background-color:#990000;'"
- dat += "
"
+ dat += "
"
if(B.high_priority)
- dat += text("| [] | ", B.name)
- dat += text("High Priority: [] | ", B.description)
- dat += text("[] | ", B.reward_string())
+ dat += {"[B.name] |
+ High Priority: [B.description] |
+ [B.reward_string()] | "}
else
- dat += text("[] | ", B.name)
- dat += text("[] | ", B.description)
- dat += text("[] | ", B.reward_string())
- dat += text("[] | ", B.completion_string())
- if(B.can_claim())
- dat += text("Claim | ")
- else if(B.claimed)
- dat += text("Claimed | ")
+ dat += {"[B.name] |
+ [B.description] |
+ [B.reward_string()] | "}
+ dat += "[B.completion_string()] | "
+ if(B.claimed)
+ dat += "Claimed | "
+ else if(B.can_claim())
+ dat += "Claim | "
else
- dat += text("Unclaimed | ")
+ dat += "Unclaimed | "
dat += "
"
dat += "
"
-
+ dat = dat.Join()
var/datum/browser/popup = new(user, "bounties", "Nanotrasen Bounties", 700, 600)
popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
@@ -91,4 +90,3 @@
playsound(src, "terminal_type", 25, 0)
updateUsrDialog()
-
diff --git a/code/modules/cargo/console.dm b/code/modules/cargo/console.dm
index 1a607b4b96..89ad8f9750 100644
--- a/code/modules/cargo/console.dm
+++ b/code/modules/cargo/console.dm
@@ -162,7 +162,7 @@
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
name = H.get_authentification_name()
- rank = H.get_assignment()
+ rank = H.get_assignment(hand_first = TRUE)
else if(issilicon(usr))
name = usr.real_name
rank = "Silicon"
diff --git a/code/modules/cargo/expressconsole.dm b/code/modules/cargo/expressconsole.dm
index 0097346a34..6170c80f8e 100644
--- a/code/modules/cargo/expressconsole.dm
+++ b/code/modules/cargo/expressconsole.dm
@@ -156,7 +156,7 @@
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
name = H.get_authentification_name()
- rank = H.get_assignment()
+ rank = H.get_assignment(hand_first = TRUE)
else if(issilicon(usr))
name = usr.real_name
rank = "Silicon"
diff --git a/code/modules/jobs/access.dm b/code/modules/jobs/access.dm
index 2119baf1a5..0ee8dbb083 100644
--- a/code/modules/jobs/access.dm
+++ b/code/modules/jobs/access.dm
@@ -35,6 +35,12 @@
/obj/item/proc/GetID()
return null
+/obj/item/proc/RemoveID()
+ return null
+
+/obj/item/proc/InsertID()
+ return FALSE
+
/obj/proc/text2access(access_text)
. = list()
if(!access_text)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index a737844f10..d460482d6f 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -574,7 +574,7 @@
return threatcount
//Check for ID
- var/obj/item/card/id/idcard = get_idcard()
+ var/obj/item/card/id/idcard = get_idcard(FALSE)
if( (judgement_criteria & JUDGE_IDCHECK) && !idcard && name=="Unknown")
threatcount += 4
diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm
index 8bc8866380..8071d632ea 100644
--- a/code/modules/mob/living/carbon/human/human_helpers.dm
+++ b/code/modules/mob/living/carbon/human/human_helpers.dm
@@ -11,8 +11,8 @@
//gets assignment from ID or ID inside PDA or PDA itself
//Useful when player do something with computers
-/mob/living/carbon/human/proc/get_assignment(if_no_id = "No id", if_no_job = "No job")
- var/obj/item/card/id/id = get_idcard()
+/mob/living/carbon/human/proc/get_assignment(if_no_id = "No id", if_no_job = "No job", hand_first = TRUE)
+ var/obj/item/card/id/id = get_idcard(hand_first)
if(id)
. = id.assignment
else
@@ -27,7 +27,7 @@
//gets name from ID or ID inside PDA or PDA itself
//Useful when player do something with computers
/mob/living/carbon/human/proc/get_authentification_name(if_no_id = "Unknown")
- var/obj/item/card/id/id = get_idcard()
+ var/obj/item/card/id/id = get_idcard(FALSE)
if(id)
return id.registered_name
var/obj/item/pda/pda = wear_id
@@ -86,10 +86,15 @@
return
//gets ID card object from special clothes slot or null.
-/mob/living/carbon/human/get_idcard()
- if(wear_id)
- return wear_id.GetID()
-
+/mob/living/carbon/human/get_idcard(hand_first = TRUE)
+ . = ..()
+ if(. && hand_first)
+ return
+ //Check inventory slots
+ var/obj/item/card/id/id_card = wear_id?.GetID()
+ if(!id_card)
+ id_card = belt?.GetID()
+ return id_card || .
/mob/living/carbon/human/IsAdvancedToolUser()
if(HAS_TRAIT(src, TRAIT_MONKEYLIKE))
@@ -100,7 +105,6 @@
return dna.species.handle_chemicals(R,src)
// if it returns 0, it will run the usual on_mob_life for that reagent. otherwise, it will stop after running handle_chemicals for the species.
-
/mob/living/carbon/human/can_track(mob/living/user)
if(wear_id && istype(wear_id.GetID(), /obj/item/card/id/syndicate))
return 0
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index a2ef5b813b..ea86ac8963 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -462,8 +462,8 @@
return
sync_lighting_plane_alpha()
-/mob/living/simple_animal/get_idcard()
- return access_card
+/mob/living/simple_animal/get_idcard(hand_first = TRUE)
+ return ..() || access_card
/mob/living/simple_animal/OpenCraftingMenu()
if(dextrous)
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index f790d15d2d..ed9a3da859 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -930,10 +930,6 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
/mob/proc/can_hold_items()
return FALSE
-/mob/proc/get_idcard()
- return
-
-
/mob/vv_get_dropdown()
. = ..()
. += "---"
diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm
index eb22ab7403..7f78e2aac8 100644
--- a/code/modules/mob/mob_helpers.dm
+++ b/code/modules/mob/mob_helpers.dm
@@ -518,3 +518,17 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
else if(HAS_TRAIT_FROM(src, TRAIT_DISSECTED,"Thorough Dissection"))
dissectionmsg = " via Thorough Dissection"
. += "This body has been dissected and analyzed[dissectionmsg].
"
+
+//gets ID card object from special clothes slot or null.
+/mob/proc/get_idcard(hand_first = TRUE)
+ var/obj/item/held_item = get_active_held_item()
+ . = held_item?.GetID()
+ if(!.) //If so, then check the inactive hand
+ held_item = get_inactive_held_item()
+ . = held_item?.GetID()
+
+/mob/proc/get_id_in_hand()
+ var/obj/item/held_item = get_active_held_item()
+ if(!held_item)
+ return
+ return held_item.GetID()
diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm
index db4cdc2ff5..ce2c49cb32 100644
--- a/code/modules/modular_computers/computers/item/computer.dm
+++ b/code/modules/modular_computers/computers/item/computer.dm
@@ -157,6 +157,21 @@
return card_slot.GetID()
return ..()
+/obj/item/modular_computer/RemoveID()
+ var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
+ if(!card_slot)
+ return
+ return card_slot.RemoveID()
+
+/obj/item/modular_computer/InsertID(obj/item/inserting_item)
+ var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
+ if(!card_slot)
+ return FALSE
+ var/obj/item/card/inserting_id = inserting_item.RemoveID()
+ if(!inserting_id)
+ return FALSE
+ return card_slot.try_insert(inserting_id)
+
/obj/item/modular_computer/MouseDrop(obj/over_object, src_location, over_location)
var/mob/M = usr
if((!istype(over_object, /obj/screen)) && usr.canUseTopic(src))
diff --git a/code/modules/modular_computers/file_system/program.dm b/code/modules/modular_computers/file_system/program.dm
index 051b12ea71..f74b53ddd2 100644
--- a/code/modules/modular_computers/file_system/program.dm
+++ b/code/modules/modular_computers/file_system/program.dm
@@ -97,14 +97,8 @@
card_slot = computer.all_components[MC_CARD]
D = card_slot.GetID()
var/mob/living/carbon/human/h = user
- var/obj/item/card/id/I = h.get_idcard()
- var/obj/item/card/id/C = h.get_active_held_item()
- if(C)
- C = C.GetID()
- if(!(C && istype(C)))
- C = null
-
- if(!I && !C && !D)
+ var/obj/item/card/id/I = h.get_idcard(TRUE)
+ if(!I && !D)
if(loud)
to_chat(user, "\The [computer] flashes an \"RFID Error - Unable to scan ID\" warning.")
return 0
@@ -112,9 +106,6 @@
if(I)
if(access_to_check in I.GetAccess())
return 1
- else if(C)
- if(access_to_check in C.GetAccess())
- return 1
else if(D)
if(access_to_check in D.GetAccess())
return 1
diff --git a/code/modules/modular_computers/file_system/programs/card.dm b/code/modules/modular_computers/file_system/programs/card.dm
index f8372dd2df..243ae89d69 100644
--- a/code/modules/modular_computers/file_system/programs/card.dm
+++ b/code/modules/modular_computers/file_system/programs/card.dm
@@ -117,7 +117,7 @@
else
if(ishuman(user))
var/mob/living/carbon/human/h = user
- user_id_card = h.get_idcard()
+ user_id_card = h.get_idcard(TRUE)
switch(action)
if("PRG_switchm")
diff --git a/code/modules/modular_computers/hardware/card_slot.dm b/code/modules/modular_computers/hardware/card_slot.dm
index 3952ac1aec..725df2fdb8 100644
--- a/code/modules/modular_computers/hardware/card_slot.dm
+++ b/code/modules/modular_computers/hardware/card_slot.dm
@@ -29,6 +29,17 @@
return stored_card2
return ..()
+/obj/item/computer_hardware/card_slot/RemoveID()
+ if(stored_card)
+ . = stored_card
+ if(!try_eject(1))
+ return null
+ return
+ if(stored_card2)
+ . = stored_card2
+ if(!try_eject(2))
+ return null
+
/obj/item/computer_hardware/card_slot/on_install(obj/item/modular_computer/M, mob/living/user = null)
M.add_verb(device_type)
diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm
index b581a54095..c863e0e44a 100644
--- a/code/modules/shuttle/emergency.dm
+++ b/code/modules/shuttle/emergency.dm
@@ -57,7 +57,7 @@
var/mob/user = usr
. = FALSE
- var/obj/item/card/id/ID = user.get_idcard()
+ var/obj/item/card/id/ID = user.get_idcard(TRUE)
if(!ID)
to_chat(user, "You don't have an ID.")
@@ -93,7 +93,7 @@
minor_announce("Early launch authorization revoked, [remaining] authorizations needed")
/obj/machinery/computer/emergency_shuttle/proc/authorize(mob/user, source)
- var/obj/item/card/id/ID = user.get_idcard()
+ var/obj/item/card/id/ID = user.get_idcard(TRUE)
if(ID in authorized)
return FALSE
diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm
index ab08c162a1..2d17a8e55a 100644
--- a/code/modules/shuttle/special.dm
+++ b/code/modules/shuttle/special.dm
@@ -199,7 +199,7 @@
if(H.mind && H.mind.assigned_role == "Bartender")
return TRUE
- var/obj/item/card/id/ID = user.get_idcard()
+ var/obj/item/card/id/ID = user.get_idcard(FALSE)
if(ID && (ACCESS_CENT_BAR in ID.access))
return TRUE
diff --git a/modular_citadel/code/game/machinery/computer/card.dm b/modular_citadel/code/game/machinery/computer/card.dm
deleted file mode 100644
index b9dd049d39..0000000000
--- a/modular_citadel/code/game/machinery/computer/card.dm
+++ /dev/null
@@ -1,3 +0,0 @@
-/obj/machinery/computer/card
- list/blacklisted = list(
- "Quartermaster")
diff --git a/tgstation.dme b/tgstation.dme
index 9e52889df7..45b51ed765 100755
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -2996,7 +2996,6 @@
#include "modular_citadel\code\game\machinery\toylathe.dm"
#include "modular_citadel\code\game\machinery\vending.dm"
#include "modular_citadel\code\game\machinery\wishgranter.dm"
-#include "modular_citadel\code\game\machinery\computer\card.dm"
#include "modular_citadel\code\game\machinery\doors\airlock.dm"
#include "modular_citadel\code\game\machinery\doors\airlock_types.dm"
#include "modular_citadel\code\game\objects\cit_screenshake.dm"