diff --git a/code/game/objects/items/manuals.dm b/code/game/objects/items/manuals.dm index 9d8cd8e9426..e89391f7887 100644 --- a/code/game/objects/items/manuals.dm +++ b/code/game/objects/items/manuals.dm @@ -232,228 +232,3 @@ Good luck! "} - -// Wiki books that are linked to the configured wiki link. - -// A book that links to the wiki -/obj/item/book/manual/wiki - var/page_link = "" - window_size = "970x710" - -/obj/item/book/manual/wiki/attack_self() - if(!book_data.content) - initialize_wikibook() - return ..() - -/obj/item/book/manual/wiki/proc/initialize_wikibook() - var/wikiurl = CONFIG_GET(string/wikiurl) - if(wikiurl) - var/wikiinfo = {" - - - - - - - - -

You start skimming through the manual...

- - - - - - "} - book_data.set_content(wikiinfo, trusted = TRUE) - -/obj/item/book/manual/wiki/chemistry - name = "Chemistry Textbook" - icon_state ="chemistrybook" - starting_author = "Nanotrasen" - starting_title = "Chemistry Textbook" - page_link = "Guide_to_chemistry" - -/obj/item/book/manual/wiki/engineering_construction - name = "Station Repairs and Construction" - icon_state ="bookEngineering" - starting_author = "Engineering Encyclopedia" - starting_title = "Station Repairs and Construction" - page_link = "Guide_to_construction" - -/obj/item/book/manual/wiki/engineering_guide - name = "Engineering Textbook" - icon_state ="bookEngineering2" - starting_author = "Engineering Encyclopedia" - starting_title = "Engineering Textbook" - page_link = "Guide_to_engineering" - -/obj/item/book/manual/wiki/security_space_law - name = "Corporate Regulations" //SKYRAT EDIT CHANGE - Original: "Space Law" - desc = "A set of Nanotrasen regulations for keeping law, order, and procedure followed within their space stations." //SKYRAT EDIT CHANGE - Original: "A set of Nanotrasen guidelines for keeping law and order on their space stations." - icon_state = "bookSpaceLaw" - starting_author = "Nanotrasen" - starting_title = "Corporate Regulations" //SKYRAT EDIT CHANGE - Original: "Space Law" - page_link = "Corporate_Regulations" //SKYRAT EDIT CHANGE - Original: "Space_Law" - -/obj/item/book/manual/wiki/security_space_law/suicide_act(mob/living/user) - user.visible_message(span_suicide("[user] pretends to read \the [src] intently... then promptly dies of laughter!")) - return OXYLOSS - -/obj/item/book/manual/wiki/infections - name = "Infections - Making your own pandemic!" - icon_state = "bookInfections" - starting_author = "Infections Encyclopedia" - starting_title = "Infections - Making your own pandemic!" - page_link = "Infections" - -/obj/item/book/manual/wiki/telescience - name = "Teleportation Science - Bluespace for dummies!" - icon_state = "book7" - starting_author = "University of Bluespace" - starting_title = "Teleportation Science - Bluespace for dummies!" - page_link = "Guide_to_telescience" - -/obj/item/book/manual/wiki/engineering_hacking - name = "Hacking" - icon_state ="bookHacking" - starting_author = "Engineering Encyclopedia" - starting_title = "Hacking" - page_link = "Hacking" - -/obj/item/book/manual/wiki/detective - name = "The Film Noir: Proper Procedures for Investigations" - icon_state ="bookDetective" - starting_author = "Nanotrasen" - starting_title = "The Film Noir: Proper Procedures for Investigations" - page_link = "Detective" - -/obj/item/book/manual/wiki/barman_recipes - name = "Barman Recipes: Mixing Drinks and Changing Lives" - icon_state = "barbook" - starting_author = "Sir John Rose" - starting_title = "Barman Recipes: Mixing Drinks and Changing Lives" - page_link = "Guide_to_drinks" - -/obj/item/book/manual/wiki/robotics_cyborgs - name = "Robotics for Dummies" - icon_state = "borgbook" - starting_author = "XISC" - starting_title = "Robotics for Dummies" - page_link = "Guide_to_robotics" - -/obj/item/book/manual/wiki/research_and_development - name = "Research and Development 101" - icon_state = "rdbook" - starting_author = "Dr. L. Ight" - starting_title = "Research and Development 101" - page_link = "Guide_to_Research_and_Development" - -/obj/item/book/manual/wiki/experimentor - name = "Mentoring your Experiments" - icon_state = "rdbook" - starting_author = "Dr. H.P. Kritz" - starting_title = "Mentoring your Experiments" - page_link = "Experimentor" - -/obj/item/book/manual/wiki/cooking_to_serve_man - name = "To Serve Man" - desc = "It's a cookbook!" - icon_state ="cooked_book" - starting_author = "the Kanamitan Empire" - starting_title = "To Serve Man" - page_link = "Guide_to_food" - -/obj/item/book/manual/wiki/tcomms - name = "Subspace Telecommunications And You" - icon_state = "book3" - starting_author = "Engineering Encyclopedia" - starting_title = "Subspace Telecommunications And You" - page_link = "Guide_to_Telecommunications" - -/obj/item/book/manual/wiki/atmospherics - name = "Lexica Atmosia" - icon_state = "book5" - starting_author = "the City-state of Atmosia" - starting_title = "Lexica Atmosia" - page_link = "Guide_to_Atmospherics" - -/obj/item/book/manual/wiki/medicine - name = "Medical Space Compendium, Volume 638" - icon_state = "book8" - starting_author = "Medical Journal" - starting_title = "Medical Space Compendium, Volume 638" - page_link = "Guide_to_medicine" - -/obj/item/book/manual/wiki/surgery - name = "Brain Surgery for Dummies" - icon_state = "book4" - starting_author = "Dr. F. Fran" - starting_title = "Brain Surgery for Dummies" - page_link = "Surgery" - -/obj/item/book/manual/wiki/grenades - name = "DIY Chemical Grenades" - icon_state = "book2" - starting_author = "W. Powell" - starting_title = "DIY Chemical Grenades" - page_link = "Grenade" - -/obj/item/book/manual/wiki/ordnance - name = "Ordnance for Dummies or: How I Learned to Stop Worrying and Love the Maxcap" - icon_state = "book6" - starting_author = "Cuban Pete" - starting_title = "Ordnance for Dummies or: How I Learned to Stop Worrying and Love the Maxcap" - page_link = "Guide_to_toxins" - -/obj/item/book/manual/wiki/ordnance/suicide_act(mob/living/user) - var/mob/living/carbon/human/H = user - user.visible_message(span_suicide("[user] starts dancing to the Rhumba Beat! It looks like [user.p_theyre()] trying to commit suicide!")) - playsound(loc, 'sound/effects/spray.ogg', 10, TRUE, -3) - if (!QDELETED(H)) - H.emote("spin") - sleep(2 SECONDS) - for(var/obj/item/W in H) - H.dropItemToGround(W) - if(prob(50)) - step(W, pick(GLOB.alldirs)) - ADD_TRAIT(H, TRAIT_DISFIGURED, TRAIT_GENERIC) - for(var/obj/item/bodypart/part as anything in H.bodyparts) - part.adjustBleedStacks(5) - H.gib_animation() - sleep(0.3 SECONDS) - H.adjustBruteLoss(1000) //to make the body super-bloody - // if we use gib() then the body gets deleted - H.spawn_gibs() - H.spill_organs(DROP_ALL_REMAINS) - H.spread_bodyparts(DROP_BRAIN) - return BRUTELOSS - -/obj/item/book/manual/wiki/plumbing - name = "Chemical Factories Without Narcotics" - icon_state ="plumbingbook" - starting_author = "Nanotrasen" - starting_title = "Chemical Factories Without Narcotics" - page_link = "Guide_to_plumbing" - -/obj/item/book/manual/wiki/cytology - name = "Unethically Grown Organics" - icon_state ="cytologybook" - starting_author = "Kryson" - starting_title = "Unethically Grown Organics" - page_link = "Guide_to_cytology" - -/obj/item/book/manual/wiki/tgc - name = "Tactical Game Cards - Player's Handbook" - icon_state = "tgcbook" - starting_author = "Nanotrasen Edu-tainment Division" - starting_title = "Tactical Game Cards - Player's Handbook" - page_link = "Tactical_Game_Cards" diff --git a/code/game/objects/items/wiki_manuals.dm b/code/game/objects/items/wiki_manuals.dm new file mode 100644 index 00000000000..7209d76cc57 --- /dev/null +++ b/code/game/objects/items/wiki_manuals.dm @@ -0,0 +1,228 @@ +// Wiki books that are linked to the configured wiki link. + +/// The size of the window that the wiki books open in. +#define BOOK_WINDOW_BROWSE_SIZE "970x710" +/// This macro will resolve to code that will open up the associated wiki page in the window. +#define WIKI_PAGE_IFRAME(wikiurl, link_identifier) {" + + + + + + + +

