mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 10:42:37 +00:00
[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:
@@ -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_slot = all_components[MC_CARD]
|
||||||
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
|
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
|
||||||
if(!(card_slot || card_slot2))
|
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
|
return FALSE
|
||||||
|
|
||||||
var/obj/item/card/inserting_id = inserting_item.RemoveID()
|
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)))
|
if((card_slot?.try_insert(inserting_id)) || (card_slot2?.try_insert(inserting_id)))
|
||||||
return TRUE
|
return TRUE
|
||||||
//to_chat(user, "<span class='warning'>This computer doesn't have an open card slot.</span>")
|
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/obj/item/modular_computer/MouseDrop(obj/over_object, src_location, over_location)
|
/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)
|
/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
|
// Insert items into the components
|
||||||
for(var/h in all_components)
|
for(var/h in all_components)
|
||||||
var/obj/item/computer_hardware/H = all_components[h]
|
var/obj/item/computer_hardware/H = all_components[h]
|
||||||
|
|||||||
@@ -320,25 +320,24 @@
|
|||||||
/datum/computer_file/program/card_mod/ui_data(mob/user)
|
/datum/computer_file/program/card_mod/ui_data(mob/user)
|
||||||
var/list/data = get_header_data()
|
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/card_slot/card_slot2
|
||||||
var/obj/item/computer_hardware/printer/printer
|
var/obj/item/computer_hardware/printer/printer
|
||||||
|
|
||||||
if(computer)
|
if(computer)
|
||||||
card_slot2 = computer.all_components[MC_CARD2]
|
card_slot2 = computer.all_components[MC_CARD2]
|
||||||
printer = computer.all_components[MC_PRINT]
|
printer = computer.all_components[MC_PRINT]
|
||||||
|
|
||||||
data["station_name"] = station_name()
|
|
||||||
|
|
||||||
if(computer)
|
|
||||||
data["have_id_slot"] = !!(card_slot2)
|
data["have_id_slot"] = !!(card_slot2)
|
||||||
data["have_printer"] = !!printer
|
data["have_printer"] = !!(printer)
|
||||||
else
|
else
|
||||||
data["have_id_slot"] = FALSE
|
data["have_id_slot"] = FALSE
|
||||||
data["have_printer"] = FALSE
|
data["have_printer"] = FALSE
|
||||||
|
|
||||||
data["authenticated"] = authenticated
|
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
|
var/obj/item/card/id/id_card = card_slot2.stored_card
|
||||||
data["has_id"] = !!id_card
|
data["has_id"] = !!id_card
|
||||||
data["id_name"] = id_card ? id_card.name : "-----"
|
data["id_name"] = id_card ? id_card.name : "-----"
|
||||||
|
|||||||
@@ -52,14 +52,10 @@
|
|||||||
if(..())
|
if(..())
|
||||||
return
|
return
|
||||||
|
|
||||||
var/authed = FALSE
|
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||||
var/mob/user = usr
|
var/obj/item/card/id/user_id = card_slot?.stored_card
|
||||||
var/obj/item/card/id/user_id = user.get_idcard()
|
|
||||||
if(user_id)
|
|
||||||
if(ACCESS_CHANGE_IDS in user_id.access)
|
|
||||||
authed = TRUE
|
|
||||||
|
|
||||||
if(!authed)
|
if(!user_id || !(ACCESS_CHANGE_IDS in user_id.access))
|
||||||
return
|
return
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
@@ -107,9 +103,9 @@
|
|||||||
var/list/data = get_header_data()
|
var/list/data = get_header_data()
|
||||||
|
|
||||||
var/authed = FALSE
|
var/authed = FALSE
|
||||||
var/obj/item/card/id/user_id = user.get_idcard(FALSE)
|
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
|
||||||
if(user_id)
|
var/obj/item/card/id/user_id = card_slot?.stored_card
|
||||||
if(ACCESS_CHANGE_IDS in user_id.access)
|
if(user_id && (ACCESS_CHANGE_IDS in user_id.access))
|
||||||
authed = TRUE
|
authed = TRUE
|
||||||
|
|
||||||
data["authed"] = authed
|
data["authed"] = authed
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/obj/item/computer_hardware/card_slot
|
/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."
|
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
|
power_usage = 10 //W
|
||||||
icon_state = "card_mini"
|
icon_state = "card_mini"
|
||||||
@@ -106,8 +106,10 @@
|
|||||||
expansion_hw = !expansion_hw
|
expansion_hw = !expansion_hw
|
||||||
if(expansion_hw)
|
if(expansion_hw)
|
||||||
device_type = MC_CARD2
|
device_type = MC_CARD2
|
||||||
|
name = "secondary RFID card module"
|
||||||
else
|
else
|
||||||
device_type = MC_CARD
|
device_type = MC_CARD
|
||||||
|
name = "primary RFID card module"
|
||||||
|
|
||||||
/obj/item/computer_hardware/card_slot/examine(mob/user)
|
/obj/item/computer_hardware/card_slot/examine(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -116,5 +118,6 @@
|
|||||||
. += "There appears to be something loaded in the card slots."
|
. += "There appears to be something loaded in the card slots."
|
||||||
|
|
||||||
/obj/item/computer_hardware/card_slot/secondary
|
/obj/item/computer_hardware/card_slot/secondary
|
||||||
|
name = "secondary RFID card module"
|
||||||
device_type = MC_CARD2
|
device_type = MC_CARD2
|
||||||
expansion_hw = TRUE
|
expansion_hw = TRUE
|
||||||
|
|||||||
Reference in New Issue
Block a user