Merge pull request #11500 from VOREStation/upstream-merge-8209

[MIRROR] Prevents Pop-up for Already Seen Lore News
This commit is contained in:
Aronai Sieyes
2021-08-26 12:56:34 -04:00
committed by Chompstation Bot
parent 145f8172f4
commit 3aca93de9b
6 changed files with 31 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
/datum/category_item/player_setup_item/player_global/settings/load_preferences(var/savefile/S)
S["lastchangelog"] >> pref.lastchangelog
S["lastnews"] >> pref.lastnews
S["lastlorenews"] >> pref.lastlorenews
S["default_slot"] >> pref.default_slot
S["preferences"] >> pref.preferences_enabled
S["preferences_disabled"] >> pref.preferences_disabled
@@ -16,6 +17,7 @@
/datum/category_item/player_setup_item/player_global/settings/save_preferences(var/savefile/S)
S["lastchangelog"] << pref.lastchangelog
S["lastnews"] << pref.lastnews
S["lastlorenews"] << pref.lastlorenews
S["default_slot"] << pref.default_slot
S["preferences"] << pref.preferences_enabled
S["preferences_disabled"] << pref.preferences_disabled

View File

@@ -327,6 +327,13 @@ var/list/_client_preferences_by_type
var/datum/plane_holder/PH = preference_mob.plane_holder
PH.set_vis(VIS_STATUS, enabled)
/datum/client_preference/show_lore_news
description = "Lore News Popup"
key = "NEWS_POPUP"
enabled_by_default = TRUE
enabled_description = "Popup New On Login"
disabled_description = "Do Nothing"
/********************
* Staff Preferences *
********************/

View File

@@ -151,6 +151,7 @@ var/list/preferences_datums = list()
var/datum/browser/panel
var/lastnews // Hash of last seen lobby news content.
var/lastlorenews //ID of last seen lore news article.
var/examine_text_mode = 0 // Just examine text, include usage (description_info), switch to examine panel.
var/multilingual_mode = 0 // Default behaviour, delimiter-key-space, delimiter-key-delimiter, off

View File

@@ -112,6 +112,12 @@
/datum/lore/codex/page/about_news,
)
var/newsindex
/datum/lore/codex/category/main_news/New()
..()
newsindex = LAZYLEN(children)
/datum/lore/codex/page/about_news
name = "About the Publisher"
data = "The <i>Daedalus Pocket Newscaster</i> is produced and maintained by Occulum Broadcast, the foremost authority on media distribution \

View File

@@ -76,12 +76,20 @@
output += "<p>[href(src, list("give_feedback" = 1), "Give Feedback")]</p>"
if(GLOB.news_data.station_newspaper)
output += "<a href='byond://?src=\ref[src];open_station_news=1'>Show [using_map.station_name] News</A>"
if(client.prefs.lastlorenews == GLOB.news_data.newsindex)
output += "<p><a href='byond://?src=\ref[src];open_station_news=1'>Show [using_map.station_name] News</A></p>"
else
output += "<p><b><a href='byond://?src=\ref[src];open_station_news=1'>Show [using_map.station_name] News (NEW!)</A></b></p>"
output += "</div>"
if(GLOB.news_data.station_newspaper && !client.seen_news)
if (client.prefs.lastlorenews == GLOB.news_data.newsindex)
client.seen_news = 1
if(GLOB.news_data.station_newspaper && !client.seen_news && client.is_preference_enabled(/datum/client_preference/show_lore_news))
show_latest_news(GLOB.news_data.station_newspaper)
client.prefs.lastlorenews = GLOB.news_data.newsindex
SScharacter_setup.queue_preferences_save(client.prefs)
panel = new(src, "Welcome","Welcome", 210, 300, src) // VOREStation Edit
panel.set_window_options("can_close=0")

View File

@@ -7,6 +7,7 @@ GLOBAL_DATUM_INIT(news_data, /datum/lore/news, new)
/datum/lore/news
var/datum/feed_channel/station_newspaper
var/datum/lore/codex/category/main_news/news_codex = new()
var/newsindex
/datum/lore/news/New()
..()
@@ -17,6 +18,10 @@ GLOBAL_DATUM_INIT(news_data, /datum/lore/news, new)
break
spawn(300) // Yes, again.
fill_codex_news()
if (!news_codex.newsindex)
return
else
newsindex = news_codex.newsindex
/datum/lore/news/proc/fill_codex_news()
if(!news_network)