mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 08:06:33 +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>
177 lines
6.7 KiB
Plaintext
177 lines
6.7 KiB
Plaintext
///The maximum amount of logs that can be generated before they start overwriting each other.
|
|
#define MAX_LOG_COUNT 300
|
|
|
|
SUBSYSTEM_DEF(modular_computers)
|
|
name = "Modular Computers"
|
|
|
|
wait = 1 MINUTES
|
|
runlevels = RUNLEVEL_GAME
|
|
|
|
///List of all logs generated by ModPCs through the round.
|
|
///Stops at MAX_LOG_COUNT and must be purged to keep logging.
|
|
var/list/modpc_logs = list()
|
|
|
|
///List of all programs available to download from the NTNet store.
|
|
var/list/available_station_software = list()
|
|
///List of all programs that can be downloaded from an emagged NTNet store.
|
|
var/list/available_antag_software = list()
|
|
///List of all chat channels created by Chat Client.
|
|
var/list/chat_channels = list()
|
|
|
|
///Boolean on whether the IDS warning system is enabled
|
|
var/intrusion_detection_enabled = TRUE
|
|
///Boolean to show a message warning if there's an active intrusion for Wirecarp users.
|
|
var/intrusion_detection_alarm = FALSE
|
|
var/next_picture_id = 0
|
|
|
|
///Lazylist of coupons used by the Coupon Master PDA app. e.g. "COUPONCODE25" = coupon_code
|
|
var/list/discount_coupons
|
|
///When will the next coupon drop?
|
|
var/next_discount = 0
|
|
|
|
/datum/controller/subsystem/modular_computers/Initialize()
|
|
build_software_lists()
|
|
initialized = TRUE
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/modular_computers/fire(resumed = FALSE)
|
|
if(discount_coupons && world.time >= next_discount)
|
|
announce_coupon()
|
|
|
|
///Generate new coupon codes that can be redeemed with the Coupon Master App
|
|
/datum/controller/subsystem/modular_computers/proc/announce_coupon()
|
|
//If there's no way to announce the coupon, we may as well skip it.
|
|
var/obj/machinery/announcement_system/announcement_system = get_announcement_system()
|
|
if(!announcement_system)
|
|
return
|
|
|
|
var/static/list/discounts = list("0.10" = 7, "0.15" = 16, "0.20" = 20, "0.25" = 16, "0.50" = 8, "0.66" = 1)
|
|
var/static/list/flash_discounts = list("0.30" = 3, "0.40" = 8, "0.50" = 8, "0.66" = 2, "0.75" = 1)
|
|
///Eliminates non-alphanumeric characters, as well as the word "Single-Pack" or "Pack" or "Crate" from the coupon code
|
|
var/static/regex/strip_pack_name = regex("\[^a-zA-Z0-9]|(Single-)?Pack|Crate", "g")
|
|
|
|
var/datum/supply_pack/discounted_pack = pick(GLOB.discountable_packs[pick_weight(GLOB.pack_discount_odds)])
|
|
var/pack_name = initial(discounted_pack.name)
|
|
var/chosen_discount
|
|
var/expires_in = 0
|
|
if(prob(75))
|
|
chosen_discount = text2num(pick_weight(discounts))
|
|
if(prob(20))
|
|
expires_in = rand(8,10) MINUTES
|
|
else
|
|
chosen_discount = text2num(pick_weight(flash_discounts))
|
|
expires_in = rand(2, 4) MINUTES
|
|
var/coupon_code = "[uppertext(strip_pack_name.Replace(pack_name, ""))][chosen_discount*100]"
|
|
|
|
var/list/targets = list()
|
|
for (var/messenger_ref in GLOB.pda_messengers)
|
|
var/datum/computer_file/program/messenger/messenger = GLOB.pda_messengers[messenger_ref]
|
|
if(locate(/datum/computer_file/program/coupon) in messenger?.computer.stored_files)
|
|
targets += messenger
|
|
|
|
///Don't go any further if the same coupon code has been done alrady or if there's no recipient for the 'promo'.
|
|
if((coupon_code in discount_coupons) || !length(targets))
|
|
return
|
|
|
|
var/datum/coupon_code/coupon = new(chosen_discount, discounted_pack, expires_in)
|
|
|
|
discount_coupons[coupon_code] = coupon
|
|
|
|
///pda message code here
|
|
var/static/list/promo_messages = list(
|
|
"A new discount has dropped for %GOODY: %DISCOUNT.",
|
|
"Check this new offer out: %GOODY, now %DISCOUNT off.",
|
|
"Now on sales: %GOODY, at %DISCOUNT discount!",
|
|
"This item is now on sale (%DISCOUNT off): %GOODY.",
|
|
"Would you look at that! A %DISCOUNT discount on %GOODY!",
|
|
"Exclusive offer for %GOODY. Only %DISCOUNT! Get it now:",
|
|
"%GOODY is now %DISCOUNT off.",
|
|
"*RING* A new discount has dropped: %GOODY, %DISCOUNT off.",
|
|
"%GOODY - %DISCOUNT off."
|
|
)
|
|
var/static/list/code_messages = list(
|
|
"Here's the code",
|
|
"Use this code to redeem it",
|
|
"Open the app to redeem it",
|
|
"Code",
|
|
"Redeem it now",
|
|
"Buy it now",
|
|
)
|
|
|
|
var/chosen_promo_message = replacetext(replacetext(pick(promo_messages), "%GOODY", pack_name), "%DISCOUNT", "[chosen_discount*100]%")
|
|
var/datum/signal/subspace/messaging/tablet_message/signal = new(announcement_system, list(
|
|
"fakename" = "Coupon Master",
|
|
"fakejob" = "Goodies Promotion",
|
|
"message" = "[chosen_promo_message] [pick(code_messages)]: [coupon_code][expires_in ? " (EXPIRES IN [uppertext(DisplayTimeText(expires_in))])" : ""].",
|
|
"targets" = targets,
|
|
"automated" = TRUE,
|
|
))
|
|
|
|
signal.send_to_receivers()
|
|
|
|
next_discount = world.time + rand(3, 5) MINUTES
|
|
|
|
|
|
///Finds all downloadable programs and adds them to their respective downloadable list.
|
|
/datum/controller/subsystem/modular_computers/proc/build_software_lists()
|
|
for(var/datum/computer_file/program/prog as anything in subtypesof(/datum/computer_file/program))
|
|
// Has no TGUI file so is not meant to be a downloadable thing.
|
|
if(!initial(prog.tgui_id) || !initial(prog.filename))
|
|
continue
|
|
prog = new prog
|
|
|
|
if(prog.program_flags & PROGRAM_ON_NTNET_STORE)
|
|
available_station_software.Add(prog)
|
|
if(prog.program_flags & PROGRAM_ON_SYNDINET_STORE)
|
|
available_antag_software.Add(prog)
|
|
|
|
///Attempts to find a new file through searching the available stores with its name.
|
|
/datum/controller/subsystem/modular_computers/proc/find_ntnet_file_by_name(filename)
|
|
for(var/datum/computer_file/program/programs as anything in available_station_software + available_antag_software)
|
|
if(filename == programs.filename)
|
|
return programs
|
|
return null
|
|
|
|
///Attempts to find a chatorom using the ID of the channel.
|
|
/datum/controller/subsystem/modular_computers/proc/get_chat_channel_by_id(id)
|
|
for(var/datum/ntnet_conversation/chan as anything in chat_channels)
|
|
if(chan.id == id)
|
|
return chan
|
|
return null
|
|
|
|
/**
|
|
* Records a message into the station logging system for the network
|
|
* Arguments:
|
|
* * log_string - The message being logged
|
|
*/
|
|
/datum/controller/subsystem/modular_computers/proc/add_log(log_string)
|
|
var/list/log_text = list()
|
|
log_text += "\[[round_timestamp()]\]"
|
|
log_text += "*SYSTEM* - "
|
|
log_text += log_string
|
|
log_string = log_text.Join()
|
|
|
|
modpc_logs.Add(log_string)
|
|
|
|
// We have too many logs, remove the oldest entries until we get into the limit
|
|
if(modpc_logs.len > MAX_LOG_COUNT)
|
|
modpc_logs = modpc_logs.Copy(modpc_logs.len - MAX_LOG_COUNT, 0)
|
|
|
|
/**
|
|
* Removes all station logs and leaves it with an alert that it's been wiped.
|
|
*/
|
|
/datum/controller/subsystem/modular_computers/proc/purge_logs()
|
|
modpc_logs = list()
|
|
add_log("-!- LOGS DELETED BY SYSTEM OPERATOR -!-")
|
|
|
|
/**
|
|
* Returns a name which a /datum/picture can be assigned to.
|
|
* Use this function to get asset names and to avoid cache duplicates/overwriting.
|
|
*/
|
|
/datum/controller/subsystem/modular_computers/proc/get_next_picture_name()
|
|
var/next_uid = next_picture_id
|
|
next_picture_id++
|
|
return "ntos_picture_[next_uid].png"
|
|
|
|
#undef MAX_LOG_COUNT
|