From 85ab392256c24b583dc809b9ff618c977c95dd60 Mon Sep 17 00:00:00 2001 From: Ron Date: Sun, 1 Oct 2017 09:17:55 -0400 Subject: [PATCH] Adds a new admin verb (#3521) Adds a verb that allows admins to replace people using the ghost trap. It is in the secrets menu. If the person they are replacing has a special role (IE. merc) it will only asks ghosts who have that pref enabled. Otherwise, it asks anyone. --- aurorastation.dme | 1 + .../secrets/admin_secrets/replace_player.dm | 25 ++++ code/modules/ghosttrap/trap.dm | 135 ++++++++++++++++++ html/changelogs/Printer16-Replaceplayer.yml | 37 +++++ 4 files changed, 198 insertions(+) create mode 100644 code/modules/admin/secrets/admin_secrets/replace_player.dm create mode 100644 html/changelogs/Printer16-Replaceplayer.yml diff --git a/aurorastation.dme b/aurorastation.dme index edd5c3279d6..5c58ff69d30 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -1004,6 +1004,7 @@ #include "code\modules\admin\secrets\admin_secrets\list_fingerprints.dm" #include "code\modules\admin\secrets\admin_secrets\move_shuttle.dm" #include "code\modules\admin\secrets\admin_secrets\prison_warp.dm" +#include "code\modules\admin\secrets\admin_secrets\replace_player.dm" #include "code\modules\admin\secrets\admin_secrets\show_ai_laws.dm" #include "code\modules\admin\secrets\admin_secrets\show_crew_manifest.dm" #include "code\modules\admin\secrets\admin_secrets\show_game_mode.dm" diff --git a/code/modules/admin/secrets/admin_secrets/replace_player.dm b/code/modules/admin/secrets/admin_secrets/replace_player.dm new file mode 100644 index 00000000000..8dce7f5ad5b --- /dev/null +++ b/code/modules/admin/secrets/admin_secrets/replace_player.dm @@ -0,0 +1,25 @@ +/datum/admin_secret_item/admin_secret/replace_player_with_ghost + name = "Replace player with ghost" + +/datum/admin_secret_item/admin_secret/replace_player_with_ghost/can_execute(var/mob/user) + if(!ROUND_IS_STARTED) return 0 + return ..() + +/datum/admin_secret_item/admin_secret/replace_player_with_ghost/execute(var/mob/user) + . = ..() + if(!.) + return + var/list/targets = list() + targets += getmobs() + var/mob/T = input(user, "Which player do you want to replace?") as null|anything in targets + if (!T) + return + var/mob/player_to_replace = targets[T] + var/datum/ghosttrap/G = get_ghost_trap("[player_to_replace.mind.special_role]") + if(player_to_replace.client) + player_to_replace.ghostize(0) + if(G) + G.request_player(player_to_replace, "Would you like to play as a [player_to_replace.mind.special_role]?", 60 SECONDS) + else + G = ghost_traps["Special"] + G.request_player(player_to_replace, "Would you like to play as [player_to_replace.name]?", 60 SECONDS) \ No newline at end of file diff --git a/code/modules/ghosttrap/trap.dm b/code/modules/ghosttrap/trap.dm index ea8374d481c..2ae8d2124d0 100644 --- a/code/modules/ghosttrap/trap.dm +++ b/code/modules/ghosttrap/trap.dm @@ -278,3 +278,138 @@ datum/ghosttrap/pai/transfer_personality(var/mob/candidate, var/mob/living/silic /datum/ghosttrap/skeleton/welcome_candidate(var/mob/target) return 0 + +//Gamemodes + +/datum/ghosttrap/merc + object = "Mercenary" + pref_check = MODE_MERCENARY + ghost_trap_message = "They are occupying a mercenary." + ghost_trap_role = "Mercenary" + ban_checks = list(MODE_MERCENARY) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/merc/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/raider + object = "Raider" + pref_check = MODE_RAIDER + ghost_trap_message = "They are occupying a raider." + ghost_trap_role = "Raider" + ban_checks = list(MODE_RAIDER) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/raider/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/ninja + object = "Ninja" + pref_check = MODE_NINJA + ghost_trap_message = "They are occupying a ninja." + ghost_trap_role = "Ninja" + ban_checks = list(MODE_NINJA) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/ninja/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/wizard + object = "Wizard" + pref_check = MODE_WIZARD + ghost_trap_message = "They are occupying a wizard." + ghost_trap_role = "Wizard" + ban_checks = list(MODE_WIZARD) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/wizard/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/malf + object = "AI Malfunction" + pref_check = MODE_MALFUNCTION + ghost_trap_message = "They are occupying a malfunctioning AI." + ghost_trap_role = "Malfuntioning AI" + ban_checks = list(MODE_MALFUNCTION) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/malf/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/ert + object = "Emergency Responder" + pref_check = MODE_ERT + ghost_trap_message = "They are occupying an ERT member." + ghost_trap_role = "ERT member" + ban_checks = list(MODE_ERT) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/ert/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/changeling + object = "Changeling" + pref_check = MODE_CHANGELING + ghost_trap_message = "They are occupying a changeling." + ghost_trap_role = "Changeling" + ban_checks = list(MODE_CHANGELING) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/changeling/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/cultist + object = "Cult" + pref_check = MODE_CULTIST + ghost_trap_message = "They are occupying a cultist." + ghost_trap_role = "Cultist" + ban_checks = list(MODE_CULTIST) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/cultist/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/traitor + object = "Traitor" + pref_check = MODE_TRAITOR + ghost_trap_message = "They are occupying a traitor." + ghost_trap_role = "Traitor" + ban_checks = list(MODE_TRAITOR) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/traitor/welcome_candidate(var/mob/target) + target << " Check your notes for your PDA code!" + return 1 + +/datum/ghosttrap/vampire + object = "Vampire" + pref_check = MODE_VAMPIRE + ghost_trap_message = "They are occupying a vampire." + ghost_trap_role = "vampire" + ban_checks = list(MODE_VAMPIRE) + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/vampire/welcome_candidate(var/mob/target) + return 0 + +/datum/ghosttrap/special + object = "Special" + pref_check = null + ghost_trap_message = "They are occupying a person." + ghost_trap_role = "person" + ban_checks = list() + can_set_own_name = FALSE + list_as_special_role = FALSE + +/datum/ghosttrap/special/welcome_candidate(var/mob/target) + return 0 \ No newline at end of file diff --git a/html/changelogs/Printer16-Replaceplayer.yml b/html/changelogs/Printer16-Replaceplayer.yml new file mode 100644 index 00000000000..a0dedb24ba6 --- /dev/null +++ b/html/changelogs/Printer16-Replaceplayer.yml @@ -0,0 +1,37 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +################################# + +# Your name. +author: Printer16 + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Admins can now replace people using the 'replace player with ghost' option in the secrets tab."