Setup for New Library

This commit is contained in:
Mechoid
2019-11-04 18:24:08 -08:00
committed by VirgoBot
parent 222a144b13
commit 551dd02a80
6 changed files with 214 additions and 5 deletions

View File

@@ -0,0 +1,61 @@
/*
* Home of the New (NOV 1st, 2019) library books.
*/
/obj/item/weapon/book/custom_library
name = "Book"
desc = "A hardbound book."
description_info = "This book is printed from the custom repo. If you can see this, something went wrong."
icon = 'icons/obj/custom_books.dmi'
icon_state = "book"
// This is the ckey of the book's author.
var/origkey = null
author = "UNKNOWN"
/obj/item/weapon/book/custom_library/fiction
libcategory = "Fiction"
/obj/item/weapon/book/custom_library/nonfiction
libcategory = "Non-Fiction"
/obj/item/weapon/book/custom_library/reference
libcategory = "Reference"
/obj/item/weapon/book/custom_library/religious
libcategory = "Religious"
/*
/obj/item/weapon/book/custom_library/adult
libcategory = "Adult"
*/
/obj/item/weapon/book/bundle/custom_library
name = "Book"
desc = "A hardbound book."
description_info = "This book is printed from the custom repo. If you can see this, something went wrong."
icon = 'icons/obj/custom_books.dmi'
icon_state = "book"
// This is the ckey of the book's author.
var/origkey = null
author = "UNKNOWN"
page = 1 //current page
pages = list() //the contents of each page
/obj/item/weapon/book/bundle/custom_library/fiction
libcategory = "Fiction"
/obj/item/weapon/book/bundle/custom_library/nonfiction
libcategory = "Non-Fiction"
/obj/item/weapon/book/bundle/custom_library/reference
libcategory = "Reference"
/obj/item/weapon/book/bundle/custom_library/religious
libcategory = "Religious"
/*
/obj/item/weapon/book/bundle/custom_library/adult
libcategory = "Adult"
*/

View File

