/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, "Computer has been associated with this unit.") else to_chat(user, "No associated computer found. Only local scans will function properly.") to_chat(user, "\n")