diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 5c483b310fe..b62f32c2da9 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -490,19 +490,26 @@ proc/pollCandidates(Question, be_special_type, antag_age_check = 0, poll_time = return candidates -/proc/pollCandidatesByKeyWithVeto(adminclient, adminusr, max_slots, Question, be_special_type, antag_age_check = 0, poll_time = 300, ignore_respawnability = 0, min_hours = 0, flashwindow = TRUE, check_antaghud = TRUE) +/proc/pollCandidatesWithVeto(adminclient, adminusr, max_slots, Question, be_special_type, antag_age_check = 0, poll_time = 300, ignore_respawnability = 0, min_hours = 0, flashwindow = TRUE, check_antaghud = TRUE) var/list/willing_ghosts = pollCandidates(Question, be_special_type, antag_age_check, poll_time, ignore_respawnability, min_hours, flashwindow, check_antaghud) - var/list/candidate_ckeys = list() - var/list/selected_ckeys = list() + var/list/selected_ghosts = list() if(!willing_ghosts.len) - return selected_ckeys - for(var/mob/dead/observer/G in willing_ghosts) - candidate_ckeys += G.key - for(var/i = max_slots, (i > 0 && candidate_ckeys.len), i--) - var/this_ckey = input("Pick players. This will go on until there either no more ghosts to pick from or the slots are full.", "Candidates") as null|anything in candidate_ckeys - candidate_ckeys -= this_ckey - selected_ckeys += this_ckey - return selected_ckeys + return selected_ghosts + + var/list/candidate_ghosts = willing_ghosts.Copy() + + to_chat(adminusr, "Candidate Ghosts:"); + for(var/mob/dead/observer/G in candidate_ghosts) + if(G.key && G.client) + to_chat(adminusr, "- [G] ([G.key])"); + else + candidate_ghosts -= G + + for(var/i = max_slots, (i > 0 && candidate_ghosts.len), i--) + var/this_ghost = input("Pick players. This will go on until there either no more ghosts to pick from or the [i] remaining slot(s) are full.", "Candidates") as null|anything in candidate_ghosts + candidate_ghosts -= this_ghost + selected_ghosts += this_ghost + return selected_ghosts /proc/window_flash(client/C) if(ismob(C)) diff --git a/code/modules/admin/verbs/striketeam.dm b/code/modules/admin/verbs/striketeam.dm index 8eaede660e1..1e809bcd948 100644 --- a/code/modules/admin/verbs/striketeam.dm +++ b/code/modules/admin/verbs/striketeam.dm @@ -37,8 +37,8 @@ var/global/sent_strike_team = 0 break // Find ghosts willing to be DS - var/list/commando_ckeys = pollCandidatesByKeyWithVeto(src, usr, commandos_possible, "Join the DeathSquad?",, 21, 600, 1, role_playtime_requirements[ROLE_DEATHSQUAD], TRUE, FALSE) - if(!commando_ckeys.len) + var/list/commando_ghosts = pollCandidatesWithVeto(src, usr, commandos_possible, "Join the DeathSquad?",, 21, 600, 1, role_playtime_requirements[ROLE_DEATHSQUAD], TRUE, FALSE) + if(!commando_ghosts.len) to_chat(usr, "Nobody volunteered to join the DeathSquad.") return @@ -47,53 +47,62 @@ var/global/sent_strike_team = 0 // Spawns commandos and equips them. var/commando_number = commandos_possible //for selecting a leader var/is_leader = TRUE // set to FALSE after leader is spawned + for(var/obj/effect/landmark/L in landmarks_list) - if(commando_number<=0) break + + if(commando_number <= 0) + break + if(L.name == "Commando") - spawn(0) - var/use_ds_borg = FALSE - var/ghost_key // Ghost ckey that we intend to put into the commando. Can remain undefined if we don't have one. - if(commando_ckeys.len) - ghost_key = pick(commando_ckeys) - commando_ckeys -= ghost_key - if(!is_leader) - var/new_gender = alert(src, "Select Deathsquad Type.", "DS Character Generation", "Organic", "Cyborg") - if(new_gender == "Cyborg") - use_ds_borg = TRUE + if(!commando_ghosts.len) + break - if(use_ds_borg) - var/mob/living/silicon/robot/deathsquad/R = new() - R.forceMove(get_turf(L)) - var/rnum = rand(1,1000) - var/borgname = "Epsilon [rnum]" - R.name = borgname - R.custom_name = borgname - R.real_name = R.name - R.mind = new - R.mind.current = R - R.mind.original = R - R.mind.assigned_role = SPECIAL_ROLE_DEATHSQUAD - R.mind.special_role = SPECIAL_ROLE_DEATHSQUAD - if(!(R.mind in ticker.minds)) - ticker.minds += R.mind - ticker.mode.traitors += R.mind - if(ghost_key) - R.key = ghost_key - if(nuke_code) - R.mind.store_memory("Nuke Code: [nuke_code].") - R.mind.store_memory("Mission: [input].") - to_chat(R, "You are a Special Operations cyborg, in the service of Central Command. \nYour current mission is: [input]") - else - var/mob/living/carbon/human/new_commando = create_death_commando(L, is_leader) - if(ghost_key) - new_commando.key = ghost_key - new_commando.internal = new_commando.s_store - new_commando.update_action_buttons_icon() - if(nuke_code) - new_commando.mind.store_memory("Nuke Code: [nuke_code].") - new_commando.mind.store_memory("Mission: [input].") - to_chat(new_commando, "You are a Special Ops [is_leader ? "TEAM LEADER" : "commando"] in the service of Central Command. Check the table ahead for detailed instructions.\nYour current mission is: [input]") + var/use_ds_borg = FALSE + var/mob/ghost_mob = pick(commando_ghosts) + commando_ghosts -= ghost_mob + if(!ghost_mob || !ghost_mob.key || !ghost_mob.client) + continue + + if(!is_leader) + var/new_dstype = alert(ghost_mob.client, "Select Deathsquad Type.", "DS Character Generation", "Organic", "Cyborg") + if(new_dstype == "Cyborg") + use_ds_borg = TRUE + + if(!ghost_mob || !ghost_mob.key || !ghost_mob.client) // Have to re-check this due to the above alert() call + continue + + if(use_ds_borg) + var/mob/living/silicon/robot/deathsquad/R = new() + R.forceMove(get_turf(L)) + var/rnum = rand(1,1000) + var/borgname = "Epsilon [rnum]" + R.name = borgname + R.custom_name = borgname + R.real_name = R.name + R.mind = new + R.mind.current = R + R.mind.original = R + R.mind.assigned_role = SPECIAL_ROLE_DEATHSQUAD + R.mind.special_role = SPECIAL_ROLE_DEATHSQUAD + if(!(R.mind in ticker.minds)) + ticker.minds += R.mind + ticker.mode.traitors += R.mind + R.key = ghost_mob.key + if(nuke_code) + R.mind.store_memory("Nuke Code: [nuke_code].") + R.mind.store_memory("Mission: [input].") + to_chat(R, "You are a Special Operations cyborg, in the service of Central Command. \nYour current mission is: [input]") + else + var/mob/living/carbon/human/new_commando = create_death_commando(L, is_leader) + new_commando.mind.key = ghost_mob.key + new_commando.key = ghost_mob.key + new_commando.internal = new_commando.s_store + new_commando.update_action_buttons_icon() + if(nuke_code) + new_commando.mind.store_memory("Nuke Code: [nuke_code].") + new_commando.mind.store_memory("Mission: [input].") + to_chat(new_commando, "You are a Special Ops [is_leader ? "TEAM LEADER" : "commando"] in the service of Central Command. Check the table ahead for detailed instructions.\nYour current mission is: [input]") is_leader = FALSE commando_number-- @@ -133,6 +142,7 @@ var/global/sent_strike_team = 0 A.real_name = "[commando_rank] [commando_name]" A.copy_to(new_commando) + new_commando.dna.ready_dna(new_commando)//Creates DNA. //Creates mind stuff. diff --git a/code/modules/admin/verbs/striketeam_syndicate.dm b/code/modules/admin/verbs/striketeam_syndicate.dm index ec31632208e..c5f46c98592 100644 --- a/code/modules/admin/verbs/striketeam_syndicate.dm +++ b/code/modules/admin/verbs/striketeam_syndicate.dm @@ -45,8 +45,8 @@ var/global/sent_syndicate_strike_team = 0 break // Find ghosts willing to be SST - var/list/commando_ckeys = pollCandidatesByKeyWithVeto(src, usr, syndicate_commandos_possible, "Join the Syndicate Strike Team?",, 21, 600, 1, role_playtime_requirements[ROLE_DEATHSQUAD], TRUE, FALSE) - if(!commando_ckeys.len) + var/list/commando_ghosts = pollCandidatesWithVeto(src, usr, syndicate_commandos_possible, "Join the Syndicate Strike Team?",, 21, 600, 1, role_playtime_requirements[ROLE_DEATHSQUAD], TRUE, FALSE) + if(!commando_ghosts.len) to_chat(usr, "Nobody volunteered to join the SST.") return @@ -54,15 +54,29 @@ var/global/sent_syndicate_strike_team = 0 //Spawns commandos and equips them. for(var/obj/effect/landmark/L in landmarks_list) - if(syndicate_commando_number<=0) break + + if(syndicate_commando_number <= 0) + break + if(L.name == "Syndicate-Commando") + + if(!commando_ghosts.len) + break + + var/mob/ghost_mob = pick(commando_ghosts) + commando_ghosts -= ghost_mob + + if(!ghost_mob || !ghost_mob.key || !ghost_mob.client) + continue + var/mob/living/carbon/human/new_syndicate_commando = create_syndicate_death_commando(L, is_leader) - if(commando_ckeys.len) - new_syndicate_commando.key = pick(commando_ckeys) - commando_ckeys -= new_syndicate_commando.key - new_syndicate_commando.internal = new_syndicate_commando.s_store - new_syndicate_commando.update_action_buttons_icon() + if(!new_syndicate_commando) + continue + + new_syndicate_commando.key = ghost_mob.key + new_syndicate_commando.internal = new_syndicate_commando.s_store + new_syndicate_commando.update_action_buttons_icon() //So they don't forget their code or mission. if(nuke_code) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 23abcfb2897..8fff84a4e69 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -203,6 +203,7 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts b_type = pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+") max_gear_slots = config.max_loadout_points + var/loaded_preferences_successfully = FALSE if(istype(C)) if(!IsGuestKey(C.key)) unlock_content = C.IsByondMember() @@ -211,16 +212,17 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts if(C.donator_level >= DONATOR_LEVEL_ONE) max_gear_slots += 5 - var/loaded_preferences_successfully = load_preferences(C) - if(loaded_preferences_successfully) - if(load_character(C)) - return + loaded_preferences_successfully = load_preferences(C) // Do not call this with no client/C, it generates a runtime / SQL error + if(loaded_preferences_successfully) + if(load_character(C)) + return //we couldn't load character data so just randomize the character appearance + name random_character() //let's create a random character then - rather than a fat, bald and naked man. real_name = random_name(gender) - if(!loaded_preferences_successfully) - save_preferences(C) - save_character(C) //let's save this new random character so it doesn't keep generating new ones. + if(istype(C)) + if(!loaded_preferences_successfully) + save_preferences(C) // Do not call this with no client/C, it generates a runtime / SQL error + save_character(C) // Do not call this with no client/C, it generates a runtime / SQL error /datum/preferences/proc/color_square(colour) return "___"