@@ -147,6 +147,7 @@
var/dat // Actual page content
var/due_date = 0 // Game time in 1/10th seconds
var/author // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned
var/libcategory = "Miscellaneous" // The library category this book sits in. "Fiction", "Non-Fiction", "Adult", "Reference", "Religion"
var/unique = 0 // 0 - Normal book, 1 - Should not be treated as normal book, unable to be copied, unable to be modified
var/title // The real name of the book.
var/carved = 0 // Has the book been hollowed out for use as a secret storage item?
@@ -260,6 +261,74 @@
M << browse("<TT><I>Penned by [author].</I></TT> <BR>" + "[dat]", "window=book")
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN) //to prevent spam
/*
* Book Bundle (Multi-page book)
*/
/obj/item/weapon/book/bundle
var/page = 1 //current page
var/list/pages = list() //the contents of each page
/obj/item/weapon/book/bundle/proc/show_content(mob/user as mob)
var/dat
var/obj/item/weapon/W = pages[page]
// first
if(page == 1)
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=\ref[src];prev_page=1'>Front</A></DIV>"
dat+= "<DIV STYLE='float:right; text-align:right; width:33.33333%'><A href='?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
// last
else if(page == pages.len)
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
dat+= "<DIV STYLE='float:right; text-align:right; with:33.33333%'><A href='?src=\ref[src];next_page=1'>Back</A></DIV><BR><HR>"
// middle pages
else
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
dat+= "<DIV STYLE='float:right; text-align:right; width:33.33333%'><A href='?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
if(istype(pages[page], /obj/item/weapon/paper))
var/obj/item/weapon/paper/P = W
if(!(istype(usr, /mob/living/carbon/human) || isobserver(usr) || istype(usr, /mob/living/silicon)))
dat += "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>"
else
dat += "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>"
user << browse(dat, "window=[name]")
else if(istype(pages[page], /obj/item/weapon/photo))
var/obj/item/weapon/photo/P = W
user << browse_rsc(P.img, "tmp_photo.png")
user << browse(dat + "<html><head><title>[P.name]</title></head>" \
+ "<body style='overflow:hidden'>" \
+ "<div> <img src='tmp_photo.png' width = '180'" \
+ "[P.scribble ? "<div> Written on the back:<br><i>[P.scribble]</i>" : ]"\
+ "</body></html>", "window=[name]")
else if(!isnull(pages[page]))
if(!(istype(usr, /mob/living/carbon/human) || isobserver(usr) || istype(usr, /mob/living/silicon)))
dat += "<HTML><HEAD><TITLE>Page [page]</TITLE></HEAD><BODY>[stars(pages[page])]</BODY></HTML>"
else
dat += "<HTML><HEAD><TITLE>Page [page]</TITLE></HEAD><BODY>[pages[page]]</BODY></HTML>"
user << browse(dat, "window=[name]")
/obj/item/weapon/book/bundle/attack_self(mob/user as mob)
src.show_content(user)
add_fingerprint(usr)
update_icon()
return
/obj/item/weapon/book/bundle/Topic(href, href_list)
if(..())
return 1
if((src in usr.contents) || (istype(src.loc, /obj/item/weapon/folder) && (src.loc in usr.contents)))
usr.set_machine(src)
if(href_list["next_page"])
if(page != pages.len)
page++
playsound(src.loc, "pageturn", 50, 1)
if(href_list["prev_page"])
if(page > 1)
page--
playsound(src.loc, "pageturn", 50, 1)
src.attack_self(usr)
updateUsrDialog()
else
to_chat(usr, "<span class='notice'>You need to hold it in your hands!</span>")
/*
* Barcode Scanner

View File

@@ -113,7 +113,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
* 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.
// 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. // Nov 2019. Nope.
/obj/machinery/librarycomp
name = "Check-In/Out Computer"
icon = 'icons/obj/library.dmi'
@@ -133,6 +133,40 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
var/bibledelay = 0 // LOL NO SPAM (1 minute delay) -- Doohl
var/static/list/all_books
var/static/list/base_genre_books
/obj/machinery/librarycomp/Initialize()
..()
if(!base_genre_books || !base_genre_books.len)
base_genre_books = list(
/obj/item/weapon/book/custom_library/fiction,
/obj/item/weapon/book/custom_library/nonfiction,
/obj/item/weapon/book/custom_library/reference,
/obj/item/weapon/book/custom_library/religious,
/obj/item/weapon/book/bundle/custom_library/fiction,
/obj/item/weapon/book/bundle/custom_library/nonfiction,
/obj/item/weapon/book/bundle/custom_library/reference,
/obj/item/weapon/book/bundle/custom_library/religious
)
if(!all_books || !all_books.len)
all_books = list()
for(var/path in subtypesof(/obj/item/weapon/book/codex/lore))
var/obj/item/weapon/book/C = new path(null)
all_books[C.name] = C
for(var/path in subtypesof(/obj/item/weapon/book/custom_library) - base_genre_books)
var/obj/item/weapon/book/B = new path(null)
all_books[B.title] = B
for(var/path in subtypesof(/obj/item/weapon/book/bundle/custom_library) - base_genre_books)
var/obj/item/weapon/book/M = new path(null)
all_books[M.title] = M
/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'>
@@ -144,7 +178,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
<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>"}
<A href='?src=\ref[src];switchscreen=6'>6. Print a Bible</A><BR>
<A href='?src=\ref[src];switchscreen=8'>8. Access NT Internal Archive</A><BR>"}
if(src.emagged)
dat += "<A href='?src=\ref[src];switchscreen=7'>7. Access the Forbidden Lore Vault</A><BR>"
if(src.arcanecheckout)
@@ -190,8 +225,11 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
<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>"
dat += "<h3>Deprecated Archive</h3>"
establish_old_db_connection()
dat += "<h3><font color=red>Warning: System Administrator has slated this archive for removal. Personal uploads should be taken to the NT board of internal literature.</font></h3>"
if(!dbcon_old.IsConnected())
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
else
@@ -210,6 +248,10 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
dat += "</table>"
dat += "<BR><A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
if(5)
dat += "<H3>ERROR</H3>"
dat+= "<FONT color=red>Library Database is in Secure Management Mode.</FONT><BR>\
Contact a System Administrator for more information.<BR>"
/*
dat += "<H3>Upload a New Title</H3>"
if(!scanner)
for(var/obj/machinery/libraryscanner/S in range(9))
@@ -227,12 +269,30 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
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>"}
if(8)
dat += "<h3>NT Internal Archive</h3>"
if(!all_books || !all_books.len)
dat += "<font color=red><b>ERROR</b> Something has gone seriously wrong. Contact System Administrator for more information.</font>"
else
dat += {"<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>"}
for(var/name in all_books)
var/obj/item/weapon/book/masterbook = all_books[name]
var/id = masterbook.type
var/author = masterbook.author
var/title = masterbook.name
var/category = masterbook.libcategory
dat += "<tr><td>[author]</td><td>[title]</td><td>[category]</td><td><A href='?src=\ref[src];hardprint=[id]'>\[Order\]</A></td></tr>"
dat += "</table>"
dat += "<BR><A href='?src=\ref[src];switchscreen=0'>(Return to main menu)</A><BR>"
//dat += "<A HREF='?src=\ref[user];mach_close=library'>Close</A><br><br>"
user << browse(dat, "window=library")
@@ -293,6 +353,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
if("7")
screenstate = 7
if("8")
screenstate = 8
if(href_list["arccheckout"])
if(src.emagged)
src.arcanecheckout = 1
@@ -328,7 +390,8 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
var/newcategory = input("Choose a category: ") in list("Fiction", "Non-Fiction", "Adult", "Reference", "Religion")
if(newcategory)
upload_category = newcategory
if(href_list["upload"])
/* 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")
@@ -356,6 +419,7 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
else
log_game("[usr.name]/[usr.key] has uploaded the book titled [scanner.cache.name], [length(scanner.cache.dat)] signs")
alert("Upload Complete.")
*/
if(href_list["targetid"])
var/sqlid = sanitizeSQL(href_list["targetid"])
@@ -392,6 +456,10 @@ datum/borrowbook // Datum used to keep track of who has borrowed what when and f
spawn() src.Topic(nhref, params2list(nhref), src)
if(href_list["sort"] in list("author", "title", "category"))
sortby = href_list["sort"]
if(href_list["hardprint"])
var/newpath = href_list["hardprint"]
var/obj/item/weapon/book/NewBook = new newpath(get_turf(src))
NewBook.name = "Book: [NewBook.name]"
src.add_fingerprint(usr)
src.updateUsrDialog()
return

