[MIRROR] Fixes a runtime for ModPCs running Plexagon Access Management without a secondary card slot (#750)

* Fixes a runtime for ModPCs running Plexagon Access Management without a secondary card slot (#53597)

As said by the title.

Also fixes an oversight where the Plexagon HR Core app (job management) was reading worn ID rather than inserted ID.

Also adds names to differentiate between primary and secondary card readers so both show on the screwdriver remove menu.

Also makes using IDs on a modPC actually call the InsertID proc, so that having the secondary ID come first in the list of parts doesn't give it priority.
Co-authored-by: Bobbahbrown <bobbahbrown@gmail.com>

* Fixes a runtime for ModPCs running Plexagon Access Management without a secondary card slot

Co-authored-by: zxaber <37497534+zxaber@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-09-11 23:18:07 +02:00
committed by GitHub
parent 307ddb6ce9
commit 76b951a104
4 changed files with 27 additions and 27 deletions

View File

@@ -103,7 +103,6 @@
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
if(!(card_slot || card_slot2))
//to_chat(user, "<span class='warning'>There isn't anywhere you can fit a card into on this computer.</span>")
return FALSE
var/obj/item/card/inserting_id = inserting_item.RemoveID()
@@ -112,7 +111,6 @@
if((card_slot?.try_insert(inserting_id)) || (card_slot2?.try_insert(inserting_id)))
return TRUE
//to_chat(user, "<span class='warning'>This computer doesn't have an open card slot.</span>")
return FALSE
/obj/item/modular_computer/MouseDrop(obj/over_object, src_location, over_location)
@@ -350,6 +348,10 @@
/obj/item/modular_computer/attackby(obj/item/W as obj, mob/user as mob)
// Check for ID first
if(istype(W, /obj/item/card/id) && InsertID(W))
return
// Insert items into the components
for(var/h in all_components)
var/obj/item/computer_hardware/H = all_components[h]

View File

@@ -320,25 +320,24 @@
/datum/computer_file/program/card_mod/ui_data(mob/user)
var/list/data = get_header_data()
data["station_name"] = station_name()
var/obj/item/computer_hardware/card_slot/card_slot2
var/obj/item/computer_hardware/printer/printer
if(computer)
card_slot2 = computer.all_components[MC_CARD2]
printer = computer.all_components[MC_PRINT]
data["station_name"] = station_name()
if(computer)
data["have_id_slot"] = !!(card_slot2)
data["have_printer"] = !!printer
data["have_printer"] = !!(printer)
else
data["have_id_slot"] = FALSE
data["have_printer"] = FALSE
data["authenticated"] = authenticated
if(!card_slot2)
return data //We're just gonna error out on the js side at this point anyway
if(computer)
var/obj/item/card/id/id_card = card_slot2.stored_card
data["has_id"] = !!id_card
data["id_name"] = id_card ? id_card.name : "-----"

View File

@@ -52,14 +52,10 @@
if(..())
return
var/authed = FALSE
var/mob/user = usr
var/obj/item/card/id/user_id = user.get_idcard()
if(user_id)
if(ACCESS_CHANGE_IDS in user_id.access)
authed = TRUE
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
var/obj/item/card/id/user_id = card_slot?.stored_card
if(!authed)
if(!user_id || !(ACCESS_CHANGE_IDS in user_id.access))
return
switch(action)
@@ -107,9 +103,9 @@
var/list/data = get_header_data()
var/authed = FALSE
var/obj/item/card/id/user_id = user.get_idcard(FALSE)
if(user_id)
if(ACCESS_CHANGE_IDS in user_id.access)
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
var/obj/item/card/id/user_id = card_slot?.stored_card
if(user_id && (ACCESS_CHANGE_IDS in user_id.access))
authed = TRUE
data["authed"] = authed

View File

@@ -1,5 +1,5 @@
/obj/item/computer_hardware/card_slot
name = "identification card authentication module" // \improper breaks the find_hardware_by_name proc
name = "primary RFID card module" // \improper breaks the find_hardware_by_name proc
desc = "A module allowing this computer to read or write data on ID cards. Necessary for some programs to run properly."
power_usage = 10 //W
icon_state = "card_mini"
@@ -106,8 +106,10 @@
expansion_hw = !expansion_hw
if(expansion_hw)
device_type = MC_CARD2
name = "secondary RFID card module"
else
device_type = MC_CARD
name = "primary RFID card module"
/obj/item/computer_hardware/card_slot/examine(mob/user)
. = ..()
@@ -116,5 +118,6 @@
. += "There appears to be something loaded in the card slots."
/obj/item/computer_hardware/card_slot/secondary
name = "secondary RFID card module"
device_type = MC_CARD2
expansion_hw = TRUE