mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
This PR replaces our current NPC AI with a [behavior tree system](https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)). Behavior trees are a common way of creating AI in which you place nodes in a tree structure to define what actions an AI should take. AI controllers defined a list of /datum/ai_planning_subtree types in behavior_nodes. Each subtree was a self-contained unit that could call queue_behavior() to fire off /datum/ai_behavior actions. The controller iterated subtrees in order, each one deciding independently whether to queue something and deciding whether the next subtree would run. This has a few issues: 1. There's no real structure; you are just defining a list of things to try in order. 2. There was a loooot of subtrees that were basically the same as another but with some slight modification 3. It was hard to understand. Controllers now define a single json file describing a tree of nodes. The tree is composed of structural composites: Sequence - do A, then B, then C (and so on) Selector - try A, if it fails try B, then C (and so on) Parallel - run A and B simultaneously, with configurable failure/success policies and or looping behavior Subplan - loop a child continiously Along that we also have "Decorators". These are nodes that basically check a condition (E.g.; do we have a combat target). These decorators can be used to gate behavior and are re-useable across behavior trees. They also have a concept known as "Observers". Which lets them cancel lower priority behavior in case their condition changes (Which we check whenever a signal fires that fits that specific decorator). This makes the AI much more responsive to change in environment. For behaviors, we still use the ai_behavior datums. These are the actual behaviors such as "Move to X", "Attack X". The only major change is that these can no longer sleep() since they now run in the ai_controller. Lastly, we now also have subtrees, except now they are essentially pieces of behavior tree that can be re-used, or even overriden at runtime or as a variable. Allowing for making modular AI made out of several smaller trees. You can set variables on these nodes directly via the extension (see below), which should reduce the need to make subtypes of behaviors by a lot. All of these vars are saved on the JSON and will be applied at runtime. If you are using subtrees, you can also assign "bindings" to these variables, which will allow instances of the subtree to override those variables. Since a tree structure with variables becomes hard to parse in a JSON, I've made a VSCode extension to edit these JSONs: https://marketplace.visualstudio.com/items?itemName=BehaviorTreeG.behaviortreeg https://github.com/CabinetOnFire/BehaviorTreeG <img width="1795" height="1268" alt="image" src="https://github.com/user-attachments/assets/56aa2f0b-3cf9-449f-bca4-8281fca82db6" /> This extension allows you to edit the behavior tree JSONs, and browse through all the behaviors/decorators/subtrees we have If you'd like more info on how to build these AI check out the learn_ai.md. I will also make a tutorial to go over more depth on what the system offers because I kind of suck at doing technical write-ups. Targetting has been changed to. I've made a new acquire_targets behavior that takes a target_source (what am I targetting) and targetting_strategy (what does the candidate need to fulfill to be considered a target). This allows us to make composites targetting combinations to reduce the amount of specific find_and_set esque behaviors we had before. Not everything is ported to this system but that would be a longer term goal. I've added a new build_bt script that converts all the behavior tree JSONs into compiled versions. Why is this needed? Because I wanted to keep using defines in behavior trees, so we need a way to convert this into literal values before we send it to DM. This script runs on compile and should also run in CI (If I didn't fuck that up!). This saves to a new build/ folder. I've ported every single AI in the game to this system (except raptors, Kobsa is working on those so should be in soon!), so I do expect some bugs to come out of this. But I also fixed some issues that have probably been in the game for a long time such as: - Fixed penguins being unable to fish - Fixed bileworms not being able to devour people - Fixes goldgrubs not grubbing gold (they could not mine!) - Lizards actually eat food they find Either way, I'd reccomend a long TM on this. 1. (Hopefully) a better development experience for making AI 2. Less copy-paste for behaviors, we should be able to re-use more pieces to make behavior 3. Behavior trees is a more common pattern in making AI, so it should be easier to find resources to find out how to do things. 🆑 CabinetOnFire, Iamgoofball, SmartKar, Ben10omintrix refactor: Replaces our AI system with behavior trees, porting all datum/ai to it /🆑 I will add this PR with more details down the line. I think I got the big picture but its a big PR, so sorry if I missed something important. --------- Co-authored-by: Iamgoofball <iamgoofball@gmail.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
823 lines
37 KiB
Plaintext
823 lines
37 KiB
Plaintext
|
|
#define STEALTH_MODE_TRAIT "stealth_mode"
|
|
|
|
/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()
|
|
ASSIGN_GAME_VERB(user, /client, 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, span_warning("Error: Aghost: Can't admin-ghost whilst in the lobby. Join or Observe first."), 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
|
|
var/mob/dead/observer/ghost = body.ghostize(TRUE, TRUE)
|
|
user.init_verbs()
|
|
if(body && !body.key)
|
|
body.key = "@[user.key]" //Haaaaaaaack. But the people have spoken. If it breaks; blame adminbus
|
|
// Carry over invisimin to their aghost
|
|
var/is_stealth_mode = user.holder.fakekey
|
|
var/is_invisimin = HAS_TRAIT_FROM(body, TRAIT_INVISIMIN, ADMIN_TRAIT)
|
|
if(is_stealth_mode || is_invisimin)
|
|
if(is_invisimin)
|
|
ADD_TRAIT(ghost, TRAIT_INVISIMIN, ADMIN_TRAIT)
|
|
ghost.SetInvisibility(INVISIBILITY_ADMIN, INVISIBILITY_SOURCE_INVISIMIN, INVISIBILITY_PRIORITY_ADMIN)
|
|
else
|
|
ghost.SetInvisibility(INVISIBILITY_ABSTRACT, INVISIBILITY_SOURCE_STEALTHMODE, INVISIBILITY_PRIORITY_ADMIN)
|
|
ghost.name = " "
|
|
ghost.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
ghost.alpha = 0
|
|
ghost.remove_from_all_data_huds()
|
|
ADD_TRAIT(ghost, TRAIT_ORBITING_FORBIDDEN, is_invisimin ? ADMIN_TRAIT : STEALTH_MODE_TRAIT)
|
|
QDEL_NULL(ghost.orbiters)
|
|
|
|
BLACKBOX_LOG_ADMIN_VERB("Admin Ghost")
|
|
|
|
ADMIN_VERB(invisimin, R_ADMIN, "Invisimin", "Toggles ghost-like invisibility.", ADMIN_CATEGORY_GAME)
|
|
// Toggle OFF
|
|
if(HAS_TRAIT(user.mob, TRAIT_INVISIMIN))
|
|
user.mob.remove_traits(list(
|
|
TRAIT_INVISIMIN,
|
|
TRAIT_ORBITING_FORBIDDEN,
|
|
TRAIT_MOVE_PHASING,
|
|
TRAIT_PIERCEIMMUNE,
|
|
TRAIT_INVISIBLE_TO_CAMERA,
|
|
), 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)
|
|
if(isobserver(user.mob) && !user.holder.fakekey) // Set the alpha back if we're not still stealth mode
|
|
user.mob.alpha = initial(user.mob.alpha)
|
|
return
|
|
|
|
// Toggle ON
|
|
user.mob.add_traits(list(
|
|
TRAIT_INVISIMIN,
|
|
TRAIT_ORBITING_FORBIDDEN,
|
|
TRAIT_MOVE_PHASING,
|
|
TRAIT_PIERCEIMMUNE,
|
|
TRAIT_INVISIBLE_TO_CAMERA,
|
|
), ADMIN_TRAIT)
|
|
user.mob.remove_from_all_data_huds()
|
|
user.mob.SetInvisibility(INVISIBILITY_ADMIN, INVISIBILITY_SOURCE_INVISIMIN, INVISIBILITY_PRIORITY_ADMIN)
|
|
if(isobserver(user.mob))
|
|
user.mob.alpha = 0
|
|
QDEL_NULL(user.mob.orbiters)
|
|
to_chat(user, span_adminnotice(span_bold("Invisimin on. You are now invisible to players and ghosts.")), confidential = TRUE)
|
|
|
|
ADMIN_VERB(toggle_admin_esp, R_ADMIN, "Toggle Admin ESP", "Toggle to be able to see ghosts and invisimins.", ADMIN_CATEGORY_GAME)
|
|
// Toggle OFF
|
|
if(HAS_TRAIT(user.mob, TRAIT_ADMIN_ESP))
|
|
if(isliving(user.mob))
|
|
var/mob/living/living_user = user.mob
|
|
living_user.remove_status_effect(/datum/status_effect/admin_esp)
|
|
else if(isobserver(user.mob))
|
|
user.mob.set_invis_see(SEE_INVISIBLE_OBSERVER)
|
|
else
|
|
user.mob.set_invis_see(SEE_INVISIBLE_LIVING)
|
|
REMOVE_TRAIT(user.mob, TRAIT_ADMIN_ESP, ADMIN_TRAIT)
|
|
to_chat(user.mob, span_adminnotice("Admin ESP off. You will no longer see [isliving(user.mob) ? "ghosts or " : ""]invisimins."), confidential = TRUE)
|
|
return
|
|
|
|
// Toggle ON
|
|
if(isliving(user.mob))
|
|
var/mob/living/living_user = user.mob
|
|
living_user.apply_status_effect(/datum/status_effect/admin_esp)
|
|
else if(ismob(user.mob))
|
|
user.mob.set_invis_see(SEE_INVISIBLE_ADMIN)
|
|
else
|
|
to_chat(user.mob, span_warning("Admin ESP only works if you are in a mob!"), confidential = TRUE)
|
|
return
|
|
|
|
ADD_TRAIT(user.mob, TRAIT_ADMIN_ESP, ADMIN_TRAIT)
|
|
to_chat(user.mob, span_adminnotice("Admin ESP on. You will now be able to see [isliving(user.mob) ? "ghosts and " : ""]invisimins."), 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")
|
|
|
|
/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)
|
|
if(!HAS_TRAIT_FROM(mob, TRAIT_INVISIMIN, ADMIN_TRAIT)) // Don't reset our alpha if we're also invisimin'd
|
|
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")
|
|
|
|
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", max_length = MAX_NAME_LEN)
|
|
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/disease = tgui_input_list(user, "Choose the disease to give to that guy", "ACHOO", sort_list(SSdisease.diseases, GLOBAL_PROC_REF(cmp_typepaths_asc)))
|
|
if(!disease)
|
|
return
|
|
victim.ForceContractDisease(new disease, FALSE, TRUE)
|
|
BLACKBOX_LOG_ADMIN_VERB("Give Disease")
|
|
log_admin("[key_name(user)] gave [key_name(victim)] the disease [disease].")
|
|
message_admins(span_adminnotice("[key_name_admin(user)] gave [key_name_admin(victim)] the disease [disease]."))
|
|
|
|
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_equal_weight()
|
|
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(!user.is_localhost() && tgui_alert(user, "You are not on localhost! 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
|
|
|
|
ADMIN_VERB(give_ai_controller, R_FUN, "Give AI Controller", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, mob/living/my_guy)
|
|
var/static/list/controllers = subtypesof(/datum/admin_ai_template)
|
|
var/static/list/controllers_by_name = list()
|
|
if (!length(controllers_by_name))
|
|
for (var/datum/admin_ai_template/template as anything in controllers)
|
|
controllers_by_name["[initial(template.name)]"] = template
|
|
|
|
var/chosen = tgui_input_list(user, "Which template should we apply?", "Select Template", controllers_by_name)
|
|
if (isnull(chosen))
|
|
return
|
|
|
|
var/chosen_type = controllers_by_name[chosen]
|
|
var/datum/admin_ai_template/using_template = new chosen_type
|
|
using_template.apply(my_guy, user)
|
|
|
|
ADMIN_VERB(clear_legacy_asset_cache, R_DEBUG, "Clear Legacy Asset Cache", "Clears the legacy asset cache, regenerating it immediately (may cause lag).", ADMIN_CATEGORY_DEBUG)
|
|
if(!CONFIG_GET(flag/cache_assets))
|
|
to_chat(user, span_warning("Asset caching is disabled in the config!"))
|
|
return
|
|
var/regenerated = 0
|
|
for(var/datum/asset/target_spritesheet as anything in valid_subtypesof(/datum/asset))
|
|
if(!initial(target_spritesheet.cross_round_cachable))
|
|
continue
|
|
var/datum/asset/asset_datum = GLOB.asset_datums[target_spritesheet]
|
|
asset_datum.regenerate()
|
|
regenerated++
|
|
to_chat(user, span_notice("Regenerated [regenerated] asset\s."))
|
|
|
|
ADMIN_VERB(clear_smart_asset_cache, R_DEBUG, "Clear Smart Asset Cache", "Clear the smart asset cache, causing it to regenerate next round.", ADMIN_CATEGORY_DEBUG)
|
|
if(!CONFIG_GET(flag/smart_cache_assets))
|
|
to_chat(user, span_warning("Smart asset caching is disabled in the config!"))
|
|
return
|
|
var/cleared = 0
|
|
for(var/datum/asset/spritesheet_batched/target_spritesheet as anything in valid_subtypesof(/datum/asset/spritesheet_batched))
|
|
fdel("[ASSET_CROSS_ROUND_SMART_CACHE_DIRECTORY]/spritesheet_cache.[initial(target_spritesheet.name)].json")
|
|
cleared++
|
|
to_chat(user, span_notice("Cleared [cleared] asset\s."))
|
|
|
|
ADMIN_VERB(open_event_logger, R_DEBUG, "Open Event Logger", "Open the event logger interface.", ADMIN_CATEGORY_DEBUG)
|
|
GLOB.event_logger.ui_interact(user.mob)
|
|
|
|
ADMIN_VERB(view_behavior_tree, R_DEBUG, "View Behavior Tree", "Inspect the AI behavior tree of a mob.", ADMIN_CATEGORY_DEBUG)
|
|
GLOB.bt_viewer.ui_interact(user.mob)
|
|
|
|
ADMIN_VERB(new_blackmarket_item, R_BUILD, "Create Black Market Item", "Add an item to the black market for purchase.", ADMIN_CATEGORY_EVENTS, object as text)
|
|
if(!object)
|
|
to_chat(user, span_boldwarning("Failed! Provide a full or partial typepath!"))
|
|
return
|
|
//first: have admins select a typepath for the item they want to offer.
|
|
var/obj/chosen = pick_closest_path(object, make_types_fancy(subtypesof(/obj)))
|
|
// second: poll admins for the name, description, price, and quantity.
|
|
if(isnull(chosen))
|
|
return
|
|
var/name = tgui_input_text(user, "Name of the item to sell?", "Item listing name", "Arcane Object", max_length = MAX_NAME_LEN)
|
|
if(isnull(name))
|
|
return
|
|
var/description = tgui_input_text(user, "Custom description of the item to sell?", "Item listing description", "[chosen::desc]", max_length = 200)
|
|
if(isnull(description))
|
|
return
|
|
var/price = tgui_input_number(user, "Price for the item listing?", "Item listing price", max_value = INFINITY, min_value = 1, round_value = TRUE)
|
|
if(isnull(price))
|
|
return
|
|
var/quantity = tgui_input_number(user, "Quantity of the item to sell?", "Item listing quantity", default = 1, max_value = 100, min_value = 1, round_value = TRUE)
|
|
if(isnull(quantity))
|
|
return
|
|
//lastly: pick a category for the item to go under
|
|
var/category = tgui_input_list(user, "Category to list the item under?", "Item listing category", BLACKMARKET_CATEGORIES)
|
|
if(isnull(category))
|
|
return
|
|
|
|
var/datum/market_item/admin_item = new /datum/market_item()
|
|
// Making a note here that we don't need to assign to blackmarket because we still only have one market type, but if we ever start using multiple we'll want to poll admins.
|
|
admin_item.item = chosen
|
|
SSblackbox.record_feedback("tally", "admin blackmarket items", 1, chosen)
|
|
|
|
admin_item.name = name
|
|
admin_item.desc = description
|
|
admin_item.price = price
|
|
admin_item.stock = quantity
|
|
admin_item.category = category
|
|
admin_item.restockable = FALSE
|
|
|
|
SSmarket.admin_items_spawned++
|
|
admin_item.identifier = "admin_[SSmarket.admin_items_spawned]"
|
|
|
|
SSmarket.initialize_admin_item(admin_item)
|
|
log_admin("[key_name(user)] created a new black market item: [name] ([chosen]) for [price] credits, of quantity [quantity].")
|
|
message_admins("[key_name(user)] created a new black market item: [name] ([chosen]) for [price] credits, of quantity [quantity].")
|
|
|
|
BLACKBOX_LOG_ADMIN_VERB("Create Black Market Item")
|
|
|
|
|
|
#undef STEALTH_MODE_TRAIT
|