mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-17 11:05:16 +01:00
aa4dc56835
## About The Pull Request Removes Station-Time entirely Server Time is now NST (Nanotrasen Standard Time). SS13 takes place exactly 540 years in the future of the current day, so every second is 1 second in-game. Round Time is now PT (Pay-Time), how Nanotrasen keeps track of how long the current rotation of Employees has been working for. Telecomms uses NST due to its importance of being the communication to the blackbox. Autopsy report, clocks, scientific reports and requisitions use both timestamps due to them being more official documents that NT may need to know beyond just the current round (just for flavortext). Pretty much everything else (Det scanner, PDA, IC logs, Time-of-Death, AI law changes, Cyborg file downloading) uses PT PT <img width="305" height="217" alt="image" src="https://github.com/user-attachments/assets/cef73025-6292-4f9c-8565-197397bda2ca" /> <img width="168" height="59" alt="image" src="https://github.com/user-attachments/assets/a99db568-045d-45fc-8206-0d9a7b13c7d2" /> <img width="308" height="122" alt="image" src="https://github.com/user-attachments/assets/37ca6f17-8916-4af2-9c91-0f0707038ca5" /> https://github.com/user-attachments/assets/29445051-c98b-4af3-a657-812083aab91a Clock (Literate) <img width="748" height="292" alt="image" src="https://github.com/user-attachments/assets/c824e812-91b5-4737-858d-768336e9a7c4" /> Clock (Illiterate) <img width="446" height="94" alt="image" src="https://github.com/user-attachments/assets/90d5ea0d-eaff-4ced-aa31-ffdf0b4832a5" /> New paperwork time working properly <img width="311" height="190" alt="image" src="https://github.com/user-attachments/assets/6d048926-db61-4c91-893b-ce93e1ea7775" /> NST <img width="800" height="115" alt="image" src="https://github.com/user-attachments/assets/35ffde49-13c1-4ce7-ab24-858e48b608bd" /> <img width="1288" height="142" alt="image" src="https://github.com/user-attachments/assets/40c30d16-e0de-4efc-b460-9486eeb901d6" /> # Other changes 1. Circuit time checker will now get the value of the given input (Hour, Minute, Second) rather than the full dedisecond time converted into hour/minutes/seconds <img width="270" height="67" alt="image" src="https://github.com/user-attachments/assets/097440cc-1c45-447f-9976-18de7f9c722c" /> 2. Turns nightshift into a round event that'll last approximately 22 minutes 3. 12-hour pref (doesn't apply to the stat panel because it's global info) & removal of "TCT" time <img width="569" height="440" alt="image" src="https://github.com/user-attachments/assets/d39083b1-d248-41c0-9a1c-b2398ca203a7" /> 4. The chocolate pudding negative moodlet is now based on the server's IRL time. 5. Admins can now use ``class``, ``style`` and ``background`` (they were already given perms to use ``img`` so hiding background, which was removed to prevent image embedding, is pointless) 6. Also fixes ``year`` being off on localhost. ## Why It's Good For The Game Server Time is approximately 1s = 12s converted, not including it desyncing from lag (I believe?). This makes it pretty much impossible for people to actually use this as a unit of measurement for in-game actions. Different things also uses different timestamps which is a bit more confusing. The main change here is for accessibility and, hopefully, using time as a source of immersion. "20 minutes ago" is no longer OOC, they're just speaking in PT. There's no timezones in space, Nanotrasen Standard Time is the closest there is, but Pay Time is how NT considers when you get your paychecks, so it's what is more commonly used. It also fixes major inconsistencies between "IC time" and "Station time", things like breakfast moodlet was the first 15mins of the round despite the round starting like 7 hours in? Nukies with an L6 SAW firing down the halls was shooting like 1 bullet every 3 seconds (assuming 4 bullets per second), overall there was just a disconnect between how long time actually is in the universe. The secondary reason for this change (though it is what pushed me to actually get around to making this change) is the greater stat-panel removal. This hopes to lessen the dependence on the stat panel for station-time by making it easier to understand, and the end-goal I have is for this information to be limited to Admins & the AI (AI will get the IC version with the accurate year), so until that happens I would like to improve the use of station-time by making it consistent (for example, you should only care for PT for IC, which is also what your PDA displays), so that when it gets removed it won't leave players timeless. If you haven't already, and is interested in helping remove the stat panel, every entry that needs to be removed can be found here - https://hackmd.io/443_dE5lRWeEAp9bjGcKYw?view Closes https://github.com/tgstation/tgstation/issues/94988 ## Changelog 🆑 del: Removed Station Time, now we use NST (Nanotrasen Standard Time), which is IRL server time +540 years, and PT (Pay Time), the amount of time since the round has started. del: Station nightshift is now a Station event rather than being based on Server time. balance: Time circuit's Unit of Measure now tells the amount of time in hour/minute/seconds rather than giving the whole time translated to hours/minutes/seconds. qol: Added a 12-hour clock pref for people who prefer it. qol: Hovering over NST timestamps on official documents will now translate how much it is in PT/Shift Time. admin: Admins can now use style/class/background in their papercode. /🆑 --------- Co-authored-by: Isratosh <Isratosh@hotmail.com>
371 lines
13 KiB
Plaintext
371 lines
13 KiB
Plaintext
ADMIN_VERB(access_news_network, R_ADMIN, "Access Newscaster Network", "Allows you to view, add, and edit news feeds.", ADMIN_CATEGORY_EVENTS)
|
|
var/datum/newspanel/new_newspanel = new
|
|
new_newspanel.ui_interact(user.mob)
|
|
|
|
/datum/newspanel
|
|
///What newscaster channel is currently being viewed by the player?
|
|
var/datum/feed_channel/current_channel
|
|
///What newscaster feed_message is currently having a comment written for it?
|
|
var/datum/feed_message/current_message
|
|
///The message that's currently being written for a feed story.
|
|
var/feed_channel_message
|
|
///The current image that will be submitted with the newscaster story.
|
|
var/datum/picture/current_image
|
|
///Is the current user creating a new channel at the moment?
|
|
var/creating_channel = FALSE
|
|
///Is the current user creating a new comment at the moment?
|
|
var/creating_comment = FALSE
|
|
///Is the current user editing or viewing a new wanted issue at the moment?
|
|
var/viewing_wanted = FALSE
|
|
///What is the user submitted, criminal name for the new wanted issue?
|
|
var/criminal_name
|
|
///What is the user submitted, crime description for the new wanted issue?
|
|
var/crime_description
|
|
///What is the current, in-creation channel's name going to be?
|
|
var/channel_name
|
|
///What is the current, in-creation channel's description going to be?
|
|
var/channel_desc
|
|
///What is the current, in-creation comment's body going to be?
|
|
var/comment_text
|
|
|
|
/datum/newspanel/ui_state(mob/user)
|
|
return ADMIN_STATE(R_ADMIN)
|
|
|
|
/datum/newspanel/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "PhysicalNewscaster")
|
|
ui.open()
|
|
|
|
/datum/newspanel/ui_static_data(mob/user)
|
|
. = ..()
|
|
if (!is_admin(user))
|
|
to_chat(usr, "Error: you are not an admin!", confidential = TRUE)
|
|
return
|
|
|
|
/datum/newspanel/ui_data(mob/user)
|
|
. = list()
|
|
var/list/data = list()
|
|
var/list/channel_list = list()
|
|
var/list/message_list = list()
|
|
|
|
data["user"] = list()
|
|
data["user"]["name"] = "Centcom Official"
|
|
data["user"]["job"] = "Official"
|
|
data["user"]["department"] = "Department of News"
|
|
|
|
data["admin_mode"] = TRUE
|
|
data["security_mode"] = TRUE
|
|
data["photo_data"] = !isnull(current_image)
|
|
data["creating_channel"] = creating_channel
|
|
data["creating_comment"] = creating_comment
|
|
|
|
//Here is all the UI_data sent about the current wanted issue, as well as making a new one in the UI.
|
|
data["viewing_wanted"] = viewing_wanted
|
|
data["making_wanted_issue"] = !(GLOB.news_network.wanted_issue?.active)
|
|
data["criminal_name"] = criminal_name
|
|
data["crime_description"] = crime_description
|
|
var/list/wanted_info = list()
|
|
if(GLOB.news_network.wanted_issue)
|
|
var/has_wanted_issue = !isnull(GLOB.news_network.wanted_issue.img)
|
|
if(has_wanted_issue)
|
|
user << browse_rsc(GLOB.news_network.wanted_issue.img, "wanted_photo.png")
|
|
wanted_info = list(list(
|
|
"active" = GLOB.news_network.wanted_issue.active,
|
|
"criminal" = GLOB.news_network.wanted_issue.criminal,
|
|
"crime" = GLOB.news_network.wanted_issue.body,
|
|
"author" = GLOB.news_network.wanted_issue.scanned_user,
|
|
"image" = (has_wanted_issue ? "wanted_photo.png" : null)
|
|
))
|
|
|
|
//Code breaking down the channels that have been made on-station thus far. ha
|
|
//Then, breaks down the messages that have been made on those channels.
|
|
for(var/datum/feed_channel/channel as anything in GLOB.news_network.network_channels)
|
|
channel_list += list(list(
|
|
"name" = channel.channel_name,
|
|
"author" = channel.author,
|
|
"censored" = channel.censored,
|
|
"locked" = channel.locked,
|
|
"ID" = channel.channel_id,
|
|
))
|
|
if(current_channel)
|
|
for(var/datum/feed_message/feed_message as anything in current_channel.messages)
|
|
var/photo_id = null
|
|
var/list/comment_list
|
|
if(feed_message.img)
|
|
user << browse_rsc(feed_message.img, "tmp_photo[feed_message.message_id].png")
|
|
photo_id = "tmp_photo[feed_message.message_id].png"
|
|
for(var/datum/feed_comment/comment_message as anything in feed_message.comments)
|
|
comment_list += list(list(
|
|
"auth" = comment_message.author,
|
|
"body" = comment_message.body,
|
|
"time" = comment_message.time_stamp,
|
|
))
|
|
message_list += list(list(
|
|
"auth" = feed_message.author,
|
|
"body" = feed_message.body,
|
|
"time" = feed_message.time_stamp,
|
|
"channel_num" = feed_message.parent_id,
|
|
"censored_message" = feed_message.body_censor,
|
|
"censored_author" = feed_message.author_censor,
|
|
"ID" = feed_message.message_id,
|
|
"photo" = photo_id,
|
|
"comments" = comment_list
|
|
))
|
|
|
|
|
|
data["viewing_channel"] = current_channel?.channel_id
|
|
//Here we display all the information about the current channel.
|
|
data["channelName"] = current_channel?.channel_name
|
|
data["channelAuthor"] = current_channel?.author
|
|
|
|
if(!current_channel)
|
|
data["channelAuthor"] = "Nanotrasen Inc"
|
|
data["channelDesc"] = "Welcome to Newscaster Net. Interface & News networks Operational."
|
|
data["channelLocked"] = TRUE
|
|
else
|
|
data["channelDesc"] = current_channel.channel_desc
|
|
data["channelLocked"] = current_channel.locked
|
|
data["channelCensored"] = current_channel.censored
|
|
|
|
//We send all the information about all channels and all messages in existence.
|
|
data["channels"] = channel_list
|
|
data["messages"] = message_list
|
|
data["wanted"] = wanted_info
|
|
return data
|
|
|
|
/datum/newspanel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
switch(action)
|
|
if("setChannel")
|
|
var/selected_channel_id = params["channel"]
|
|
if(isnull(selected_channel_id))
|
|
return TRUE
|
|
var/datum/feed_channel/potential_channel = GLOB.news_network.network_channels_by_id["[selected_channel_id]"]
|
|
if(isnull(potential_channel))
|
|
return TRUE
|
|
current_channel = potential_channel
|
|
|
|
if("createStory")
|
|
if(!current_channel)
|
|
to_chat(usr, "select a channel first!")
|
|
return TRUE
|
|
var/current_channel_id = params["current"]
|
|
create_story(channel_id = current_channel_id)
|
|
|
|
if("togglePhoto")
|
|
toggle_photo()
|
|
return TRUE
|
|
|
|
if("startCreateChannel")
|
|
start_creating_channel()
|
|
return TRUE
|
|
|
|
if("setChannelName")
|
|
var/pre_channel_name = params["channeltext"]
|
|
if(!pre_channel_name)
|
|
return TRUE
|
|
channel_name = pre_channel_name
|
|
|
|
if("setChannelDesc")
|
|
var/pre_channel_desc = params["channeldesc"]
|
|
if(!pre_channel_desc)
|
|
return TRUE
|
|
channel_desc = pre_channel_desc
|
|
|
|
if("createChannel")
|
|
var/locked = params["lockedmode"]
|
|
create_channel(locked)
|
|
return TRUE
|
|
|
|
if("cancelCreation")
|
|
creating_channel = FALSE
|
|
creating_comment = FALSE
|
|
viewing_wanted = FALSE
|
|
return TRUE
|
|
|
|
if("storyCensor")
|
|
var/questionable_message = params["messageID"]
|
|
for(var/datum/feed_message/iterated_feed_message as anything in current_channel.messages)
|
|
if(iterated_feed_message.message_id == questionable_message)
|
|
iterated_feed_message.toggle_censor_body()
|
|
break
|
|
|
|
if("author_censor")
|
|
var/questionable_message = params["messageID"]
|
|
for(var/datum/feed_message/iterated_feed_message in current_channel.messages)
|
|
if(iterated_feed_message.message_id == questionable_message)
|
|
iterated_feed_message.toggle_censor_author()
|
|
break
|
|
|
|
if("channelDNotice")
|
|
var/selected_channel_id = (params["channel"])
|
|
if(isnull(selected_channel_id))
|
|
return TRUE
|
|
var/datum/feed_channel/potential_channel = GLOB.news_network.network_channels_by_id["[selected_channel_id]"]
|
|
if(isnull(potential_channel))
|
|
return TRUE
|
|
current_channel = potential_channel
|
|
current_channel.toggle_censor_D_class()
|
|
|
|
if("startComment")
|
|
creating_comment = TRUE
|
|
var/commentable_message = params["messageID"]
|
|
if(!commentable_message)
|
|
return TRUE
|
|
for(var/datum/feed_message/iterated_feed_message as anything in current_channel.messages)
|
|
if(iterated_feed_message.message_id == commentable_message)
|
|
current_message = iterated_feed_message
|
|
return TRUE
|
|
|
|
if("setCommentBody")
|
|
var/pre_comment_text = params["commenttext"]
|
|
if(!pre_comment_text)
|
|
return TRUE
|
|
comment_text = pre_comment_text
|
|
return TRUE
|
|
|
|
if("createComment")
|
|
create_comment()
|
|
return TRUE
|
|
|
|
if("toggleWanted")
|
|
viewing_wanted = TRUE
|
|
return TRUE
|
|
|
|
if("setCriminalName")
|
|
var/temp_name = tgui_input_text(usr, "Write the Criminal's Name", "Warrent Alert Handler", "John Doe", max_length = MAX_NAME_LEN, multiline = FALSE)
|
|
if(!temp_name)
|
|
return TRUE
|
|
criminal_name = temp_name
|
|
return TRUE
|
|
|
|
if("setCrimeData")
|
|
var/temp_desc = tgui_input_text(usr, "Write the Criminal's Crimes", "Warrent Alert Handler", "Unknown", max_length = MAX_BROADCAST_LEN, multiline = TRUE)
|
|
if(!temp_desc)
|
|
return TRUE
|
|
crime_description = temp_desc
|
|
return TRUE
|
|
|
|
if("submitWantedIssue")
|
|
if(!crime_description || !criminal_name)
|
|
return TRUE
|
|
GLOB.news_network.submit_wanted(criminal_name, crime_description, "Centcom Official", current_image, adminMsg = TRUE, newMessage = TRUE)
|
|
current_image = null
|
|
return TRUE
|
|
|
|
if("clearWantedIssue")
|
|
clear_wanted_issue(user = usr)
|
|
return TRUE
|
|
|
|
return TRUE
|
|
|
|
|
|
/**
|
|
* Sends photo data to build the newscaster article.
|
|
*/
|
|
/datum/newspanel/proc/send_photo_data()
|
|
if(!current_image)
|
|
return null
|
|
return current_image
|
|
|
|
/**
|
|
* This takes a held photograph, and updates the current_image variable with that of the held photograph's image.
|
|
* *user: The mob who is being checked for a held photo object.
|
|
*/
|
|
/datum/newspanel/proc/attach_photo(mob/user)
|
|
to_chat(user, "I didn't add this!")
|
|
return
|
|
|
|
/**
|
|
* Performs a series of sanity checks before giving the user confirmation to create a new feed_channel using channel_name, and channel_desc.
|
|
* *channel_locked: This variable determines if other users than the author can make comments and new feed_stories on this channel.
|
|
*/
|
|
/datum/newspanel/proc/create_channel(channel_locked)
|
|
if(!channel_name)
|
|
return
|
|
var/datum/feed_channel/potential_channel = GLOB.news_network.network_channels_by_name[channel_name]
|
|
if(potential_channel)
|
|
tgui_alert(usr, "ERROR: Feed channel with that name already exists on the Network.", list("Okay"))
|
|
return TRUE
|
|
if(!channel_desc)
|
|
return TRUE
|
|
if(isnull(channel_locked))
|
|
return TRUE
|
|
var/choice = tgui_alert(usr, "Please confirm feed channel creation","Network Channel Handler", list("Confirm","Cancel"))
|
|
if(choice == "Confirm")
|
|
GLOB.news_network.create_feed_channel(channel_name, "Centcom Official", channel_desc, locked = channel_locked)
|
|
SSblackbox.record_feedback("text", "newscaster_channels", 1, "[channel_name]")
|
|
creating_channel = FALSE
|
|
|
|
/**
|
|
* Constructs a comment to attach to the currently selected feed_message of choice, assuming that a user can be found and that a message body has been written.
|
|
*/
|
|
/datum/newspanel/proc/create_comment()
|
|
if(!comment_text)
|
|
creating_comment = FALSE
|
|
return TRUE
|
|
var/datum/feed_comment/new_feed_comment = new /datum/feed_comment
|
|
new_feed_comment.author = "Centcom Official"
|
|
new_feed_comment.body = comment_text
|
|
new_feed_comment.time_stamp = round_timestamp()
|
|
current_message.comments += new_feed_comment
|
|
GLOB.news_network.last_action ++
|
|
usr.log_message("(as an admin) commented on message [current_message.return_body(-1)] -- [current_message.body]", LOG_COMMENT)
|
|
creating_comment = FALSE
|
|
|
|
/**
|
|
* This proc performs checks before enabling the creating_channel var on the newscaster, such as preventing a user from having multiple channels,
|
|
* preventing an un-ID'd user from making a channel, and preventing censored authors from making a channel.
|
|
* Otherwise, sets creating_channel to TRUE.
|
|
*/
|
|
/datum/newspanel/proc/start_creating_channel()
|
|
//This first block checks for pre-existing reasons to prevent you from making a new channel, like being censored, or if you have a channel already.
|
|
var/list/existing_authors = list()
|
|
for(var/datum/feed_channel/iterated_feed_channel as anything in GLOB.news_network.network_channels)
|
|
if(iterated_feed_channel.author_censor)
|
|
existing_authors += GLOB.news_network.redacted_text
|
|
else
|
|
existing_authors += iterated_feed_channel.author
|
|
creating_channel = TRUE
|
|
|
|
/**
|
|
* Creates a new feed story to the global newscaster network.
|
|
* Verifies that the message is being written to a real feed_channel, then provides a text input for the feed story to be written into.
|
|
* Finally, it submits the message to the network, is logged globally, and clears all message-specific variables from the machine.
|
|
*/
|
|
/datum/newspanel/proc/create_story(channel_id)
|
|
var/datum/feed_channel/potential_channel = GLOB.news_network.network_channels_by_id["[channel_id]"]
|
|
if(isnull(potential_channel))
|
|
return
|
|
current_channel = potential_channel
|
|
|
|
var/temp_message = tgui_input_text(usr, "Write your Feed story", "Network Channel Handler", feed_channel_message, max_length = MAX_BROADCAST_LEN, multiline = TRUE)
|
|
if(length(temp_message) <= 1)
|
|
return TRUE
|
|
if(temp_message)
|
|
feed_channel_message = temp_message
|
|
GLOB.news_network.submit_article("<font face=\"[PEN_FONT]\">[parsemarkdown(feed_channel_message, usr)]</font>", "Centcom Official", current_channel.channel_name, send_photo_data(), adminMessage = TRUE, allow_comments = TRUE)
|
|
SSblackbox.record_feedback("amount", "newscaster_stories", 1)
|
|
feed_channel_message = ""
|
|
current_image = null
|
|
|
|
/**
|
|
* Selects a currently held photo from the user's hand and makes it the current_image held by the newscaster.
|
|
* If a photo is still held in the newscaster, it will otherwise clear it from the machine.
|
|
*/
|
|
/datum/newspanel/proc/toggle_photo()
|
|
if(current_image)
|
|
current_image = null
|
|
return TRUE
|
|
else
|
|
attach_photo(usr)
|
|
return TRUE
|
|
|
|
/datum/newspanel/proc/clear_wanted_issue(user)
|
|
GLOB.news_network.wanted_issue.active = FALSE
|
|
return
|