mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.
* this is probably important
* Remove cascade disabling SSgarbage
* Fixed a bug where dust() did not qdel the target mob
* Misc fixes
* Fix decals surviving break-to-plating
* Subsystem flag tweaks
* Apparently subsystems are new'd before config is.
* Fix paper icons
* Speculative fix for insane lag
* Better machinery stat
* Make organs not use SSoverlay
* Misc bugfixes & tweaks
* Nightmode fixes
* Changelog for SMC
* Port /tg/'s improved MC crash handling
* Add some more SS Recover() procs
* supply_controller -> SScargo
* More New() -> Initialize()
* pAI and robot construction overlays
* Fix cargo unit tests
* Merge the DMM Suite's atom/New() into atoms_init
* Lighting pre-baking
* Lighting initialization logging
* Fix some bad SS init orders
* Fix SSlighting logging; rename Processes to MC
* Speculative fix for insane GC lag
* Prebaked openturf/icon_smooth & fix lighting prebake
* SS init status; SSatoms LATEQDEL
* Fix bug with MC init stat panel
* Fix parallax
* Misc
* Ignore SS_NO_DISPLAY during init
* apparently this is important
* REEEEEE
* Image GC fixes; broadcaster radio-new sanity
* RCON Cleanup
* Move pAI recruiter into subsystem
* Move global solars list into sun subsystem
* Make chickens not use a global
* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup
* Speed up space init a little
* Fix bad timer flags on floor drying
* Subsystem panic-restart verb for mins
* Explosion speedup
* Minor subsystem & MC logging tweaks
* SSopenturf improvements
* Make pipenet actually initialize (whoops)
* Minor tweaks
* Implement lighting rounding
* comments are hard okay
* Minor lattice tweaks
* Fix some timer issues & better closet init
* Timer sanity
* Request console tweaks + Storage init sanity
* Minor SSmachiner RCON improvements
* Further reduce world-start timer count
* Standardize subsystem logging
* Garbage hard delete profiling from /tg/
* Timer hang detection & recovery
* Log machines that sleep in process() and fuck up SSmachinery
* Fix an issue with external airlocks sleeping in process()
* Failsafe logging
* Minor tweaks
* Revert "Request console tweaks + Storage init sanity"
This reverts commit 98d3579e35.
* Re-implement RC changes
* Fix SQL FT saving
* Fix SSmachinery sleep in disposals
* Minor SS tweaks
* Paper fixes
* Blood drying fixes
* Merge gameticker and SSticker
* Minor global list init cleanup
* Lagcheck biogenerator & bags
* Tweak SScargo init order; RIG Initialize()
* Caching tweaks
* Remove rogue comma
* Initialize fixes
* Lighting destroy cleanup
* Fix emagging airlocks
* Initial SSicon implementation
* Tweaks & Fixes
* Fire + Air alarm queued icon updates
* Overlays + Queued icon cleanup
* Runtime & background fixes
* Kill some meaningless set statements
* Kill some image qdels
* Bump up lighting rounding val
* Fix adv. scanner destroy runtimes
* Remove unneeded icon update limiting
* Move icon smoothing into helpers
* Show a warning if DM 510 compiles without memory leak hack enabled
* Re-organize subsystems & MC defines a little
* Airlock SFX
* Log of Changes
* Make SSicon_update disable itself when not doing anything
* Fix respawn verb runtime when used early in server-init
* Add more information to MC's stat_entry()
* Replace direct refernces to gcDestroyed with QDEL* macros
* plant_controller -> SSplants
* More plant tweaks
* Add more humor to changelog
* Move parallax globals into SSparallax
* Lighting responsiveness tweaks
* Fix parallax init order & better MC init panel stat
* Make mobs GC
* More overlays + Remove intercom spawn()
* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.
* Update changelog
* Mob GC tweaks
* Del() cleanup
* Fix insomniac ZAS connection edges
* Minor pAI cleanup
* Convert more things to SSoverlay; fix duplicated overlay in field gens
* SM Bluespace turf tweaks
* Update SSgarbage debug globals list
* Human-type qdel tweaks
* Subsystem suspension; stat_entry improvements
* SQL Statistics cleanup
* Fix runtimes with ambrosia
* More disable() -> suspend(); fix nightmode again
* Human qdel fix; minor tweaks
* Update turbolift to work with StonedMC
* Make lifts use timers instead of a subsystem
* Make SSassets start earlier
* Convert the radio controller into a subsystem
* Fix some missing CHECK_TICKs in asteroid generation
* MC stat tweaks; make shouldnt_see a typecache
* Kill some redundant debug-controller entries
* radio_controller -> SSradio
* Better SSgarbage hard-del logging from /tg/ upstream
* Logging tweaks + GELF
* Misc client caching improvements
* Slime SSoverlay
* Oven icon fixes
* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.
* Holder tweaks + Welding tool Initialize()
* Fix some bad subsystem logging
* Fix suit cooling units spawning without cells
* Starlight tweaks
* Gibber infinite gib fix
* More SSoverlay stuff
* Make crates use CUT_OVERLAY_IN
* Make SSarrivals suspend instead of disable
* Make openturf use split/phased tick checks
* Speculative fix for unwet timer runtimes
* Blood overlay tweaks/fixes
* Update crusher to play nice with SMC + SSoverlay
* Openturf improvements and fixes
* Minor turbolift tweaks
* Lighting performance improvements + ChangeTurf tweaks
* this is probably important
* Fix wall weld noises on changeturf
* More ChangeTurf tweaks
* Explosion tweaks
* Pre-game lobby tweaks
* Openturf tweaks
* Prevent admins from starting the game before init finishes
* Fix Travis
* Kill an unused var
* Fix ChangeTurf runtimes on openturfs
* Fixes
* Browser datum fixes, asset caching
* Update changelog
* Changelog
* Lobby tweaks
* Ticker tweaks; kill ticker var
* Further lobby tweaks
* Cascade tweaks
* air_master -> SSair
* Reduce overhead from radio autosay
* alarm_manager -> SSalarm
* bomb_processor -> SSexplosives
* corp_regs -> SSlaw
* ZAS overlay fixes
* Small wall icon optimization
* Fix effects master
* Assembly tweaks
* Megavend fixes
* Shuttle fixes
* Camera alert performance improvements
* Fix some world.log spam from lighting overlays
* Fix some Initialize() procs
* Openspace responsiveness tweaks
* Make HE pipes animate through openturfs
* Kill a spawn
476 lines
18 KiB
Plaintext
476 lines
18 KiB
Plaintext
/* Library Machines
|
|
*
|
|
* Contains:
|
|
* Borrowbook datum
|
|
* Library Public Computer
|
|
* Library Computer
|
|
* Library Scanner
|
|
* Book Binder
|
|
*/
|
|
|
|
/*
|
|
* Borrowbook datum
|
|
*/
|
|
datum/borrowbook // Datum used to keep track of who has borrowed what when and for how long.
|
|
var/bookname
|
|
var/mobname
|
|
var/getdate
|
|
var/duedate
|
|
|
|
/*
|
|
* Library Public Computer
|
|
*/
|
|
/obj/machinery/librarypubliccomp
|
|
name = "visitor computer"
|
|
icon = 'icons/obj/library.dmi'
|
|
icon_state = "computer"
|
|
anchored = 1
|
|
density = 1
|
|
var/screenstate = 0
|
|
var/title
|
|
var/category = "Any"
|
|
var/author
|
|
var/SQLquery
|
|
|
|
/obj/machinery/librarypubliccomp/attack_hand(var/mob/user as mob)
|
|
usr.set_machine(src)
|
|
var/dat = "<HEAD><TITLE>Library Visitor</TITLE></HEAD><BODY>\n" // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
|
switch(screenstate)
|
|
if(0)
|
|
dat += {"<h2>Search Settings</h2><br>
|
|
<A href='?src=\ref[src];settitle=1'>Filter by Title: [title]</A><BR>
|
|
<A href='?src=\ref[src];setcategory=1'>Filter by Category: [category]</A><BR>
|
|
<A href='?src=\ref[src];setauthor=1'>Filter by Author: [author]</A><BR>
|
|
<A href='?src=\ref[src];search=1'>\[Start Search\]</A><BR>"}
|
|
if(1)
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font><BR>"
|
|
else if(!SQLquery)
|
|
dat += "<font color=red><b>ERROR</b>: Malformed search request. Please contact your system administrator for assistance.</font><BR>"
|
|
else
|
|
dat += {"<table>
|
|
<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td>SS<sup>13</sup>BN</td></tr>"}
|
|
|
|
var/DBQuery/query = dbcon.NewQuery(SQLquery)
|
|
query.Execute()
|
|
|
|
while(query.NextRow())
|
|
var/author = query.item[1]
|
|
var/title = query.item[2]
|
|
var/category = query.item[3]
|
|
var/id = query.item[4]
|
|
dat += "<tr><td>[author]</td><td>[title]</td><td>[category]</td><td>[id]</td></tr>"
|
|
dat += "</table><BR>"
|
|
dat += "<A href='?src=\ref[src];back=1'>\[Go Back\]</A><BR>"
|
|
user << browse(dat, "window=publiclibrary")
|
|
onclose(user, "publiclibrary")
|
|
|
|
/obj/machinery/librarypubliccomp/Topic(href, href_list)
|
|
if(..())
|
|
usr << browse(null, "window=publiclibrary")
|
|
onclose(usr, "publiclibrary")
|
|
return
|
|
|
|
if(href_list["settitle"])
|
|
var/newtitle = input("Enter a title to search for:") as text|null
|
|
if(newtitle)
|
|
title = sanitize(newtitle)
|
|
else
|
|
title = null
|
|
title = sanitizeSQL(title)
|
|
if(href_list["setcategory"])
|
|
var/newcategory = input("Choose a category to search for:") in list("Any", "Fiction", "Non-Fiction", "Adult", "Reference", "Religion")
|
|
if(newcategory)
|
|
category = sanitize(newcategory)
|
|
else
|
|
category = "Any"
|
|
category = sanitizeSQL(category)
|
|
if(href_list["setauthor"])
|
|
var/newauthor = input("Enter an author to search for:") as text|null
|
|
if(newauthor)
|
|
author = sanitize(newauthor)
|
|
else
|
|
author = null
|
|
author = sanitizeSQL(author)
|
|
if(href_list["search"])
|
|
SQLquery = "SELECT author, title, category, id FROM ss13_library WHERE "
|
|
if(category == "Any")
|
|
SQLquery += "author LIKE '%[author]%' AND title LIKE '%[title]%'"
|
|
else
|
|
SQLquery += "author LIKE '%[author]%' AND title LIKE '%[title]%' AND category='[category]'"
|
|
screenstate = 1
|
|
|
|
if(href_list["back"])
|
|
screenstate = 0
|
|
|
|
src.add_fingerprint(usr)
|
|
src.updateUsrDialog()
|
|
return
|
|
|
|
|
|
/*
|
|
* Library Computer
|
|
*/
|
|
// TODO: Make this an actual /obj/machinery/computer that can be crafted from circuit boards and such
|
|
// It is August 22nd, 2012... This TODO has already been here for months.. I wonder how long it'll last before someone does something about it.
|
|
/obj/machinery/librarycomp
|
|
name = "Check-In/Out Computer"
|
|
icon = 'icons/obj/library.dmi'
|
|
icon_state = "computer"
|
|
anchored = 1
|
|
density = 1
|
|
var/arcanecheckout = 0
|
|
var/screenstate = 0 // 0 - Main Menu, 1 - Inventory, 2 - Checked Out, 3 - Check Out a Book
|
|
var/sortby = "author"
|
|
var/buffer_book
|
|
var/buffer_mob
|
|
var/upload_category = "Fiction"
|
|
var/list/checkouts = list()
|
|
var/list/inventory = list()
|
|
var/checkoutperiod = 5 // In minutes
|
|
var/obj/machinery/libraryscanner/scanner // Book scanner that will be used when uploading books to the Archive
|
|
|
|
var/bibledelay = 0 // LOL NO SPAM (1 minute delay) -- Doohl
|
|
|
|
/obj/machinery/librarycomp/attack_hand(var/mob/user as mob)
|
|
usr.set_machine(src)
|
|
var/dat = "<HEAD><TITLE>Book Inventory Management</TITLE></HEAD><BODY>\n" // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
|
switch(screenstate)
|
|
if(0)
|
|
// Main Menu
|
|
dat += {"<A href='?src=\ref[src];switchscreen=1'>1. View General Inventory</A><BR>
|
|
<A href='?src=\ref[src];switchscreen=2'>2. View Checked Out Inventory</A><BR>
|
|
<A href='?src=\ref[src];switchscreen=3'>3. Check out a Book</A><BR>
|
|
<A href='?src=\ref[src];switchscreen=4'>4. Connect to External Archive</A><BR>
|
|
<A href='?src=\ref[src];switchscreen=5'>5. Upload New Title to Archive</A><BR>
|
|
<A href='?src=\ref[src];switchscreen=6'>6. Print a Bible</A><BR>"}
|
|
if(src.emagged)
|
|
dat += "<A href='?src=\ref[src];switchscreen=7'>7. Access the Forbidden Lore Vault</A><BR>"
|
|
if(src.arcanecheckout)
|
|
new /obj/item/weapon/book/tome(src.loc)
|
|
user << "<span class='warning'>Your sanity barely endures the seconds spent in the vault's browsing window. The only thing to remind you of this when you stop browsing is a dusty old tome sitting on the desk. You don't really remember printing it.</span>"
|
|
user.visible_message("<span class='notice'>\The [user] stares at the blank screen for a few moments, \his expression frozen in fear. When \he finally awakens from it, \he looks a lot older.</span>", 2)
|
|
src.arcanecheckout = 0
|
|
if(1)
|
|
// Inventory
|
|
dat += "<H3>Inventory</H3><BR>"
|
|
for(var/obj/item/weapon/book/b in inventory)
|
|
dat += "[b.name] <A href='?src=\ref[src];delbook=\ref[b]'>(Delete)</A><BR>"
|
|
dat += "<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
|
|
if(2)
|
|
// Checked Out
|
|
dat += "<h3>Checked Out Books</h3><BR>"
|
|
for(var/datum/borrowbook/b in checkouts)
|
|
var/timetaken = world.time - b.getdate
|
|
//timetaken *= 10
|
|
timetaken /= 600
|
|
timetaken = round(timetaken)
|
|
var/timedue = b.duedate - world.time
|
|
//timedue *= 10
|
|
timedue /= 600
|
|
if(timedue <= 0)
|
|
timedue = "<font color=red><b>(OVERDUE)</b> [timedue]</font>"
|
|
else
|
|
timedue = round(timedue)
|
|
dat += {"\"[b.bookname]\", Checked out to: [b.mobname]<BR>--- Taken: [timetaken] minutes ago, Due: in [timedue] minutes<BR>
|
|
<A href='?src=\ref[src];checkin=\ref[b]'>(Check In)</A><BR><BR>"}
|
|
dat += "<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
|
|
if(3)
|
|
// Check Out a Book
|
|
dat += {"<h3>Check Out a Book</h3><BR>
|
|
Book: [src.buffer_book]
|
|
<A href='?src=\ref[src];editbook=1'>\[Edit\]</A><BR>
|
|
Recipient: [src.buffer_mob]
|
|
<A href='?src=\ref[src];editmob=1'>\[Edit\]</A><BR>
|
|
Checkout Date : [world.time/600]<BR>
|
|
Due Date: [(world.time + checkoutperiod)/600]<BR>
|
|
(Checkout Period: [checkoutperiod] minutes) (<A href='?src=\ref[src];increasetime=1'>+</A>/<A href='?src=\ref[src];decreasetime=1'>-</A>)
|
|
<A href='?src=\ref[src];checkout=1'>(Commit Entry)</A><BR>
|
|
<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"}
|
|
if(4)
|
|
dat += "<h3>External Archive</h3>"
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
|
|
else
|
|
dat += {"<A href='?src=\ref[src];orderbyid=1'>(Order book by SS<sup>13</sup>BN)</A><BR><BR>
|
|
<table>
|
|
<tr><td><A href='?src=\ref[src];sort=author>AUTHOR</A></td><td><A href='?src=\ref[src];sort=title>TITLE</A></td><td><A href='?src=\ref[src];sort=category>CATEGORY</A></td><td></td></tr>"}
|
|
var/DBQuery/query = dbcon.NewQuery("SELECT id, author, title, category FROM ss13_library ORDER BY [sortby]")
|
|
query.Execute()
|
|
|
|
while(query.NextRow())
|
|
var/id = query.item[1]
|
|
var/author = query.item[2]
|
|
var/title = query.item[3]
|
|
var/category = query.item[4]
|
|
dat += "<tr><td>[author]</td><td>[title]</td><td>[category]</td><td><A href='?src=\ref[src];targetid=[id]'>\[Order\]</A></td></tr>"
|
|
dat += "</table>"
|
|
dat += "<BR><A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
|
|
if(5)
|
|
dat += "<H3>Upload a New Title</H3>"
|
|
if(!scanner)
|
|
for(var/obj/machinery/libraryscanner/S in range(9))
|
|
scanner = S
|
|
break
|
|
if(!scanner)
|
|
dat += "<FONT color=red>No scanner found within wireless network range.</FONT><BR>"
|
|
else if(!scanner.cache)
|
|
dat += "<FONT color=red>No data found in scanner memory.</FONT><BR>"
|
|
else
|
|
dat += {"<TT>Data marked for upload...</TT><BR>
|
|
<TT>Title: </TT>[scanner.cache.name]<BR>"}
|
|
if(!scanner.cache.author)
|
|
scanner.cache.author = "Anonymous"
|
|
dat += {"<TT>Author: </TT><A href='?src=\ref[src];setauthor=1'>[scanner.cache.author]</A><BR>
|
|
<TT>Category: </TT><A href='?src=\ref[src];setcategory=1'>[upload_category]</A><BR>
|
|
<A href='?src=\ref[src];upload=1'>\[Upload\]</A><BR>"}
|
|
dat += "<A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
|
|
if(7)
|
|
dat += {"<h3>Accessing Forbidden Lore Vault v 1.3</h3>
|
|
Are you absolutely sure you want to proceed? EldritchTomes Inc. takes no responsibilities for loss of sanity resulting from this action.<p>
|
|
<A href='?src=\ref[src];arccheckout=1'>Yes.</A><BR>
|
|
<A href='?src=\ref[src];switchscreen=0'>No.</A><BR>"}
|
|
|
|
//dat += "<A HREF='?src=\ref[user];mach_close=library'>Close</A><br><br>"
|
|
user << browse(dat, "window=library")
|
|
onclose(user, "library")
|
|
|
|
/obj/machinery/librarycomp/emag_act(var/remaining_charges, var/mob/user)
|
|
if (src.density && !src.emagged)
|
|
src.emagged = 1
|
|
return 1
|
|
|
|
/obj/machinery/librarycomp/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
if(istype(W, /obj/item/weapon/barcodescanner))
|
|
var/obj/item/weapon/barcodescanner/scanner = W
|
|
scanner.computer = src
|
|
user << "[scanner]'s associated machine has been set to [src]."
|
|
for (var/mob/V in hearers(src))
|
|
V.show_message("[src] lets out a low, short blip.", 2)
|
|
else
|
|
..()
|
|
|
|
/obj/machinery/librarycomp/Topic(href, href_list)
|
|
if(..())
|
|
usr << browse(null, "window=library")
|
|
onclose(usr, "library")
|
|
return
|
|
|
|
if(href_list["switchscreen"])
|
|
switch(href_list["switchscreen"])
|
|
if("0")
|
|
screenstate = 0
|
|
if("1")
|
|
screenstate = 1
|
|
if("2")
|
|
screenstate = 2
|
|
if("3")
|
|
screenstate = 3
|
|
if("4")
|
|
screenstate = 4
|
|
if("5")
|
|
screenstate = 5
|
|
if("6")
|
|
if(!bibledelay)
|
|
|
|
var/obj/item/weapon/storage/bible/B = new /obj/item/weapon/storage/bible(src.loc)
|
|
if((SSticker.Bible_icon_state && SSticker.Bible_item_state) )
|
|
B.icon_state = SSticker.Bible_icon_state
|
|
B.item_state = SSticker.Bible_item_state
|
|
B.name = SSticker.Bible_name
|
|
B.deity_name = SSticker.Bible_deity_name
|
|
|
|
bibledelay = 1
|
|
spawn(60)
|
|
bibledelay = 0
|
|
|
|
else
|
|
for (var/mob/V in hearers(src))
|
|
V.show_message("<b>[src]</b>'s monitor flashes, \"Bible printer currently unavailable, please wait a moment.\"")
|
|
|
|
if("7")
|
|
screenstate = 7
|
|
if(href_list["arccheckout"])
|
|
if(src.emagged)
|
|
src.arcanecheckout = 1
|
|
src.screenstate = 0
|
|
if(href_list["increasetime"])
|
|
checkoutperiod += 1
|
|
if(href_list["decreasetime"])
|
|
checkoutperiod -= 1
|
|
if(checkoutperiod < 1)
|
|
checkoutperiod = 1
|
|
if(href_list["editbook"])
|
|
buffer_book = sanitizeSafe(input("Enter the book's title:") as text|null)
|
|
if(href_list["editmob"])
|
|
buffer_mob = sanitize(input("Enter the recipient's name:") as text|null, MAX_NAME_LEN)
|
|
if(href_list["checkout"])
|
|
var/datum/borrowbook/b = new /datum/borrowbook
|
|
b.bookname = sanitizeSafe(buffer_book)
|
|
b.mobname = sanitize(buffer_mob)
|
|
b.getdate = world.time
|
|
b.duedate = world.time + (checkoutperiod * 600)
|
|
checkouts.Add(b)
|
|
if(href_list["checkin"])
|
|
var/datum/borrowbook/b = locate(href_list["checkin"])
|
|
checkouts.Remove(b)
|
|
if(href_list["delbook"])
|
|
var/obj/item/weapon/book/b = locate(href_list["delbook"])
|
|
inventory.Remove(b)
|
|
if(href_list["setauthor"])
|
|
var/newauthor = sanitize(input("Enter the author's name: ") as text|null)
|
|
if(newauthor)
|
|
scanner.cache.author = newauthor
|
|
if(href_list["setcategory"])
|
|
var/newcategory = input("Choose a category: ") in list("Fiction", "Non-Fiction", "Adult", "Reference", "Religion")
|
|
if(newcategory)
|
|
upload_category = newcategory
|
|
if(href_list["upload"])
|
|
if(scanner)
|
|
if(scanner.cache)
|
|
var/choice = input("Are you certain you wish to upload this title to the Archive?") in list("Confirm", "Abort")
|
|
if(choice == "Confirm")
|
|
if(scanner.cache.unique)
|
|
alert("This book has been rejected from the database. Aborting!")
|
|
else
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
alert("Connection to Archive has been severed. Aborting.")
|
|
else
|
|
/*
|
|
var/sqltitle = dbcon.Quote(scanner.cache.name)
|
|
var/sqlauthor = dbcon.Quote(scanner.cache.author)
|
|
var/sqlcontent = dbcon.Quote(scanner.cache.dat)
|
|
var/sqlcategory = dbcon.Quote(upload_category)
|
|
*/
|
|
var/sqltitle = sanitizeSQL(scanner.cache.name)
|
|
var/sqlauthor = sanitizeSQL(scanner.cache.author)
|
|
var/sqlcontent = sanitizeSQL(scanner.cache.dat)
|
|
var/sqlcategory = sanitizeSQL(upload_category)
|
|
var/sqlckey = sanitizeSQL(ckey(usr.client.ckey))
|
|
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_library (author, title, content, category, uploadtime, uploader) VALUES ('[sqlauthor]', '[sqltitle]', '[sqlcontent]', '[sqlcategory]', NOW(), '[sqlckey]')")
|
|
if(!query.Execute())
|
|
usr << query.ErrorMsg()
|
|
else
|
|
log_and_message_admins("has uploaded the book titled [scanner.cache.name], [length(scanner.cache.dat)] signs")
|
|
log_game("[usr.name]/[usr.key] has uploaded the book titled [scanner.cache.name], [length(scanner.cache.dat)] signs",ckey=key_name(usr))
|
|
alert("Upload Complete.")
|
|
|
|
if(href_list["targetid"])
|
|
var/sqlid = sanitizeSQL(href_list["targetid"])
|
|
establish_db_connection(dbcon)
|
|
if(!dbcon.IsConnected())
|
|
alert("Connection to Archive has been severed. Aborting.")
|
|
if(bibledelay)
|
|
for (var/mob/V in hearers(src))
|
|
V.show_message("<b>[src]</b>'s monitor flashes, \"Printer unavailable. Please allow a short time before attempting to print.\"")
|
|
else
|
|
bibledelay = 1
|
|
spawn(60)
|
|
bibledelay = 0
|
|
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM ss13_library WHERE id=[sqlid]")
|
|
query.Execute()
|
|
|
|
while(query.NextRow())
|
|
var/author = query.item[2]
|
|
var/title = query.item[3]
|
|
var/content = query.item[4]
|
|
var/obj/item/weapon/book/B = new(src.loc)
|
|
B.name = "Book: [title]"
|
|
B.title = title
|
|
B.author = author
|
|
B.dat = content
|
|
B.icon_state = "book[rand(1,7)]"
|
|
src.visible_message("[src]'s printer hums as it produces a completely bound book. How did it do that?")
|
|
break
|
|
if(href_list["orderbyid"])
|
|
var/orderid = input("Enter your order:") as num|null
|
|
if(orderid)
|
|
if(isnum(orderid))
|
|
var/nhref = "src=\ref[src];targetid=[orderid]"
|
|
spawn() src.Topic(nhref, params2list(nhref), src)
|
|
if(href_list["sort"] in list("author", "title", "category"))
|
|
sortby = href_list["sort"]
|
|
src.add_fingerprint(usr)
|
|
src.updateUsrDialog()
|
|
return
|
|
|
|
/*
|
|
* Library Scanner
|
|
*/
|
|
/obj/machinery/libraryscanner
|
|
name = "scanner"
|
|
icon = 'icons/obj/library.dmi'
|
|
icon_state = "bigscanner"
|
|
anchored = 1
|
|
density = 1
|
|
var/obj/item/weapon/book/cache // Last scanned book
|
|
|
|
/obj/machinery/libraryscanner/attackby(var/obj/O as obj, var/mob/user as mob)
|
|
if(istype(O, /obj/item/weapon/book))
|
|
user.drop_item()
|
|
O.loc = src
|
|
|
|
/obj/machinery/libraryscanner/attack_hand(var/mob/user as mob)
|
|
usr.set_machine(src)
|
|
var/dat = "<HEAD><TITLE>Scanner Control Interface</TITLE></HEAD><BODY>\n" // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
|
if(cache)
|
|
dat += "<FONT color=#005500>Data stored in memory.</FONT><BR>"
|
|
else
|
|
dat += "No data stored in memory.<BR>"
|
|
dat += "<A href='?src=\ref[src];scan=1'>\[Scan\]</A>"
|
|
if(cache)
|
|
dat += " <A href='?src=\ref[src];clear=1'>\[Clear Memory\]</A><BR><BR><A href='?src=\ref[src];eject=1'>\[Remove Book\]</A>"
|
|
else
|
|
dat += "<BR>"
|
|
user << browse(dat, "window=scanner")
|
|
onclose(user, "scanner")
|
|
|
|
/obj/machinery/libraryscanner/Topic(href, href_list)
|
|
if(..())
|
|
usr << browse(null, "window=scanner")
|
|
onclose(usr, "scanner")
|
|
return
|
|
|
|
if(href_list["scan"])
|
|
for(var/obj/item/weapon/book/B in contents)
|
|
cache = B
|
|
break
|
|
if(href_list["clear"])
|
|
cache = null
|
|
if(href_list["eject"])
|
|
for(var/obj/item/weapon/book/B in contents)
|
|
B.loc = src.loc
|
|
src.add_fingerprint(usr)
|
|
src.updateUsrDialog()
|
|
return
|
|
|
|
|
|
/*
|
|
* Book binder
|
|
*/
|
|
/obj/machinery/bookbinder
|
|
name = "Book Binder"
|
|
icon = 'icons/obj/library.dmi'
|
|
icon_state = "binder"
|
|
anchored = 1
|
|
density = 1
|
|
|
|
/obj/machinery/bookbinder/attackby(var/obj/O as obj, var/mob/user as mob)
|
|
if(istype(O, /obj/item/weapon/paper))
|
|
user.drop_item()
|
|
O.loc = src
|
|
user.visible_message("[user] loads some paper into [src].", "You load some paper into [src].")
|
|
src.visible_message("[src] begins to hum as it warms up its printing drums.")
|
|
sleep(rand(200,400))
|
|
src.visible_message("[src] whirs as it prints and binds a new book.")
|
|
var/obj/item/weapon/book/b = new(src.loc)
|
|
b.dat = O:info
|
|
b.name = "Print Job #" + "[rand(100, 999)]"
|
|
b.icon_state = "book[rand(1,7)]"
|
|
qdel(O)
|
|
else
|
|
..()
|