This commit is contained in:
Rohesie
2019-10-30 20:17:55 -03:00
committed by Rob Bailey
parent bbf773c729
commit 9dd28d5180
10 changed files with 139 additions and 40 deletions

View File

@@ -163,6 +163,8 @@ GLOBAL_LIST_INIT(turfs_without_ground, 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))

View File

@@ -65,7 +65,7 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
. += "<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(isidcard(I))
if(check_access(I) && !inserted_scan_id)
if(id_insert(user, I, inserted_scan_id))
inserted_scan_id = I
@@ -130,13 +130,26 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
return JOB_MAX_POSITIONS
return JOB_DENIED
/obj/machinery/computer/card/proc/id_insert(mob/user, obj/item/card/id/I, target)
if(!user.transferItemToLoc(I, src))
/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)
id_eject(user, target)
user.visible_message("<span class='notice'>[user] inserts \the [I] into \the [src].</span>", \
"<span class='notice'>You insert \the [I] into \the [src].</span>")
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
@@ -359,11 +372,11 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
inserted_modify_id = null
updateUsrDialog()
return
var/mob/M = usr
if(M.get_idcard(TRUE))
var/obj/item/card/id/I = M.get_idcard(TRUE)
if(id_insert(usr, I, inserted_modify_id))
inserted_modify_id = I
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 && !usr.get_active_held_item())
@@ -371,11 +384,11 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
inserted_scan_id = null
updateUsrDialog()
return
var/mob/M = usr
if(M.get_idcard(TRUE))
var/obj/item/card/id/I = M.get_idcard(TRUE)
if(id_insert(usr, I, inserted_scan_id))
inserted_scan_id = I
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)) || mode))

View File

@@ -49,11 +49,6 @@
detail_overlay.color = detail_color
add_overlay(detail_overlay)
/obj/item/proc/GetCard()
/obj/item/card/data/GetCard()
return src
/obj/item/card/data/full_color
desc = "A plastic magstripe card for simple and speedy data storage and transfer. This one has the entire card colored."
icon_state = "data_2"
@@ -299,6 +294,9 @@
/obj/item/card/id/GetID()
return src
/obj/item/card/id/RemoveID()
return src
/obj/item/card/id/update_icon(blank=FALSE)
cut_overlays()
cached_flat_icon = null

View File

@@ -147,6 +147,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()
cut_overlays()
var/mutable_appearance/overlay = new()
@@ -591,19 +603,29 @@ 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)
/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()
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()
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)
@@ -791,20 +813,28 @@ 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(ishuman(loc))
var/mob/living/carbon/human/H = loc
if(H.wear_id == src)
H.sec_hud_set_ID()
if(old_id)
user.put_in_hands(old_id)
insert_id(I, user)
update_icon()
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)

View File

@@ -105,6 +105,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

View File

@@ -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)

View File

@@ -114,6 +114,12 @@
if(id_card)
return id_card
/mob/living/carbon/human/get_id_in_hand()
var/obj/item/held_item = get_active_held_item()
if(!held_item)
return
return held_item.GetID()
/mob/living/carbon/human/IsAdvancedToolUser()
if(HAS_TRAIT(src, TRAIT_MONKEYLIKE))
return FALSE

View File

@@ -1117,6 +1117,9 @@
/mob/proc/get_idcard(hand_first)
return
/mob/proc/get_id_in_hand()
return
/**
* Get the mob VV dropdown extras
*/

View File

@@ -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, BE_CLOSE))

View File

@@ -36,6 +36,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)