Files
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

343 lines
12 KiB
Plaintext

#define TANK_COMPRESSOR_PRESSURE_LIMIT 5000
#define TANK_COMPRESSOR_MAX_TRANSFER_RATE 20
#define SIGNIFICANT_AMOUNT_OF_MOLES 10
/obj/machinery/atmospherics/components/binary/tank_compressor
name = "Tank Compressor"
desc = "Heavy duty shielded air compressor designed to pressurize tanks above the safe limit."
circuit = /obj/item/circuitboard/machine/tank_compressor
icon = 'icons/obj/machines/research.dmi'
base_icon_state = "tank_compressor"
icon_state = "tank_compressor-open"
density = TRUE
var/active = FALSE
var/transfer_rate = TANK_COMPRESSOR_MAX_TRANSFER_RATE
var/datum/gas_mixture/leaked_gas_buffer
var/list/compressor_record = list()
var/last_recorded_pressure = 0
var/record_number = 1
var/obj/item/tank/inserted_tank
/// Reference to a disk we are going to print to.
var/obj/item/disk/computer/inserted_disk
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
/obj/machinery/atmospherics/components/binary/tank_compressor/Initialize(mapload)
. = ..()
leaked_gas_buffer = new(200)
RegisterSignal(src, COMSIG_ATOM_INTERNAL_EXPLOSION, PROC_REF(explosion_handle))
/obj/machinery/atmospherics/components/binary/tank_compressor/examine()
. = ..()
. += "This one is rated for up to [TANK_COMPRESSOR_PRESSURE_LIMIT] kPa."
. += "Can be opened with a screwdriver and rotated with a wrench. The green port is the input, the red one is the output."
/// Stores the record of the gas data for a significant enough tank leak
/datum/data/compressor_record
/// Tank Name
var/experiment_source
/// Key: Path, Value: Moles
var/list/gas_data = list()
var/timestamp
/obj/machinery/atmospherics/components/binary/tank_compressor/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if (user.combat_mode || panel_open)
return NONE
if(istype(tool, /obj/item/disk/computer))
eject_disk(user)
if(!user.transferItemToLoc(tool, src))
balloon_alert(user, "it's stuck to your hand!")
return ITEM_INTERACT_BLOCKING
inserted_disk = tool
return ITEM_INTERACT_SUCCESS
if(!istype(tool, /obj/item/tank))
return NONE
if(inserted_tank)
if(!eject_tank(user))
balloon_alert(user, "it's stuck inside!")
return ITEM_INTERACT_BLOCKING
if(!user.transferItemToLoc(tool, src))
balloon_alert(user, "it's stuck to your hand!")
return ITEM_INTERACT_BLOCKING
inserted_tank = tool
last_recorded_pressure = 0
RegisterSignal(inserted_tank, COMSIG_QDELETING, PROC_REF(tank_destruction))
update_appearance()
return ITEM_INTERACT_SUCCESS
/obj/machinery/atmospherics/components/binary/tank_compressor/wrench_act(mob/living/user, obj/item/tool)
if(active || inserted_tank)
return FALSE
if(!default_change_direction_wrench(user, tool))
return FALSE
return TRUE
/obj/machinery/atmospherics/components/binary/tank_compressor/default_change_direction_wrench(mob/user, obj/item/I)
if(!..())
return FALSE
set_init_directions()
update_appearance()
return TRUE
/obj/machinery/atmospherics/components/binary/tank_compressor/screwdriver_act(mob/living/user, obj/item/tool)
if(active || inserted_tank)
return NONE
. = default_deconstruction_screwdriver(user, tool)
change_nodes_connection(panel_open)
return .
/obj/machinery/atmospherics/components/binary/tank_compressor/crowbar_act(mob/living/user, obj/item/tool)
if(active || inserted_tank)
return NONE
return default_deconstruction_crowbar(user, tool)
/// Glorified volume pump.
/obj/machinery/atmospherics/components/binary/tank_compressor/process_atmos()
var/datum/gas_mixture/input_air = airs[2]
if(!input_air?.total_moles() || !active || !transfer_rate || !inserted_tank)
return
var/datum/gas_mixture/tank_air = inserted_tank.return_air()
if(!tank_air)
return
if(input_air.return_pressure() < 0.01 || tank_air.return_pressure() > TANK_COMPRESSOR_PRESSURE_LIMIT)
return
/// Prevent pumping if tank is taking damage but still below pressure limit. Here to prevent exploiting the buffer system.
if((inserted_tank.leaking) && (tank_air.return_pressure() <= TANK_LEAK_PRESSURE))
active = FALSE
return
var/datum/gas_mixture/removed = input_air.remove_ratio(transfer_rate / input_air.volume)
if(!removed)
return
tank_air.merge(removed)
update_parents()
/obj/machinery/atmospherics/components/binary/tank_compressor/assume_air(datum/gas_mixture/giver)
if(!leaked_gas_buffer)
return ..()
leaked_gas_buffer.merge(giver)
return TRUE
/// Recording of last pressure of the tank. Ran when a tank is about to explode or disintegrate. We dont care about last pressure if the tank is ejected.
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/tank_destruction()
SIGNAL_HANDLER
if(inserted_tank.get_integrity() > 0)
return
flush_buffer()
var/datum/gas_mixture/tank_air = inserted_tank.return_air()
last_recorded_pressure = tank_air.return_pressure()
active = FALSE
return
/// Use this to absorb explosions.
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/explosion_handle(atom/source, list/arguments)
SIGNAL_HANDLER
say("Internal explosion detected and absorbed.")
SSexplosions.shake_the_room(get_turf(src), 1, 8, 0.5, 0.25, FALSE)
return COMSIG_CANCEL_EXPLOSION
/**
* Everytime a tank is destroyed or a new tank is inserted, our buffer is flushed.
* Mole requirements in experiments are tracked by buffer data.
*/
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/flush_buffer()
if(!leaked_gas_buffer.total_moles())
return
if(leaked_gas_buffer.total_moles() > SIGNIFICANT_AMOUNT_OF_MOLES)
record_data()
else
say("Buffer data discarded. Required moles for storage: [SIGNIFICANT_AMOUNT_OF_MOLES] moles.")
var/datum/gas_mixture/removed = leaked_gas_buffer.remove_ratio(1)
airs[1].merge(removed)
say("Gas stored in buffer flushed to output port. Compressor ready to start the next experiment.")
/// This proc should be called whenever we want to store our buffer data.
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/record_data()
var/datum/data/compressor_record/new_record = new()
new_record.name = "Log Recording #[record_number]"
new_record.experiment_source = inserted_tank.name
new_record.timestamp = "[server_timestamp(ic_time = TRUE)] (PT: [round_timestamp()])"
for(var/gas_path in leaked_gas_buffer.gases)
new_record.gas_data[gas_path] = leaked_gas_buffer.gases[gas_path][MOLES]
compressor_record += new_record
record_number += 1
say("Buffer data stored.")
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/apply_experiments(datum/data/compressor_record/record)
var/list/passed_experiments = list()
var/list/gas_data = record.gas_data
for (var/datum/experiment/ordnance/gaseous/experiment in SSresearch.ordnance_experiments)
if(experiment.required_gas in gas_data)
if(gas_data[experiment.required_gas] > MINIMUM_MOLE_COUNT)
passed_experiments += list(experiment.type = gas_data[experiment.required_gas])
return passed_experiments
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/print(mob/user, datum/data/compressor_record/record)
if(!record || !inserted_disk)
return
var/datum/computer_file/data/ordnance/gaseous/record_data = new
record_data.filename = "Gas Compressor " + record.name //Gas Compressor Log Recording #x
record_data.gas_record = record
record_data.possible_experiments = apply_experiments(record)
if(inserted_disk.add_file(record_data))
playsound(src, 'sound/machines/ping.ogg', 25)
else
playsound(src, 'sound/machines/terminal/terminal_error.ogg', 25)
/// Ejecting a tank. Also called on insertion to clear previous tanks.
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/eject_tank(mob/user)
if(!inserted_tank)
return FALSE
var/datum/gas_mixture/tank_air = inserted_tank.return_air()
if(tank_air.return_pressure() >= (PUMP_MAX_PRESSURE + ONE_ATMOSPHERE))
return FALSE
flush_buffer()
if(user)
user.put_in_hands(inserted_tank)
else
inserted_tank.forceMove(drop_location())
active = FALSE
return TRUE
/obj/machinery/atmospherics/components/binary/tank_compressor/proc/eject_disk(mob/user)
if(!inserted_disk)
return FALSE
if(!user || !Adjacent(user))
inserted_disk.forceMove(drop_location())
else
user.put_in_hands(inserted_disk)
playsound(src, 'sound/machines/card_slide.ogg', 50)
return TRUE
/// We rely on exited to clear references.
/obj/machinery/atmospherics/components/binary/tank_compressor/Exited(atom/movable/gone, direction)
if(gone == inserted_disk)
inserted_disk = null
if(gone == inserted_tank)
UnregisterSignal(inserted_tank, COMSIG_QDELETING)
inserted_tank = null
update_appearance()
return ..()
/obj/machinery/atmospherics/components/binary/tank_compressor/on_deconstruction(disassembled)
eject_tank()
eject_disk()
return ..()
/obj/machinery/atmospherics/components/binary/tank_compressor/Destroy()
inserted_tank = null
inserted_disk = null
leaked_gas_buffer = null
compressor_record.Cut() // We only want to clear the list itself, not delete its contents.
return ..()
/obj/machinery/atmospherics/components/binary/tank_compressor/update_icon_state()
if(istype(inserted_tank))
icon_state = "[base_icon_state]-closed"
else
icon_state = "[base_icon_state]-open"
return ..()
/obj/machinery/atmospherics/components/binary/tank_compressor/update_overlays()
. = ..()
. += get_pipe_image(icon, "[base_icon_state]-pipe", dir, COLOR_VIBRANT_LIME, piping_layer)
. += get_pipe_image(icon, "[base_icon_state]-pipe", REVERSE_DIR(dir), COLOR_RED, piping_layer)
if(!istype(inserted_tank))
. += mutable_appearance(icon, "[base_icon_state]-doors",)
if(panel_open)
. += mutable_appearance(icon, "[base_icon_state]-maintenance")
else
. += mutable_appearance(icon, "[base_icon_state]-cables")
/obj/machinery/atmospherics/components/binary/tank_compressor/ui_interact(mob/user, datum/tgui/ui)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "TankCompressor")
ui.open()
/obj/machinery/atmospherics/components/binary/tank_compressor/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if (.)
return
switch(action)
if("change_rate")
transfer_rate = clamp(params["target"], 0, TANK_COMPRESSOR_MAX_TRANSFER_RATE)
if("toggle_injection")
active = !active
if("eject_tank")
eject_tank(usr)
if("eject_disk")
eject_disk(usr)
if("delete_record")
var/datum/data/compressor_record/record = locate(params["ref"]) in compressor_record
if(!compressor_record || !(record in compressor_record))
return
compressor_record -= record
return TRUE
if("save_record")
var/datum/data/compressor_record/record = locate(params["ref"]) in compressor_record
if(!compressor_record || !(record in compressor_record))
return
print(usr, record)
return TRUE
/obj/machinery/atmospherics/components/binary/tank_compressor/ui_static_data()
var/list/data = list(
"maxTransfer" = TANK_COMPRESSOR_MAX_TRANSFER_RATE,
"leakPressure" = round(TANK_LEAK_PRESSURE),
"fragmentPressure" = round(TANK_FRAGMENT_PRESSURE),
"ejectPressure" = PUMP_MAX_PRESSURE + ONE_ATMOSPHERE,
)
return data
/obj/machinery/atmospherics/components/binary/tank_compressor/ui_data(mob/user)
var/list/data = list()
data["tankPresent"] = inserted_tank ? TRUE : FALSE
var/datum/gas_mixture/tank_air = inserted_tank?.return_air()
data["tankPressure"] = tank_air?.return_pressure()
data["leaking"] = inserted_tank?.leaking
data["active"] = active
data["transferRate"] = transfer_rate
data["lastPressure"] = last_recorded_pressure
data["disk"] = inserted_disk?.name
data["storage"] = "[inserted_disk?.used_capacity] / [inserted_disk?.max_capacity] GQ"
data["records"] = list()
for (var/datum/data/compressor_record/record in compressor_record)
var/list/single_record_data = list(
"ref" = REF(record),
"name" = record.name,
"source" = record.experiment_source,
"timestamp" = record.timestamp,
"gases" = list()
)
for (var/path in record.gas_data)
var/datum/gas/gas_path = path
single_record_data["gases"] += list(initial(gas_path.name) = record.gas_data[gas_path])
data["records"] += list(single_record_data)
return data
#undef TANK_COMPRESSOR_PRESSURE_LIMIT
#undef TANK_COMPRESSOR_MAX_TRANSFER_RATE
#undef SIGNIFICANT_AMOUNT_OF_MOLES