Files
Bubberstation/code/modules/requests/request_manager.dm
T
John Willard aa4dc56835 Removes Station-time (more time changes) (#95744)
## 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>
2026-04-25 14:13:31 -06:00

284 lines
9.1 KiB
Plaintext

/// Requests from prayers
#define REQUEST_PRAYER "request_prayer"
/// Requests for Centcom
#define REQUEST_CENTCOM "request_centcom"
/// Requests for the Syndicate
#define REQUEST_SYNDICATE "request_syndicate"
/// Requests for the nuke code
#define REQUEST_NUKE "request_nuke"
/// Requests somebody from fax
#define REQUEST_FAX "request_fax"
/// Requests from Request Music
#define REQUEST_INTERNET_SOUND "request_internet_sound"
GLOBAL_DATUM_INIT(requests, /datum/request_manager, new)
/**
* # Request Manager
*
* Handles all player requests (prayers, centcom requests, syndicate requests)
* that occur in the duration of a round.
*/
/datum/request_manager
/// Associative list of ckey -> list of requests
var/list/requests = list()
/// List where requests can be accessed by ID
var/list/requests_by_id = list()
/datum/request_manager/Destroy(force)
QDEL_LIST(requests)
return ..()
/**
* Used in the new client pipeline to catch when clients are reconnecting and need to have their
* reference re-assigned to the 'owner' variable of any requests
*
* Arguments:
* * C - The client who is logging in
*/
/datum/request_manager/proc/client_login(client/C)
if (!requests[C.ckey])
return
for (var/datum/request/request as anything in requests[C.ckey])
request.owner = C
/**
* Used in the destroy client pipeline to catch when clients are disconnecting and need to have their
* reference nulled on the 'owner' variable of any requests
*
* Arguments:
* * C - The client who is logging out
*/
/datum/request_manager/proc/client_logout(client/C)
if (!requests[C.ckey])
return
for (var/datum/request/request as anything in requests[C.ckey])
request.owner = null
/**
* Creates a request for a prayer, and notifies admins who have the sound notifications enabled when appropriate
*
* Arguments:
* * C - The client who is praying
* * message - The prayer
* * is_chaplain - Boolean operator describing if the prayer is from a chaplain
*/
/datum/request_manager/proc/pray(client/C, message, is_chaplain)
request_for_client(C, REQUEST_PRAYER, message)
for(var/client/admin in GLOB.admins)
if(is_chaplain && get_chat_toggles(admin) & CHAT_PRAYER && admin.prefs.toggles & SOUND_PRAYERS)
SEND_SOUND(admin, sound('sound/effects/pray.ogg'))
/**
* Creates a request for a Centcom message
*
* Arguments:
* * C - The client who is sending the request
* * message - The message
*/
/datum/request_manager/proc/message_centcom(client/C, message)
request_for_client(C, REQUEST_CENTCOM, message)
/**
* Creates a request for a Syndicate message
*
* Arguments:
* * C - The client who is sending the request
* * message - The message
*/
/datum/request_manager/proc/message_syndicate(client/C, message)
request_for_client(C, REQUEST_SYNDICATE, message)
/**
* Creates a request for the nuclear self destruct codes
*
* Arguments:
* * C - The client who is sending the request
* * message - The message
*/
/datum/request_manager/proc/nuke_request(client/C, message)
request_for_client(C, REQUEST_NUKE, message)
/**
* Creates a request for fax answer
*
* Arguments:
* * requester - The client who is sending the request
* * message - Paper with text.. some stamps.. and another things.
*/
/datum/request_manager/proc/fax_request(client/requester, message, additional_info)
request_for_client(requester, REQUEST_FAX, message, additional_info)
/**
* Creates a request for a song
*
* Arguments:
* * requester - The client who is sending the request
* * message - The URL of the song
*/
/datum/request_manager/proc/music_request(client/requester, message)
request_for_client(requester, REQUEST_INTERNET_SOUND, message)
/**
* Creates a request and registers the request with all necessary internal tracking lists
*
* Arguments:
* * C - The client who is sending the request
* * type - The type of request, see defines
* * message - The message
*/
/datum/request_manager/proc/request_for_client(client/C, type, message, additional_info)
var/datum/request/request = new(C, type, message, additional_info)
if (!requests[C.ckey])
requests[C.ckey] = list()
requests[C.ckey] += request
requests_by_id.len++
requests_by_id[request.id] = request
/datum/request_manager/ui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "RequestManager")
ui.open()
/datum/request_manager/ui_state(mob/user)
return ADMIN_STATE(R_ADMIN)
/datum/request_manager/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
if (..())
return
// Only admins should be sending actions
if (!check_rights(R_ADMIN))
to_chat(usr, "You do not have permission to do this, you require +ADMIN", confidential = TRUE)
return
if (action == "toggleprint")
GLOB.fax_autoprinting = !GLOB.fax_autoprinting
return TRUE
// Get the request this relates to
var/id = params["id"] != null ? text2num(params["id"]) : null
if (!id)
to_chat(usr, "Failed to find a request ID in your action, please report this", confidential = TRUE)
CRASH("Received an action without a request ID, this shouldn't happen!")
var/datum/request/request = !id ? null : requests_by_id[id]
switch(action)
if ("pp")
SSadmin_verbs.dynamic_invoke_verb(ui.user, /datum/admin_verb/show_player_panel, request.owner?.mob)
return TRUE
if ("vv")
var/mob/M = request.owner?.mob
usr.client.debug_variables(M)
return TRUE
if ("sm")
SSadmin_verbs.dynamic_invoke_verb(ui.user, /datum/admin_verb/cmd_admin_subtle_message, request.owner?.mob)
return TRUE
if ("flw")
var/mob/M = request.owner?.mob
usr.client.admin_follow(M)
return TRUE
if ("tp")
if(!SSticker.HasRoundStarted())
tgui_alert(usr,"The game hasn't started yet!")
return TRUE
var/mob/M = request.owner?.mob
if(!ismob(M))
var/datum/mind/D = M
if(!istype(D))
to_chat(usr, "This can only be used on instances of type /mob and /mind", confidential = TRUE)
return TRUE
else
D.traitor_panel()
return TRUE
else
SSadmin_verbs.dynamic_invoke_verb(usr, /datum/admin_verb/show_traitor_panel, M)
return TRUE
if ("logs")
var/mob/M = request.owner?.mob
if(!ismob(M))
to_chat(usr, "This can only be used on instances of type /mob.", confidential = TRUE)
return TRUE
show_individual_logging_panel(M, null, null)
return TRUE
if ("smite")
SSadmin_verbs.dynamic_invoke_verb(ui.user, /datum/admin_verb/admin_smite, request.owner?.mob)
return TRUE
if ("rply")
if (request.req_type == REQUEST_PRAYER)
to_chat(usr, "Cannot reply to a prayer", confidential = TRUE)
return TRUE
var/mob/M = request.owner?.mob
usr.client.admin_headset_message(M, request.req_type == REQUEST_SYNDICATE ? RADIO_CHANNEL_SYNDICATE : RADIO_CHANNEL_CENTCOM)
return TRUE
if ("setcode")
if (request.req_type != REQUEST_NUKE)
to_chat(usr, "You cannot set the nuke code for a non-nuke-code-request request!", confidential = TRUE)
return TRUE
var/code = random_nukecode()
for(var/obj/machinery/nuclearbomb/selfdestruct/SD in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/nuclearbomb/selfdestruct))
SD.r_code = code
message_admins("[key_name_admin(usr)] has set the self-destruct code to \"[code]\".")
return TRUE
if ("show")
if(request.req_type != REQUEST_FAX)
to_chat(usr, "Request doesn't have a paper to read.", confidential = TRUE)
return TRUE
var/obj/item/paper/request_message = request.additional_information["paper"]
request_message.ui_interact(usr)
return TRUE
if ("print")
if (request.req_type != REQUEST_FAX)
to_chat(usr, "Request doesn't have a paper to print.", confidential = TRUE)
return TRUE
for(var/obj/machinery/fax/admin/FAX as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/fax/admin))
if(FAX.fax_id != request.additional_information["destination_id"])
continue
var/obj/item/paper/request_message = request.additional_information["paper"]
var/sender_name = request.additional_information["sender_name"]
FAX.receive(request_message, sender_name)
return TRUE
if ("play")
if(request.req_type != REQUEST_INTERNET_SOUND)
to_chat(usr, "Request doesn't have a sound to play.", confidential = TRUE)
return TRUE
if(findtext(request.message, ":") && !findtext(request.message, GLOB.is_http_protocol))
to_chat(usr, "Request is not a valid URL.", confidential = TRUE)
return TRUE
web_sound(usr, request.message)
return TRUE
/datum/request_manager/ui_data(mob/user)
var/list/data = list()
for (var/ckey in requests)
for (var/datum/request/request as anything in requests[ckey])
data["requests"] += list(list(
"id" = request.id,
"req_type" = request.req_type,
"owner" = request.owner ? "[REF(request.owner)]" : null,
"owner_ckey" = request.owner_ckey,
"owner_name" = request.owner_name,
"message" = request.message,
"additional_info" = request.additional_information,
"timestamp" = request.timestamp,
"timestamp_str" = round_timestamp(wtime = request.timestamp)
))
data["fax_autoprinting"] = GLOB.fax_autoprinting
return data
#undef REQUEST_PRAYER
#undef REQUEST_CENTCOM
#undef REQUEST_SYNDICATE
#undef REQUEST_NUKE
#undef REQUEST_FAX
#undef REQUEST_INTERNET_SOUND