mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 13:38:41 +01:00
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
SUBSYSTEM_DEF(lorecaster)
|
|
name = "Lorecaster"
|
|
wait = 30 MINUTES
|
|
/// List of all stories, that have run or not
|
|
var/list/all_stories
|
|
/// List of stories yet to have been run
|
|
var/list/stories
|
|
|
|
/datum/controller/subsystem/lorecaster/Initialize()
|
|
GLOB.news_network.create_feed_channel("Nanotrasen News Network", "NNN", "Get the latest stories from the frontier, here! For the not-quite-latest stories, download the \"News Archive\" app to any NTOS-based device today!", locked = TRUE)
|
|
var/config_delay = CONFIG_GET(number/lorecaster_delay)
|
|
if(config_delay)
|
|
wait = config_delay
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/lorecaster/fire(resumed)
|
|
if(!fexists(NEWS_FILE))
|
|
can_fire = FALSE
|
|
return
|
|
|
|
if(!length(all_stories)) // Ran out of stories? Run through 'em again
|
|
all_stories = json_load(NEWS_FILE)
|
|
|
|
if(!length(stories))
|
|
stories = all_stories.Copy()
|
|
return // But skip the cycle this time
|
|
|
|
var/picked_story = pick(stories)
|
|
var/text = stories[picked_story]["text"]
|
|
var/title = stories[picked_story]["title"]
|
|
text += "\n\nOriginally published on: [stories[picked_story]["month"]]/[stories[picked_story]["day"]]/[stories[picked_story]["year"]]"
|
|
GLOB.news_network.submit_article(text || "Someone forgot to fill out the article!", title || "Nanotrasen News Broadcast", "Nanotrasen News Network", null)
|
|
stories -= picked_story
|