Files
Bubberstation/code/modules/admin/admin_verbs.dm
Timberpoes 6808a082eb Assorted changes to job assignment code and logging. Runtime free, guaranteed or your money back. Price: $£0. (#85947)
## About The Previous Pull Request

#85308 reverted by #85929


![image](https://github.com/user-attachments/assets/e7518dcb-a60a-4bf1-a3d4-a5a8966d8633)

~~Causes the round to not start when a player isn't eligible for any
jobs at a specific priority level due to runtimes trying to `pick()`
from an empty list aborting the entire job assignment stack.~~
(Fixed???? by
e0e9f2f430)

Maybe we should test merge this for a mo just to make sure no more
cheeky runtimes pop up before merging.

## About The Pull Request

This PR does a couple of minor things:
Makes the job debug logging a bit easier to follow.
Minorly brings some SSjob code up to code standards, converting proc
names to snake_case and doing some otherm is cleanup.
Refactored some stuff into different procs, updated some comments.

And some major things:
Changes the job assignment logic.
Old behaviour
> Assign dynamic priority roles
> Force one Head of Staff (if possible)
> Assign all AIs
> Assign overflow roles (bugged in 2 ways)
> Shuffle the available jobs list once, at the start of the random job
assignment loop
> Pick and assign random jobs for random players from High prefs down,
with a priority on Head of Staff roles
> Handle everyone that couldn't be assigned a random job

New behaviour
> Assign dynamic priority roles
> Assign all Head of Staff roles to players with High prefs
> If no Head of Staff was made in the above way, force one Head of Staff
(if possible)
> Assign all AIs
> Assign overflow roles (fixed)
> Prioritise and fill unfilled head roles at each job priority pref
level, from High prefs down.
> Build a list of all jobs that each unassigned player could be eligible
for at the above pref level.
> Pick a job from that list at random and assign it to the player.
> Handle everyone that couldn't be assigned a random job.

In reality there should be little impact on overall job assignment, the
code changes read more as semantics. For example, the priority check for
filling Head slots will have the same candidate pool in both old and new
versions, but in the new version we're more clearly saying that Heads
are important and we want to prioritise filling them for the sake of
round progression even though the outcome in new and old is the same.

A key change will lead to an increase in assistants - Overflow fixes.

Currently the code block to do early assignments to the Overflow role
doesn't work - or works but not as you'd expect. The idea was is that
because enabling the Overflow role in the prefs menu is an On/Off toggle
that sets the job to High priority when enabled and prevents any other
High priority pref, players that have the Overflow role enabled will
**always** get it. It's their highest priority job with infinite slots.
So we do a pass right at the start to give everyone with the Overflow
role enabled that role and save us wasting time later on in random job
code giving them that same role but with more work.

The problem is the code for this only assigns the Overflow role to
people with it set to Low priority in their prefs, resulting in log
readouts like:
```
[2024-07-27 09:49:43.469] DEBUG-JOB: DO, Running Overflow Check 1
[2024-07-27 09:49:43.469] DEBUG-JOB: Running FOC, Job: /datum/job/assistant, Level: Low Priority
[2024-07-27 09:49:43.472] DEBUG-JOB: FOC player job enabled at wrong level, Player: Radioprague, TheirLevel: Medium Priority, ReqLevel: Low Priority
[2024-07-27 09:49:43.472] DEBUG-JOB: FOC player job enabled at wrong level, Player: Caluan, TheirLevel: High Priority, ReqLevel: Low Priority
[2024-07-27 09:49:43.473] DEBUG-JOB: FOC player job enabled at wrong level, Player: Caractaser, TheirLevel: High Priority, ReqLevel: Low Priority
[2024-07-27 09:49:43.473] DEBUG-JOB: FOC player job enabled at wrong level, Player: Apsua, TheirLevel: High Priority, ReqLevel: Low Priority
[2024-07-27 09:49:43.475] DEBUG-JOB: FOC player job enabled at wrong level, Player: Bebrus2, TheirLevel: Medium Priority, ReqLevel: Low Priority
[2024-07-27 09:49:43.475] DEBUG-JOB: AC1, Candidates: 0
```
Where nobody gets pre-assigned the overflow role because their prefs are
all set to the High priority from being toggled... Except wait a second,
some people have it at Medium priority when it should just be a No
Role/High Priority Role toggle?

And herein we meet a problem. My hypothesis is that traits and stuff
that change the overflow have allowed players to set the "ordinary"
overflow role of Assistant to Medium and/or Low priority.

This still shows as enabled in the prefs menu, but leads to an outcome
where a player with assistant enabled is assigned Cook instead.
```
[2024-07-27 09:49:47.775] DEBUG-JOB: DO, Running Overflow Check 1
[2024-07-27 09:49:47.775] DEBUG-JOB: Running FOC, Job: /datum/job/assistant, Level: Low Priority
...
[2024-07-27 09:49:43.475] DEBUG-JOB: FOC player job enabled at wrong level, Player: Bebrus2, TheirLevel: Medium Priority, ReqLevel: Low Priority
...
[2024-07-27 09:49:47.987] DEBUG-JOB: Running AR, Player: Bebrus2, Job: /datum/job/cook, LateJoin: 0
```

So players with the Overflow job pref set to Low (an unexpected state,
should be disabled or High) would be guaranteed to get that role if none
of the higher priority Head of Staff/AI/Dynamic roles took over via the
bugged "force overflow for people with the pref enabled" proc.

Players with the Overflow job pref set to High would be guaranteed to
get that role if none of the higher priority Head of Staff/AI/Dynamic
roles took over via the random job assignment code giving them their
Highest priority role thanks to the infinite job slots of the Overflow.

And players with the Overflow job pref set to Medium (an unexpected
state, should be disabled or High) would get Assistant if the shuffle
step of the available jobs list put Assisstant before any of the other
jobs they had prefs enabled for at Medium that weren't already filled,
otherwise they'd get another random job.

This code is now changed to ignore the priority the player has set when
looking for people to fill the overflow role. As long as it **is**
enabled, the player will get it unless they're forced into a dynamic
ruleset role (AI when malf rolls) or a Head of Staff role due to their
other prefs (they have RD set to med or low, and no other player has a
Head of Staff at high so they get randomly picked and miss the overflow
role).

This will increase the number of assistants in shifts where their pref
state has Assisstant in the bugged Medium priority, but doesn't change
it for bugged Low and not-bugged High/On priority.

On the other side of the coin, we have how the random jobs are picked.
They're kinda not random, and I noticed this reading the logs then
reading the code.

The list of available jobs to pick from is randomly shuffled - but only
**once**. All players pull from a list of jobs in the same order. So you
end up with a log block like this:
```
[2024-07-27 09:49:47.985] DEBUG-JOB: DO pass, Player: Pierow, Level:3, Job:Botanist
[2024-07-27 09:49:47.985] DEBUG-JOB: Running AR, Player: Pierow, Job: /datum/job/botanist, LateJoin: 0
[2024-07-27 09:49:47.985] DEBUG-JOB: Player: Pierow is now Rank: Botanist, JCP:0, JPL:2
[2024-07-27 09:49:47.986] DEBUG-JOB: DO pass, Player: Daddos, Level:3, Job:Botanist
[2024-07-27 09:49:47.986] DEBUG-JOB: Running AR, Player: Daddos, Job: /datum/job/botanist, LateJoin: 0
[2024-07-27 09:49:47.986] DEBUG-JOB: Player: Daddos is now Rank: Botanist, JCP:1, JPL:2
[2024-07-27 09:49:47.986] DEBUG-JOB: FOC job filled and not overflow, Player: Bebrus2, Job: /datum/job/botanist, Current: 2, Limit: 2
[2024-07-27 09:49:47.987] DEBUG-JOB: FOC player job not enabled, Player: Bebrus2
[2024-07-27 09:49:47.987] DEBUG-JOB: DO pass, Player: Bebrus2, Level:3, Job:Cook
[2024-07-27 09:49:47.987] DEBUG-JOB: Running AR, Player: Bebrus2, Job: /datum/job/cook, LateJoin: 0
[2024-07-27 09:49:47.988] DEBUG-JOB: Player: Bebrus2 is now Rank: Cook, JCP:0, JPL:1
[2024-07-27 09:49:47.988] DEBUG-JOB: FOC player job not enabled, Player: Redwizz
[2024-07-27 09:49:47.988] DEBUG-JOB: FOC job filled and not overflow, Player: Redwizz, Job: /datum/job/cook, Current: 1, Limit: 1
```

The list is shuffled into an order of something like `list("Scientist",
"Botanist", "Cook", "Sec Officer", ...)` then iterated over for each
player. So every random job selection goes:
> "Does Player1 have Scientist enabled and at the right priority? No?
Okay, Botanist? Yes? You get botanist."
> "Does Player2 have Scientist enabled and at the right priority? No?
Okay, Botanist? Yes? You get botanist."
> "Does Player3 have Scientist enabled and at the right priority? No?
Okay, Botanist has no slots left so we'll remove it from the list. Okay,
Cook? Yes? You get cook."
> "Does Player4 have Scientist enabled and at the right priority? No?
Okay, Cook has no slots left so we'll remove it from the list. Okay, Sec
Officer? ..."

This can lead to stacked individual departments if it gets randomly
rolled to the start of the list in the shuffle, and completely empty
departments if they end up at the end.

On high pop shifts this is probably less of an issue. Player prefs add
noise to this and as departments at the front fill up, those at the back
pick up some of the lower pref players.

But have you ever had a shift where there's just like... No fucking sec
even though there's tons of players? The logging (before I made changes
in this PR) was a bit ass, but my hypothesis there is that sec officer
was shuffled right at the end of the random job list, so every other
department was filled up before sec officers were picked.

To mitigate this, I made the list shuffle every single time the game
picks a random available job for the player. This should lead to a more
balanced selection of available jobs by avoiding situations where the
code is biased towards packing some departments by accident.
## Why It's Good For The Game

Overflow fixes mean people who go to their prefs and see the Overflow
Role is On will all have the same experience - They will be the Overflow
role.

More random random job selection should prevent individual departments
having a jobs be stacked when it would have otherwise been possible for
a more balanced selection but the code unintentially biased random
departments to be overstaffed and understaffed each shift.
## Changelog
🆑
fix: Having the Overflow Role set to On will properly ensure you get
that role at a High priority as intended by the game code.
fix: Job selection is now a little bit more random. Fixes an
unintentional bias in random job assignment that could lead to
feast-or-famine for roles where everyone is assigned one job and nobody
is assigned another job.
/🆑
2024-09-13 13:58:35 +02:00

667 lines
30 KiB
Plaintext

/client/proc/add_admin_verbs()
control_freak = CONTROL_FREAK_SKIN | CONTROL_FREAK_MACROS
SSadmin_verbs.assosciate_admin(src)
/client/proc/remove_admin_verbs()
control_freak = initial(control_freak)
SSadmin_verbs.deassosciate_admin(src)
ADMIN_VERB(hide_verbs, R_NONE, "Adminverbs - Hide All", "Hide most of your admin verbs.", ADMIN_CATEGORY_MAIN)
user.remove_admin_verbs()
add_verb(user, /client/proc/show_verbs)
to_chat(user, span_interface("Almost all of your adminverbs have been hidden."), confidential = TRUE)
BLACKBOX_LOG_ADMIN_VERB("Hide All Adminverbs")
ADMIN_VERB(admin_ghost, R_ADMIN, "AGhost", "Become a ghost without DNR.", ADMIN_CATEGORY_GAME)
. = TRUE
if(isobserver(user.mob))
//re-enter
var/mob/dead/observer/ghost = user.mob
if(!ghost.mind || !ghost.mind.current) //won't do anything if there is no body
return FALSE
if(!ghost.can_reenter_corpse)
log_admin("[key_name(user)] re-entered corpse")
message_admins("[key_name_admin(user)] re-entered corpse")
ghost.can_reenter_corpse = 1 //force re-entering even when otherwise not possible
ghost.reenter_corpse()
BLACKBOX_LOG_ADMIN_VERB("Admin Reenter")
else if(isnewplayer(user.mob))
to_chat(user, "<font color='red'>Error: Aghost: Can't admin-ghost whilst in the lobby. Join or Observe first.</font>", confidential = TRUE)
return FALSE
else
//ghostize
log_admin("[key_name(user)] admin ghosted.")
message_admins("[key_name_admin(user)] admin ghosted.")
var/mob/body = user.mob
body.ghostize(TRUE)
user.init_verbs()
if(body && !body.key)
body.key = "@[user.key]" //Haaaaaaaack. But the people have spoken. If it breaks; blame adminbus
BLACKBOX_LOG_ADMIN_VERB("Admin Ghost")
ADMIN_VERB(invisimin, R_ADMIN, "Invisimin", "Toggles ghost-like invisibility.", ADMIN_CATEGORY_GAME)
if(HAS_TRAIT(user.mob, TRAIT_INVISIMIN))
REMOVE_TRAIT(user.mob, TRAIT_INVISIMIN, ADMIN_TRAIT)
user.mob.add_to_all_human_data_huds()
user.mob.RemoveInvisibility(INVISIBILITY_SOURCE_INVISIMIN)
to_chat(user, span_adminnotice(span_bold("Invisimin off. Invisibility reset.")), confidential = TRUE)
return
ADD_TRAIT(user.mob, TRAIT_INVISIMIN, ADMIN_TRAIT)
user.mob.remove_from_all_data_huds()
user.mob.SetInvisibility(INVISIBILITY_OBSERVER, INVISIBILITY_SOURCE_INVISIMIN, INVISIBILITY_PRIORITY_ADMIN)
to_chat(user, span_adminnotice(span_bold("Invisimin on. You are now as invisible as a ghost.")), confidential = TRUE)
ADMIN_VERB(check_antagonists, R_ADMIN, "Check Antagonists", "See all antagonists for the round.", ADMIN_CATEGORY_GAME)
user.holder.check_antagonists()
log_admin("[key_name(user)] checked antagonists.")
if(!isobserver(user.mob) && SSticker.HasRoundStarted())
message_admins("[key_name_admin(user)] checked antagonists.")
BLACKBOX_LOG_ADMIN_VERB("Check Antagonists")
ADMIN_VERB(list_bombers, R_ADMIN, "List Bombers", "Look at all bombs and their likely culprit.", ADMIN_CATEGORY_GAME)
user.holder.list_bombers()
BLACKBOX_LOG_ADMIN_VERB("List Bombers")
ADMIN_VERB(list_signalers, R_ADMIN, "List Signalers", "View all signalers.", ADMIN_CATEGORY_GAME)
user.holder.list_signalers()
BLACKBOX_LOG_ADMIN_VERB("List Signalers")
ADMIN_VERB(list_law_changes, R_ADMIN, "List Law Changes", "View all AI law changes.", ADMIN_CATEGORY_DEBUG)
user.holder.list_law_changes()
BLACKBOX_LOG_ADMIN_VERB("List Law Changes")
ADMIN_VERB(show_manifest, R_ADMIN, "Show Manifest", "View the shift's Manifest.", ADMIN_CATEGORY_DEBUG)
user.holder.show_manifest()
BLACKBOX_LOG_ADMIN_VERB("Show Manifest")
ADMIN_VERB(list_dna, R_ADMIN, "List DNA", "View DNA.", ADMIN_CATEGORY_DEBUG)
user.holder.list_dna()
BLACKBOX_LOG_ADMIN_VERB("List DNA")
ADMIN_VERB(list_fingerprints, R_ADMIN, "List Fingerprints", "View fingerprints.", ADMIN_CATEGORY_DEBUG)
user.holder.list_fingerprints()
BLACKBOX_LOG_ADMIN_VERB("List Fingerprints")
ADMIN_VERB(ban_panel, R_BAN, "Banning Panel", "Ban players here.", ADMIN_CATEGORY_MAIN)
user.holder.ban_panel()
BLACKBOX_LOG_ADMIN_VERB("Banning Panel")
ADMIN_VERB(unban_panel, R_BAN, "Unbanning Panel", "Unban players here.", ADMIN_CATEGORY_MAIN)
user.holder.unban_panel()
BLACKBOX_LOG_ADMIN_VERB("Unbanning Panel")
ADMIN_VERB(game_panel, R_ADMIN, "Game Panel", "Look at the state of the game.", ADMIN_CATEGORY_GAME)
user.holder.Game()
BLACKBOX_LOG_ADMIN_VERB("Game Panel")
ADMIN_VERB(poll_panel, R_POLL, "Server Poll Management", "View and manage polls.", ADMIN_CATEGORY_MAIN)
user.holder.poll_list_panel()
BLACKBOX_LOG_ADMIN_VERB("Server Poll Management")
/// Returns this client's stealthed ckey
/client/proc/getStealthKey()
return GLOB.stealthminID[ckey]
/// Takes a stealthed ckey as input, returns the true key it represents
/proc/findTrueKey(stealth_key)
if(!stealth_key)
return
for(var/potentialKey in GLOB.stealthminID)
if(GLOB.stealthminID[potentialKey] == stealth_key)
return potentialKey
/// Hands back a stealth ckey to use, guarenteed to be unique
/proc/generateStealthCkey()
var/guess = rand(0, 1000)
var/text_guess
var/valid_found = FALSE
while(valid_found == FALSE)
valid_found = TRUE
text_guess = "@[num2text(guess)]"
// We take a guess at some number, and if it's not in the existing stealthmin list we exit
for(var/key in GLOB.stealthminID)
// If it is in the list tho, we up one number, and redo the loop
if(GLOB.stealthminID[key] == text_guess)
guess += 1
valid_found = FALSE
break
return text_guess
/client/proc/createStealthKey()
GLOB.stealthminID["[ckey]"] = generateStealthCkey()
ADMIN_VERB(stealth, R_STEALTH, "Stealth Mode", "Toggle stealth.", ADMIN_CATEGORY_MAIN)
if(user.holder.fakekey)
user.disable_stealth_mode()
else
user.enable_stealth_mode()
BLACKBOX_LOG_ADMIN_VERB("Stealth Mode")
#define STEALTH_MODE_TRAIT "stealth_mode"
/client/proc/enable_stealth_mode()
var/new_key = ckeyEx(stripped_input(usr, "Enter your desired display name.", "Fake Key", key, 26))
if(!new_key)
return
holder.fakekey = new_key
createStealthKey()
if(isobserver(mob))
mob.SetInvisibility(INVISIBILITY_ABSTRACT, INVISIBILITY_SOURCE_STEALTHMODE, INVISIBILITY_PRIORITY_ADMIN)
mob.alpha = 0 //JUUUUST IN CASE
mob.name = " "
mob.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
ADD_TRAIT(mob, TRAIT_ORBITING_FORBIDDEN, STEALTH_MODE_TRAIT)
QDEL_NULL(mob.orbiters)
log_admin("[key_name(usr)] has turned stealth mode ON")
message_admins("[key_name_admin(usr)] has turned stealth mode ON")
/client/proc/disable_stealth_mode()
holder.fakekey = null
if(isobserver(mob))
mob.RemoveInvisibility(INVISIBILITY_SOURCE_STEALTHMODE)
mob.alpha = initial(mob.alpha)
if(mob.mind)
if(mob.mind.ghostname)
mob.name = mob.mind.ghostname
else
mob.name = mob.mind.name
else
mob.name = mob.real_name
mob.mouse_opacity = initial(mob.mouse_opacity)
REMOVE_TRAIT(mob, TRAIT_ORBITING_FORBIDDEN, STEALTH_MODE_TRAIT)
log_admin("[key_name(usr)] has turned stealth mode OFF")
message_admins("[key_name_admin(usr)] has turned stealth mode OFF")
#undef STEALTH_MODE_TRAIT
ADMIN_VERB(drop_bomb, R_FUN, "Drop Bomb", "Cause an explosion of varying strength at your location", ADMIN_CATEGORY_FUN)
var/list/choices = list("Small Bomb (1, 2, 3, 3)", "Medium Bomb (2, 3, 4, 4)", "Big Bomb (3, 5, 7, 5)", "Maxcap", "Custom Bomb")
var/choice = tgui_input_list(user, "What size explosion would you like to produce? NOTE: You can do all this rapidly and in an IC manner (using cruise missiles!) with the Config/Launch Supplypod verb. WARNING: These ignore the maxcap", "Drop Bomb", choices)
if(isnull(choice))
return
var/turf/epicenter = user.mob.loc
switch(choice)
if("Small Bomb (1, 2, 3, 3)")
explosion(epicenter, devastation_range = 1, heavy_impact_range = 2, light_impact_range = 3, flash_range = 3, adminlog = TRUE, ignorecap = TRUE, explosion_cause = user.mob)
if("Medium Bomb (2, 3, 4, 4)")
explosion(epicenter, devastation_range = 2, heavy_impact_range = 3, light_impact_range = 4, flash_range = 4, adminlog = TRUE, ignorecap = TRUE, explosion_cause = user.mob)
if("Big Bomb (3, 5, 7, 5)")
explosion(epicenter, devastation_range = 3, heavy_impact_range = 5, light_impact_range = 7, flash_range = 5, adminlog = TRUE, ignorecap = TRUE, explosion_cause = user.mob)
if("Maxcap")
explosion(epicenter, devastation_range = GLOB.MAX_EX_DEVESTATION_RANGE, heavy_impact_range = GLOB.MAX_EX_HEAVY_RANGE, light_impact_range = GLOB.MAX_EX_LIGHT_RANGE, flash_range = GLOB.MAX_EX_FLASH_RANGE, adminlog = TRUE, ignorecap = TRUE, explosion_cause = user.mob)
if("Custom Bomb")
var/range_devastation = input(user, "Devastation range (in tiles):") as null|num
if(range_devastation == null)
return
var/range_heavy = input(user, "Heavy impact range (in tiles):") as null|num
if(range_heavy == null)
return
var/range_light = input(user, "Light impact range (in tiles):") as null|num
if(range_light == null)
return
var/range_flash = input(user, "Flash range (in tiles):") as null|num
if(range_flash == null)
return
if(range_devastation > GLOB.MAX_EX_DEVESTATION_RANGE || range_heavy > GLOB.MAX_EX_HEAVY_RANGE || range_light > GLOB.MAX_EX_LIGHT_RANGE || range_flash > GLOB.MAX_EX_FLASH_RANGE)
if(tgui_alert(user, "Bomb is bigger than the maxcap. Continue?",,list("Yes","No")) != "Yes")
return
epicenter = get_turf(user.mob) //We need to reupdate as they may have moved again
explosion(epicenter, devastation_range = range_devastation, heavy_impact_range = range_heavy, light_impact_range = range_light, flash_range = range_flash, adminlog = TRUE, ignorecap = TRUE, explosion_cause = user.mob)
message_admins("[ADMIN_LOOKUPFLW(user.mob)] creating an admin explosion at [epicenter.loc].")
log_admin("[key_name(user)] created an admin explosion at [epicenter.loc].")
BLACKBOX_LOG_ADMIN_VERB("Drop Bomb")
ADMIN_VERB(drop_bomb_dynex, R_FUN, "Drop DynEx Bomb", "Cause an explosion of varying strength at your location.", ADMIN_CATEGORY_FUN)
var/ex_power = input(user, "Explosive Power:") as null|num
var/turf/epicenter = get_turf(user.mob)
if(!ex_power || !epicenter)
return
dyn_explosion(epicenter, ex_power)
message_admins("[ADMIN_LOOKUPFLW(user.mob)] creating an admin explosion at [epicenter.loc].")
log_admin("[key_name(user)] created an admin explosion at [epicenter.loc].")
BLACKBOX_LOG_ADMIN_VERB("Drop Dynamic Bomb")
ADMIN_VERB(get_dynex_range, R_FUN, "Get DynEx Range", "Get the estimated range of a bomb using explosive power.", ADMIN_CATEGORY_DEBUG)
var/ex_power = input(user, "Explosive Power:") as null|num
if (isnull(ex_power))
return
var/range = round((2 * ex_power)**GLOB.DYN_EX_SCALE)
to_chat(user, "Estimated Explosive Range: (Devastation: [round(range*0.25)], Heavy: [round(range*0.5)], Light: [round(range)])", confidential = TRUE)
ADMIN_VERB(get_dynex_power, R_FUN, "Get DynEx Power", "Get the estimated required power of a bomb to reach the given range.", ADMIN_CATEGORY_DEBUG)
var/ex_range = input(user, "Light Explosion Range:") as null|num
if (isnull(ex_range))
return
var/power = (0.5 * ex_range)**(1/GLOB.DYN_EX_SCALE)
to_chat(user, "Estimated Explosive Power: [power]", confidential = TRUE)
ADMIN_VERB(set_dynex_scale, R_FUN, "Set DynEx Scale", "Set the scale multiplier on dynex explosions. Default 0.5.", ADMIN_CATEGORY_DEBUG)
var/ex_scale = input(user, "New DynEx Scale:") as null|num
if(!ex_scale)
return
GLOB.DYN_EX_SCALE = ex_scale
log_admin("[key_name(user)] has modified Dynamic Explosion Scale: [ex_scale]")
message_admins("[key_name_admin(user)] has modified Dynamic Explosion Scale: [ex_scale]")
ADMIN_VERB(atmos_control, R_DEBUG|R_SERVER, "Atmos Control Panel", "Open the atmospherics control panel.", ADMIN_CATEGORY_DEBUG)
SSair.ui_interact(user.mob)
ADMIN_VERB(reload_cards, R_DEBUG, "Reload Cards", "Reload all TCG cards.", ADMIN_CATEGORY_DEBUG)
if(!SStrading_card_game.loaded)
message_admins("The card subsystem is not currently loaded")
return
SStrading_card_game.reloadAllCardFiles()
ADMIN_VERB(validate_cards, R_DEBUG, "Validate Cards", "Validate the card settings.", ADMIN_CATEGORY_DEBUG)
if(!SStrading_card_game.loaded)
message_admins("The card subsystem is not currently loaded")
return
var/message = SStrading_card_game.check_cardpacks(SStrading_card_game.card_packs)
message += SStrading_card_game.check_card_datums()
if(message)
message_admins(message)
else
message_admins("No errors found in card rarities or overrides.")
ADMIN_VERB(test_cardpack_distribution, R_DEBUG, "Test Cardpack Distribution", "Test the distribution of a card pack.", ADMIN_CATEGORY_DEBUG)
if(!SStrading_card_game.loaded)
message_admins("The card subsystem is not currently loaded")
return
var/pack = tgui_input_list(user, "Which pack should we test?", "You fucked it didn't you", sort_list(SStrading_card_game.card_packs))
if(!pack)
return
var/batch_count = tgui_input_number(user, "How many times should we open it?", "Don't worry, I understand")
var/batch_size = tgui_input_number(user, "How many cards per batch?", "I hope you remember to check the validation")
var/guar = tgui_input_number(user, "Should we use the pack's guaranteed rarity? If so, how many?", "We've all been there. Man you should have seen the old system")
SStrading_card_game.check_card_distribution(pack, batch_size, batch_count, guar)
ADMIN_VERB(print_cards, R_DEBUG, "Print Cards", "Print all cards to chat.", ADMIN_CATEGORY_DEBUG)
SStrading_card_game.printAllCards()
ADMIN_VERB(give_mob_action, R_FUN, "Give Mob Action", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, mob/ability_recipient)
var/static/list/all_mob_actions = sort_list(subtypesof(/datum/action/cooldown/mob_cooldown), GLOBAL_PROC_REF(cmp_typepaths_asc))
var/static/list/actions_by_name = list()
if (!length(actions_by_name))
for (var/datum/action/cooldown/mob_cooldown as anything in all_mob_actions)
actions_by_name["[initial(mob_cooldown.name)] ([mob_cooldown])"] = mob_cooldown
var/ability = tgui_input_list(user, "Choose an ability", "Ability", actions_by_name)
if(isnull(ability))
return
var/ability_type = actions_by_name[ability]
var/datum/action/cooldown/mob_cooldown/add_ability
var/make_sequence = tgui_alert(user, "Would you like this action to be a sequence of multiple abilities?", "Sequence Ability", list("Yes", "No"))
if(make_sequence == "Yes")
add_ability = new /datum/action/cooldown/mob_cooldown(ability_recipient)
add_ability.sequence_actions = list()
while(!isnull(ability_type))
var/ability_delay = tgui_input_number(user, "Enter the delay in seconds before the next ability in the sequence is used", "Ability Delay", 2)
if(isnull(ability_delay) || ability_delay < 0)
ability_delay = 0
add_ability.sequence_actions[ability_type] = ability_delay * 1 SECONDS
ability = tgui_input_list(user, "Choose a new sequence ability", "Sequence Ability", actions_by_name)
ability_type = actions_by_name[ability]
var/ability_cooldown = tgui_input_number(user, "Enter the sequence abilities cooldown in seconds", "Ability Cooldown", 2)
if(isnull(ability_cooldown) || ability_cooldown < 0)
ability_cooldown = 2
add_ability.cooldown_time = ability_cooldown * 1 SECONDS
var/ability_melee_cooldown = tgui_input_number(user, "Enter the abilities melee cooldown in seconds", "Melee Cooldown", 2)
if(isnull(ability_melee_cooldown) || ability_melee_cooldown < 0)
ability_melee_cooldown = 2
add_ability.melee_cooldown_time = ability_melee_cooldown * 1 SECONDS
add_ability.name = tgui_input_text(user, "Choose ability name", "Ability name", "Generic Ability")
add_ability.create_sequence_actions()
else
add_ability = new ability_type(ability_recipient)
if(isnull(ability_recipient))
return
add_ability.Grant(ability_recipient)
message_admins("[key_name_admin(user)] added mob ability [ability_type] to mob [ability_recipient].")
log_admin("[key_name(user)] added mob ability [ability_type] to mob [ability_recipient].")
BLACKBOX_LOG_ADMIN_VERB("Add Mob Ability")
ADMIN_VERB(remove_mob_action, R_FUN, "Remove Mob Action", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, mob/removal_target)
var/list/target_abilities = list()
for(var/datum/action/cooldown/mob_cooldown/ability in removal_target.actions)
target_abilities[ability.name] = ability
if(!length(target_abilities))
return
var/chosen_ability = tgui_input_list(user, "Choose the spell to remove from [removal_target]", "Depower", sort_list(target_abilities))
if(isnull(chosen_ability))
return
var/datum/action/cooldown/mob_cooldown/to_remove = target_abilities[chosen_ability]
if(!istype(to_remove))
return
qdel(to_remove)
log_admin("[key_name(user)] removed the ability [chosen_ability] from [key_name(removal_target)].")
message_admins("[key_name_admin(user)] removed the ability [chosen_ability] from [key_name_admin(removal_target)].")
BLACKBOX_LOG_ADMIN_VERB("Remove Mob Ability")
ADMIN_VERB(give_spell, R_FUN, "Give Spell", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, mob/spell_recipient)
var/which = tgui_alert(user, "Chose by name or by type path?", "Chose option", list("Name", "Typepath"))
if(!which)
return
if(QDELETED(spell_recipient))
to_chat(user, span_warning("The intended spell recipient no longer exists."))
return
var/list/spell_list = list()
for(var/datum/action/cooldown/spell/to_add as anything in subtypesof(/datum/action/cooldown/spell))
var/spell_name = initial(to_add.name)
if(spell_name == "Spell") // abstract or un-named spells should be skipped.
continue
if(which == "Name")
spell_list[spell_name] = to_add
else
spell_list += to_add
var/chosen_spell = tgui_input_list(user, "Choose the spell to give to [spell_recipient]", "ABRAKADABRA", sort_list(spell_list))
if(isnull(chosen_spell))
return
var/datum/action/cooldown/spell/spell_path = which == "Typepath" ? chosen_spell : spell_list[chosen_spell]
if(!ispath(spell_path))
return
var/robeless = (tgui_alert(user, "Would you like to force this spell to be robeless?", "Robeless Casting?", list("Force Robeless", "Use Spell Setting")) == "Force Robeless")
if(QDELETED(spell_recipient))
to_chat(user, span_warning("The intended spell recipient no longer exists."))
return
BLACKBOX_LOG_ADMIN_VERB("Give Spell")
log_admin("[key_name(user)] gave [key_name(spell_recipient)] the spell [chosen_spell][robeless ? " (Forced robeless)" : ""].")
message_admins("[key_name_admin(user)] gave [key_name_admin(spell_recipient)] the spell [chosen_spell][robeless ? " (Forced robeless)" : ""].")
var/datum/action/cooldown/spell/new_spell = new spell_path(spell_recipient.mind || spell_recipient)
if(robeless)
new_spell.spell_requirements &= ~SPELL_REQUIRES_WIZARD_GARB
new_spell.Grant(spell_recipient)
if(!spell_recipient.mind)
to_chat(user, span_userdanger("Spells given to mindless mobs will belong to the mob and not their mind, \
and as such will not be transferred if their mind changes body (Such as from Mindswap)."))
ADMIN_VERB(remove_spell, R_FUN, "Remove Spell", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, mob/removal_target)
var/list/target_spell_list = list()
for(var/datum/action/cooldown/spell/spell in removal_target.actions)
target_spell_list[spell.name] = spell
if(!length(target_spell_list))
return
var/chosen_spell = tgui_input_list(user, "Choose the spell to remove from [removal_target]", "ABRAKADABRA", sort_list(target_spell_list))
if(isnull(chosen_spell))
return
var/datum/action/cooldown/spell/to_remove = target_spell_list[chosen_spell]
if(!istype(to_remove))
return
qdel(to_remove)
log_admin("[key_name(user)] removed the spell [chosen_spell] from [key_name(removal_target)].")
message_admins("[key_name_admin(user)] removed the spell [chosen_spell] from [key_name_admin(removal_target)].")
BLACKBOX_LOG_ADMIN_VERB("Remove Spell")
ADMIN_VERB(give_disease, R_FUN, "Give Disease", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, mob/living/victim)
var/datum/disease/D = input(user, "Choose the disease to give to that guy", "ACHOO") as null|anything in sort_list(SSdisease.diseases, GLOBAL_PROC_REF(cmp_typepaths_asc))
if(!D)
return
victim.ForceContractDisease(new D, FALSE, TRUE)
BLACKBOX_LOG_ADMIN_VERB("Give Disease")
log_admin("[key_name(user)] gave [key_name(victim)] the disease [D].")
message_admins(span_adminnotice("[key_name_admin(user)] gave [key_name_admin(victim)] the disease [D]."))
ADMIN_VERB_AND_CONTEXT_MENU(object_say, R_FUN, "OSay", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, obj/speaker in world)
var/message = tgui_input_text(user, "What do you want the message to be?", "Make Sound", encode = FALSE)
if(!message)
return
speaker.say(message, sanitize = FALSE)
log_admin("[key_name(user)] made [speaker] at [AREACOORD(speaker)] say \"[message]\"")
message_admins(span_adminnotice("[key_name_admin(user)] made [speaker] at [AREACOORD(speaker)]. say \"[message]\""))
BLACKBOX_LOG_ADMIN_VERB("Object Say")
ADMIN_VERB(build_mode_self, R_BUILD, "Toggle Build Mode Self", "Toggle build mode for yourself.", ADMIN_CATEGORY_EVENTS)
togglebuildmode(user.mob) // why is this a global proc???
BLACKBOX_LOG_ADMIN_VERB("Toggle Build Mode")
ADMIN_VERB(check_ai_laws, R_ADMIN, "Check AI Laws", "View the current AI laws.", ADMIN_CATEGORY_GAME)
user.holder.output_ai_laws()
ADMIN_VERB(manage_sect, R_ADMIN, "Manage Religious Sect", "Manages the chaplain's religion.", ADMIN_CATEGORY_GAME)
if (!isnull(GLOB.religious_sect))
var/you_sure = tgui_alert(
user,
"The Chaplain has already chosen [GLOB.religious_sect.name], override their selection?",
"Replace God?",
list("Yes", "Cancel"),
)
if (you_sure != "Yes")
return
var/static/list/choices = list()
if (!length(choices))
choices["nothing"] = null
for(var/datum/religion_sect/sect as anything in subtypesof(/datum/religion_sect))
choices[initial(sect.name)] = sect
var/choice = tgui_input_list(user, "Set new Chaplain sect", "God Picker", choices)
if(isnull(choice))
return
if(choice == "nothing")
reset_religious_sect()
return
set_new_religious_sect(choices[choice], reset_existing = TRUE)
ADMIN_VERB(deadmin, R_NONE, "DeAdmin", "Shed your admin powers.", ADMIN_CATEGORY_MAIN)
user.holder.deactivate()
to_chat(user, span_interface("You are now a normal player."))
log_admin("[key_name(user)] deadminned themselves.")
message_admins("[key_name_admin(user)] deadminned themselves.")
BLACKBOX_LOG_ADMIN_VERB("Deadmin")
ADMIN_VERB(populate_world, R_DEBUG, "Populate World", "Populate the world with test mobs.", ADMIN_CATEGORY_DEBUG, amount = 50 as num)
for (var/i in 1 to amount)
var/turf/tile = get_safe_random_station_turf()
var/mob/living/carbon/human/hooman = new(tile)
hooman.equipOutfit(pick(subtypesof(/datum/outfit)))
testing("Spawned test mob at [get_area_name(tile, TRUE)] ([tile.x],[tile.y],[tile.z])")
ADMIN_VERB(toggle_ai_interact, R_ADMIN, "Toggle Admin AI Interact", "Allows you to interact with most machines as an AI would as a ghost.", ADMIN_CATEGORY_GAME)
var/doesnt_have_silicon_access = !HAS_TRAIT_FROM(user, TRAIT_AI_ACCESS, ADMIN_TRAIT)
if(doesnt_have_silicon_access)
ADD_TRAIT(user, TRAIT_AI_ACCESS, ADMIN_TRAIT)
else
REMOVE_TRAIT(user, TRAIT_AI_ACCESS, ADMIN_TRAIT)
log_admin("[key_name(user)] has [doesnt_have_silicon_access ? "activated" : "deactivated"] Admin AI Interact")
message_admins("[key_name_admin(user)] has [doesnt_have_silicon_access ? "activated" : "deactivated"] their AI interaction")
ADMIN_VERB(debug_statpanel, R_DEBUG, "Debug Stat Panel", "Toggles local debug of the stat panel", ADMIN_CATEGORY_DEBUG)
user.stat_panel.send_message("create_debug")
ADMIN_VERB(display_sendmaps, R_DEBUG, "Send Maps Profile", "View the profile.", ADMIN_CATEGORY_DEBUG)
user << link("?debug=profile&type=sendmaps&window=test")
ADMIN_VERB(spawn_debug_full_crew, R_DEBUG, "Spawn Debug Full Crew", "Creates a full crew for the station, flling datacore and assigning minds and jobs.", ADMIN_CATEGORY_DEBUG)
if(SSticker.current_state != GAME_STATE_PLAYING)
to_chat(user, "You should only be using this after a round has setup and started.")
return
// Two input checks here to make sure people are certain when they're using this.
if(tgui_alert(user, "This command will create a bunch of dummy crewmembers with minds, job, and datacore entries, which will take a while and fill the manifest.", "Spawn Crew", list("Yes", "Cancel")) != "Yes")
return
if(tgui_alert(user, "I sure hope you aren't doing this on live. Are you sure?", "Spawn Crew (Be certain)", list("Yes", "Cancel")) != "Yes")
return
// Find the observer spawn, so we have a place to dump the dummies.
var/obj/effect/landmark/observer_start/observer_point = locate(/obj/effect/landmark/observer_start) in GLOB.landmarks_list
var/turf/destination = get_turf(observer_point)
if(!destination)
to_chat(user, "Failed to find the observer spawn to send the dummies.")
return
// Okay, now go through all nameable occupations.
// Pick out all jobs that have JOB_CREW_MEMBER set.
// Then, spawn a human and slap a person into it.
var/number_made = 0
for(var/rank in SSjob.name_occupations)
var/datum/job/job = SSjob.get_job(rank)
// JOB_CREW_MEMBER is all jobs that pretty much aren't silicon
if(!(job.job_flags & JOB_CREW_MEMBER))
continue
// Create our new_player for this job and set up its mind.
var/mob/dead/new_player/new_guy = new()
new_guy.mind_initialize()
new_guy.mind.name = "[rank] Dummy"
// Assign the rank to the new player dummy.
if(!SSjob.assign_role(new_guy, job, do_eligibility_checks = FALSE))
qdel(new_guy)
to_chat(user, "[rank] wasn't able to be spawned.")
continue
// It's got a job, spawn in a human and shove it in the human.
var/mob/living/carbon/human/character = new(destination)
character.name = new_guy.mind.name
new_guy.mind.transfer_to(character)
qdel(new_guy)
// Then equip up the human with job gear.
SSjob.equip_rank(character, job)
job.after_latejoin_spawn(character)
// Finally, ensure the minds are tracked and in the manifest.
SSticker.minds += character.mind
if(ishuman(character))
GLOB.manifest.inject(character)
number_made++
CHECK_TICK
to_chat(user, "[number_made] crewmembers have been created.")
ADMIN_VERB(debug_spell_requirements, R_DEBUG, "Debug Spell Requirements", "View all spells and their requirements.", ADMIN_CATEGORY_DEBUG)
var/header = "<tr><th>Name</th> <th>Requirements</th>"
var/all_requirements = list()
for(var/datum/action/cooldown/spell/spell as anything in typesof(/datum/action/cooldown/spell))
if(initial(spell.name) == "Spell")
continue
var/list/real_reqs = list()
var/reqs = initial(spell.spell_requirements)
if(reqs & SPELL_CASTABLE_AS_BRAIN)
real_reqs += "Castable as brain"
if(reqs & SPELL_REQUIRES_HUMAN)
real_reqs += "Must be human"
if(reqs & SPELL_REQUIRES_MIME_VOW)
real_reqs += "Must be miming"
if(reqs & SPELL_REQUIRES_MIND)
real_reqs += "Must have a mind"
if(reqs & SPELL_REQUIRES_NO_ANTIMAGIC)
real_reqs += "Must have no antimagic"
if(reqs & SPELL_REQUIRES_STATION)
real_reqs += "Must be on the station z-level"
if(reqs & SPELL_REQUIRES_WIZARD_GARB)
real_reqs += "Must have wizard clothes"
all_requirements += "<tr><td>[initial(spell.name)]</td> <td>[english_list(real_reqs, "No requirements")]</td></tr>"
var/page_style = "<style>table, th, td {border: 1px solid black;border-collapse: collapse;}</style>"
var/page_contents = "[page_style]<table style=\"width:100%\">[header][jointext(all_requirements, "")]</table>"
var/datum/browser/popup = new(user.mob, "spellreqs", "Spell Requirements", 600, 400)
popup.set_content(page_contents)
popup.open()
ADMIN_VERB(load_lazy_template, R_ADMIN, "Load/Jump Lazy Template", "Loads a lazy template and/or jumps to it.", ADMIN_CATEGORY_EVENTS)
var/list/choices = LAZY_TEMPLATE_KEY_LIST_ALL()
var/choice = tgui_input_list(user, "Key?", "Lazy Loader", choices)
var/teleport_to_template = tgui_input_list(user, "Jump to template after loading?", "Where to?", list("Yes", "No"))
if(!choice)
return
choice = choices[choice]
if(!choice)
to_chat(user, span_warning("No template with that key found, report this!"))
return
var/already_loaded = LAZYACCESS(SSmapping.loaded_lazy_templates, choice)
var/force_load = FALSE
if(already_loaded && (tgui_alert(user, "Template already loaded.", "", list("Jump", "Load Again")) == "Load Again"))
force_load = TRUE
var/datum/turf_reservation/reservation = SSmapping.lazy_load_template(choice, force = force_load)
if(!reservation)
to_chat(user, span_boldwarning("Failed to load template!"))
return
if(teleport_to_template == "Yes")
if(!isobserver(user.mob))
SSadmin_verbs.dynamic_invoke_verb(user, /datum/admin_verb/admin_ghost)
user.mob.forceMove(reservation.bottom_left_turfs[1])
to_chat(user, span_boldnicegreen("Template loaded, you have been moved to the bottom left of the reservation."))
message_admins("[key_name_admin(user)] has loaded lazy template '[choice]'")
ADMIN_VERB(library_control, R_BAN, "Library Management", "List and manage the Library.", ADMIN_CATEGORY_MAIN)
if(!user.holder.library_manager)
user.holder.library_manager = new
user.holder.library_manager.ui_interact(user.mob)
BLACKBOX_LOG_ADMIN_VERB("Library Management")
ADMIN_VERB(create_mob_worm, R_FUN, "Create Mob Worm", "Attach a linked list of mobs to your marked mob.", ADMIN_CATEGORY_FUN)
if(!isliving(user.holder.marked_datum))
to_chat(user, span_warning("Error: Please mark a mob to attach mobs to."))
return
var/mob/living/head = user.holder.marked_datum
var/attempted_target_path = tgui_input_text(
user,
"Enter typepath of a mob you'd like to make your chain from.",
"Typepath",
"[/mob/living/basic/pet/dog/corgi/ian]",
)
if (isnull(attempted_target_path))
return //The user pressed "Cancel"
var/desired_mob = text2path(attempted_target_path)
if(!ispath(desired_mob))
desired_mob = pick_closest_path(attempted_target_path, make_types_fancy(subtypesof(/mob/living)))
if(isnull(desired_mob) || !ispath(desired_mob) || QDELETED(head))
return //The user pressed "Cancel"
var/amount = tgui_input_number(user, "How long should our tail be?", "Worm Configurator", default = 3, min_value = 1)
if (isnull(amount) || amount < 1 || QDELETED(head))
return
head.AddComponent(/datum/component/mob_chain)
var/mob/living/previous = head
for (var/i in 1 to amount)
var/mob/living/segment = new desired_mob(head.drop_location())
if (QDELETED(segment)) // ffs mobs which replace themselves with other mobs
i--
continue
ADD_TRAIT(segment, TRAIT_PERMANENTLY_MORTAL, INNATE_TRAIT)
QDEL_NULL(segment.ai_controller)
segment.AddComponent(/datum/component/mob_chain, front = previous)
previous = segment