mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
map conflict any%
This commit is contained in:
@@ -294,7 +294,7 @@
|
|||||||
/turf/template_noop,
|
/turf/template_noop,
|
||||||
/area/space/nearstation)
|
/area/space/nearstation)
|
||||||
"N" = (
|
"N" = (
|
||||||
/obj/item/book/random/triple,
|
/obj/item/book/random,
|
||||||
/turf/open/floor/plasteel,
|
/turf/open/floor/plasteel,
|
||||||
/area/ruin/space/has_grav/powered/ancient_shuttle)
|
/area/ruin/space/has_grav/powered/ancient_shuttle)
|
||||||
"O" = (
|
"O" = (
|
||||||
|
|||||||
@@ -42867,7 +42867,7 @@
|
|||||||
/area/science/xenobiology)
|
/area/science/xenobiology)
|
||||||
"bPd" = (
|
"bPd" = (
|
||||||
/obj/structure/table/reinforced,
|
/obj/structure/table/reinforced,
|
||||||
/obj/item/book/random/triple,
|
/obj/item/book/random,
|
||||||
/turf/open/floor/engine,
|
/turf/open/floor/engine,
|
||||||
/area/science/xenobiology)
|
/area/science/xenobiology)
|
||||||
"bPe" = (
|
"bPe" = (
|
||||||
|
|||||||
@@ -240,3 +240,9 @@ GLOBAL_LIST_INIT(glass_sheet_types, typecacheof(list(
|
|||||||
#define isshuttleturf(T) (length(T.baseturfs) && (/turf/baseturf_skipover/shuttle in T.baseturfs))
|
#define isshuttleturf(T) (length(T.baseturfs) && (/turf/baseturf_skipover/shuttle in T.baseturfs))
|
||||||
|
|
||||||
#define isProbablyWallMounted(O) (O.pixel_x > 20 || O.pixel_x < -20 || O.pixel_y > 20 || O.pixel_y < -20)
|
#define isProbablyWallMounted(O) (O.pixel_x > 20 || O.pixel_x < -20 || O.pixel_y > 20 || O.pixel_y < -20)
|
||||||
|
#define isbook(O) (is_type_in_typecache(O, GLOB.book_types))
|
||||||
|
|
||||||
|
GLOBAL_LIST_INIT(book_types, typecacheof(list(
|
||||||
|
/obj/item/book,
|
||||||
|
/obj/item/spellbook,
|
||||||
|
/obj/item/storage/book)))
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
#define BOOKCASE_UNANCHORED 0
|
||||||
|
#define BOOKCASE_ANCHORED 1
|
||||||
|
#define BOOKCASE_FINISHED 2
|
||||||
|
|
||||||
/* Library Items
|
/* Library Items
|
||||||
*
|
*
|
||||||
* Contains:
|
* Contains:
|
||||||
@@ -17,69 +21,85 @@
|
|||||||
desc = "A great place for storing knowledge."
|
desc = "A great place for storing knowledge."
|
||||||
anchored = FALSE
|
anchored = FALSE
|
||||||
density = TRUE
|
density = TRUE
|
||||||
opacity = 0
|
opacity = FALSE
|
||||||
resistance_flags = FLAMMABLE
|
resistance_flags = FLAMMABLE
|
||||||
max_integrity = 200
|
max_integrity = 200
|
||||||
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 0)
|
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 0)
|
||||||
var/state = 0
|
var/state = BOOKCASE_UNANCHORED
|
||||||
var/list/allowed_books = list(/obj/item/book, /obj/item/spellbook, /obj/item/storage/book, /obj/item/gun/magic/wand/book) //Things allowed in the bookcase
|
/// When enabled, books_to_load number of random books will be generated for this bookcase when first interacted with.
|
||||||
|
var/load_random_books = FALSE
|
||||||
|
/// The category of books to pick from when populating random books.
|
||||||
|
var/random_category = null
|
||||||
|
/// How many random books to generate.
|
||||||
|
var/books_to_load = 0
|
||||||
|
|
||||||
/obj/structure/bookcase/examine(mob/user)
|
/obj/structure/bookcase/examine(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(!anchored)
|
if(!anchored)
|
||||||
. += "<span class='notice'>The <i>bolts</i> on the bottom are unsecured.</span>"
|
. += "<span class='notice'>The <i>bolts</i> on the bottom are unsecured.</span>"
|
||||||
if(anchored)
|
else
|
||||||
. += "<span class='notice'>It's secured in place with <b>bolts</b>.</span>"
|
. += "<span class='notice'>It's secured in place with <b>bolts</b>.</span>"
|
||||||
switch(state)
|
switch(state)
|
||||||
if(0)
|
if(BOOKCASE_UNANCHORED)
|
||||||
. += "<span class='notice'>There's a <b>small crack</b> visible on the back panel.</span>"
|
. += "<span class='notice'>There's a <b>small crack</b> visible on the back panel.</span>"
|
||||||
if(1)
|
if(BOOKCASE_ANCHORED)
|
||||||
. += "<span class='notice'>There's space inside for a <i>wooden</i> shelf.</span>"
|
. += "<span class='notice'>There's space inside for a <i>wooden</i> shelf.</span>"
|
||||||
if(2)
|
if(BOOKCASE_FINISHED)
|
||||||
. += "<span class='notice'>There's a <b>small crack</b> visible on the shelf.</span>"
|
. += "<span class='notice'>There's a <b>small crack</b> visible on the shelf.</span>"
|
||||||
|
|
||||||
/obj/structure/bookcase/Initialize(mapload)
|
/obj/structure/bookcase/Initialize(mapload)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(!mapload)
|
if(!mapload)
|
||||||
return
|
return
|
||||||
state = 2
|
set_anchored(TRUE)
|
||||||
icon_state = "book-0"
|
state = BOOKCASE_FINISHED
|
||||||
anchored = TRUE
|
|
||||||
for(var/obj/item/I in loc)
|
for(var/obj/item/I in loc)
|
||||||
if(istype(I, /obj/item/book))
|
if(!isbook(I))
|
||||||
I.forceMove(src)
|
continue
|
||||||
|
I.forceMove(src)
|
||||||
|
update_icon()
|
||||||
|
|
||||||
|
/obj/structure/bookcase/set_anchored(anchorvalue)
|
||||||
|
. = ..()
|
||||||
|
if(isnull(.))
|
||||||
|
return
|
||||||
|
state = anchorvalue
|
||||||
|
if(!anchorvalue) //in case we were vareditted or uprooted by a hostile mob, ensure we drop all our books instead of having them disappear till we're rebuild.
|
||||||
|
var/atom/Tsec = drop_location()
|
||||||
|
for(var/obj/I in contents)
|
||||||
|
if(!isbook(I))
|
||||||
|
continue
|
||||||
|
I.forceMove(Tsec)
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
/obj/structure/bookcase/attackby(obj/item/I, mob/user, params)
|
/obj/structure/bookcase/attackby(obj/item/I, mob/user, params)
|
||||||
switch(state)
|
switch(state)
|
||||||
if(0)
|
if(BOOKCASE_UNANCHORED)
|
||||||
if(istype(I, /obj/item/wrench))
|
if(I.tool_behaviour == TOOL_WRENCH)
|
||||||
if(I.use_tool(src, user, 20, volume=50))
|
if(I.use_tool(src, user, 20, volume=50))
|
||||||
to_chat(user, "<span class='notice'>You wrench the frame into place.</span>")
|
to_chat(user, "<span class='notice'>You wrench the frame into place.</span>")
|
||||||
anchored = TRUE
|
set_anchored(TRUE)
|
||||||
state = 1
|
else if(I.tool_behaviour == TOOL_CROWBAR)
|
||||||
if(istype(I, /obj/item/crowbar))
|
|
||||||
if(I.use_tool(src, user, 20, volume=50))
|
if(I.use_tool(src, user, 20, volume=50))
|
||||||
to_chat(user, "<span class='notice'>You pry the frame apart.</span>")
|
to_chat(user, "<span class='notice'>You pry the frame apart.</span>")
|
||||||
deconstruct(TRUE)
|
deconstruct(TRUE)
|
||||||
|
|
||||||
if(1)
|
if(BOOKCASE_ANCHORED)
|
||||||
if(istype(I, /obj/item/stack/sheet/mineral/wood))
|
if(istype(I, /obj/item/stack/sheet/mineral/wood))
|
||||||
var/obj/item/stack/sheet/mineral/wood/W = I
|
var/obj/item/stack/sheet/mineral/wood/W = I
|
||||||
if(W.get_amount() >= 2)
|
if(W.get_amount() >= 2)
|
||||||
W.use(2)
|
W.use(2)
|
||||||
to_chat(user, "<span class='notice'>You add a shelf.</span>")
|
to_chat(user, "<span class='notice'>You add a shelf.</span>")
|
||||||
state = 2
|
state = BOOKCASE_FINISHED
|
||||||
icon_state = "book-0"
|
update_icon()
|
||||||
if(istype(I, /obj/item/wrench))
|
else if(I.tool_behaviour == TOOL_WRENCH)
|
||||||
I.play_tool_sound(src, 100)
|
I.play_tool_sound(src, 100)
|
||||||
to_chat(user, "<span class='notice'>You unwrench the frame.</span>")
|
to_chat(user, "<span class='notice'>You unwrench the frame.</span>")
|
||||||
anchored = FALSE
|
set_anchored(FALSE)
|
||||||
state = 0
|
|
||||||
|
|
||||||
if(2)
|
if(BOOKCASE_FINISHED)
|
||||||
var/datum/component/storage/STR = I.GetComponent(/datum/component/storage)
|
var/datum/component/storage/STR = I.GetComponent(/datum/component/storage)
|
||||||
if(is_type_in_list(I, allowed_books))
|
if(isbook(I))
|
||||||
if(!user.transferItemToLoc(I, src))
|
if(!user.transferItemToLoc(I, src))
|
||||||
return
|
return
|
||||||
update_icon()
|
update_icon()
|
||||||
@@ -100,26 +120,29 @@
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
name = "bookcase ([sanitize(newname)])"
|
name = "bookcase ([sanitize(newname)])"
|
||||||
else if(istype(I, /obj/item/crowbar))
|
else if(I.tool_behaviour == TOOL_CROWBAR)
|
||||||
if(contents.len)
|
if(contents.len)
|
||||||
to_chat(user, "<span class='warning'>You need to remove the books first!</span>")
|
to_chat(user, "<span class='warning'>You need to remove the books first!</span>")
|
||||||
else
|
else
|
||||||
I.play_tool_sound(src, 100)
|
I.play_tool_sound(src, 100)
|
||||||
to_chat(user, "<span class='notice'>You pry the shelf out.</span>")
|
to_chat(user, "<span class='notice'>You pry the shelf out.</span>")
|
||||||
new /obj/item/stack/sheet/mineral/wood(drop_location(), 2)
|
new /obj/item/stack/sheet/mineral/wood(drop_location(), 2)
|
||||||
state = 1
|
state = BOOKCASE_ANCHORED
|
||||||
icon_state = "bookempty"
|
update_icon()
|
||||||
else
|
else
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/structure/bookcase/on_attack_hand(mob/living/user, act_intent = user.a_intent, unarmed_attack_flags)
|
|
||||||
. = ..()
|
/obj/structure/bookcase/on_attack_hand(mob/living/user)
|
||||||
if(. || !istype(user))
|
if(!istype(user))
|
||||||
return
|
return
|
||||||
|
if(load_random_books)
|
||||||
|
create_random_books(books_to_load, src, FALSE, random_category)
|
||||||
|
load_random_books = FALSE
|
||||||
if(contents.len)
|
if(contents.len)
|
||||||
var/obj/item/book/choice = input("Which book would you like to remove from the shelf?") as null|obj in contents
|
var/obj/item/book/choice = input(user, "Which book would you like to remove from the shelf?") as null|obj in sortNames(contents.Copy())
|
||||||
if(choice)
|
if(choice)
|
||||||
if(!CHECK_MOBILITY(user, MOBILITY_USE) || !in_range(loc, user))
|
if(!(user.mobility_flags & MOBILITY_USE) || user.stat != CONSCIOUS || !in_range(loc, user))
|
||||||
return
|
return
|
||||||
if(ishuman(user))
|
if(ishuman(user))
|
||||||
if(!user.get_active_held_item())
|
if(!user.get_active_held_item())
|
||||||
@@ -128,36 +151,25 @@
|
|||||||
choice.forceMove(drop_location())
|
choice.forceMove(drop_location())
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
/obj/structure/bookcase/attack_ghost(mob/dead/observer/user)
|
|
||||||
. = ..()
|
|
||||||
if(!length(contents))
|
|
||||||
to_chat(user, "<span class='warning'>It's empty!</span>")
|
|
||||||
return
|
|
||||||
var/obj/item/book/choice = input("Which book would you like to read?") as null|obj in contents
|
|
||||||
if(choice)
|
|
||||||
if(!istype(choice)) //spellbook, cult tome, or the one weird bible storage
|
|
||||||
to_chat(user,"A mysterious force is keeping you from reading that.")
|
|
||||||
return
|
|
||||||
choice.attack_ghost(user)
|
|
||||||
|
|
||||||
/obj/structure/bookcase/deconstruct(disassembled = TRUE)
|
/obj/structure/bookcase/deconstruct(disassembled = TRUE)
|
||||||
new /obj/item/stack/sheet/mineral/wood(loc, 4)
|
var/atom/Tsec = drop_location()
|
||||||
for(var/obj/item/book/B in contents)
|
new /obj/item/stack/sheet/mineral/wood(Tsec, 4)
|
||||||
B.forceMove(get_turf(src))
|
for(var/obj/item/I in contents)
|
||||||
qdel(src)
|
if(!isbook(I))
|
||||||
|
continue
|
||||||
|
I.forceMove(Tsec)
|
||||||
|
return ..()
|
||||||
|
|
||||||
|
|
||||||
/obj/structure/bookcase/update_icon_state()
|
/obj/structure/bookcase/update_icon_state()
|
||||||
icon_state = "book-[min(length(contents), 5)]"
|
if(state == BOOKCASE_UNANCHORED || state == BOOKCASE_ANCHORED)
|
||||||
|
icon_state = "bookempty"
|
||||||
|
return
|
||||||
/obj/structure/bookcase/manuals/medical
|
var/amount = contents.len
|
||||||
name = "medical manuals bookcase"
|
if(load_random_books)
|
||||||
|
amount += books_to_load
|
||||||
/obj/structure/bookcase/manuals/medical/Initialize()
|
icon_state = "book-[clamp(amount, 0, 5)]"
|
||||||
. = ..()
|
|
||||||
new /obj/item/book/manual/wiki/medical_cloning(src)
|
|
||||||
update_icon()
|
|
||||||
|
|
||||||
|
|
||||||
/obj/structure/bookcase/manuals/engineering
|
/obj/structure/bookcase/manuals/engineering
|
||||||
@@ -198,34 +210,27 @@
|
|||||||
var/dat //Actual page content
|
var/dat //Actual page content
|
||||||
var/due_date = 0 //Game time in 1/10th seconds
|
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/author //Who wrote the thing, can be changed by pen or PC. It is not automatically assigned
|
||||||
var/unique = 0 //0 - Normal book, 1 - Should not be treated as normal book, unable to be copied, unable to be modified
|
var/unique = FALSE //false - Normal book, true - Should not be treated as normal book, unable to be copied, unable to be modified
|
||||||
var/title //The real name of the book.
|
var/title //The real name of the book.
|
||||||
var/window_size = null // Specific window size for the book, i.e: "1920x1080", Size x Width
|
var/window_size = null // Specific window size for the book, i.e: "1920x1080", Size x Width
|
||||||
|
|
||||||
|
|
||||||
/obj/item/book/attack_self(mob/user)
|
/obj/item/book/attack_self(mob/user)
|
||||||
if(is_blind(user))
|
if(!user.can_read(src))
|
||||||
to_chat(user, "<span class='warning'>As you are trying to read, you suddenly feel very stupid!</span>")
|
|
||||||
return
|
|
||||||
if(ismonkey(user))
|
|
||||||
to_chat(user, "<span class='notice'>You skim through the book but can't comprehend any of it.</span>")
|
|
||||||
return
|
return
|
||||||
if(dat)
|
if(dat)
|
||||||
show_to(user)
|
user << browse("<TT><I>Penned by [author].</I></TT> <BR>" + "[dat]", "window=book[window_size != null ? ";size=[window_size]" : ""]")
|
||||||
user.visible_message("[user] opens a book titled \"[title]\" and begins reading intently.")
|
user.visible_message("<span class='notice'>[user] opens a book titled \"[title]\" and begins reading intently.</span>")
|
||||||
|
// SEND_SIGNAL(user, COMSIG_ADD_MOOD_EVENT, "book_nerd", /datum/mood_event/book_nerd)
|
||||||
|
onclose(user, "book")
|
||||||
else
|
else
|
||||||
to_chat(user, "<span class='notice'>This book is completely blank!</span>")
|
to_chat(user, "<span class='notice'>This book is completely blank!</span>")
|
||||||
|
|
||||||
/obj/item/book/attack_ghost(mob/dead/observer/O)
|
|
||||||
. = ..()
|
|
||||||
show_to(O)
|
|
||||||
|
|
||||||
/obj/item/book/proc/show_to(mob/user)
|
|
||||||
user << browse("<TT><I>Penned by [author].</I></TT> <BR>" + "[dat]", "window=book[window_size != null ? ";size=[window_size]" : ""]")
|
|
||||||
|
|
||||||
/obj/item/book/attackby(obj/item/I, mob/user, params)
|
/obj/item/book/attackby(obj/item/I, mob/user, params)
|
||||||
if(istype(I, /obj/item/pen))
|
if(istype(I, /obj/item/pen))
|
||||||
if(is_blind(user))
|
if(user.is_blind())
|
||||||
to_chat(user, "<span class='warning'> As you are trying to write on the book, you suddenly feel very stupid!</span>")
|
to_chat(user, "<span class='warning'>As you are trying to write on the book, you suddenly feel very stupid!</span>")
|
||||||
return
|
return
|
||||||
if(unique)
|
if(unique)
|
||||||
to_chat(user, "<span class='warning'>These pages don't seem to take the ink well! Looks like you can't modify it.</span>")
|
to_chat(user, "<span class='warning'>These pages don't seem to take the ink well! Looks like you can't modify it.</span>")
|
||||||
@@ -243,10 +248,10 @@
|
|||||||
if(!user.canUseTopic(src, BE_CLOSE, literate))
|
if(!user.canUseTopic(src, BE_CLOSE, literate))
|
||||||
return
|
return
|
||||||
if (length(newtitle) > 20)
|
if (length(newtitle) > 20)
|
||||||
to_chat(user, "That title won't fit on the cover!")
|
to_chat(user, "<span class='warning'>That title won't fit on the cover!</span>")
|
||||||
return
|
return
|
||||||
if(!newtitle)
|
if(!newtitle)
|
||||||
to_chat(user, "That title is invalid.")
|
to_chat(user, "<span class='warning'>That title is invalid.</span>")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
name = newtitle
|
name = newtitle
|
||||||
@@ -256,7 +261,7 @@
|
|||||||
if(!user.canUseTopic(src, BE_CLOSE, literate))
|
if(!user.canUseTopic(src, BE_CLOSE, literate))
|
||||||
return
|
return
|
||||||
if(!content)
|
if(!content)
|
||||||
to_chat(user, "The content is invalid.")
|
to_chat(user, "<span class='warning'>The content is invalid.</span>")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
dat += content
|
dat += content
|
||||||
@@ -265,7 +270,7 @@
|
|||||||
if(!user.canUseTopic(src, BE_CLOSE, literate))
|
if(!user.canUseTopic(src, BE_CLOSE, literate))
|
||||||
return
|
return
|
||||||
if(!newauthor)
|
if(!newauthor)
|
||||||
to_chat(user, "The name is invalid.")
|
to_chat(user, "<span class='warning'>The name is invalid.</span>")
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
author = newauthor
|
author = newauthor
|
||||||
@@ -275,34 +280,34 @@
|
|||||||
else if(istype(I, /obj/item/barcodescanner))
|
else if(istype(I, /obj/item/barcodescanner))
|
||||||
var/obj/item/barcodescanner/scanner = I
|
var/obj/item/barcodescanner/scanner = I
|
||||||
if(!scanner.computer)
|
if(!scanner.computer)
|
||||||
to_chat(user, "[I]'s screen flashes: 'No associated computer found!'")
|
to_chat(user, "<span class='alert'>[I]'s screen flashes: 'No associated computer found!'</span>")
|
||||||
else
|
else
|
||||||
switch(scanner.mode)
|
switch(scanner.mode)
|
||||||
if(0)
|
if(0)
|
||||||
scanner.book = src
|
scanner.book = src
|
||||||
to_chat(user, "[I]'s screen flashes: 'Book stored in buffer.'")
|
to_chat(user, "<span class='notice'>[I]'s screen flashes: 'Book stored in buffer.'</span>")
|
||||||
if(1)
|
if(1)
|
||||||
scanner.book = src
|
scanner.book = src
|
||||||
scanner.computer.buffer_book = name
|
scanner.computer.buffer_book = name
|
||||||
to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Book title stored in associated computer buffer.'")
|
to_chat(user, "<span class='notice'>[I]'s screen flashes: 'Book stored in buffer. Book title stored in associated computer buffer.'</span>")
|
||||||
if(2)
|
if(2)
|
||||||
scanner.book = src
|
scanner.book = src
|
||||||
for(var/datum/borrowbook/b in scanner.computer.checkouts)
|
for(var/datum/borrowbook/b in scanner.computer.checkouts)
|
||||||
if(b.bookname == name)
|
if(b.bookname == name)
|
||||||
scanner.computer.checkouts.Remove(b)
|
scanner.computer.checkouts.Remove(b)
|
||||||
to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Book has been checked in.'")
|
to_chat(user, "<span class='notice'>[I]'s screen flashes: 'Book stored in buffer. Book has been checked in.'</span>")
|
||||||
return
|
return
|
||||||
to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. No active check-out record found for current title.'")
|
to_chat(user, "<span class='notice'>[I]'s screen flashes: 'Book stored in buffer. No active check-out record found for current title.'</span>")
|
||||||
if(3)
|
if(3)
|
||||||
scanner.book = src
|
scanner.book = src
|
||||||
for(var/obj/item/book in scanner.computer.inventory)
|
for(var/obj/item/book in scanner.computer.inventory)
|
||||||
if(book == src)
|
if(book == src)
|
||||||
to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Title already present in inventory, aborting to avoid duplicate entry.'")
|
to_chat(user, "<span class='alert'>[I]'s screen flashes: 'Book stored in buffer. Title already present in inventory, aborting to avoid duplicate entry.'</span>")
|
||||||
return
|
return
|
||||||
scanner.computer.inventory.Add(src)
|
scanner.computer.inventory.Add(src)
|
||||||
to_chat(user, "[I]'s screen flashes: 'Book stored in buffer. Title added to general inventory.'")
|
to_chat(user, "<span class='notice'>[I]'s screen flashes: 'Book stored in buffer. Title added to general inventory.'</span>")
|
||||||
|
|
||||||
else if(istype(I, /obj/item/kitchen/knife) || istype(I, /obj/item/wirecutters))
|
else if(istype(I, /obj/item/kitchen/knife) || I.tool_behaviour == TOOL_WIRECUTTER)
|
||||||
to_chat(user, "<span class='notice'>You begin to carve out [title]...</span>")
|
to_chat(user, "<span class='notice'>You begin to carve out [title]...</span>")
|
||||||
if(do_after(user, 30, target = src))
|
if(do_after(user, 30, target = src))
|
||||||
to_chat(user, "<span class='notice'>You carve out the pages from [title]! You didn't want to read it anyway.</span>")
|
to_chat(user, "<span class='notice'>You carve out the pages from [title]! You didn't want to read it anyway.</span>")
|
||||||
@@ -361,3 +366,8 @@
|
|||||||
else
|
else
|
||||||
to_chat(user, "<font color=red>No associated computer found. Only local scans will function properly.</font>")
|
to_chat(user, "<font color=red>No associated computer found. Only local scans will function properly.</font>")
|
||||||
to_chat(user, "\n")
|
to_chat(user, "\n")
|
||||||
|
|
||||||
|
|
||||||
|
#undef BOOKCASE_UNANCHORED
|
||||||
|
#undef BOOKCASE_ANCHORED
|
||||||
|
#undef BOOKCASE_FINISHED
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
var/search_page = 0
|
var/search_page = 0
|
||||||
COOLDOWN_DECLARE(library_visitor_topic_cooldown)
|
COOLDOWN_DECLARE(library_visitor_topic_cooldown)
|
||||||
clockwork = TRUE
|
clockwork = TRUE
|
||||||
|
|
||||||
/obj/machinery/computer/libraryconsole/ui_interact(mob/user)
|
/obj/machinery/computer/libraryconsole/ui_interact(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
var/list/dat = list() // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
var/list/dat = list() // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
||||||
@@ -158,7 +158,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Library Computer
|
* Library Computer
|
||||||
* After 860 days, it's finally a buildable computer.
|
* After 860 days, it's finally a buildable computer.*
|
||||||
|
* * i cannot change maps because you are a buch of fucks who ignore map changes
|
||||||
*/
|
*/
|
||||||
// TODO: Make this an actual /obj/machinery/computer that can be crafted from circuit boards and such
|
// 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.
|
||||||
@@ -173,7 +174,7 @@
|
|||||||
|
|
||||||
circuit = /obj/item/circuitboard/computer/libraryconsole
|
circuit = /obj/item/circuitboard/computer/libraryconsole
|
||||||
|
|
||||||
var/screenstate = 0 // 0 - Main Menu, 1 - Inventory, 2 - Checked Out, 3 - Check Out a Book
|
// var/screenstate = 0 // 0 - Main Menu, 1 - Inventory, 2 - Checked Out, 3 - Check Out a Book
|
||||||
|
|
||||||
var/arcanecheckout = 0
|
var/arcanecheckout = 0
|
||||||
var/buffer_book
|
var/buffer_book
|
||||||
@@ -187,13 +188,13 @@
|
|||||||
var/printer_cooldown = 0
|
var/printer_cooldown = 0
|
||||||
COOLDOWN_DECLARE(library_console_topic_cooldown)
|
COOLDOWN_DECLARE(library_console_topic_cooldown)
|
||||||
|
|
||||||
/obj/machinery/computer/bookmanagement/Initialize()
|
/obj/machinery/computer/libraryconsole/bookmanagement/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
if(circuit)
|
if(circuit)
|
||||||
circuit.name = "Book Inventory Management Console (Machine Board)"
|
circuit.name = "Book Inventory Management Console (Machine Board)"
|
||||||
circuit.build_path = /obj/machinery/computer/bookmanagement
|
circuit.build_path = /obj/machinery/computer/libraryconsole/bookmanagement
|
||||||
|
|
||||||
/obj/machinery/computer/bookmanagement/ui_interact(mob/user)
|
/obj/machinery/computer/libraryconsole/bookmanagement/ui_interact(mob/user)
|
||||||
. = ..()
|
. = ..()
|
||||||
var/dat = "" // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
var/dat = "" // <META HTTP-EQUIV='Refresh' CONTENT='10'>
|
||||||
switch(screenstate)
|
switch(screenstate)
|
||||||
@@ -324,17 +325,17 @@
|
|||||||
popup.set_content(dat)
|
popup.set_content(dat)
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|
||||||
/obj/machinery/computer/bookmanagement/proc/findscanner(viewrange)
|
/obj/machinery/computer/libraryconsole/bookmanagement/proc/findscanner(viewrange)
|
||||||
for(var/obj/machinery/libraryscanner/S in range(viewrange, get_turf(src)))
|
for(var/obj/machinery/libraryscanner/S in range(viewrange, get_turf(src)))
|
||||||
return S
|
return S
|
||||||
return null
|
return null
|
||||||
|
|
||||||
/obj/machinery/computer/bookmanagement/proc/print_forbidden_lore(mob/user)
|
/obj/machinery/computer/libraryconsole/bookmanagement/proc/print_forbidden_lore(mob/user)
|
||||||
new /obj/item/melee/cultblade/dagger(get_turf(src))
|
new /obj/item/melee/cultblade/dagger(get_turf(src))
|
||||||
to_chat(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 sinister dagger sitting on the desk. You don't even remember where it came from...</span>")
|
to_chat(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 sinister dagger sitting on the desk. You don't even remember where it came from...</span>")
|
||||||
user.visible_message("<span class='warning'>[user] stares at the blank screen for a few moments, [user.p_their()] expression frozen in fear. When [user.p_they()] finally awaken[user.p_s()] from it, [user.p_they()] look[user.p_s()] a lot older.</span>", 2)
|
user.visible_message("<span class='warning'>[user] stares at the blank screen for a few moments, [user.p_their()] expression frozen in fear. When [user.p_they()] finally awaken[user.p_s()] from it, [user.p_they()] look[user.p_s()] a lot older.</span>", 2)
|
||||||
|
|
||||||
/obj/machinery/computer/bookmanagement/attackby(obj/item/W, mob/user, params)
|
/obj/machinery/computer/libraryconsole/bookmanagement/attackby(obj/item/W, mob/user, params)
|
||||||
if(istype(W, /obj/item/barcodescanner))
|
if(istype(W, /obj/item/barcodescanner))
|
||||||
var/obj/item/barcodescanner/scanner = W
|
var/obj/item/barcodescanner/scanner = W
|
||||||
scanner.computer = src
|
scanner.computer = src
|
||||||
@@ -343,11 +344,11 @@
|
|||||||
else
|
else
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/machinery/computer/bookmanagement/emag_act(mob/user)
|
/obj/machinery/computer/libraryconsole/bookmanagement/emag_act(mob/user)
|
||||||
if(density && !(obj_flags & EMAGGED))
|
if(density && !(obj_flags & EMAGGED))
|
||||||
obj_flags |= EMAGGED
|
obj_flags |= EMAGGED
|
||||||
|
|
||||||
/obj/machinery/computer/bookmanagement/Topic(href, href_list)
|
/obj/machinery/computer/libraryconsole/bookmanagement/Topic(href, href_list)
|
||||||
if(!COOLDOWN_FINISHED(src, library_console_topic_cooldown))
|
if(!COOLDOWN_FINISHED(src, library_console_topic_cooldown))
|
||||||
return
|
return
|
||||||
COOLDOWN_START(src, library_console_topic_cooldown, 1 SECONDS)
|
COOLDOWN_START(src, library_console_topic_cooldown, 1 SECONDS)
|
||||||
@@ -583,7 +584,7 @@
|
|||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/machinery/bookbinder/proc/bind_book(mob/user, obj/item/paper/P)
|
/obj/machinery/bookbinder/proc/bind_book(mob/user, obj/item/paper/P)
|
||||||
if(machine_stat)
|
if(stat)
|
||||||
return
|
return
|
||||||
if(busy)
|
if(busy)
|
||||||
to_chat(user, "<span class='warning'>The book binder is busy. Please wait for completion of previous operation.</span>")
|
to_chat(user, "<span class='warning'>The book binder is busy. Please wait for completion of previous operation.</span>")
|
||||||
@@ -596,7 +597,7 @@
|
|||||||
sleep(rand(200,400))
|
sleep(rand(200,400))
|
||||||
busy = FALSE
|
busy = FALSE
|
||||||
if(P)
|
if(P)
|
||||||
if(!machine_stat)
|
if(!stat)
|
||||||
visible_message("<span class='notice'>[src] whirs as it prints and binds a new book.</span>")
|
visible_message("<span class='notice'>[src] whirs as it prints and binds a new book.</span>")
|
||||||
var/obj/item/book/B = new(src.loc)
|
var/obj/item/book/B = new(src.loc)
|
||||||
B.dat = P.info
|
B.dat = P.info
|
||||||
|
|||||||
@@ -10,78 +10,83 @@
|
|||||||
|
|
||||||
/obj/item/book/random
|
/obj/item/book/random
|
||||||
icon_state = "random_book"
|
icon_state = "random_book"
|
||||||
var/amount = 1
|
/// The category of books to pick from when creating this book.
|
||||||
var/category = null
|
var/random_category = null
|
||||||
|
/// If this book has already been 'generated' yet.
|
||||||
|
var/random_loaded = FALSE
|
||||||
|
|
||||||
/obj/item/book/random/Initialize()
|
/obj/item/book/random/Initialize(mapload)
|
||||||
..()
|
. = ..()
|
||||||
create_random_books(amount, src.loc, TRUE, category)
|
icon_state = "book[rand(1,8)]"
|
||||||
return INITIALIZE_HINT_QDEL
|
|
||||||
|
|
||||||
/obj/item/book/random/triple
|
/obj/item/book/random/attack_self()
|
||||||
amount = 3
|
if(!random_loaded)
|
||||||
|
create_random_books(1, loc, TRUE, random_category, src)
|
||||||
|
random_loaded = TRUE
|
||||||
|
return ..()
|
||||||
|
|
||||||
/obj/structure/bookcase/random
|
/obj/structure/bookcase/random
|
||||||
var/category = null
|
load_random_books = TRUE
|
||||||
var/book_count = 2
|
books_to_load = 2
|
||||||
icon_state = "random_bookcase"
|
icon_state = "random_bookcase"
|
||||||
anchored = TRUE
|
|
||||||
state = 2
|
|
||||||
|
|
||||||
/obj/structure/bookcase/random/Initialize(mapload)
|
/obj/structure/bookcase/random/Initialize(mapload)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(!book_count || !isnum(book_count))
|
if(books_to_load && isnum(books_to_load))
|
||||||
update_icon()
|
books_to_load += pick(-1,-1,0,1,1)
|
||||||
return
|
|
||||||
book_count += pick(-1,-1,0,1,1)
|
|
||||||
create_random_books(book_count, src, FALSE, category)
|
|
||||||
update_icon()
|
update_icon()
|
||||||
|
|
||||||
/proc/create_random_books(amount = 2, location, fail_loud = FALSE, category = null)
|
/proc/create_random_books(amount, location, fail_loud = FALSE, category = null, obj/item/book/existing_book)
|
||||||
. = list()
|
. = list()
|
||||||
if(!isnum(amount) || amount<1)
|
if(!isnum(amount) || amount<1)
|
||||||
return
|
return
|
||||||
if (!SSdbcore.Connect())
|
if (!SSdbcore.Connect())
|
||||||
if(fail_loud || prob(5))
|
if(existing_book && (fail_loud || prob(5)))
|
||||||
var/obj/item/paper/P = new(location)
|
existing_book.author = "???"
|
||||||
P.info = "There once was a book from Nantucket<br>But the database failed us, so f*$! it.<br>I tried to be good to you<br>Now this is an I.O.U<br>If you're feeling entitled, well, stuff it!<br><br><font color='gray'>~</font>"
|
existing_book.title = "Strange book"
|
||||||
P.update_icon()
|
existing_book.name = "Strange book"
|
||||||
|
existing_book.dat = "There once was a book from Nantucket<br>But the database failed us, so f*$! it.<br>I tried to be good to you<br>Now this is an I.O.U<br>If you're feeling entitled, well, stuff it!<br><br><font color='gray'>~</font>"
|
||||||
return
|
return
|
||||||
if(prob(25))
|
if(prob(25))
|
||||||
category = null
|
category = null
|
||||||
var/c = category? " AND category='[sanitizeSQL(category)]'" :""
|
var/datum/db_query/query_get_random_books = SSdbcore.NewQuery({"
|
||||||
var/datum/DBQuery/query_get_random_books = SSdbcore.NewQuery("SELECT * FROM [format_table_name("library")] WHERE isnull(deleted)[c] GROUP BY title ORDER BY rand() LIMIT [amount];") // isdeleted copyright (c) not me
|
SELECT author, title, content
|
||||||
|
FROM [format_table_name("library")]
|
||||||
|
WHERE isnull(deleted) AND (:category IS NULL OR category = :category)
|
||||||
|
ORDER BY rand() LIMIT :limit
|
||||||
|
"}, list("category" = category, "limit" = amount))
|
||||||
if(query_get_random_books.Execute())
|
if(query_get_random_books.Execute())
|
||||||
while(query_get_random_books.NextRow())
|
while(query_get_random_books.NextRow())
|
||||||
var/obj/item/book/B = new(location)
|
var/obj/item/book/B
|
||||||
. += B
|
B = existing_book ? existing_book : new(location)
|
||||||
B.author = query_get_random_books.item[2]
|
B.author = query_get_random_books.item[1]
|
||||||
B.title = query_get_random_books.item[3]
|
B.title = query_get_random_books.item[2]
|
||||||
B.dat = query_get_random_books.item[4]
|
B.dat = query_get_random_books.item[3]
|
||||||
B.name = "Book: [B.title]"
|
B.name = "Book: [B.title]"
|
||||||
B.icon_state= "book[rand(1,8)]"
|
if(!existing_book)
|
||||||
|
B.icon_state= "book[rand(1,8)]"
|
||||||
qdel(query_get_random_books)
|
qdel(query_get_random_books)
|
||||||
|
|
||||||
/obj/structure/bookcase/random/fiction
|
/obj/structure/bookcase/random/fiction
|
||||||
name = "bookcase (Fiction)"
|
name = "bookcase (Fiction)"
|
||||||
category = "Fiction"
|
random_category = "Fiction"
|
||||||
/obj/structure/bookcase/random/nonfiction
|
/obj/structure/bookcase/random/nonfiction
|
||||||
name = "bookcase (Non-Fiction)"
|
name = "bookcase (Non-Fiction)"
|
||||||
category = "Non-fiction"
|
random_category = "Non-fiction"
|
||||||
/obj/structure/bookcase/random/religion
|
/obj/structure/bookcase/random/religion
|
||||||
name = "bookcase (Religion)"
|
name = "bookcase (Religion)"
|
||||||
category = "Religion"
|
random_category = "Religion"
|
||||||
/obj/structure/bookcase/random/adult
|
/obj/structure/bookcase/random/adult
|
||||||
name = "bookcase (Adult)"
|
name = "bookcase (Adult)"
|
||||||
category = "Adult"
|
random_category = "Adult"
|
||||||
|
|
||||||
/obj/structure/bookcase/random/reference
|
/obj/structure/bookcase/random/reference
|
||||||
name = "bookcase (Reference)"
|
name = "bookcase (Reference)"
|
||||||
category = "Reference"
|
random_category = "Reference"
|
||||||
var/ref_book_prob = 20
|
var/ref_book_prob = 20
|
||||||
|
|
||||||
/obj/structure/bookcase/random/reference/Initialize(mapload)
|
/obj/structure/bookcase/random/reference/Initialize(mapload)
|
||||||
. = ..()
|
. = ..()
|
||||||
while(book_count > 0 && prob(ref_book_prob))
|
while(books_to_load > 0 && prob(ref_book_prob))
|
||||||
book_count--
|
books_to_load--
|
||||||
new /obj/item/book/manual/random(src)
|
new /obj/item/book/manual/random(src)
|
||||||
|
|||||||
Reference in New Issue
Block a user