From 9a3ccb6d47c21861ee7f6b95cee1691632145023 Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Mon, 17 Sep 2012 01:44:36 +0000 Subject: [PATCH] Re-added most of the one-click antag buttons back that the tensioner used to have. The Admin tab now has a 'create antagonist' button that opens a panel with a list of options. Make traitor, changeling, revolution, cult, malf AI and Wizard should all work just fine. Make Nuke ops, space ninja, aliens and deathsquad all need some work. Hopefully this at least covers the majority of what admins "need" this panel for, at least until the rest of the buttons can be fixed. Please report any bugs found with this to the issue tracker. I'll get to them as soon as I can. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4707 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/admin/admin.dm | 42 ++ code/modules/admin/admin_verbs.dm | 2 + code/modules/admin/verbs/one_click_antag.dm | 452 ++++++++++++++++++++ 3 files changed, 496 insertions(+) create mode 100644 code/modules/admin/verbs/one_click_antag.dm diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 750a79466ab..2533a8fa978 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -24,6 +24,48 @@ var/global/floorIsLava = 0 log_admin("[key_name(usr)] tried to use the admin panel without authorization.") return + if(href_list["makeAntag"]) + switch(href_list["makeAntag"]) + if("1") + log_admin("[key_name(usr)] has spawned a traitor.") + if(!src.makeTratiors()) + usr << "\red Unfortunatly there were no candidates available" + if("2") + log_admin("[key_name(usr)] has spawned a changeling.") + if(!src.makeChanglings()) + usr << "\red Unfortunatly there were no candidates available" + if("3") + log_admin("[key_name(usr)] has spawned revolutionaries.") + if(!src.makeRevs()) + usr << "\red Unfortunatly there were no candidates available" + if("4") + log_admin("[key_name(usr)] has spawned a cultists.") + if(!src.makeCult()) + usr << "\red Unfortunatly there were no candidates available" + if("5") + log_admin("[key_name(usr)] has spawned a malf AI.") + if(!src.makeMalfAImode()) + usr << "\red Unfortunatly there were no candidates available" + if("6") + log_admin("[key_name(usr)] has spawned a wizard.") + if(!src.makeWizard()) + usr << "\red Unfortunatly there were no candidates available" + if("7") + log_admin("[key_name(usr)] has spawned a nuke team.") + if(!src.makeNukeTeam()) + usr << "\red Unfortunatly there were no candidates available" + if("8") + log_admin("[key_name(usr)] has spawned a ninja.") + src.makeSpaceNinja() + if("9") + log_admin("[key_name(usr)] has spawned aliens.") + src.makeAliens() + if("10") + log_admin("[key_name(usr)] has spawned a death squad.") + if(!src.makeDeathsquad()) + usr << "\red Unfortunatly there were no candidates available" + return + if(href_list["call_shuttle"]) if (src.rank in list("Trial Admin", "Badmin", "Game Admin", "Game Master")) if( ticker.mode.name == "blob" ) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 43f6f8f4ad6..f91e691c723 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -186,6 +186,7 @@ verbs += /client/proc/toggleadminhelpsound verbs += /proc/possess verbs += /proc/release + verbs += /client/proc/one_click_antag else return @@ -425,6 +426,7 @@ verbs -= /client/proc/debug_controller verbs -= /client/proc/check_ai_laws verbs -= /client/proc/cmd_debug_mob_lists + verbs -= /client/proc/one_click_antag return diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm new file mode 100644 index 00000000000..42e71a8e386 --- /dev/null +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -0,0 +1,452 @@ +client/proc/one_click_antag() + set name = "Create Antagonist" + set desc = "Auto-create an antagonist of your choice" + set category = "Admin" + + if(holder) + holder.one_click_antag() + return + + +/obj/admins/proc/one_click_antag() + + var/dat = {"One-click Antagonist
+ Make Tratiors
+ Make Changlings
+ Make Revs
+ Make Cult
+ Make Malf AI
+ Make Wizard (Requires Ghosts)
+ "} +/* These dont work just yet + Ninja, aliens and deathsquad I have not looked into yet + Nuke team is getting a null mob returned from makebody() (runtime error: null.mind. Line 272) + + Make Nuke Team (Requires Ghosts)
+ Make Space Ninja (Requires Ghosts)
+ Make Aliens (Requires Ghosts)
+ Make Deathsquad (Syndicate) (Requires Ghosts)
+ "} +*/ + usr << browse(dat, "window=oneclickantag;size=400x400") + return + + +/obj/admins/proc/makeMalfAImode() + + var/list/mob/living/silicon/AIs = list() + var/mob/living/silicon/malfAI = null + var/datum/mind/themind = null + + for(var/mob/living/silicon/ai/ai in player_list) + if(ai.client) + AIs += ai + + if(AIs.len) + malfAI = pick(AIs) + + if(malfAI) + themind = malfAI.mind + themind.make_AI_Malf() + return 1 + + return 0 + + +/obj/admins/proc/makeTratiors() + var/datum/game_mode/traitor/temp = new + + if(config.protect_roles_from_antagonist) + temp.restricted_jobs += temp.protected_jobs + + var/list/mob/living/carbon/human/candidates = list() + var/mob/living/carbon/human/H = null + + for(var/mob/living/carbon/human/applicant in player_list) + var/datum/preferences/preferences = new + + if(!applicant.stat) + if(applicant.mind) + if (!applicant.mind.special_role) + if(!jobban_isbanned(applicant, "traitor") && !jobban_isbanned(applicant, "Syndicate")) + if(!(applicant.job in temp.restricted_jobs)) + if(applicant.client) + if(preferences.savefile_load(applicant, 0)) + if(preferences.be_special & BE_TRAITOR) + candidates += applicant + + if(candidates.len) + var/numTratiors = min(candidates.len, 3) + + for(var/i = 0, i300)//If more than 30 game seconds passed. + return + candidates += G + if("No") + return + else + return + + sleep(300) + + if(candidates.len) + shuffle(candidates) + for(var/mob/i in candidates) + if(!i || !i.client) continue //Dont bother removing them from the list since we only grab one wizard + + theghost = i + break + + if(theghost) + var/mob/living/carbon/human/new_character=makeBody(theghost) + new_character.mind.make_Wizard() + return 1 + + return 0 + + +/obj/admins/proc/makeCult() + + var/datum/game_mode/cult/temp = new + if(config.protect_roles_from_antagonist) + temp.restricted_jobs += temp.protected_jobs + + var/list/mob/living/carbon/human/candidates = list() + var/mob/living/carbon/human/H = null + + for(var/mob/living/carbon/human/applicant in player_list) + + var/datum/preferences/preferences = new + + if(!applicant.stat) + if(applicant.mind) + if (!applicant.mind.special_role) + if(!jobban_isbanned(applicant, "cultist") && !jobban_isbanned(applicant, "Syndicate")) + if(!(applicant.job in temp.restricted_jobs)) + if(applicant.client) + if(preferences.savefile_load(applicant, 0)) + if(preferences.be_special & BE_CULTIST) + candidates += applicant + + if(candidates.len) + var/numCultists = min(candidates.len, 4) + + for(var/i = 0, i300)//If more than 30 game seconds passed. + return + candidates += G + if("No") + return + else + return + + sleep(300) + + if(candidates.len) + var/numagents = 5 + var/agentcount = 0 + syndicate_begin() + + for(var/i = 0, i300)//If more than 30 game seconds passed. + return + candidates += G + if("No") + return + else + return + sleep(300) + + for(var/mob/dead/observer/G in candidates) + if(!G.key) + candidates.Remove(G) + + if(candidates.len) + var/numagents = 6 + //Spawns commandos and equips them. + for (var/obj/effect/landmark/L in /area/syndicate_mothership/elite_squad) + if(numagents<=0) + break + if (L.name == "Syndicate-Commando") + syndicate_leader_selected = numagents == 1?1:0 + + var/mob/living/carbon/human/new_syndicate_commando = create_syndicate_death_commando(L, syndicate_leader_selected) + + + while((!theghost || !theghost.client) && candidates.len) + theghost = pick(candidates) + candidates.Remove(theghost) + + if(!theghost) + del(new_syndicate_commando) + break + + new_syndicate_commando.key = theghost.key + new_syndicate_commando.internal = new_syndicate_commando.s_store + new_syndicate_commando.internals.icon_state = "internal1" + + //So they don't forget their code or mission. + + + new_syndicate_commando << "\blue You are an Elite Syndicate. [!syndicate_leader_selected?"commando":"LEADER"] in the service of the Syndicate. \nYour current mission is: \red [input]" + + numagents-- + if(numagents >= 6) + return 0 + + for (var/obj/effect/landmark/L in /area/shuttle/syndicate_elite) + if (L.name == "Syndicate-Commando-Bomb") + new /obj/effect/spawner/newbomb/timer/syndicate(L.loc) + + return 1 + + +/obj/admins/proc/makeBody(var/mob/dead/observer/G_found) // Uses stripped down and bastardized code from respawn character + if(!G_found || !G_found.key) return + + //First we spawn a dude. + var/mob/living/carbon/human/new_character = new(pick(latejoin))//The mob being spawned. + + new_character.gender = pick(MALE,FEMALE) + + var/datum/preferences/A = new() + A.randomize_appearance_for(new_character) + if(new_character.gender == MALE) + new_character.real_name = "[pick(first_names_male)] [pick(last_names)]" + else + new_character.real_name = "[pick(first_names_female)] [pick(last_names)]" + new_character.name = new_character.real_name + new_character.age = rand(17,45) + + new_character.dna.ready_dna(new_character) + new_character.key = G_found.key + + return new_character + +/obj/admins/proc/create_syndicate_death_commando(obj/spawn_location, syndicate_leader_selected = 0) + var/mob/living/carbon/human/new_syndicate_commando = new(spawn_location.loc) + var/syndicate_commando_leader_rank = pick("Lieutenant", "Captain", "Major") + var/syndicate_commando_rank = pick("Corporal", "Sergeant", "Staff Sergeant", "Sergeant 1st Class", "Master Sergeant", "Sergeant Major") + var/syndicate_commando_name = pick(last_names) + + new_syndicate_commando.gender = pick(MALE, FEMALE) + + var/datum/preferences/A = new()//Randomize appearance for the commando. + A.randomize_appearance_for(new_syndicate_commando) + + new_syndicate_commando.real_name = "[!syndicate_leader_selected ? syndicate_commando_rank : syndicate_commando_leader_rank] [syndicate_commando_name]" + new_syndicate_commando.name = new_syndicate_commando.real_name + new_syndicate_commando.age = !syndicate_leader_selected ? rand(23,35) : rand(35,45) + + new_syndicate_commando.dna.ready_dna(new_syndicate_commando)//Creates DNA. + + //Creates mind stuff. + new_syndicate_commando.mind_initialize() + new_syndicate_commando.mind.assigned_role = "MODE" + new_syndicate_commando.mind.special_role = "Syndicate Commando" + + //Adds them to current traitor list. Which is really the extra antagonist list. + ticker.mode.traitors += new_syndicate_commando.mind + new_syndicate_commando.equip_syndicate_commando(syndicate_leader_selected) + + return new_syndicate_commando \ No newline at end of file