View File

@@ -23,14 +23,19 @@
desc = "Contains useful information about the world around you. It seems to have been written for travelers to Virgo-Erigone, human or not. It also \
has the words 'Don't Panic' in small, friendly letters on the cover."
icon_state = "codex"
<<<<<<< HEAD
root_type = /datum/lore/codex/category/main_virgo_lore
=======
root_type = /datum/lore/codex/category/main_vir_lore
libcategory = "Reference"
>>>>>>> 41fc81e... Setup for New Library (#6514)
/obj/item/weapon/book/codex/lore/robutt
name = "A Buyer's Guide to Artificial Bodies"
desc = "Recommended reading for the newly cyborgified, new positronics, and the upwardly-mobile FBP."
icon_state = "codex_robutt"
root_type = /datum/lore/codex/category/main_robutts
libcategory = "Reference"
/obj/item/weapon/book/codex/lore/news
name = "Daedalus Pocket Newscaster"
@@ -38,6 +43,7 @@
icon_state = "newscodex"
w_class = ITEMSIZE_SMALL
root_type = /datum/lore/codex/category/main_news
libcategory = "Reference"
/* //VORESTATION REMOVAL
// Combines SOP/Regs/Law
@@ -48,4 +54,8 @@
icon_state = "corp_regs"
root_type = /datum/lore/codex/category/main_corp_regs
throwforce = 5 // Throw the book at 'em.
<<<<<<< HEAD
*/
=======
libcategory = "Reference"
>>>>>>> 41fc81e... Setup for New Library (#6514)

BIN
icons/obj/custom_books.dmi Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -2020,6 +2020,7 @@
#include "code\modules\library\lib_items.dm"
#include "code\modules\library\lib_machines.dm"
#include "code\modules\library\lib_readme.dm"
#include "code\modules\library\hardcode_library\_library.dm"
#include "code\modules\lighting\lighting_area.dm"
#include "code\modules\lighting\lighting_atom.dm"
#include "code\modules\lighting\lighting_corner.dm"