mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
[MIRROR] Fixes Wiki Book Manuals not working [MDB IGNORE] (#24870)
* Fixes Wiki Book Manuals not working * Fixing diffs --------- Co-authored-by: san7890 <the@san7890.com> Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user