Files
Bubberstation/code/modules/library/barcode_scanner.dm
Tim c08be61d0e Split library items into their own dm files (#66246)
Each library item has it's own dm file for better organization. No code has been changed.
2022-04-19 17:14:45 -05:00

39 lines
1.3 KiB
Plaintext

/obj/item/barcodescanner
name = "barcode scanner"
icon = 'icons/obj/library.dmi'
icon_state ="scanner"
desc = "A fabulous tool if you need to scan a barcode."
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_TINY
/// A weakref to our associated computer - Modes 1 to 3 use this
var/datum/weakref/computer_ref
/// Currently scanned book
var/datum/book_info/book_data
/// 0 - Scan only, 1 - Scan and Set Buffer, 2 - Scan and Attempt to Check In, 3 - Scan and Attempt to Add to Inventory
var/mode = 0
/obj/item/barcodescanner/attack_self(mob/user)
mode += 1
if(mode > 3)
mode = 0
to_chat(user, "[src] Status Display:")
var/modedesc
switch(mode)
if(0)
modedesc = "Scan book to local buffer."
if(1)
modedesc = "Scan book to local buffer and set associated computer buffer to match."
if(2)
modedesc = "Scan book to local buffer, attempt to check in scanned book."
if(3)
modedesc = "Scan book to local buffer, attempt to add book to general inventory."
else
modedesc = "ERROR"
to_chat(user, " - Mode [mode] : [modedesc]")
if(computer_ref?.resolve())
to_chat(user, "<font color=green>Computer has been associated with this unit.</font>")
else
to_chat(user, "<font color=red>No associated computer found. Only local scans will function properly.</font>")
to_chat(user, "\n")