From c7db7cb2bec2dfbb7656fb71c8b36f9a5c9a19b0 Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Sat, 16 Nov 2019 01:17:23 -0700
Subject: [PATCH] The ID Code Cleanup and Fixening (tm)
---
code/__DEFINES/access.dm | 2 +
code/__DEFINES/is_helpers.dm | 2 +
code/game/machinery/computer/apc_control.dm | 4 +-
code/game/machinery/computer/card.dm | 310 +++++++++---------
.../game/machinery/computer/communications.dm | 8 +-
code/game/objects/items/cards_ids.dm | 153 +++++++--
code/game/objects/items/devices/PDA/PDA.dm | 60 +++-
code/game/objects/items/storage/wallets.dm | 15 +
code/modules/cargo/bounty_console.dm | 58 ++--
code/modules/cargo/console.dm | 10 +-
code/modules/cargo/expressconsole.dm | 5 +-
code/modules/jobs/access.dm | 14 +-
code/modules/jobs/job_types/security.dm | 12 +-
code/modules/mob/living/carbon/human/human.dm | 2 +-
.../mob/living/carbon/human/human_helpers.dm | 19 +-
.../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 -
modular_citadel/code/game/objects/ids.dm | 83 -----
tgstation.dme | 2 -
27 files changed, 467 insertions(+), 364 deletions(-)
delete mode 100644 modular_citadel/code/game/machinery/computer/card.dm
delete mode 100644 modular_citadel/code/game/objects/ids.dm
diff --git a/code/__DEFINES/access.dm b/code/__DEFINES/access.dm
index c9d545fc..d9eb48d7 100644
--- a/code/__DEFINES/access.dm
+++ b/code/__DEFINES/access.dm
@@ -64,6 +64,8 @@
#define ACCESS_WEAPONS 66 //Weapon authorization for secbots
#define ACCESS_NETWORK 67 //NTnet diagnostics/monitoring software
#define ACCESS_CLONING 68 //Cloning room and clone pod ejection
+#define ACCESS_ENTER_GENPOP 69
+#define ACCESS_LEAVE_GENPOP 70
//BEGIN CENTCOM ACCESS
/*Should leave plenty of room if we need to add more access levels.
diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm
index 2dbc63aa..5f5903e2 100644
--- a/code/__DEFINES/is_helpers.dm
+++ b/code/__DEFINES/is_helpers.dm
@@ -221,6 +221,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 d433c557..1101034c 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 acca6633..eaecc9a9 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,27 +50,30 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
light_color = LIGHT_COLOR_BLUE
-/obj/machinery/computer/card/examine(mob/user)
- . = ..()
- if(inserted_scan_id || inserted_modify_id)
- . += "Alt-click to eject the ID card."
+/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/Initialize()
. = ..()
change_position_cooldown = CONFIG_GET(number/id_console_jobslot_delay)
+/obj/machinery/computer/card/examine(mob/user)
+ . = ..()
+ if(inserted_scan_id || inserted_modify_id)
+ . += "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)
- 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 if(id_insert(user, I, inserted_modify_id))
+ inserted_modify_id = I
+ updateUsrDialog()
else
return ..()
@@ -106,10 +115,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)
@@ -118,34 +127,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
@@ -157,86 +176,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
@@ -250,57 +251,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
@@ -333,18 +312,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.Join()]
[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()
@@ -388,25 +367,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_scan_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()
@@ -478,7 +463,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
updateUsrDialog()
break
if(!jobdatum)
- to_chat(usr, "No log exists for this job.")
+ to_chat(usr, "No log exists for this job.")
updateUsrDialog()
return
@@ -491,7 +476,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
inserted_modify_id.assignment = "Unassigned"
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
else
- to_chat(usr, "You are not authorized to demote this position.")
+ to_chat(usr, "You are not authorized to demote this position.")
if ("reg")
if (authenticated)
var/t2 = inserted_modify_id
@@ -501,7 +486,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
inserted_modify_id.registered_name = newName
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
else
- to_chat(usr, "Invalid name entered.")
+ to_chat(usr, "Invalid name entered.")
updateUsrDialog()
return
if ("mode")
@@ -514,7 +499,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 && !target_dept)
var/edit_job_target = href_list["job"]
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j)
@@ -531,7 +516,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 && !target_dept)
var/edit_job_target = href_list["job"]
var/datum/job/j = SSjob.GetJob(edit_job_target)
if(!j)
@@ -549,7 +534,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 && !target_dept)
var/priority_target = href_list["job"]
var/datum/job/j = SSjob.GetJob(priority_target)
if(!j)
@@ -565,7 +550,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
return
else
SSjob.prioritized_jobs += j
- to_chat(usr, "[j.title] has been successfully [priority ? "prioritized" : "unprioritized"]. Potential employees will notice your request.")
+ to_chat(usr, "[j.title] has been successfully [priority ? "prioritized" : "unprioritized"]. Potential employees will notice your request.")
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE)
if ("print")
@@ -637,3 +622,8 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
icon_screen = "idqm"
light_color = LIGHT_COLOR_ORANGE
+
+#undef JOB_ALLOWED
+#undef JOB_COOLDOWN
+#undef JOB_MAX_POSITIONS
+#undef JOB_DENIED
diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm
index 2c3d7f63..71c84f9a 100644
--- 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))
@@ -335,7 +333,7 @@
Nuke_request(input, usr)
to_chat(usr, "Request sent.")
usr.log_message("has requested the nuclear codes from CentCom", LOG_SAY)
- priority_announce("The codes for the on-station nuclear self-destruct have been requested by [usr]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested",'sound/ai/commandreport.ogg')
+ priority_announce("The codes for the on-station nuclear self-destruct have been requested by [usr]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested","commandreport")
CM.lastTimeUsed = world.time
@@ -431,6 +429,7 @@
return ..()
/obj/machinery/computer/communications/emag_act(mob/user)
+ . = ..()
if(obj_flags & EMAGGED)
return
obj_flags |= EMAGGED
@@ -439,6 +438,7 @@
authenticated = 2
to_chat(user, "You scramble the communication routing circuits!")
playsound(src, 'sound/machines/terminal_alert.ogg', 50, 0)
+ return TRUE
/obj/machinery/computer/communications/ui_interact(mob/user)
. = ..()
diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm
index ef47445c..9422a979 100644
--- a/code/game/objects/items/cards_ids.dm
+++ b/code/game/objects/items/cards_ids.dm
@@ -80,6 +80,7 @@
righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi'
item_flags = NO_MAT_REDEMPTION | NOBLUDGEON
var/prox_check = TRUE //If the emag requires you to be in range
+ var/uses = 10
/obj/item/card/emag/bluespace
name = "bluespace cryptographic sequencer"
@@ -93,39 +94,55 @@
/obj/item/card/emag/afterattack(atom/target, mob/user, proximity)
. = ..()
var/atom/A = target
- if(!proximity && prox_check)
+ if(!proximity && prox_check || !(isobj(A) || issilicon(A) || isbot(A) || isdrone(A)))
+ return
+ if(istype(A, /obj/item/storage) && !(istype(A, /obj/item/storage/lockbox) || istype(A, /obj/item/storage/pod)))
return
- //Citadel changes: modular code misfiring, so we're bypassing into main code.
if(!uses)
user.visible_message("[src] emits a weak spark. It's burnt out!")
playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
return
else if(uses <= 3)
playsound(src, 'sound/effects/light_flicker.ogg', 30, 1) //Tiiiiiiny warning sound to let ya know your emag's almost dead
-
- if(isturf(A))
+ if(!A.emag_act(user))
return
- if(istype(A,/obj/item/storage/lockbox) || istype(A, /obj/item/storage/pod))
- A.emag_act(user)
- uses = max(uses - 1, 0)
- if(!uses)
- user.visible_message("[src] fizzles and sparks. It seems like it's out of charges.")
- playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
- if(istype(A,/obj/item/storage))
- return
- if(!(isobj(A) || issilicon(A) || isbot(A) || isdrone(A)))
- return
- else
- A.emag_act(user)
- uses = max(uses - 1, 0)
- if(!uses)
- user.visible_message("[src] fizzles and sparks. It seems like it's out of charges.")
- playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
+ uses = max(uses - 1, 0)
+ if(!uses)
+ user.visible_message("[src] fizzles and sparks. It seems like it's out of charges.")
+ playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
/obj/item/card/emag/examine(mob/user)
. = ..()
. += "It has [uses ? uses : "no"] charges left."
+/obj/item/card/emag/attackby(obj/item/W, mob/user, params)
+ if(istype(W, /obj/item/emagrecharge))
+ var/obj/item/emagrecharge/ER = W
+ if(ER.uses)
+ uses += ER.uses
+ to_chat(user, "You have added [ER.uses] charges to [src]. It now has [uses] charges.")
+ playsound(src, "sparks", 100, 1)
+ ER.uses = 0
+ else
+ to_chat(user, "[ER] has no charges left.")
+ return
+ . = ..()
+
+/obj/item/emagrecharge
+ name = "electromagnet charging device"
+ desc = "A small cell with two prongs lazily jabbed into it. It looks like it's made for charging the small batteries found in electromagnetic devices, sadly this can't be recharged like a normal cell."
+ icon = 'icons/obj/module.dmi'
+ icon_state = "cell_mini"
+ item_flags = NOBLUDGEON
+ var/uses = 5 //Dictates how many charges the device adds to compatible items
+
+/obj/item/emagrecharge/examine(mob/user)
+ . = ..()
+ if(uses)
+ . += "It can add up to [uses] charges to compatible devices"
+ else
+ . += "It has a small, red, blinking light coming from inside of it. It's spent."
+
/obj/item/card/emagfake
desc = "It's a card with a magnetic strip attached to some circuitry. Closer inspection shows that this card is a poorly made replica, with a \"DonkCo\" logo stamped on the back."
name = "cryptographic sequencer"
@@ -186,6 +203,9 @@
/obj/item/card/id/GetID()
return src
+/obj/item/card/id/RemoveID()
+ return src
+
/*
Usage:
update_label()
@@ -357,12 +377,41 @@ update_label("John Doe", "Clowny")
lefthand_file = 'icons/mob/inhands/equipment/idcards_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi'
assignment = "Prisoner"
- registered_name = "Scum"
+ access = list(ACCESS_ENTER_GENPOP)
+
+ //Lavaland labor camp
var/goal = 0 //How far from freedom?
var/points = 0
+ //Genpop
+ var/sentence = 0 //When world.time is greater than this number, the card will have its ACCESS_ENTER_GENPOP access replaced with ACCESS_LEAVE_GENPOP the next time it's checked, unless this value is 0/null
+ var/crime= "\[REDACTED\]"
-/obj/item/card/id/prisoner/attack_self(mob/user)
- to_chat(usr, "You have accumulated [points] out of the [goal] points you need for freedom.")
+/obj/item/card/id/prisoner/GetAccess()
+ if((sentence && world.time >= sentence) || (goal && points >= goal))
+ access = list(ACCESS_LEAVE_GENPOP)
+ return ..()
+
+/obj/item/card/id/prisoner/process()
+ if(!sentence)
+ STOP_PROCESSING(SSobj, src)
+ return
+ if(world.time >= sentence)
+ playsound(loc, 'sound/machines/ping.ogg', 50, 1)
+ if(isliving(loc))
+ to_chat(loc, "[src] buzzes: You have served your sentence! You may now exit prison through the turnstiles and collect your belongings.")
+ STOP_PROCESSING(SSobj, src)
+ return
+
+/obj/item/card/id/prisoner/examine(mob/user)
+ . = ..()
+ if(sentence && world.time < sentence)
+ . += "You're currently serving a sentence for [crime]. [DisplayTimeText(sentence - world.time)] left."
+ else if(goal)
+ . += "You have accumulated [points] out of the [goal] points you need for freedom."
+ else if(!sentence)
+ . += "You are currently serving a permanent sentence for [crime]."
+ else
+ . += "Your sentence is up! You're free!"
/obj/item/card/id/prisoner/one
name = "Prisoner #13-001"
@@ -438,10 +487,60 @@ update_label("John Doe", "Clowny")
desc = "A special ID card that allows access to APC terminals."
access = list(ACCESS_ENGINE_EQUIP)
-/obj/item/card/id/away/snowdin
- name = "a perfectly generic identification card"
- desc = "A perfectly generic identification card. Looks like it could use some flavor."
- icon_state = "centcom"
+//Polychromatic Knight Badge
+
+/obj/item/card/id/knight
+ var/id_color = "#00FF00" //defaults to green
+ name = "knight badge"
+ icon_state = "knight"
+ desc = "A badge denoting the owner as a knight! It has a strip for swiping like an ID"
+
+/obj/item/card/id/knight/update_label(newname, newjob)
+ if(newname || newjob)
+ name = "[(!newname) ? "knight badge" : "[newname]'s Knight Badge"][(!newjob) ? "" : " ([newjob])"]"
+ return
+
+ name = "[(!registered_name) ? "knight badge" : "[registered_name]'s Knight Badge"][(!assignment) ? "" : " ([assignment])"]"
+
+/obj/item/card/id/knight/update_icon()
+ var/mutable_appearance/id_overlay = mutable_appearance(icon, "knight_overlay")
+
+ if(id_color)
+ id_overlay.color = id_color
+ cut_overlays()
+
+ add_overlay(id_overlay)
+
+/obj/item/card/id/knight/AltClick(mob/living/user)
+ . = ..()
+ if(!in_range(src, user)) //Basic checks to prevent abuse
+ return
+ if(user.incapacitated() || !istype(user))
+ to_chat(user, "You can't do that right now!")
+ return
+ if(alert("Are you sure you want to recolor your id?", "Confirm Repaint", "Yes", "No") == "Yes")
+ var/energy_color_input = input(usr,"","Choose Energy Color",id_color) as color|null
+ if(!in_range(src, user) || !energy_color_input)
+ return
+ if(user.incapacitated() || !istype(user))
+ to_chat(user, "You can't do that right now!")
+ return
+ id_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
+ update_icon()
+
+/obj/item/card/id/knight/Initialize()
+ . = ..()
+ update_icon()
+
+/obj/item/card/id/knight/examine(mob/user)
+ . = ..()
+ . += "Alt-click to recolor it."
+
+/obj/item/card/id/knight/blue
+ id_color = "#0000FF"
+
+/obj/item/card/id/knight/captain
+ id_color = "#FFD700"
/obj/item/card/id/away/snowdin/eng
name = "Arctic Station Engineer's ID card"
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index c4b86f04..37b8e3ff 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -139,7 +139,7 @@ GLOBAL_LIST_EMPTY(PDAs)
var/choice = input(M, "Choose the a reskin for [src]","Reskin Object") as null|anything in GLOB.pda_reskins
var/new_icon = GLOB.pda_reskins[choice]
- if(QDELETED(src) || isnull(new_icon) || new_icon == icon || M.incapacitated() || !in_range(M,src))
+ if(QDELETED(src) || isnull(new_icon) || new_icon == icon || !M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
icon = new_icon
update_icon(FALSE, TRUE)
@@ -199,6 +199,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()
@@ -273,7 +285,7 @@ GLOBAL_LIST_EMPTY(PDAs)
dat += text("
[id ? "Update PDA Info" : ""]
")
dat += "[STATION_TIME_TIMESTAMP("hh:mm:ss")]
" //:[world.time / 100 % 6][world.time / 100 % 10]"
- dat += "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer+540]"
+ dat += "[time2text(world.realtime, "MMM DD")] [GLOB.year_integer]"
dat += "
"
@@ -687,15 +699,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)
@@ -877,17 +901,27 @@ GLOBAL_LIST_EMPTY(PDAs)
if(istype(C))
I = C
- if(I && I.registered_name)
+ if(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)
+ 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 0adf4604..0b026e99 100644
--- a/code/game/objects/items/storage/wallets.dm
+++ b/code/game/objects/items/storage/wallets.dm
@@ -67,6 +67,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 39465df7..e0f97c7c 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 = "Kinaris.Co bounty console"
desc = "Used to check and claim bounties offered by Kinaris"
@@ -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", "Kinaris 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 1ad0d569..526062d0 100644
--- a/code/modules/cargo/console.dm
+++ b/code/modules/cargo/console.dm
@@ -3,6 +3,7 @@
desc = "Used to order supplies, approve requests, and control the shuttle."
icon_screen = "supply"
circuit = /obj/item/circuitboard/computer/cargo
+ req_access = list(ACCESS_CARGO)
var/requestonly = FALSE
var/contraband = FALSE
var/safety_warning = "For safety reasons, the automated supply shuttle \
@@ -17,6 +18,7 @@
desc = "Used to request supplies from cargo."
icon_screen = "request"
circuit = /obj/item/circuitboard/computer/cargo/request
+ req_access = list()
requestonly = TRUE
/obj/machinery/computer/cargo/Initialize()
@@ -36,6 +38,7 @@
. |= EXPORT_EMAG
/obj/machinery/computer/cargo/emag_act(mob/user)
+ . = ..()
if(obj_flags & EMAGGED)
return
user.visible_message("[user] swipes a suspicious card through [src]!",
@@ -48,6 +51,8 @@
var/obj/item/circuitboard/computer/cargo/board = circuit
board.contraband = TRUE
board.obj_flags |= EMAGGED
+ req_access = list()
+ return TRUE
/obj/machinery/computer/cargo/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
@@ -111,6 +116,9 @@
/obj/machinery/computer/cargo/ui_act(action, params, datum/tgui/ui)
if(..())
return
+ if(!allowed(usr))
+ to_chat(usr, "Access denied.")
+ return
if(action != "add" && requestonly)
return
switch(action)
@@ -159,7 +167,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 186b55a6..049ba8c8 100644
--- a/code/modules/cargo/expressconsole.dm
+++ b/code/modules/cargo/expressconsole.dm
@@ -54,6 +54,7 @@
..()
/obj/machinery/computer/cargo/express/emag_act(mob/living/user)
+ . = SEND_SIGNAL(src, COMSIG_ATOM_EMAG_ACT)
if(obj_flags & EMAGGED)
return
user.visible_message("[user] swipes a suspicious card through [src]!",
@@ -63,6 +64,8 @@
var/obj/item/circuitboard/computer/cargo/board = circuit
board.obj_flags |= EMAGGED
packin_up()
+ req_access = list()
+ return TRUE
/obj/machinery/computer/cargo/express/proc/packin_up() // oh shit, I'm sorry
meme_pack_data = list() // sorry for what?
@@ -153,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 b3e9ef2c..29234a2b 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)
@@ -121,7 +127,7 @@
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_LIVING, ACCESS_CENT_BAR)
/proc/get_all_accesses()
- return list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT,
+ return list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP,
ACCESS_MEDICAL, ACCESS_GENETICS, ACCESS_MORGUE, ACCESS_RD,
ACCESS_TOX, ACCESS_TOX_STORAGE, ACCESS_CHEMISTRY, ACCESS_ENGINE, ACCESS_ENGINE_EQUIP, ACCESS_MAINT_TUNNELS,
ACCESS_EXTERNAL_AIRLOCKS, ACCESS_CHANGE_IDS, ACCESS_AI_UPLOAD,
@@ -157,7 +163,7 @@
if(1) //station general
return list(ACCESS_KITCHEN,ACCESS_BAR, ACCESS_HYDROPONICS, ACCESS_JANITOR, ACCESS_CHAPEL_OFFICE, ACCESS_CREMATORIUM, ACCESS_LIBRARY, ACCESS_THEATRE, ACCESS_LAWYER)
if(2) //security
- return list(ACCESS_SEC_DOORS, ACCESS_WEAPONS, ACCESS_SECURITY, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT, ACCESS_HOS)
+ return list(ACCESS_SEC_DOORS, ACCESS_WEAPONS, ACCESS_SECURITY, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT, ACCESS_HOS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP)
if(3) //medbay
return list(ACCESS_MEDICAL, ACCESS_GENETICS, ACCESS_CLONING, ACCESS_MORGUE, ACCESS_CHEMISTRY, ACCESS_VIROLOGY, ACCESS_SURGERY, ACCESS_CMO)
if(4) //research
@@ -312,6 +318,10 @@
return "Gateway"
if(ACCESS_SEC_DOORS)
return "Brig"
+ if(ACCESS_ENTER_GENPOP)
+ return "Prison Turnstile Entrance"
+ if(ACCESS_LEAVE_GENPOP)
+ return "Prison Turnstile Exit"
if(ACCESS_MINERAL_STOREROOM)
return "Mineral Storage"
if(ACCESS_MINISAT)
diff --git a/code/modules/jobs/job_types/security.dm b/code/modules/jobs/job_types/security.dm
index b2b0271f..4600fce9 100644
--- a/code/modules/jobs/job_types/security.dm
+++ b/code/modules/jobs/job_types/security.dm
@@ -26,11 +26,11 @@ Head of Security
outfit = /datum/outfit/job/hos
- access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_WEAPONS,
+ access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_WEAPONS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP,
ACCESS_FORENSICS_LOCKERS, ACCESS_MORGUE, ACCESS_MAINT_TUNNELS, ACCESS_ALL_PERSONAL_LOCKERS,
ACCESS_RESEARCH, ACCESS_ENGINE, ACCESS_MINING, ACCESS_MEDICAL, ACCESS_CONSTRUCTION, ACCESS_MAILSORTING,
ACCESS_HEADS, ACCESS_HOS, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_GATEWAY, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM)
- minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_WEAPONS,
+ minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_WEAPONS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP,
ACCESS_FORENSICS_LOCKERS, ACCESS_MORGUE, ACCESS_MAINT_TUNNELS, ACCESS_ALL_PERSONAL_LOCKERS,
ACCESS_RESEARCH, ACCESS_ENGINE, ACCESS_MINING, ACCESS_MEDICAL, ACCESS_CONSTRUCTION, ACCESS_MAILSORTING,
ACCESS_HEADS, ACCESS_HOS, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_GATEWAY, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM)
@@ -94,8 +94,8 @@ Warden
outfit = /datum/outfit/job/warden
- access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_MORGUE, ACCESS_WEAPONS, ACCESS_FORENSICS_LOCKERS, ACCESS_MINERAL_STOREROOM)
- minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_WEAPONS, ACCESS_MINERAL_STOREROOM) //SEE /DATUM/JOB/WARDEN/GET_ACCESS()
+ access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_MORGUE, ACCESS_WEAPONS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP, ACCESS_FORENSICS_LOCKERS, ACCESS_MINERAL_STOREROOM)
+ minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_COURT, ACCESS_WEAPONS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP, ACCESS_MINERAL_STOREROOM) //SEE /DATUM/JOB/WARDEN/GET_ACCESS()
mind_traits = list(TRAIT_LAW_ENFORCEMENT_METABOLISM)
blacklisted_quirks = list(/datum/quirk/mute, /datum/quirk/nonviolent, /datum/quirk/paraplegic)
@@ -210,8 +210,8 @@ Security Officer
outfit = /datum/outfit/job/security
- access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_MORGUE, ACCESS_WEAPONS, ACCESS_FORENSICS_LOCKERS, ACCESS_MINERAL_STOREROOM)
- minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_WEAPONS, ACCESS_MINERAL_STOREROOM) //BUT SEE /DATUM/JOB/WARDEN/GET_ACCESS()
+ access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_MORGUE, ACCESS_WEAPONS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP, ACCESS_FORENSICS_LOCKERS, ACCESS_MINERAL_STOREROOM)
+ minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_WEAPONS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP, ACCESS_MINERAL_STOREROOM) //BUT SEE /DATUM/JOB/WARDEN/GET_ACCESS()
mind_traits = list(TRAIT_LAW_ENFORCEMENT_METABOLISM)
blacklisted_quirks = list(/datum/quirk/mute, /datum/quirk/nonviolent, /datum/quirk/paraplegic)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 89765081..1f993f38 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -584,7 +584,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 d489c2e3..6bb9dd6e 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))
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 689cb51f..36041b02 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 1d14e084..4918e378 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -942,10 +942,6 @@
/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 04a0aa40..80f999f8 100644
--- a/code/modules/mob/mob_helpers.dm
+++ b/code/modules/mob/mob_helpers.dm
@@ -506,3 +506,17 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
. = BLOOD_COLOR_BUG
//add more stuff to the switch if you have more blood colors for different types
// the defines are in _DEFINES/misc.dm
+
+//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 daaf8a9e..8a8dbbc0 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 051b12ea..f74b53dd 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 f8372dd2..243ae89d 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 7eef8eb1..c68e1ad1 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 020b4b29..435db75f 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 4b3cabd9..4ee94c05 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 b9dd049d..00000000
--- 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/modular_citadel/code/game/objects/ids.dm b/modular_citadel/code/game/objects/ids.dm
deleted file mode 100644
index 76469547..00000000
--- a/modular_citadel/code/game/objects/ids.dm
+++ /dev/null
@@ -1,83 +0,0 @@
-
-//Polychromatic Knight Badge
-
-/obj/item/card/id/knight
- var/id_color = "#00FF00" //defaults to green
- name = "knight badge"
- icon = 'modular_citadel/icons/obj/id.dmi'
- icon_state = "knight"
- desc = "A badge denoting the owner as a knight! It has a strip for swiping like an ID"
-
-/obj/item/card/id/knight/update_label(newname, newjob)
- . = ..()
- if(newname || newjob)
- name = "[(!newname) ? "identification card" : "[newname]'s Knight Badge"][(!newjob) ? "" : " ([newjob])"]"
- return
-
- name = "[(!registered_name) ? "identification card" : "[registered_name]'s Knight Badge"][(!assignment) ? "" : " ([assignment])"]"
-
-/obj/item/card/id/knight/update_icon()
- var/mutable_appearance/id_overlay = mutable_appearance('modular_citadel/icons/obj/id.dmi', "knight_overlay")
-
- if(id_color)
- id_overlay.color = id_color
- cut_overlays()
-
- add_overlay(id_overlay)
-
-/obj/item/card/id/knight/AltClick(mob/living/user)
- if(!in_range(src, user)) //Basic checks to prevent abuse
- return
- if(user.incapacitated() || !istype(user))
- to_chat(user, "You can't do that right now!")
- return
- if(alert("Are you sure you want to recolor your id?", "Confirm Repaint", "Yes", "No") == "Yes")
- var/energy_color_input = input(usr,"","Choose Energy Color",id_color) as color|null
- if(energy_color_input)
- id_color = sanitize_hexcolor(energy_color_input, desired_format=6, include_crunch=1)
- update_icon()
-
-/obj/item/card/id/knight/Initialize()
- . = ..()
- update_icon()
-
-/obj/item/card/id/knight/examine(mob/user)
- . = ..()
- . += "Alt-click to recolor it."
-
-//=================================================
-
-/obj/item/emagrecharge
- name = "electromagnet charging device"
- desc = "A small cell with two prongs lazily jabbed into it. It looks like it's made for charging the small batteries found in electromagnetic devices."
- icon = 'icons/obj/module.dmi'
- icon_state = "cell_mini"
- item_flags = NOBLUDGEON
- var/uses = 5 //Dictates how many charges the device adds to compatible items
-
-/obj/item/emagrecharge/examine(mob/user)
- . = ..()
- if(uses)
- to_chat(user, "It can add up to [uses] charges to compatible devices")
- else
- to_chat(user, "It has a small, red, blinking light coming from inside of it. It's spent.")
-
-/obj/item/card/emag
- var/uses = 10
-
-/obj/item/card/emag/examine(mob/user)
- . = ..()
- to_chat(user, "It has [uses ? uses : "no"] charges left.")
-
-/obj/item/card/emag/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/emagrecharge))
- var/obj/item/emagrecharge/ER = W
- if(ER.uses)
- uses += ER.uses
- to_chat(user, "You have added [ER.uses] charges to [src]. It now has [uses] charges.")
- playsound(src, "sparks", 100, 1)
- ER.uses = 0
- else
- to_chat(user, "[ER] has no charges left.")
- return
- . = ..()
diff --git a/tgstation.dme b/tgstation.dme
index a6158571..0984a6d5 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -3064,11 +3064,9 @@
#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"
-#include "modular_citadel\code\game\objects\ids.dm"
#include "modular_citadel\code\game\objects\items.dm"
#include "modular_citadel\code\game\objects\tools.dm"
#include "modular_citadel\code\game\objects\effects\spawner\spawners.dm"