Merge pull request #4483 from Citadel-Station-13/upstream-merge-33682
[MIRROR] Makes newscaster feedback messages and comments always a list.
This commit is contained in:
@@ -45,7 +45,33 @@
|
||||
var/result = O.check_completion() ? "SUCCESS" : "FAIL"
|
||||
antag_info["objectives"] += list(list("objective_type"=O.type,"text"=O.explanation_text,"result"=result))
|
||||
SSblackbox.record_feedback("associative", "antagonists", 1, antag_info)
|
||||
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/gather_newscaster()
|
||||
var/json_file = file("[GLOB.log_directory]/newscaster.json")
|
||||
var/list/file_data = list()
|
||||
var/pos = 1
|
||||
for(var/V in GLOB.news_network.network_channels)
|
||||
var/datum/newscaster/feed_channel/channel = V
|
||||
if(!istype(channel))
|
||||
stack_trace("Non-channel in newscaster channel list")
|
||||
continue
|
||||
file_data["[pos]"] = list("channel name" = "[channel.channel_name]", "author" = "[channel.author]", "censored" = channel.censored ? 1 : 0, "author censored" = channel.authorCensor ? 1 : 0, "messages" = list())
|
||||
for(var/M in channel.messages)
|
||||
var/datum/newscaster/feed_message/message = M
|
||||
if(!istype(message))
|
||||
stack_trace("Non-message in newscaster channel messages list")
|
||||
continue
|
||||
file_data["[pos]"]["messages"] += list(list("author" = "[message.author]", "time stamp" = "[message.time_stamp]", "censored" = message.bodyCensor ? 1 : 0, "author censored" = message.authorCensor ? 1 : 0, "photo file" = "[message.photo_file]", "photo caption" = "[message.caption]", "body" = "[message.body]", "comments" = list()))
|
||||
for(var/C in message.comments)
|
||||
var/datum/newscaster/feed_comment/comment = C
|
||||
if(!istype(comment))
|
||||
stack_trace("Non-message in newscaster message comments list")
|
||||
continue
|
||||
file_data["[pos]"]["messages"]["comments"] += list(list("author" = "[comment.author]", "time stamp" = "[comment.time_stamp]", "body" = "[comment.body]"))
|
||||
pos++
|
||||
if(GLOB.news_network.wanted_issue.active)
|
||||
file_data["wanted"] = list("author" = "[GLOB.news_network.wanted_issue.scannedUser]", "criminal" = "[GLOB.news_network.wanted_issue.criminal]", "description" = "[GLOB.news_network.wanted_issue.body]", "photo file" = "[GLOB.news_network.wanted_issue.photo_file]")
|
||||
WRITE_FILE(json_file, json_encode(file_data))
|
||||
|
||||
/datum/controller/subsystem/ticker/proc/declare_completion()
|
||||
set waitfor = FALSE
|
||||
|
||||
@@ -22,6 +22,7 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
var/creationTime
|
||||
var/authorCensor
|
||||
var/bodyCensor
|
||||
var/photo_file
|
||||
|
||||
/datum/newscaster/feed_message/proc/returnAuthor(censor)
|
||||
if(censor == -1)
|
||||
@@ -97,6 +98,7 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
var/scannedUser
|
||||
var/isAdminMsg
|
||||
var/icon/img
|
||||
var/photo_file
|
||||
|
||||
/datum/newscaster/feed_network
|
||||
var/list/datum/newscaster/feed_channel/network_channels = list()
|
||||
@@ -126,6 +128,7 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
if(photo)
|
||||
newMsg.img = photo.img
|
||||
newMsg.caption = photo.scribble
|
||||
newMsg.photo_file = save_photo(photo.img)
|
||||
for(var/datum/newscaster/feed_channel/FC in network_channels)
|
||||
if(FC.channel_name == channel_name)
|
||||
FC.messages += newMsg
|
||||
@@ -143,6 +146,7 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
wanted_issue.isAdminMsg = adminMsg
|
||||
if(photo)
|
||||
wanted_issue.img = photo.img
|
||||
wanted_issue.photo_file = save_photo(photo.img)
|
||||
if(newMessage)
|
||||
for(var/obj/machinery/newscaster/N in GLOB.allCasters)
|
||||
N.newsAlert()
|
||||
@@ -157,7 +161,12 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters)
|
||||
NEWSCASTER.update_icon()
|
||||
|
||||
|
||||
/datum/newscaster/feed_network/proc/save_photo(icon/photo)
|
||||
var/photo_file = copytext(md5("\icon[photo]"), 1, 6)
|
||||
if(!fexists("[GLOB.log_directory]/photos/[photo_file].png"))
|
||||
var/icon/p = icon(photo, frame = 1)
|
||||
fcopy(p, "[GLOB.log_directory]/photos/[photo_file].png")
|
||||
return photo_file
|
||||
|
||||
/obj/item/wallframe/newscaster
|
||||
name = "newscaster frame"
|
||||
|
||||
Reference in New Issue
Block a user