You start skimming through the manual...

+ + + + "} + +// A book that links to the wiki +/obj/item/book/manual/wiki + starting_content = "Nanotrasen presently does not have any resources on this topic. If you would like to know more, contact your local Central Command representative." // safety + /// The ending URL of the page that we link to. + var/page_link = "" + +/obj/item/book/manual/wiki/display_content(mob/living/user) + var/wiki_url = CONFIG_GET(string/wikiurl) + if(!wiki_url) + user.balloon_alert(user, "this book is empty!") + return + + credit_book_to_reader(user) + DIRECT_OUTPUT(user, browse(WIKI_PAGE_IFRAME(wiki_url, page_link), "window=manual;size=[BOOK_WINDOW_BROWSE_SIZE]")) // if you change this GUARANTEE that it works. + +/obj/item/book/manual/wiki/chemistry + name = "Chemistry Textbook" + icon_state ="chemistrybook" + starting_author = "Nanotrasen" + starting_title = "Chemistry Textbook" + page_link = "Guide_to_chemistry" + +/obj/item/book/manual/wiki/engineering_construction + name = "Station Repairs and Construction" + icon_state ="bookEngineering" + starting_author = "Engineering Encyclopedia" + starting_title = "Station Repairs and Construction" + page_link = "Guide_to_construction" + +/obj/item/book/manual/wiki/engineering_guide + name = "Engineering Textbook" + icon_state ="bookEngineering2" + starting_author = "Engineering Encyclopedia" + starting_title = "Engineering Textbook" + page_link = "Guide_to_engineering" + +/obj/item/book/manual/wiki/security_space_law + name = "Space Law" + desc = "A set of Nanotrasen guidelines for keeping law and order on their space stations." + icon_state = "bookSpaceLaw" + starting_author = "Nanotrasen" + starting_title = "Space Law" + page_link = "Space_Law" + +/obj/item/book/manual/wiki/security_space_law/suicide_act(mob/living/user) + user.visible_message(span_suicide("[user] pretends to read \the [src] intently... then promptly dies of laughter!")) + return OXYLOSS + +/obj/item/book/manual/wiki/infections + name = "Infections - Making your own pandemic!" + icon_state = "bookInfections" + starting_author = "Infections Encyclopedia" + starting_title = "Infections - Making your own pandemic!" + page_link = "Infections" + +/obj/item/book/manual/wiki/telescience + name = "Teleportation Science - Bluespace for dummies!" + icon_state = "book7" + starting_author = "University of Bluespace" + starting_title = "Teleportation Science - Bluespace for dummies!" + page_link = "Guide_to_telescience" + +/obj/item/book/manual/wiki/engineering_hacking + name = "Hacking" + icon_state ="bookHacking" + starting_author = "Engineering Encyclopedia" + starting_title = "Hacking" + page_link = "Hacking" + +/obj/item/book/manual/wiki/detective + name = "The Film Noir: Proper Procedures for Investigations" + icon_state ="bookDetective" + starting_author = "Nanotrasen" + starting_title = "The Film Noir: Proper Procedures for Investigations" + page_link = "Detective" + +/obj/item/book/manual/wiki/barman_recipes + name = "Barman Recipes: Mixing Drinks and Changing Lives" + icon_state = "barbook" + starting_author = "Sir John Rose" + starting_title = "Barman Recipes: Mixing Drinks and Changing Lives" + page_link = "Guide_to_drinks" + +/obj/item/book/manual/wiki/robotics_cyborgs + name = "Robotics for Dummies" + icon_state = "borgbook" + starting_author = "XISC" + starting_title = "Robotics for Dummies" + page_link = "Guide_to_robotics" + +/obj/item/book/manual/wiki/research_and_development + name = "Research and Development 101" + icon_state = "rdbook" + starting_author = "Dr. L. Ight" + starting_title = "Research and Development 101" + page_link = "Guide_to_Research_and_Development" + +/obj/item/book/manual/wiki/experimentor + name = "Mentoring your Experiments" + icon_state = "rdbook" + starting_author = "Dr. H.P. Kritz" + starting_title = "Mentoring your Experiments" + page_link = "Experimentor" + +/obj/item/book/manual/wiki/cooking_to_serve_man + name = "To Serve Man" + desc = "It's a cookbook!" + icon_state ="cooked_book" + starting_author = "the Kanamitan Empire" + starting_title = "To Serve Man" + page_link = "Guide_to_food" + +/obj/item/book/manual/wiki/tcomms + name = "Subspace Telecommunications And You" + icon_state = "book3" + starting_author = "Engineering Encyclopedia" + starting_title = "Subspace Telecommunications And You" + page_link = "Guide_to_Telecommunications" + +/obj/item/book/manual/wiki/atmospherics + name = "Lexica Atmosia" + icon_state = "book5" + starting_author = "the City-state of Atmosia" + starting_title = "Lexica Atmosia" + page_link = "Guide_to_Atmospherics" + +/obj/item/book/manual/wiki/medicine + name = "Medical Space Compendium, Volume 638" + icon_state = "book8" + starting_author = "Medical Journal" + starting_title = "Medical Space Compendium, Volume 638" + page_link = "Guide_to_medicine" + +/obj/item/book/manual/wiki/surgery + name = "Brain Surgery for Dummies" + icon_state = "book4" + starting_author = "Dr. F. Fran" + starting_title = "Brain Surgery for Dummies" + page_link = "Surgery" + +/obj/item/book/manual/wiki/grenades + name = "DIY Chemical Grenades" + icon_state = "book2" + starting_author = "W. Powell" + starting_title = "DIY Chemical Grenades" + page_link = "Grenade" + +/obj/item/book/manual/wiki/ordnance + name = "Ordnance for Dummies or: How I Learned to Stop Worrying and Love the Maxcap" + icon_state = "book6" + starting_author = "Cuban Pete" + starting_title = "Ordnance for Dummies or: How I Learned to Stop Worrying and Love the Maxcap" + page_link = "Guide_to_toxins" + +/obj/item/book/manual/wiki/ordnance/suicide_act(mob/living/user) + var/mob/living/carbon/human/H = user + user.visible_message(span_suicide("[user] starts dancing to the Rhumba Beat! It looks like [user.p_theyre()] trying to commit suicide!")) + playsound(loc, 'sound/effects/spray.ogg', 10, TRUE, -3) + if (!QDELETED(H)) + H.emote("spin") + sleep(2 SECONDS) + for(var/obj/item/W in H) + H.dropItemToGround(W) + if(prob(50)) + step(W, pick(GLOB.alldirs)) + ADD_TRAIT(H, TRAIT_DISFIGURED, TRAIT_GENERIC) + for(var/obj/item/bodypart/part as anything in H.bodyparts) + part.adjustBleedStacks(5) + H.gib_animation() + sleep(0.3 SECONDS) + H.adjustBruteLoss(1000) //to make the body super-bloody + // if we use gib() then the body gets deleted + H.spawn_gibs() + H.spill_organs(DROP_ALL_REMAINS) + H.spread_bodyparts(DROP_BRAIN) + return BRUTELOSS + +/obj/item/book/manual/wiki/plumbing + name = "Chemical Factories Without Narcotics" + icon_state ="plumbingbook" + starting_author = "Nanotrasen" + starting_title = "Chemical Factories Without Narcotics" + page_link = "Guide_to_plumbing" + +/obj/item/book/manual/wiki/cytology + name = "Unethically Grown Organics" + icon_state ="cytologybook" + starting_author = "Kryson" + starting_title = "Unethically Grown Organics" + page_link = "Guide_to_cytology" + +/obj/item/book/manual/wiki/tgc + name = "Tactical Game Cards - Player's Handbook" + icon_state = "tgcbook" + starting_author = "Nanotrasen Edu-tainment Division" + starting_title = "Tactical Game Cards - Player's Handbook" + page_link = "Tactical_Game_Cards" + +#undef BOOK_WINDOW_BROWSE_SIZE +#undef WIKI_PAGE_IFRAME diff --git a/code/modules/library/book.dm b/code/modules/library/book.dm index e706872c710..19b65f82489 100644 --- a/code/modules/library/book.dm +++ b/code/modules/library/book.dm @@ -21,8 +21,6 @@ /// whether or not we have been carved out var/carved = FALSE - /// Specific window size for the book, i.e: "1920x1080", Size x Width - var/window_size = null /// The initial title, for use in var editing and such var/starting_title /// The initial author, for use in var editing and such @@ -51,35 +49,53 @@ return data /obj/item/book/ui_interact(mob/living/user, datum/tgui/ui) - if(carved) - balloon_alert(user, "book is carved out!") - return - if(!length(book_data.get_content())) - balloon_alert(user, "book is blank!") - return - - if(istype(user) && !isnull(user.mind)) - LAZYINITLIST(user.mind.book_titles_read) - var/has_not_read_book = !(starting_title in user.mind.book_titles_read) - if(has_not_read_book) - user.add_mood_event("book_nerd", /datum/mood_event/book_nerd) - user.mind.book_titles_read[starting_title] = TRUE - ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "MarkdownViewer", name) ui.open() -/obj/item/book/attack_self(mob/user) +/// Proc that handles sending the book information to the user, as well as some housekeeping stuff. +/obj/item/book/proc/display_content(mob/living/user) + credit_book_to_reader(user) + ui_interact(user) + +/// Proc that checks if the user is capable of reading the book, for UI interactions and otherwise. Returns TRUE if they can, FALSE if they can't. +/obj/item/book/proc/can_read_book(mob/living/user) if(user.is_blind()) to_chat(user, span_warning("You are blind and can't read anything!")) - return + return FALSE if(!user.can_read(src)) + return FALSE + + if(carved) + balloon_alert(user, "book is carved out!") + return FALSE + + if(!length(book_data.get_content())) + balloon_alert(user, "book is blank!") + return FALSE + + return TRUE + +/// Proc that adds the book to a list on the user's mind so we know what works of art they've been catching up on. +/obj/item/book/proc/credit_book_to_reader(mob/living/user) + if(!isliving(user) || isnull(user.mind)) + return + + LAZYINITLIST(user.mind.book_titles_read) + if(starting_title in user.mind.book_titles_read) + return + + user.add_mood_event("book_nerd", /datum/mood_event/book_nerd) + user.mind.book_titles_read[starting_title] = TRUE + +/obj/item/book/attack_self(mob/user) + if(!can_read_book(user)) return user.visible_message(span_notice("[user] opens a book titled \"[book_data.title]\" and begins reading intently.")) - ui_interact(user) + display_content(user) /obj/item/book/attackby(obj/item/attacking_item, mob/living/user, params) if(burn_paper_product_attackby_check(attacking_item, user)) diff --git a/modular_skyrat/master_files/code/game/objects/items/wiki_manuals.dm b/modular_skyrat/master_files/code/game/objects/items/wiki_manuals.dm new file mode 100644 index 00000000000..97d31062593 --- /dev/null +++ b/modular_skyrat/master_files/code/game/objects/items/wiki_manuals.dm @@ -0,0 +1,5 @@ +/obj/item/book/manual/wiki/security_space_law + name = "Corporate Regulations" + desc = "A set of Nanotrasen regulations for keeping law, order, and procedure followed within their space stations." + starting_title = "Corporate Regulations" + page_link = "Corporate_Regulations" diff --git a/tgstation.dme b/tgstation.dme index 440bff325f9..293fa576945 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2317,6 +2317,7 @@ #include "code\game\objects\items\virgin_mary.dm" #include "code\game\objects\items\wall_mounted.dm" #include "code\game\objects\items\weaponry.dm" +#include "code\game\objects\items\wiki_manuals.dm" #include "code\game\objects\items\AI_modules\_AI_modules.dm" #include "code\game\objects\items\AI_modules\freeform.dm" #include "code\game\objects\items\AI_modules\full_lawsets.dm" @@ -6077,6 +6078,7 @@ #include "modular_skyrat\master_files\code\game\objects\items\RCD.dm" #include "modular_skyrat\master_files\code\game\objects\items\religion.dm" #include "modular_skyrat\master_files\code\game\objects\items\scratchingstone.dm" +#include "modular_skyrat\master_files\code\game\objects\items\wiki_manuals.dm" #include "modular_skyrat\master_files\code\game\objects\items\devices\anomaly_neutralizer.dm" #include "modular_skyrat\master_files\code\game\objects\items\stacks\sheets\sheet_types.dm" #include "modular_skyrat\master_files\code\game\objects\items\storage\backpack.dm"