mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-01 10:15:23 +01:00
0ccd900aac
Updates the Library to TGUI and the new DBCore The GUI was created using Claude Code Public Library Computer <img width="652" height="501" alt="image" src="https://github.com/user-attachments/assets/eba1841a-5784-4fe4-b337-6a9e9503bb58" /> Library Management Computer: Inventory Page: <img width="750" height="605" alt="image" src="https://github.com/user-attachments/assets/e4f38fcb-7299-4baf-a8a2-0974297a544c" /> Check Out Page with Book Picker active: <img width="750" height="607" alt="image" src="https://github.com/user-attachments/assets/e9189157-1617-4535-a053-942b17378614" /> Library Order Page with pagination: <img width="747" height="598" alt="image" src="https://github.com/user-attachments/assets/07d3abaf-5a16-4229-8ab8-e64e2f73de24" /> Emag action: <img width="752" height="602" alt="image" src="https://github.com/user-attachments/assets/285cd4bf-0ed3-4cf2-a9cb-4469e6466ad0" /> Book Uploader: <img width="747" height="602" alt="image" src="https://github.com/user-attachments/assets/b4b648ab-59e4-48f1-90a3-77e8440f01e4" /> And its orderable instantly: <img width="750" height="602" alt="image" src="https://github.com/user-attachments/assets/1c1c21fa-28fd-42fe-82b5-1c859cd74fdf" /> --------- Co-authored-by: Werner <Arrow768@users.noreply.github.com>
75 lines
2.1 KiB
Plaintext
75 lines
2.1 KiB
Plaintext
/*
|
|
* Library Scanner
|
|
*/
|
|
/obj/machinery/libraryscanner
|
|
name = "book scanner"
|
|
desc = "A machine that scans books for upload to the library database."
|
|
icon = 'icons/obj/library.dmi'
|
|
icon_state = "bigscanner"
|
|
var/insert_animation = "bigscanner1"
|
|
anchored = TRUE
|
|
density = TRUE
|
|
var/obj/item/book/cache // Last scanned book
|
|
|
|
/obj/machinery/libraryscanner/attackby(obj/item/attacking_item, mob/user)
|
|
if(istype(attacking_item, /obj/item/book))
|
|
if(!anchored)
|
|
to_chat(user, SPAN_WARNING("\The [src] must be secured to the floor first!"))
|
|
return
|
|
user.drop_from_inventory(attacking_item, src)
|
|
if(attacking_item.tool_behaviour == TOOL_WRENCH)
|
|
attacking_item.play_tool_sound(get_turf(src), 75)
|
|
if(anchored)
|
|
user.visible_message(
|
|
SPAN_NOTICE("\The [user] unsecures \the [src] from the floor."),
|
|
SPAN_NOTICE("You unsecure \the [src] from the floor."),
|
|
SPAN_WARNING("You hear a ratcheting noise."))
|
|
else
|
|
user.visible_message(
|
|
SPAN_NOTICE("\The [user] secures \the [src] to the floor."),
|
|
SPAN_NOTICE("You secure \the [src] to the floor."),
|
|
SPAN_WARNING("You hear a ratcheting noise."))
|
|
anchored = !anchored
|
|
|
|
/obj/machinery/libraryscanner/attack_hand(var/mob/user)
|
|
. = ..()
|
|
if(.)
|
|
return TRUE
|
|
ui_interact(user)
|
|
|
|
/obj/machinery/libraryscanner/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "LibraryScanner", "Book Scanner", 400, 250)
|
|
ui.open()
|
|
|
|
/obj/machinery/libraryscanner/ui_data(mob/user)
|
|
var/list/data = list()
|
|
data["has_book"] = !!cache
|
|
data["book_title"] = cache ? cache.name : null
|
|
data["book_author"] = cache ? cache.author : null
|
|
data["is_anchored"] = anchored
|
|
return data
|
|
|
|
/obj/machinery/libraryscanner/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
add_fingerprint(usr)
|
|
switch(action)
|
|
if("scan")
|
|
flick(insert_animation, src)
|
|
playsound(loc, 'sound/items/bureaucracy/scan.ogg', 75, 1)
|
|
for(var/obj/item/book/book in contents)
|
|
cache = book
|
|
break
|
|
. = TRUE
|
|
if("clear")
|
|
cache = null
|
|
. = TRUE
|
|
if("eject")
|
|
for(var/obj/item/book/book in contents)
|
|
book.forceMove(src.loc)
|
|
cache = null
|
|
. = TRUE
|