From b39a89cfe7504eb66a53fa15e189df6467a07068 Mon Sep 17 00:00:00 2001 From: Novacat <35587478+Novacat@users.noreply.github.com> Date: Tue, 9 Mar 2021 17:21:28 -0500 Subject: [PATCH] Update new_newspaper.dm --- code/modules/news/new_newspaper.dm | 199 +++++++++++++++++++---------- 1 file changed, 130 insertions(+), 69 deletions(-) diff --git a/code/modules/news/new_newspaper.dm b/code/modules/news/new_newspaper.dm index 294ffa6d6d2..c9759a5a837 100644 --- a/code/modules/news/new_newspaper.dm +++ b/code/modules/news/new_newspaper.dm @@ -1,85 +1,146 @@ -//Version of the newspaper that uses the lobby-style news reports from one channel only. Currently unused. +//######################################################################################################################## +//###################################### NEWSPAPER! ###################################################################### +//######################################################################################################################## /obj/item/weapon/newspaper name = "newspaper" - desc = "This seems to be a generic, worn up newspaper." + desc = "An issue of The Griffon, the newspaper circulating aboard most stations." icon = 'icons/obj/bureaucracy.dmi' icon_state = "newspaper" w_class = ITEMSIZE_SMALL //Let's make it fit in trashbags! attack_verb = list("bapped") - - var/datum/feed_channel/news_source - var/current_news_page - + var/screen = 0 + var/pages = 0 + var/curr_page = 0 + var/list/datum/feed_channel/news_content = list() + var/datum/feed_message/important_message = null + var/scribble="" + var/scribble_page = null + drop_sound = 'sound/items/drop/wrapper.ogg' pickup_sound = 'sound/items/pickup/wrapper.ogg' - drop_sound = 'sound/items/drop/paper.ogg' -/obj/item/weapon/newspaper/Initialize() - . = ..() - if(!news_source && GLOB.news_data) - news_source = GLOB.news_data.station_newspaper +obj/item/weapon/newspaper/attack_self(mob/user) + if(ishuman(user)) + var/mob/living/carbon/human/human_user = user + var/dat + pages = 0 + switch(screen) + if(0) //Cover + dat+="
The Griffon
" + dat+="
[using_map.company_name]-standard newspaper, for use on [using_map.company_name]© Space Facilities

" + if(isemptylist(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(1) // 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(isemptylist(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(2) //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 + dat+="I'm sorry to break your immersion. This shit's bugged. Report this bug to Agouri, polyxenitopalidou@gmail.com" - if(news_source) - name = "[news_source.channel_name] [name]" - desc = "This is a newspaper that contains the articles of the [news_source.channel_name]." - - -/obj/item/weapon/newspaper/attack_self(mob/user) - var/dat - - if(!current_news_page) - if(news_source.messages) - current_news_page = news_source.messages.len - - if(!current_news_page || !news_source.messages) - dat += "No current available news on [news_source.channel_name]" + dat+="

[curr_page+1]
" + human_user << browse(dat, "window=newspaper_main;size=300x400") + onclose(human_user, "newspaper_main") else - dat += get_news_page(news_source, news_source.messages[current_news_page], current_news_page) - if(current_news_page > news_source.messages.len || (news_source.messages.len > 1) && !(current_news_page == 1)) - dat += "Previous Issue " - if(news_source.messages.len > current_news_page) - dat += "Next Issue" + to_chat(user, "The paper is full of intelligible symbols!") - dat += " (Page [current_news_page] out of [news_source.messages.len])" - - var/datum/browser/popup = new(usr, "News", "Latest News", 640, 600, src) - popup.set_content(jointext(dat,null)) - popup.open() - - -/obj/item/weapon/newspaper/Topic(href, href_list[]) +obj/item/weapon/newspaper/Topic(href, href_list) + var/mob/living/U = usr ..() + if((src in U.contents) || (istype(loc, /turf) && in_range(src, U))) + U.set_machine(src) + if(href_list["next_page"]) + if(curr_page == pages+1) + return //Don't need that at all, but anyway. + if(curr_page == pages) //We're at the middle, get to the end + screen = 2 + else + if(curr_page == 0) //We're at the start, get to the middle + screen = 1 + curr_page++ + playsound(src, "pageturn", 50, 1) - if(href_list["next_news"]) - var/datum/feed_channel/next_page = locate(href_list["nextpage"]) - if(!next_page) - return - if(!current_news_page) - return - if(!next_page.messages) - return + else if(href_list["prev_page"]) + if(curr_page == 0) + return + if(curr_page == 1) + screen = 0 - if(current_news_page == next_page.messages.len) - return + else + if(curr_page == pages+1) //we're at the end, let's go back to the middle. + screen = 1 + curr_page-- + playsound(src, "pageturn", 50, 1) + + if(istype(src.loc, /mob)) + attack_self(src.loc) + +obj/item/weapon/newspaper/attackby(obj/item/weapon/W as obj, mob/user) + if(istype(W, /obj/item/weapon/pen)) + if(scribble_page == curr_page) + to_chat(user, "There's already a scribble in this page... You wouldn't want to make things too cluttered, would you?") else - current_news_page++ - playsound(src.loc, "pageturn", 50, 1) - updateDialog() - attack_self(loc) - - - if(href_list["previous_news"]) - var/datum/feed_channel/prev_page = locate(href_list["prevpage"]) - if(!prev_page) - return - if(!current_news_page) - return - if(!prev_page.messages) - return - if(1 >= current_news_page) - return - else - current_news_page-- - playsound(src.loc, "pageturn", 50, 1) - updateDialog() - attack_self(loc) \ No newline at end of file + var/s = sanitize(input(user, "Write something", "Newspaper", "")) + s = sanitize(s) + if(!s) + return + if(!in_range(src, usr) && src.loc != usr) + return + scribble_page = curr_page + scribble = s + attack_self(user) + return