#define SCREEN_COVER 0 #define SCREEN_PAGE_INNER 1 #define SCREEN_PAGE_LAST 2 /** * # Newspaper * * A newspaper displaying the stories of all channels contained within. */ /obj/item/newspaper name = "newspaper" desc = "An issue of The Griffon, the newspaper circulating aboard Nanotrasen Space Stations." icon = 'icons/obj/bureaucracy.dmi' icon_state = "newspaper" inhand_icon_state = "newspaper" w_class = WEIGHT_CLASS_SMALL attack_verb = list("bapped") /// The current screen to display. var/screen = 0 /// The number of pages. var/pages = 0 /// The currently selected page. var/curr_page = 0 /// The channels to display as content. var/list/datum/feed_channel/news_content /// The security notice to display optionally. var/datum/feed_message/important_message = null /// The contents of a scribble made through pen, if any. var/scribble = "" /// The page of said scribble. var/scribble_page = null /// Whether the newspaper is rolled or not, making it a deadly weapon. var/rolled = FALSE /obj/item/newspaper/Initialize(mapload) . = ..() if(!news_content) news_content = list() /obj/item/newspaper/attack_self__legacy__attackchain(mob/user) if(rolled) to_chat(user, SPAN_WARNING("Unroll it first!")) return if(ishuman(user)) var/mob/living/carbon/human/human_user = user var/dat = {""} pages = 0 switch(screen) if(SCREEN_COVER) //Cover dat += "
The Griffon
" dat += "
Nanotrasen-standard newspaper, for use on Nanotrasen Space Facilities

" if(!length(news_content)) if(important_message) dat += "Contents:
" else dat += "Other than the title, the rest of the newspaper is unprinted..." else dat += "Contents:
" if(scribble_page==curr_page) dat += "
There is a small scribble near the end of this page... It reads: \"[scribble]\"" dat+= "
Next Page
Done reading
" if(SCREEN_PAGE_INNER) // X channel pages inbetween. for(var/datum/feed_channel/NP in news_content) pages++ //Let's get it right again. var/datum/feed_channel/C = news_content[curr_page] dat += "[C.channel_name] \[created by: [C.author]\]

" if(C.censored) dat += "This channel was deemed dangerous to the general welfare of the station and therefore marked with a D-Notice. Its contents were not transferred to the newspaper at the time of printing." else if(!length(C.messages)) dat += "No Feed stories stem from this channel..." else dat += "" if(scribble_page==curr_page) dat += "
There is a small scribble near the end of this page... It reads: \"[scribble]\"" dat+= "

Previous Page
Next Page
" if(SCREEN_PAGE_LAST) //Last page for(var/datum/feed_channel/NP in news_content) pages++ if(important_message!=null) dat += "
Wanted Issue:


" dat += "Criminal name: [important_message.author]
" dat += "Description: [important_message.body]
" dat += "Photo:: " if(important_message.img) user << browse_rsc(important_message.img, "tmp_photow.png") dat += "
" else dat += "None" else dat += "Apart from some uninteresting Classified ads, there's nothing on this page..." if(scribble_page==curr_page) dat += "
There is a small scribble near the end of this page... It reads: \"[scribble]\"" dat+= "
Previous Page
" else // No trailing punctuation so that it's easy to copy and paste the address if(GLOB.configuration.url.github_url) dat += "We're sorry to break your immersion, but there has been an error with the newscaster. Please report this error, along with any more information you have, to [GLOB.configuration.url.github_url]/issues/new?template=bug_report.md" else dat += "We're sorry to break your immersion, but there has been an error with the newscaster. Unfortunately there is no GitHub URL set in the config. This is really bad." dat += "

[curr_page+1]
" human_user << browse(dat, "window=newspaper_main;size=300x400") onclose(human_user, "newspaper_main") else to_chat(user, SPAN_WARNING("The paper is full of unintelligible symbols!")) /obj/item/newspaper/Topic(href, href_list) if(..()) return var/mob/living/M = usr if(!Adjacent(M)) return if(href_list["next_page"]) if(curr_page == pages + 1) return //Don't need that at all, but anyway. else if(curr_page == pages) //We're at the middle, get to the end screen = SCREEN_PAGE_LAST else if(curr_page == 0) //We're at the start, get to the middle screen = SCREEN_PAGE_INNER curr_page++ playsound(loc, "pageturn", 50, TRUE) else if(href_list["prev_page"]) if(curr_page == 0) return else if(curr_page == 1) screen = SCREEN_COVER else if(curr_page == pages + 1) //we're at the end, let's go back to the middle. screen = SCREEN_PAGE_INNER curr_page-- playsound(loc, "pageturn", 50, TRUE) if(loc == M) attack_self__legacy__attackchain(M) /obj/item/newspaper/attackby__legacy__attackchain(obj/item/W, mob/user, params) if(is_pen(W)) if(rolled) to_chat(user, SPAN_WARNING("Unroll it first!")) return if(scribble_page == curr_page) to_chat(user, SPAN_NOTICE("There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?")) else var/s = tgui_input_text(user, "Write something", "Newspaper") if(!s || !Adjacent(user)) return scribble_page = curr_page scribble = s user.visible_message(SPAN_NOTICE("[user] scribbles something on [src]."),\ SPAN_NOTICE("You scribble on page number [curr_page] of [src].")) attack_self__legacy__attackchain(user) return return ..() /obj/item/newspaper/AltClick(mob/user) if(ishuman(user) && Adjacent(user) && !user.incapacitated()) rolled = !rolled icon_state = "newspaper[rolled ? "_rolled" : ""]" update_icon() var/verbtext = "[rolled ? "" : "un"]roll" user.visible_message(SPAN_NOTICE("[user] [verbtext]s [src]."),\ SPAN_NOTICE("You [verbtext] [src].")) name = "[rolled ? "rolled" : ""] [initial(name)]" return ..() #undef SCREEN_COVER #undef SCREEN_PAGE_INNER #undef SCREEN_PAGE_LAST