Files
Bubberstation/code/modules/client/verbs/who.dm
MrMelbert 4c277dc572 Dynamic Rework (#91290)
## About The Pull Request

Implements https://hackmd.io/@tgstation/SkeUS7lSp , rewriting Dynamic
from the ground-up

- Dynamic configuration is now vastly streamlined, making it far far far
easier to understand and edit

- Threat is gone entirely; round chaos is now determined by dynamic
tiers
   - There's 5 dynamic tiers, 0 to 4.
      - 0 is a pure greenshift.
- Tiers are just picked via weight - "16% chance of getting a high chaos
round".
- Tiers have min pop ranges. "Tier 4 (high chaos) requires 25 pop to be
selected".
- Tier determines how much of every ruleset is picked. "Tier 4 (High
Chaos) will pick 3-4 roundstart[1], 1-2 light, 1-2 heavy, and 2-3
latejoins".
- The number of rulesets picked depends on how many people are in the
server - this is also configurable[2]. As an example, a tier that
demands "1-3" rulesets will not spawn 3 rulesets if population <= 40 and
will not spawn 2 rulesets if population <= 25.
- Tiers also determine time before light, heavy, and latejoin rulesets
are picked, as well as the cooldown range between spawns. More chaotic
tiers may send midrounds sooner or wait less time between sending them.

- On the ruleset side of things, "requirements", "scaling", and
"enemies" is gone.
- You can configure a ruleset's min pop and weight flat, or per tier.
- For example a ruleset like Obsession is weighted higher for tiers 1-2
and lower for tiers 3-4.
- Rather than scaling up, roundstart rulesets can just be selected
multiple times.
- Rulesets also have `min_antag_cap` and `max_antag_cap`.
`min_antag_cap` determines how many candidates are needed for it to run,
and `max_antag_cap` determines how many candidates are selected.

- Rulesets attempt to run every 2.5 minutes. [3]

- Light rulesets will ALWAYS be picked before heavy rulesets. [4]

- Light injection chance is no longer 100%, heavy injection chance
formula has been simplified.
- Chance simply scales based on number of dead players / total number
off players, with a flag 50% chance if no antags exist. [5]

[1] This does not guarantee you will actually GET 3-4 roundstart
rulesets. If a roundstart ruleset is picked, and it ends up being unable
to execute (such as "not enough candidates", that slot is effectively a
wash.) This might be revisited.

[2] Currently, this is a hard limit - below X pop, you WILL get a
quarter or a half of the rulesets. This might be revisited to just be
weighted - you are just MORE LIKELY to get a quarter or a half.

[3] Little worried about accidentally frontloading everything so we'll
see about this

[4] This may be revisited but in most contexts it seems sensible. 

[5] This may also be revisited, I'm not 100% sure what the best / most
simple way to tackle midround chances is.

Other implementation details

- The process of making rulesets has been streamlined as well. Many
rulesets only amount to a definition and `assign_role`.

- Dynamic.json -> Dynamic.toml

- Dynamic event hijacked was ripped out entirely.
- Most midround antag random events are now dynamic rulesets. Fugitives,
Morphs, Slaughter Demons, etc.
      - The 1 weight slaughter demon event is gone. RIP in peace. 
- There is now a hidden midround event that simply adds +1 latejoin, +1
light, or +1 heavy ruleset.

- `mind.special_role` is dead. Minds have a lazylist of special roles
now but it's essentially only used for traitor panel.

- Revs refactored almost entirely. Revs can now exist without a dynamic
ruleset.

- Cult refactored a tiny bit. 

- Antag datums cleaned up.

- Pre round setup is less centralized on Dynamic.

- Admins have a whole panel for interfacing with dynamic. It's pretty
slapdash I'm sure someone could make a nicer looking one.


