The ID Code Cleanup and Fixening (tm)

This commit is contained in:
kevinz000
2019-11-16 01:17:23 -07:00
committed by Dip
parent c59c9e88ae
commit c7db7cb2be
27 changed files with 467 additions and 364 deletions
+1 -3
View File
@@ -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
+150 -160
View File
@@ -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)
. += "<span class='notice'>Alt-click to eject the ID card.</span>"
/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)
. += "<span class='notice'>Alt-click to eject the ID card.</span>"
/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, "<span class='warning'>There's already an ID card in the console!</span>")
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, "<span class='warning'>There's already an ID card in the console!</span>")
return FALSE
if(!user.transferItemToLoc(I, src))
return FALSE
user.visible_message("<span class='notice'>[user] inserts an ID card into the console.</span>", \
"<span class='notice'>You insert the ID card into the console.</span>")
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("<span class='notice'>[user] inserts \the [card_to_insert] into \the [src].</span>",
"<span class='notice'>You insert \the [card_to_insert] into \the [src].</span>")
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, "<span class='warning'>There's no ID card in the console!</span>")
to_chat(user, "<span class='warning'>That slot is empty!</span>")
return FALSE
else
target.forceMove(drop_location())
if(!issilicon(user) && Adjacent(user))
user.put_in_hands(target)
user.visible_message("<span class='notice'>[user] gets an ID card from the console.</span>", \
"<span class='notice'>You get the ID card from the console.</span>")
user.visible_message("<span class='notice'>[user] gets \the [target] from \the [src].</span>", \
"<span class='notice'>You get \the [target] from \the [src].</span>")
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 += "<tt><b>Crew Manifest:</b><br>Please use security record computer to modify entries.<br><br>"
for(var/datum/data/record/t in sortRecord(GLOB.data_core.general))
crew += t.fields["name"] + " - " + t.fields["rank"] + "<br>"
dat = "<tt><b>Crew Manifest:</b><br>Please use security record computer to modify entries.<br><br>[crew]<a href='?src=[REF(src)];choice=print'>Print</a><br><br><a href='?src=[REF(src)];choice=mode;mode_target=0'>Access ID modification console.</a><br></tt>"
dat += {"[t.fields["name"]] - [t.fields["rank"]]<br>"}
dat += "<a href='?src=[REF(src)];choice=print'>Print</a><br><br><a href='?src=[REF(src)];choice=mode;mode_target=0'>Access ID modification console.</a><br></tt>"
else if(mode == 2)
// JOB MANAGEMENT
dat = "<a href='?src=[REF(src)];choice=return'>Return</a>"
dat += " || Confirm Identity: "
var/S
if(inserted_scan_id)
S = html_encode(inserted_scan_id.name)
else
S = "--------"
dat += "<a href='?src=[REF(src)];choice=inserted_scan_id'>[S]</a>"
dat += "<table>"
dat += "<tr><td style='width:25%'><b>Job</b></td><td style='width:25%'><b>Slots</b></td><td style='width:25%'><b>Open job</b></td><td style='width:25%'><b>Close job</b><td style='width:25%'><b>Prioritize</b></td></td></tr>"
var/ID
if(inserted_scan_id && (ACCESS_CHANGE_IDS in inserted_scan_id.access) && !target_dept)
ID = 1
else
ID = 0
dat += {"<a href='?src=[REF(src)];choice=return'>Return</a>
<table><tr><td style='width:25%'><b>Job</b></td><td style='width:25%'><b>Slots</b></td>
<td style='width:25%'><b>Open job</b></td><td style='width:25%'><b>Close job</b><td style='width:25%'><b>Prioritize</b></td></td></tr>"}
for(var/datum/job/job in SSjob.occupations)
dat += "<tr>"
if(job.title in blacklisted)
continue
dat += "<td>[job.title]</td>"
dat += "<td>[job.current_positions]/[job.total_positions]</td>"
dat += "<td>"
dat += {"<td>[job.title]</td>
<td>[job.current_positions]/[job.total_positions]</td>
<td>"}
switch(can_open_job(job))
if(1)
if(ID)
if(JOB_ALLOWED)
if(authenticated == 2)
dat += "<a href='?src=[REF(src)];choice=make_job_available;job=[job.title]'>Open Position</a><br>"
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 += "</td><td>"
switch(can_close_job(job))
if(1)
if(ID)
if(JOB_ALLOWED)
if(authenticated == 2)
dat += "<a href='?src=[REF(src)];choice=make_job_unavailable;job=[job.title]'>Close Position</a>"
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 += "</td><td>"
switch(job.total_positions)
if(0)
dat += "Denied"
else
if(ID)
if(authenticated == 2)
if(job in SSjob.prioritized_jobs)
dat += "<a href='?src=[REF(src)];choice=prioritize_job;job=[job.title]'>Deprioritize</a>"
else
@@ -250,57 +251,35 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
dat += "</td></tr>"
dat += "</table>"
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 += "<br><i>Please insert the cards into the slots</i><br>"
header += "Target: <a href='?src=[REF(src)];choice=inserted_modify_id'>[target_name]</a><br>"
header += "Confirm Identity: <a href='?src=[REF(src)];choice=inserted_scan_id'>[scan_name]</a><br>"
header += {"<br><i>Please insert the cards into the slots</i><br>
Target: <a href='?src=[REF(src)];choice=inserted_modify_id'>[target_name]</a><br>
Confirm Identity: <a href='?src=[REF(src)];choice=inserted_scan_id'>[scan_name]</a><br>"}
else
header += "<div align='center'><br>"
header += "<a href='?src=[REF(src)];choice=inserted_modify_id'>Remove [target_name]</a> || "
header += "<a href='?src=[REF(src)];choice=inserted_scan_id'>Remove [scan_name]</a> <br> "
header += "<a href='?src=[REF(src)];choice=mode;mode_target=1'>Access Crew Manifest</a> <br> "
header += "<a href='?src=[REF(src)];choice=logout'>Log Out</a></div>"
header += {"<div align='center'><br>
Target: <a href='?src=[REF(src)];choice=inserted_modify_id'>Remove [target_name]</a> ||
Confirm Identity: <a href='?src=[REF(src)];choice=inserted_scan_id'>Remove [scan_name]</a><br>
<a href='?src=[REF(src)];choice=mode;mode_target=1'>Access Crew Manifest</a><br>
[!target_dept ? "<a href='?src=[REF(src)];choice=mode;mode_target=2'>Job Management</a><br>" : ""]
<a href='?src=[REF(src)];choice=logout'>Log Out</a></div>"}
header += "<hr>"
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 += "<a href='?src=[REF(src)];choice=assign;assign_target=[job]'>[replacetext(job, " ", "&nbsp")]</a> " //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 += "<a href='?src=[REF(src)];choice=assign;assign_target=[job]'>[replacetext(job, " ", "&nbsp;")]</a> " //make sure there isn't a line break in the middle of a job
carddesc += {"<script type="text/javascript">
function markRed(){
var nameField = document.getElementById('namefield');
@@ -312,20 +291,20 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
}
function showAll(){
var allJobsSlot = document.getElementById('alljobsslot');
allJobsSlot.innerHTML = "<a href='#' onclick='hideAll()'>hide</a><br>"+ "[jobs_all]";
allJobsSlot.innerHTML = "<a href='#' onclick='hideAll()'>hide</a><br>"+ "[jobs_all.Join()]";
}
function hideAll(){
var allJobsSlot = document.getElementById('alljobsslot');
allJobsSlot.innerHTML = "<a href='#' onclick='showAll()'>show</a>";
}
</script>"}
carddesc += "<form name='cardcomp' action='?src=[REF(src)]' method='get'>"
carddesc += "<input type='hidden' name='src' value='[REF(src)]'>"
carddesc += "<input type='hidden' name='choice' value='reg'>"
carddesc += "<b>registered name:</b> <input type='text' id='namefield' name='reg' value='[target_owner]' style='width:250px; background-color:white;' onchange='markRed()'>"
carddesc += "<input type='submit' value='Rename' onclick='markGreen()'>"
carddesc += "</form>"
carddesc += "<b>Assignment:</b> "
carddesc += {"<form name='cardcomp' action='?src=[REF(src)]' method='get'>
<input type='hidden' name='src' value='[REF(src)]'>
<input type='hidden' name='choice' value='reg'>
<b>registered name:</b> <input type='text' id='namefield' name='reg' value='[target_owner]' style='width:250px; background-color:white;' onchange='markRed()'>
<input type='submit' value='Rename' onclick='markGreen()'>
</form>
<b>Assignment:</b> "}
jobs += "<span id='alljobsslot'><a href='#' onclick='showAll()'>[target_rank]</a></span>" //CHECK THIS
@@ -333,18 +312,18 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
carddesc += "<b>registered_name:</b> [target_owner]</span>"
jobs += "<b>Assignment:</b> [target_rank] (<a href='?src=[REF(src)];choice=demote'>Demote</a>)</span>"
var/accesses = ""
if(istype(src, /obj/machinery/computer/card/centcom))
var/list/accesses = list()
if(istype(src, /obj/machinery/computer/card/centcom)) //REE
accesses += "<h5>Central Command:</h5>"
for(var/A in get_all_centcom_access())
if(A in inserted_modify_id.access)
accesses += "<a href='?src=[REF(src)];choice=access;access_target=[A];allowed=0'><font color=\"red\">[replacetext(get_centcom_access_desc(A), " ", "&nbsp")]</font></a> "
accesses += "<a href='?src=[REF(src)];choice=access;access_target=[A];allowed=0'><font color=\"6bc473\">[replacetext(get_centcom_access_desc(A), " ", "&nbsp")]</font></a> "
else
accesses += "<a href='?src=[REF(src)];choice=access;access_target=[A];allowed=1'>[replacetext(get_centcom_access_desc(A), " ", "&nbsp")]</a> "
else
accesses += "<div align='center'><b>Access</b></div>"
accesses += "<table style='width:100%'>"
accesses += "<tr>"
accesses += {"<div align='center'><b>Access</b></div>
<table style='width:100%'>
<tr>"}
for(var/i = 1; i <= 7; i++)
if(authenticated == 1 && !(i in region_access))
continue
@@ -356,23 +335,23 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
accesses += "<td style='width:14%' valign='top'>"
for(var/A in get_region_accesses(i))
if(A in inserted_modify_id.access)
accesses += "<a href='?src=[REF(src)];choice=access;access_target=[A];allowed=0'><font color=\"red\">[replacetext(get_access_desc(A), " ", "&nbsp")]</font></a> "
accesses += "<a href='?src=[REF(src)];choice=access;access_target=[A];allowed=0'><font color=\"6bc473\">[replacetext(get_access_desc(A), " ", "&nbsp")]</font></a> "
else
accesses += "<a href='?src=[REF(src)];choice=access;access_target=[A];allowed=1'>[replacetext(get_access_desc(A), " ", "&nbsp")]</a> "
accesses += "<br>"
accesses += "</td>"
accesses += "</tr></table>"
body = "[carddesc]<br>[jobs]<br><br>[accesses]" //CHECK THIS
body = "[carddesc.Join()]<br>[jobs.Join()]<br><br>[accesses.Join()]<hr>" //CHECK THIS
else
body = "<a href='?src=[REF(src)];choice=auth'>{Log in}</a> <br><hr>"
body += "<a href='?src=[REF(src)];choice=mode;mode_target=1'>Access Crew Manifest</a>"
else if (!authenticated)
body = {"<a href='?src=[REF(src)];choice=auth'>Log In</a><br><hr>
<a href='?src=[REF(src)];choice=mode;mode_target=1'>Access Crew Manifest</a><br><hr>"}
if(!target_dept)
body += "<br><hr><a href = '?src=[REF(src)];choice=mode;mode_target=2'>Job Management</a>"
body += "<a href='?src=[REF(src)];choice=mode;mode_target=2'>Job Management</a><hr>"
dat = "<tt>[header][body]<hr><br></tt>"
dat = list("<tt>", header.Join(), body, "<br></tt>")
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, "<span class='error'>No log exists for this job.</span>")
to_chat(usr, "<span class='alert'>No log exists for this job.</span>")
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, "<span class='error'>You are not authorized to demote this position.</span>")
to_chat(usr, "<span class='alert'>You are not authorized to demote this position.</span>")
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, "<span class='error'>Invalid name entered.</span>")
to_chat(usr, "<span class='alert'>Invalid name entered.</span>")
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, "<span class='notice'>[j.title] has been successfully [priority ? "prioritized" : "unprioritized"]. Potential employees will notice your request.</span>")
to_chat(usr, "<span class='notice'>[j.title] has been successfully [priority ? "prioritized" : "unprioritized"]. Potential employees will notice your request.</span>")
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
@@ -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, "<span class='notice'>Request sent.</span>")
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, "<span class='danger'>You scramble the communication routing circuits!</span>")
playsound(src, 'sound/machines/terminal_alert.ogg', 50, 0)
return TRUE
/obj/machinery/computer/communications/ui_interact(mob/user)
. = ..()
+126 -27
View File
@@ -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("<span class='warning'>[src] emits a weak spark. It's burnt out!</span>")
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("<span class='warning'>[src] fizzles and sparks. It seems like it's out of charges.</span>")
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("<span class='warning'>[src] fizzles and sparks. It seems like it's out of charges.</span>")
playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
uses = max(uses - 1, 0)
if(!uses)
user.visible_message("<span class='warning'>[src] fizzles and sparks. It seems like it's out of charges.</span>")
playsound(src, 'sound/effects/light_flicker.ogg', 100, 1)
/obj/item/card/emag/examine(mob/user)
. = ..()
. += "<span class='notice'>It has <b>[uses ? uses : "no"]</b> charges left.</span>"
/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, "<span class='notice'>You have added [ER.uses] charges to [src]. It now has [uses] charges.</span>")
playsound(src, "sparks", 100, 1)
ER.uses = 0
else
to_chat(user, "<span class='warning'>[ER] has no charges left.</span>")
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)
. += "<span class='notice'>It can add up to [uses] charges to compatible devices</span>"
else
. += "<span class='warning'>It has a small, red, blinking light coming from inside of it. It's spent.</span>"
/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, "<span class='notice'>You have accumulated [points] out of the [goal] points you need for freedom.</span>")
/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, "<span class='boldnotice'>[src]</span><span class='notice'> buzzes: You have served your sentence! You may now exit prison through the turnstiles and collect your belongings.</span>")
STOP_PROCESSING(SSobj, src)
return
/obj/item/card/id/prisoner/examine(mob/user)
. = ..()
if(sentence && world.time < sentence)
. += "<span class='notice'>You're currently serving a sentence for [crime]. <b>[DisplayTimeText(sentence - world.time)]</b> left.</span>"
else if(goal)
. += "<span class='notice'>You have accumulated [points] out of the [goal] points you need for freedom.</span>"
else if(!sentence)
. += "<span class='warning'>You are currently serving a permanent sentence for [crime].</span>"
else
. += "<span class='notice'>Your sentence is up! You're free!</span>"
/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, "<span class='warning'>You can't do that right now!</span>")
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, "<span class='warning'>You can't do that right now!</span>")
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)
. = ..()
. += "<span class='notice'>Alt-click to recolor it.</span>"
/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"
+47 -13
View File
@@ -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("<br><a href='?src=[REF(src)];choice=UpdateInfo'>[id ? "Update PDA Info" : ""]</A><br><br>")
dat += "[STATION_TIME_TIMESTAMP("hh:mm:ss")]<br>" //:[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 += "<br><br>"
@@ -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, "<span class='notice'>You remove the ID from the [name].</span>")
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, "<span class='notice'>You remove the ID from the [name].</span>")
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)
@@ -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