mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 16:14:08 +01:00
21b4095dfd
Upstream 04/17/2026 fixes https://github.com/Bubberstation/Bubberstation/issues/5549 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tgstation-ci[bot] <179393467+tgstation-ci[bot]@users.noreply.github.com> Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> Co-authored-by: rageguy505 <54517726+rageguy505@users.noreply.github.com> Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Aliceee2ch <160794176+Aliceee2ch@users.noreply.github.com> Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com> Co-authored-by: Tsar-Salat <62388554+Tsar-Salat@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Maxipat <108554989+Maxipat112@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com> Co-authored-by: SimplyLogan <47579821+loganuk@users.noreply.github.com> Co-authored-by: loganuk <fakeemail123@aol.com> Co-authored-by: Leland Kemble <70413276+lelandkemble@users.noreply.github.com> Co-authored-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com> Co-authored-by: Roxy <75404941+TealSeer@users.noreply.github.com> Co-authored-by: Lucy <lucy@absolucy.moe> Co-authored-by: siliconOpossum <138069572+siliconOpossum@users.noreply.github.com> Co-authored-by: Isratosh <Isratosh@hotmail.com> Co-authored-by: TheRyeGuyWhoWillNowDie <70169560+TheRyeGuyWhoWillNowDie@users.noreply.github.com> Co-authored-by: Neocloudy <88008002+Neocloudy@users.noreply.github.com> Co-authored-by: Alexander V. <volas@ya.ru> Co-authored-by: ElGitificador <168473461+ElGitificador@users.noreply.github.com> Co-authored-by: Twaticus <46540570+Twaticus@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: Layzu666 <121319428+Layzu666@users.noreply.github.com> Co-authored-by: Arturlang <24881678+Arturlang@users.noreply.github.com> Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com> Co-authored-by: mrmanlikesbt <99309552+mrmanlikesbt@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: John F. Kennedy <54908920+MacaroniCritter@users.noreply.github.com> Co-authored-by: Cursor <102828457+theselfish@users.noreply.github.com> Co-authored-by: Josh <josh.adam.powell@gmail.com> Co-authored-by: Josh Powell <josh.powell@softwire.com> Co-authored-by: Yobrocharlie <Charliemiller5617@gmail.com> Co-authored-by: Hardly3D <66234359+Hardly3D@users.noreply.github.com> Co-authored-by: shayoki <96078776+shayoki@users.noreply.github.com> Co-authored-by: LT3 <83487515+lessthnthree@users.noreply.github.com>
69 lines
2.8 KiB
Plaintext
69 lines
2.8 KiB
Plaintext
/// Manages library data, loading bookselves, etc
|
|
SUBSYSTEM_DEF(library)
|
|
name = "Library Loading"
|
|
dependencies = list(
|
|
/datum/controller/subsystem/atoms,
|
|
/datum/controller/subsystem/mapping,
|
|
)
|
|
ss_flags = SS_NO_FIRE
|
|
|
|
/// List of bookselves to prefill with books
|
|
var/list/shelves_to_load = list()
|
|
/// List of book datums that we consider to be "in" any one area.
|
|
var/list/books_by_area = list()
|
|
|
|
/// List of acceptable search categories for book consoles
|
|
var/list/search_categories = list("Any", "Fiction", "Non-Fiction", "Adult", "Reference", "Religion")
|
|
/// List of acceptable categories for a book to be
|
|
var/list/upload_categories = list("Fiction", "Non-Fiction", "Adult", "Reference", "Religion")
|
|
|
|
/// List of poster typepaths we're ok with being printable
|
|
var/list/printable_posters = list()
|
|
/// List of areas that count as "a library", modified by map config
|
|
var/list/library_areas = list()
|
|
|
|
/datum/controller/subsystem/library/Initialize()
|
|
prepare_official_posters()
|
|
prepare_library_areas()
|
|
load_shelves()
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/library/proc/load_shelves()
|
|
var/list/datum/callback/load_callbacks = list()
|
|
|
|
for(var/obj/structure/bookcase/case_to_load as anything in shelves_to_load)
|
|
if(!case_to_load)
|
|
stack_trace("A null bookcase somehow ended up in SSlibrary's shelves_to_load list. Did something harddel?")
|
|
continue
|
|
load_callbacks += CALLBACK(case_to_load, TYPE_PROC_REF(/obj/structure/bookcase, load_shelf))
|
|
shelves_to_load = null
|
|
|
|
//Load all of the shelves asyncronously at the same time, blocking until the last one is finished.
|
|
callback_select(load_callbacks, savereturns = FALSE)
|
|
|
|
/// Returns a list of copied book datums that we consider to be "in" the passed in area at roundstart
|
|
/datum/controller/subsystem/library/proc/get_area_books(area/book_parent)
|
|
var/list/areas = list(book_parent.type)
|
|
// If we have an area that's in the global libraries list, we want all the others too
|
|
if(length(areas & library_areas))
|
|
areas |= library_areas
|
|
|
|
var/list/books = list()
|
|
for(var/area_type in areas)
|
|
for(var/datum/book_info/info in books_by_area[area_type])
|
|
books += info.return_copy()
|
|
|
|
return books
|
|
|
|
/datum/controller/subsystem/library/proc/prepare_official_posters()
|
|
printable_posters = list()
|
|
for(var/obj/structure/sign/poster/official/poster_type as anything in subtypesof(/obj/structure/sign/poster/official))
|
|
if (initial(poster_type.pixel_x) == 0 && initial(poster_type.pixel_y) == 0) //Anything with an initial pixel offset is a directional subtype, keep it out the list
|
|
printable_posters[initial(poster_type.name)] = poster_type
|
|
|
|
/datum/controller/subsystem/library/proc/prepare_library_areas()
|
|
library_areas = typesof(/area/station/service/library) - /area/station/service/library/abandoned
|
|
var/list/additional_areas = SSmapping.current_map.library_areas
|
|
if(additional_areas)
|
|
library_areas += additional_areas
|