![image](https://github.com/user-attachments/assets/e99ca607-20b0-4d30-ab4a-f602babe7ac7)


![image](https://github.com/user-attachments/assets/470c3c20-c354-4ee6-b63b-a8f36dda4b5c)

- Maybe some other things.

## Why It's Good For The Game

See readme for more info.

Will you see a massive change in how rounds play out? My hunch says
rounds will spawn less rulesets on average, but it's ultimately to how
it's configured

## Changelog

🆑 Melbert
refactor: Dynamic rewritten entirely, report any strange rounds
config: Dynamic config reworked, it's now a TOML file
refactor: Refactored antag roles somewhat, report any oddities
refactor: Refactored Revolution entirely, report any oddities
del: Deleted most midround events that spawn antags - they use dynamic
rulesets now
add: Dynamic rulesets can now be false alarms
add: Adds a random event that gives dynamic the ability to run another
ruleset later
admin: Adds a panel for messing around with dynamic
admin: Adds a panel for chance for every dynamic ruleset to be selected
admin: You can spawn revs without using dynamic now
fix: Nuke team leaders get their fun title back
/🆑
2025-06-25 17:36:10 -07:00

167 lines
5.9 KiB
Plaintext

#define DEFAULT_WHO_CELLS_PER_ROW 4
#define NO_ADMINS_ONLINE_MESSAGE "Adminhelps are also sent through TGS to services like IRC and Discord. If no admins are available in game, sending an adminhelp might still be noticed and responded to."
/client/verb/who()
set name = "Who"
set category = "OOC"
var/msg = ""
var/list/Lines = list()
var/columns_per_row = DEFAULT_WHO_CELLS_PER_ROW
if(holder)
if (check_rights(R_ADMIN,0) && isobserver(src.mob))//If they have +ADMIN and are a ghost they can see players IC names and statuses.
columns_per_row = 1
var/mob/dead/observer/G = src.mob
if(!G.started_as_observer)//If you aghost to do this, KorPhaeron will deadmin you in your sleep.
log_admin("[key_name(usr)] checked advanced who in-round")
for(var/client/client in GLOB.clients)
var/entry = "\t[client.key]"
if(client.holder && client.holder.fakekey)
entry += " <i>(as [client.holder.fakekey])</i>"
if (isnewplayer(client.mob))
entry += " - <font color='darkgray'><b>In Lobby</b></font>"
else
entry += " - Playing as [client.mob.real_name]"
switch(client.mob.stat)
if(UNCONSCIOUS, HARD_CRIT)
entry += " - <font color='darkgray'><b>Unconscious</b></font>"
if(DEAD)
if(isobserver(client.mob))
var/mob/dead/observer/O = client.mob
if(O.started_as_observer)
entry += " - <font color='gray'>Observing</font>"
else
entry += " - <font color='black'><b>DEAD</b></font>"
else
entry += " - <font color='black'><b>DEAD</b></font>"
if(client.mob.is_antag())
entry += " - <b><font color='red'>Antagonist</font></b>"
entry += " [ADMIN_QUE(client.mob)]"
entry += " ([round(client.avgping, 1)]ms)"
Lines += entry
else//If they don't have +ADMIN, only show hidden admins
for(var/client/client in GLOB.clients)
var/entry = "[client.key]"
if(client.holder && client.holder.fakekey)
entry += " <i>(as [client.holder.fakekey])</i>"
entry += " ([round(client.avgping, 1)]ms)"
Lines += entry
else
for(var/client/client in GLOB.clients)
if(client.holder && client.holder.fakekey)
Lines += "[client.holder.fakekey] ([round(client.avgping, 1)]ms)"
else
Lines += "[client.key] ([round(client.avgping, 1)]ms)"
var/num_lines = 0
msg += "<table style='width: 100%; table-layout: fixed'><tr>"
for(var/line in sort_list(Lines))
msg += "<td>[line]</td>"
num_lines += 1
if (num_lines == columns_per_row)
num_lines = 0
msg += "</tr><tr>"
msg += "</tr></table>"
msg += "<b>Total Players: [length(Lines)]</b>"
to_chat(src, fieldset_block(span_bold("Current Players"), span_infoplain(msg), "boxed_message"), type = MESSAGE_TYPE_INFO)
/client/verb/adminwho()
set category = "Admin"
set name = "Adminwho"
var/list/lines = list()
var/payload_string = generate_adminwho_string()
var/header = (payload_string == NO_ADMINS_ONLINE_MESSAGE) ? "No Admins Currently Online" : "Current Admins"
lines += span_bold(header)
lines += payload_string
to_chat(src, fieldset_block(span_bold(header), jointext(lines, "\n"), "boxed_message"), type = MESSAGE_TYPE_INFO)
/// Proc that generates the applicable string to dispatch to the client for adminwho.
/client/proc/generate_adminwho_string()
var/list/list_of_admins = get_list_of_admins()
if(isnull(list_of_admins))
return NO_ADMINS_ONLINE_MESSAGE
var/list/message_strings = list()
if(isnull(holder))
message_strings += get_general_adminwho_information(list_of_admins)
message_strings += NO_ADMINS_ONLINE_MESSAGE
else
message_strings += get_sensitive_adminwho_information(list_of_admins)
return jointext(message_strings, "\n")
/// Proc that returns a list of cliented admins. Remember that this list can contain nulls!
/// Also, will return null if we don't have any admins.
/proc/get_list_of_admins()
var/returnable_list = list()
for(var/client/admin in GLOB.admins)
returnable_list += admin
if(length(returnable_list) == 0)
return null
return returnable_list
/// Proc that will return the applicable display name, linkified or not, based on the input client reference.
/proc/get_linked_admin_name(client/admin)
var/feedback_link = admin.holder.feedback_link()
return isnull(feedback_link) ? admin : "<a href=[feedback_link]>[admin]</a>"
/// Proc that gathers adminwho information for a general player, which will only give information if an admin isn't AFK, and handles potential fakekeying.
/// Will return a list of strings.
/proc/get_general_adminwho_information(list/checkable_admins)
var/returnable_list = list()
for(var/client/admin in checkable_admins)
if(admin.is_afk() || !isnull(admin.holder.fakekey))
continue //Don't show afk or fakekeyed admins to adminwho
returnable_list += "• [get_linked_admin_name(admin)] is a [admin.holder.rank_names()]"
return returnable_list
/// Proc that gathers adminwho information for admins, which will contain information on if the admin is AFK, readied to join, etc. Only arg is a list of clients to use.
/// Will return a list of strings.
/proc/get_sensitive_adminwho_information(list/checkable_admins)
var/returnable_list = list()
for(var/client/admin in checkable_admins)
var/list/admin_strings = list()
admin_strings += "• [get_linked_admin_name(admin)] is a [admin.holder.rank_names()]"
if(admin.holder.fakekey)
admin_strings += "<i>(as [admin.holder.fakekey])</i>"
if(isobserver(admin.mob))
admin_strings += "- Observing"
else if(isnewplayer(admin.mob))
if(SSticker.current_state <= GAME_STATE_PREGAME)
var/mob/dead/new_player/lobbied_admin = admin.mob
if(lobbied_admin.ready == PLAYER_READY_TO_PLAY)
admin_strings += "- Lobby (Readied)"
else
admin_strings += "- Lobby (Not Readied)"
else
admin_strings += "- Lobby"
else
admin_strings += "- Playing"
if(admin.is_afk())
admin_strings += "(AFK)"
returnable_list += jointext(admin_strings, " ")
return returnable_list
#undef DEFAULT_WHO_CELLS_PER_ROW
#undef NO_ADMINS_ONLINE_MESSAGE