From 35ca96331e5af4fe7ef68134461a49ecc42e5d26 Mon Sep 17 00:00:00 2001 From: Shadowlight213 Date: Sun, 18 Oct 2015 15:25:14 -0700 Subject: [PATCH 1/5] Adds jobban support to syndicate borg Adds jobban and pref checking to various events Adds support for alien jobbans Adds feedback to alien infestation event. --- code/__HELPERS/game.dm | 6 ++-- code/game/gamemodes/antag_spawner.dm | 2 +- code/modules/admin/topic.dm | 4 +-- code/modules/admin/verbs/one_click_antag.dm | 2 +- code/modules/events/abductor.dm | 4 +-- code/modules/events/alien_infestation.dm | 33 +++++++++++++++++-- code/modules/events/operative.dm | 6 ++-- .../carbon/alien/special/alien_embryo.dm | 2 +- 8 files changed, 45 insertions(+), 14 deletions(-) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 1d7c5cfdd24..6709de50dfe 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -290,7 +290,7 @@ // Will return a list of active candidates. It increases the buffer 5 times until it finds a candidate which is active within the buffer. -/proc/get_candidates(be_special_flag=0, afk_bracket=3000) +/proc/get_candidates(be_special_flag=0,afk_bracket=3000, var/jobbanType) var/list/candidates = list() // Keep looping until we find a non-afk candidate within the time bracket (we limit the bracket to 10 minutes (6000)) while(!candidates.len && afk_bracket < 6000) @@ -298,7 +298,9 @@ if(G.client != null) if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD)) if(!G.client.is_afk(afk_bracket) && (G.client.prefs.be_special & be_special_flag)) - candidates += G.client + if (jobbanType) + if(!(jobban_isbanned(G, jobbanType) || jobban_isbanned(G, "Syndicate"))) + candidates += G.client afk_bracket += 600 // Add a minute to the bracket, for every attempt return candidates diff --git a/code/game/gamemodes/antag_spawner.dm b/code/game/gamemodes/antag_spawner.dm index 835898e450d..1ab4ecdc166 100644 --- a/code/game/gamemodes/antag_spawner.dm +++ b/code/game/gamemodes/antag_spawner.dm @@ -138,7 +138,7 @@ borg_to_spawn = input("What type?", "Cyborg Type", type) as null|anything in possible_types if(!borg_to_spawn) return - var/list/borg_candicates = get_candidates(BE_OPERATIVE) + var/list/borg_candicates = get_candidates(BE_OPERATIVE, 3000, "operative") if(borg_candicates.len > 0) used = 1 var/client/C = pick(borg_candicates) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 49a46309629..e05eb149bc8 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -802,13 +802,13 @@ jobs += "[replacetext("Malf AI", " ", " ")]" else jobs += "[replacetext("Malf AI", " ", " ")]" - +*/ //Alien if(jobban_isbanned(M, "alien candidate") || isbanned_dept) jobs += "[replacetext("Alien", " ", " ")]" else jobs += "[replacetext("Alien", " ", " ")]" - +/* //Infested Monkey if(jobban_isbanned(M, "infested monkey") || isbanned_dept) jobs += "[replacetext("Infested Monkey", " ", " ")]" diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 198dbff5c2e..36775bfbef6 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -412,7 +412,7 @@ /datum/admins/proc/makeOfficial() var/mission = input("Assign a task for the official", "Assign Task", "Conduct a routine preformance review of [station_name()] and its Captain.") - var/list/mob/dead/observer/candidates = pollCandidates("Do you wish to be considered to be a Centcom Official?", "pAI") + var/list/mob/dead/observer/candidates = pollCandidates("Do you wish to be considered to be a Centcom Official?", "deathsquad") if(candidates.len) var/mob/dead/observer/chosen_candidate = pick(candidates) diff --git a/code/modules/events/abductor.dm b/code/modules/events/abductor.dm index 3a4aacbb116..3e5dd4be203 100644 --- a/code/modules/events/abductor.dm +++ b/code/modules/events/abductor.dm @@ -18,8 +18,8 @@ makeAbductorTeam() /datum/round_event/abductor/proc/makeAbductorTeam() - var/list/mob/dead/observer/candidates = pollCandidates("Do you wish to be considered for an Abductor Team?", "abductor", null) - + var/list/mob/dead/observer/candidates = pollCandidates("Do you wish to be considered for an Abductor Team?", "abductor", null, BE_ABDUCTOR ) + if(candidates.len >= 2) //Oh god why we can't have static functions var/number = ticker.mode.abductor_teams + 1 diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index a461a546282..23df6e23628 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -26,6 +26,13 @@ /datum/round_event/alien_infestation/start() + get_alien() + + + + + +/datum/round_event/alien_infestation/proc/get_alien(end_if_fail = 0) var/list/vents = list() for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in machines) if(qdeleted(temp_vent)) @@ -35,7 +42,15 @@ if(temp_vent_parent.other_atmosmch.len > 20) //Stops Aliens getting stuck in small networks. See: Security, Virology vents += temp_vent - var/list/candidates = get_candidates(BE_ALIEN, ALIEN_AFK_BRACKET) + if(!vents.len) + message_admins("An event attempted to spawn an alien but no suitable vents were found. Shutting down.") + return kill() + + var/list/candidates = get_candidates(BE_ALIEN, ALIEN_AFK_BRACKET, "alien candidate") + if(!candidates.len) + if(end_if_fail) + return 0 + return find_alien() while(spawncount > 0 && vents.len && candidates.len) var/obj/vent = pick_n_take(vents) @@ -45,4 +60,18 @@ new_xeno.key = C.key spawncount-- - successSpawn = 1 \ No newline at end of file + successSpawn = 1 + message_admins("[new_xeno.key] has been made into an alien by an event.") + log_game("[new_xeno.key] was spawned as an alien by an event.") + if(successSpawn) + return 1 + + +/datum/round_event/alien_infestation/proc/find_alien() + message_admins("Event attempted to spawn an alien but no candidates were available. Will try again momentarily...") + spawn(50) + if(get_alien(1)) + message_admins("Situation has been resolved") + return 0 + message_admins("Unfortunately, no candidates were available for becoming an alien. Shutting down.") + return kill() \ No newline at end of file diff --git a/code/modules/events/operative.dm b/code/modules/events/operative.dm index f11961388b7..519a46c56b2 100644 --- a/code/modules/events/operative.dm +++ b/code/modules/events/operative.dm @@ -10,7 +10,7 @@ /datum/round_event/operative/proc/get_operative(end_if_fail = 0) key_of_operative = null if(!key_of_operative) - var/list/candidates = get_candidates(BE_OPERATIVE) + var/list/candidates = get_candidates(BE_OPERATIVE, 3000, "operative") if(!candidates.len) if(end_if_fail) return 0 @@ -29,7 +29,7 @@ spawn_locs += L.loc if(!spawn_locs.len) return kill() - + var/mob/living/carbon/human/operative = new(pick(spawn_locs)) var/datum/preferences/A = new A.copy_to(operative) @@ -45,7 +45,7 @@ var/obj/machinery/nuclearbomb/selfdestruct/nuke = locate() in machines if(nuke) - var/nuke_code + var/nuke_code if(!nuke.r_code || nuke.r_code == "ADMIN") nuke_code = "[rand(10000, 99999)]" nuke.r_code = nuke_code diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index bb7abd6f7f9..d81f7136c05 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -67,7 +67,7 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds /obj/item/organ/internal/body_egg/alien_embryo/proc/AttemptGrow(gib_on_success = 1) if(!owner) return - var/list/candidates = get_candidates(BE_ALIEN, ALIEN_AFK_BRACKET) + var/list/candidates = get_candidates(BE_ALIEN, ALIEN_AFK_BRACKET, "alien candidate") var/client/C = null // To stop clientless larva, we will check that our host has a client From c6971d35e999ea879246af7794fa335c9c78ecce Mon Sep 17 00:00:00 2001 From: Shadowlight213 Date: Sun, 18 Oct 2015 15:36:22 -0700 Subject: [PATCH 2/5] Removes misc spaces --- code/modules/events/abductor.dm | 2 +- code/modules/events/alien_infestation.dm | 6 ------ code/modules/events/operative.dm | 4 ++-- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/code/modules/events/abductor.dm b/code/modules/events/abductor.dm index 3e5dd4be203..92828d70c72 100644 --- a/code/modules/events/abductor.dm +++ b/code/modules/events/abductor.dm @@ -19,7 +19,7 @@ /datum/round_event/abductor/proc/makeAbductorTeam() var/list/mob/dead/observer/candidates = pollCandidates("Do you wish to be considered for an Abductor Team?", "abductor", null, BE_ABDUCTOR ) - + if(candidates.len >= 2) //Oh god why we can't have static functions var/number = ticker.mode.abductor_teams + 1 diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 23df6e23628..14f28d48213 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -28,10 +28,6 @@ /datum/round_event/alien_infestation/start() get_alien() - - - - /datum/round_event/alien_infestation/proc/get_alien(end_if_fail = 0) var/list/vents = list() for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in machines) @@ -51,7 +47,6 @@ if(end_if_fail) return 0 return find_alien() - while(spawncount > 0 && vents.len && candidates.len) var/obj/vent = pick_n_take(vents) var/client/C = pick_n_take(candidates) @@ -66,7 +61,6 @@ if(successSpawn) return 1 - /datum/round_event/alien_infestation/proc/find_alien() message_admins("Event attempted to spawn an alien but no candidates were available. Will try again momentarily...") spawn(50) diff --git a/code/modules/events/operative.dm b/code/modules/events/operative.dm index 519a46c56b2..cb185d01dec 100644 --- a/code/modules/events/operative.dm +++ b/code/modules/events/operative.dm @@ -29,7 +29,7 @@ spawn_locs += L.loc if(!spawn_locs.len) return kill() - + var/mob/living/carbon/human/operative = new(pick(spawn_locs)) var/datum/preferences/A = new A.copy_to(operative) @@ -45,7 +45,7 @@ var/obj/machinery/nuclearbomb/selfdestruct/nuke = locate() in machines if(nuke) - var/nuke_code + var/nuke_code if(!nuke.r_code || nuke.r_code == "ADMIN") nuke_code = "[rand(10000, 99999)]" nuke.r_code = nuke_code From 9884a6624a1b7abfadf9352c401fe55f4c03c7a3 Mon Sep 17 00:00:00 2001 From: Shadowlight213 Date: Sun, 18 Oct 2015 16:20:58 -0700 Subject: [PATCH 3/5] Adds Shadowling bans --- code/game/gamemodes/game_mode.dm | 1 + code/modules/admin/topic.dm | 10 ++++++++-- code/modules/admin/verbs/one_click_antag.dm | 10 ++++++---- .../mob/living/carbon/alien/special/alien_embryo.dm | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index ec1b2cb906b..2d5b1be7fdc 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -303,6 +303,7 @@ if(BE_CULTIST) roletext="cultist" if(BE_MONKEY) roletext="monkey" if(BE_ABDUCTOR) roletext="abductor" + if(BE_SHADOWLING) roletext="shadowling" // Ultimate randomizing code right here diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index e05eb149bc8..8f932615227 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -771,20 +771,26 @@ else jobs += "[replacetext("Revolutionary", " ", " ")]" - jobs += "" //Breaking it up so it fits nicer on the screen every 5 entries - //Gangster if(jobban_isbanned(M, "gangster") || isbanned_dept) jobs += "[replacetext("Gangster", " ", " ")]" else jobs += "[replacetext("Gangster", " ", " ")]" + jobs += "" //Breaking it up so it fits nicer on the screen every 5 entries + //Cultist if(jobban_isbanned(M, "cultist") || isbanned_dept) jobs += "[replacetext("Cultist", " ", " ")]" else jobs += "[replacetext("Cultist", " ", " ")]" + //Shadowling + if(jobban_isbanned(M, "shadowling") || isbanned_dept) + jobs += "[replacetext("Shadowling", " ", " ")]" + else + jobs += "[replacetext("Shadowling", " ", " ")]" + //Wizard if(jobban_isbanned(M, "wizard") || isbanned_dept) jobs += "[replacetext("Wizard", " ", " ")]" diff --git a/code/modules/admin/verbs/one_click_antag.dm b/code/modules/admin/verbs/one_click_antag.dm index 36775bfbef6..ff607a2c1f6 100644 --- a/code/modules/admin/verbs/one_click_antag.dm +++ b/code/modules/admin/verbs/one_click_antag.dm @@ -575,6 +575,7 @@ else return +//Shadowling /datum/admins/proc/makeShadowling() var/datum/game_mode/shadowling/temp = new if(config.protect_roles_from_antagonist) @@ -588,10 +589,11 @@ if(!applicant.stat) if(applicant.mind) if(!applicant.mind.special_role) - if(temp.age_check(applicant.client)) - if(!(applicant.job in temp.restricted_jobs)) - if(!(is_shadow_or_thrall(applicant))) - candidates += applicant + if(!jobban_isbanned(applicant, "shadowling") && !jobban_isbanned(applicant, "Syndicate")) + if(temp.age_check(applicant.client)) + if(!(applicant.job in temp.restricted_jobs)) + if(!(is_shadow_or_thrall(applicant))) + candidates += applicant if(candidates.len) H = pick(candidates) diff --git a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm index d81f7136c05..65cfed936c1 100644 --- a/code/modules/mob/living/carbon/alien/special/alien_embryo.dm +++ b/code/modules/mob/living/carbon/alien/special/alien_embryo.dm @@ -77,7 +77,7 @@ var/const/ALIEN_AFK_BRACKET = 450 // 45 seconds if(candidates.len) C = pick(candidates) - else if(owner.client) + else if(owner.client && !(jobban_isbanned(owner, "alien candidate") || jobban_isbanned(owner, "Syndicate"))) C = owner.client else stage = 4 // Let's try again later. From 435fbb4653221d96a14a82dc16eef3a88a7ced75 Mon Sep 17 00:00:00 2001 From: Shadowlight213 Date: Sun, 18 Oct 2015 16:24:26 -0700 Subject: [PATCH 4/5] Fix --- code/__HELPERS/game.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 6709de50dfe..a0c581966a8 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -301,6 +301,8 @@ if (jobbanType) if(!(jobban_isbanned(G, jobbanType) || jobban_isbanned(G, "Syndicate"))) candidates += G.client + else + candidates += G.client afk_bracket += 600 // Add a minute to the bracket, for every attempt return candidates From 3303a926fac5ca0410200a651807f3618a66e691 Mon Sep 17 00:00:00 2001 From: Shadowlight213 Date: Mon, 19 Oct 2015 21:15:35 -0700 Subject: [PATCH 5/5] Removes commented out code --- code/modules/admin/topic.dm | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 8f932615227..fdb2ccfac82 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -803,24 +803,12 @@ else jobs += "[replacetext("Abductor", " ", " ")]" -/* //Malfunctioning AI //Removed Malf-bans because they're a pain to impliment - if(jobban_isbanned(M, "malf AI") || isbanned_dept) - jobs += "[replacetext("Malf AI", " ", " ")]" - else - jobs += "[replacetext("Malf AI", " ", " ")]" -*/ //Alien if(jobban_isbanned(M, "alien candidate") || isbanned_dept) jobs += "[replacetext("Alien", " ", " ")]" else jobs += "[replacetext("Alien", " ", " ")]" -/* - //Infested Monkey - if(jobban_isbanned(M, "infested monkey") || isbanned_dept) - jobs += "[replacetext("Infested Monkey", " ", " ")]" - else - jobs += "[replacetext("Infested Monkey", " ", " ")]" -*/ + jobs += "" body = "[jobs]"