mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-23 07:05:13 +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>
197 lines
8.3 KiB
Plaintext
197 lines
8.3 KiB
Plaintext
///defined truthy result for `handle_unique_ai()`, which makes initialize return INITIALIZE_HINT_QDEL
|
|
#define SHOULD_QDEL_MODULE 1
|
|
|
|
/obj/item/ai_module
|
|
name = "\improper AI module"
|
|
icon = 'icons/obj/devices/circuitry_n_data.dmi'
|
|
icon_state = "std_mod"
|
|
inhand_icon_state = "electronic"
|
|
lefthand_file = 'icons/mob/inhands/items/devices_lefthand.dmi'
|
|
righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi'
|
|
desc = "An AI Module for programming laws to an AI."
|
|
obj_flags = CONDUCTS_ELECTRICITY
|
|
force = 5
|
|
w_class = WEIGHT_CLASS_SMALL
|
|
throwforce = 0
|
|
throw_speed = 3
|
|
throw_range = 7
|
|
custom_materials = list(/datum/material/gold = SMALL_MATERIAL_AMOUNT * 0.5)
|
|
/// This is where our laws get put at for the module
|
|
var/list/laws = list()
|
|
/// Used to skip laws being checked (for reset & remove boards that have no laws)
|
|
var/bypass_law_amt_check = FALSE
|
|
|
|
/obj/item/ai_module/Initialize(mapload)
|
|
. = ..()
|
|
if(mapload && HAS_TRAIT(SSstation, STATION_TRAIT_UNIQUE_AI) && is_station_level(z))
|
|
var/delete_module = handle_unique_ai()
|
|
if(delete_module)
|
|
return INITIALIZE_HINT_QDEL
|
|
|
|
/obj/item/ai_module/examine(mob/user as mob)
|
|
. = ..()
|
|
var/examine_laws = display_laws()
|
|
if(examine_laws)
|
|
. += "\n" + examine_laws
|
|
|
|
/obj/item/ai_module/attack_self(mob/user as mob)
|
|
..()
|
|
to_chat(user, boxed_message(display_laws()))
|
|
|
|
/// Returns a text display of the laws for the module.
|
|
/obj/item/ai_module/proc/display_laws()
|
|
// Used to assemble the laws to show to an examining user.
|
|
var/assembled_laws = ""
|
|
|
|
if(laws.len)
|
|
assembled_laws += "<B>Programmed Law[(laws.len > 1) ? "s" : ""]:</B><br>"
|
|
for(var/law in laws)
|
|
assembled_laws += "\"[law]\"<br>"
|
|
|
|
return assembled_laws
|
|
|
|
///what this module should do if it is mapload spawning on a unique AI station trait round.
|
|
/obj/item/ai_module/proc/handle_unique_ai()
|
|
return SHOULD_QDEL_MODULE //instead of the roundstart bid to un-unique the AI, there will be a research requirement for it.
|
|
|
|
//The proc other things should be calling
|
|
/obj/item/ai_module/proc/install(datum/ai_laws/law_datum, mob/user)
|
|
if(!bypass_law_amt_check && (!laws.len || laws[1] == "")) //So we don't loop trough an empty list and end up with runtimes.
|
|
to_chat(user, span_warning("ERROR: No laws found on board."))
|
|
return
|
|
|
|
var/overflow = FALSE
|
|
//Handle the lawcap
|
|
if(law_datum)
|
|
var/tot_laws = 0
|
|
var/included_lawsets = list(law_datum.supplied, law_datum.ion, law_datum.hacked, laws)
|
|
|
|
// if the ai module is a core module we don't count inherent laws since they will be replaced
|
|
// however the freeformcore doesn't replace inherent laws so we check that too
|
|
if(!istype(src, /obj/item/ai_module/core) || istype(src, /obj/item/ai_module/core/freeformcore))
|
|
included_lawsets += list(law_datum.inherent)
|
|
|
|
for(var/lawlist in included_lawsets)
|
|
for(var/mylaw in lawlist)
|
|
if(mylaw != "")
|
|
tot_laws++
|
|
|
|
if(tot_laws > CONFIG_GET(number/silicon_max_law_amount) && !bypass_law_amt_check)//allows certain boards to avoid this check, eg: reset
|
|
to_chat(user, span_alert("Not enough memory allocated to [law_datum.owner ? law_datum.owner : "the AI core"]'s law processor to handle this amount of laws."))
|
|
message_admins("[ADMIN_LOOKUPFLW(user)] tried to upload laws to [law_datum.owner ? ADMIN_LOOKUPFLW(law_datum.owner) : "an AI core"] that would exceed the law cap.")
|
|
log_silicon("[key_name(user)] tried to upload laws to [law_datum.owner ? key_name(law_datum.owner) : "an AI core"] that would exceed the law cap.")
|
|
overflow = TRUE
|
|
|
|
var/law2log = transmitInstructions(law_datum, user, overflow) //Freeforms return something extra we need to log
|
|
if(law_datum.owner)
|
|
to_chat(user, span_notice("Upload complete. [law_datum.owner]'s laws have been modified."))
|
|
law_datum.owner.law_change_counter++
|
|
else
|
|
to_chat(user, span_notice("Upload complete."))
|
|
|
|
var/time = round_timestamp()
|
|
var/ainame = law_datum.owner ? law_datum.owner.name : "empty AI core"
|
|
var/aikey = law_datum.owner ? law_datum.owner.ckey : "null"
|
|
|
|
//affected cyborgs are cyborgs linked to the AI with lawsync enabled
|
|
var/affected_cyborgs = list()
|
|
var/list/borg_txt = list()
|
|
var/list/borg_flw = list()
|
|
if(isAI(law_datum.owner))
|
|
var/mob/living/silicon/ai/owner = law_datum.owner
|
|
for(var/mob/living/silicon/robot/owned_borg as anything in owner.connected_robots)
|
|
if(owned_borg.connected_ai && owned_borg.lawupdate)
|
|
affected_cyborgs += owned_borg
|
|
borg_flw += "[ADMIN_LOOKUPFLW(owned_borg)], "
|
|
borg_txt += "[owned_borg.name]([owned_borg.key]), "
|
|
|
|
borg_txt = borg_txt.Join()
|
|
GLOB.lawchanges.Add("[time] <B>:</B> [user.name]([user.key]) used [src.name] on [ainame]([aikey]).[law2log ? " The law specified [law2log]" : ""], [length(affected_cyborgs) ? ", impacting synced borgs [borg_txt]" : ""]")
|
|
log_silicon("LAW: [key_name(user)] used [src.name] on [key_name(law_datum.owner)] from [AREACOORD(user)].[law2log ? " The law specified [law2log]" : ""], [length(affected_cyborgs) ? ", impacting synced borgs [borg_txt]" : ""]")
|
|
message_admins("[ADMIN_LOOKUPFLW(user)] used [src.name] on [ADMIN_LOOKUPFLW(law_datum.owner)] from [AREACOORD(user)].[law2log ? " The law specified [law2log]" : ""] , [length(affected_cyborgs) ? ", impacting synced borgs [borg_flw.Join()]" : ""]")
|
|
if(law_datum.owner)
|
|
deadchat_broadcast("<b> changed [span_name("[ainame]")]'s laws at [get_area_name(user, TRUE)].</b>", span_name("[user]"), follow_target=user, message_type=DEADCHAT_LAWCHANGE)
|
|
|
|
//The proc that actually changes the silicon's laws.
|
|
/obj/item/ai_module/proc/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow = FALSE)
|
|
if(law_datum.owner)
|
|
to_chat(law_datum.owner, span_userdanger("[sender] has uploaded a change to the laws you must follow using a [name]."))
|
|
|
|
/obj/item/ai_module/core
|
|
desc = "An AI Module for programming core laws to an AI."
|
|
|
|
/obj/item/ai_module/core/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow)
|
|
for(var/templaw in laws)
|
|
if(law_datum.owner)
|
|
if(!overflow)
|
|
law_datum.owner.add_inherent_law(templaw)
|
|
else
|
|
law_datum.owner.replace_random_law(templaw, list(LAW_INHERENT, LAW_SUPPLIED), LAW_INHERENT)
|
|
else
|
|
if(!overflow)
|
|
law_datum.add_inherent_law(templaw)
|
|
else
|
|
law_datum.replace_random_law(templaw, list(LAW_INHERENT, LAW_SUPPLIED), LAW_INHERENT)
|
|
|
|
/obj/item/ai_module/core/full
|
|
var/law_id // if non-null, loads the laws from the ai_laws datums
|
|
|
|
/obj/item/ai_module/core/full/Initialize(mapload)
|
|
. = ..()
|
|
if(!law_id)
|
|
return
|
|
var/lawtype = lawid_to_type(law_id)
|
|
if(!lawtype)
|
|
return
|
|
var/datum/ai_laws/core_laws = new lawtype
|
|
laws = core_laws.inherent
|
|
|
|
/obj/item/ai_module/core/full/transmitInstructions(datum/ai_laws/law_datum, mob/sender, overflow) //These boards replace inherent laws.
|
|
if(law_datum.owner)
|
|
law_datum.owner.clear_inherent_laws()
|
|
law_datum.owner.clear_zeroth_law(0)
|
|
else
|
|
law_datum.clear_inherent_laws()
|
|
law_datum.clear_zeroth_law(0)
|
|
..()
|
|
|
|
/obj/item/ai_module/core/full/handle_unique_ai()
|
|
var/datum/ai_laws/default_laws = get_round_default_lawset()
|
|
if(law_id == initial(default_laws.id))
|
|
return
|
|
return SHOULD_QDEL_MODULE
|
|
|
|
/obj/effect/spawner/round_default_module
|
|
name = "ai default lawset spawner"
|
|
icon = 'icons/hud/screen_gen.dmi'
|
|
icon_state = "x2"
|
|
color = COLOR_VIBRANT_LIME
|
|
|
|
/obj/effect/spawner/round_default_module/Initialize(mapload)
|
|
. = ..()
|
|
var/datum/ai_laws/default_laws = get_round_default_lawset()
|
|
//try to spawn a law board, since they may have special functionality (asimov setting subjects)
|
|
for(var/obj/item/ai_module/core/full/potential_lawboard as anything in subtypesof(/obj/item/ai_module/core/full))
|
|
if(initial(potential_lawboard.law_id) != initial(default_laws.id))
|
|
continue
|
|
potential_lawboard = new potential_lawboard(loc)
|
|
return
|
|
//spawn the fallback instead
|
|
new /obj/item/ai_module/core/round_default_fallback(loc)
|
|
|
|
///When the default lawset spawner cannot find a module object to spawn, it will spawn this, and this sets itself to the round default.
|
|
///This is so /datum/lawsets can be picked even if they have no module for themselves.
|
|
/obj/item/ai_module/core/round_default_fallback
|
|
|
|
/obj/item/ai_module/core/round_default_fallback/Initialize(mapload)
|
|
. = ..()
|
|
var/datum/ai_laws/default_laws = get_round_default_lawset()
|
|
default_laws = new default_laws()
|
|
name = "'[default_laws.name]' Core AI Module"
|
|
laws = default_laws.inherent
|
|
|
|
/obj/item/ai_module/core/round_default_fallback/handle_unique_ai()
|
|
return
|
|
|
|
#undef SHOULD_QDEL_MODULE
|