From 24cc205ce5a2e2be35b106aef79ed894e6e9a93a Mon Sep 17 00:00:00 2001 From: Incoming Date: Sun, 22 Feb 2015 21:32:17 -0500 Subject: [PATCH] On primary antagonist rounds (wizard/blob/malfunction) if the config is set for continous rounds the round will convert on the fly to a new mode choosen from these mode if the primary antagonist dies: EXTENDED TRAITOR CHANGELING DOUBLE AGENTS TRAITORLING based on the game probabilities set through the config. The round will not convert if more than 30% of the players are dead (round immediatly ends) or if the shuttle is beyond the point of no return (the round ends normally). Adds the CONTINIOUS_ROUND_BLOB config --- code/controllers/configuration.dm | 3 ++ code/game/gamemodes/blob/blob_finish.dm | 12 +++++ code/game/gamemodes/changeling/changeling.dm | 1 + code/game/gamemodes/extended/extended.dm | 1 + code/game/gamemodes/game_mode.dm | 46 +++++++++++++++++++ .../game/gamemodes/malfunction/malfunction.dm | 2 + code/game/gamemodes/traitor/traitor.dm | 1 + code/game/gamemodes/wizard/wizard.dm | 14 ++++-- config/game_options.txt | 1 + 9 files changed, 77 insertions(+), 4 deletions(-) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index fe46cc00ae5..82238f59ea8 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -90,6 +90,7 @@ var/continuous_round_rev = 0 // Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke. var/continuous_round_wiz = 0 var/continuous_round_malf = 0 + var/continuous_round_blob = 0 var/shuttle_refuel_delay = 12000 var/show_game_type_odds = 0 //if set this allows players to see the odds of each roundtype on the get revision screen var/mutant_races = 0 //players can choose their mutant race before joining the game @@ -361,6 +362,8 @@ config.continuous_round_wiz = 1 if("continuous_round_malf") config.continuous_round_malf = 1 + if("continuous_round_blob") + config.continuous_round_blob = 1 if("shuttle_refuel_delay") config.shuttle_refuel_delay = text2num(value) if("show_game_type_odds") diff --git a/code/game/gamemodes/blob/blob_finish.dm b/code/game/gamemodes/blob/blob_finish.dm index 56c1b4449c8..852ad8e9c6e 100644 --- a/code/game/gamemodes/blob/blob_finish.dm +++ b/code/game/gamemodes/blob/blob_finish.dm @@ -1,9 +1,21 @@ /datum/game_mode/blob/check_finished() + if(round_converted) + return 0 if(infected_crew.len > burst)//Some blobs have yet to burst return 0 if(blobwincount <= blobs.len)//Blob took over return 1 if(!blob_cores.len) // blob is dead + if(config.continuous_round_blob) + if(!convert_roundtype()) + return ..() + else + if(SSshuttle.emergency.mode == SHUTTLE_STRANDED) + SSshuttle.emergency.mode = SHUTTLE_DOCKED + SSshuttle.emergency.timer = world.time + priority_announce("Hostile enviroment resolved. You have 3 minutes to board the Emergency Shuttle.", null, 'sound/AI/shuttledock.ogg', "Priority") + round_converted = 1 + return 0 return 1 if(station_was_nuked)//Nuke went off return 1 diff --git a/code/game/gamemodes/changeling/changeling.dm b/code/game/gamemodes/changeling/changeling.dm index 7b5c1acc332..ab64a285afc 100644 --- a/code/game/gamemodes/changeling/changeling.dm +++ b/code/game/gamemodes/changeling/changeling.dm @@ -13,6 +13,7 @@ var/list/possible_changeling_IDs = list("Alpha","Beta","Gamma","Delta","Epsilon" required_players = 15 required_enemies = 1 recommended_enemies = 4 + reroll_friendly = 1 var/const/prob_int_murder_target = 50 // intercept names the assassination target half the time diff --git a/code/game/gamemodes/extended/extended.dm b/code/game/gamemodes/extended/extended.dm index 77e754ee36f..409b655f5ba 100644 --- a/code/game/gamemodes/extended/extended.dm +++ b/code/game/gamemodes/extended/extended.dm @@ -2,6 +2,7 @@ name = "extended" config_tag = "extended" required_players = 0 + reroll_friendly = 1 /datum/game_mode/announce() world << "The current game mode is - Extended Role-Playing!" diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 03a424efb75..e088c12f6b2 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -29,6 +29,8 @@ var/pre_setup_before_jobs = 0 var/antag_flag = null //preferences flag such as BE_WIZARD that need to be turned on for players to be antag var/datum/mind/sacrifice_target = null + var/round_converted = 0 + var/reroll_friendly //During mode conversion only these are in the running var/const/waittime_l = 600 var/const/waittime_h = 1800 // started at 1800 @@ -88,6 +90,50 @@ /datum/game_mode/proc/make_antag_chance(var/mob/living/carbon/human/character) return +///convert_roundtype() +///Allows rounds to basically be "rerolled" should the initial premise fall through +/datum/game_mode/proc/convert_roundtype() + var/list/datum/game_mode/runnable_modes = config.get_runnable_modes() + for(var/datum/game_mode/G in runnable_modes) + if(!G.reroll_friendly) del(G) + + if(!runnable_modes) return 0 + + var/list/datum/game_mode/replacementmode = pickweight(runnable_modes) + + switch(SSshuttle.emergency.mode) //Rounds on the verge of ending don't get new antags, they just run out + if(SHUTTLE_STRANDED, SHUTTLE_ESCAPE) + return 1 + if(SHUTTLE_CALL) + if(SSshuttle.emergency.timeLeft(1) < initial(SSshuttle.emergencyCallTime)*0.5) + return 1 + + var/list/living_crew = list() + + for(var/mob in player_list) + if(mob in living_mob_list) + living_crew += mob + if(living_crew.len / player_list.len <= 0.7) //If a lot of the player base died, we start fresh + return 0 + + var/list/antag_canadates = list() + + for(var/mob/living/carbon/human/H in living_crew) + antag_canadates += H + + if(!antag_canadates) return 1 + + antag_canadates = shuffle(antag_canadates) + + if(config.protect_roles_from_antagonist) + replacementmode.restricted_jobs += replacementmode.protected_jobs + if(config.protect_assistant_from_antagonist) + replacementmode.restricted_jobs += "Assistant" + for(var/mob/living/carbon/human/H in antag_canadates) + replacementmode.make_antag_chance(H) + + return 1 + ///process() ///Called by the gameticker /datum/game_mode/proc/process() diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index 930b43848a9..15681dc4502 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -153,6 +153,8 @@ priority_announce("Hostile enviroment resolved. You have 3 minutes to board the Emergency Shuttle.", null, 'sound/AI/shuttledock.ogg', "Priority") SSshuttle.emergencyNoEscape = 0 malf_mode_declared = 0 + convert_roundtype() + round_converted = 1 else return 1 return ..() //check for shuttle and nuke diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 44c6b4365e8..0fe48bda7f4 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -15,6 +15,7 @@ required_players = 0 required_enemies = 1 recommended_enemies = 4 + reroll_friendly = 1 var/traitors_possible = 4 //hard limit on traitors if scaling is turned off var/num_modifier = 0 // Used for gamemodes, that are a child of traitor, that need more than the usual. diff --git a/code/game/gamemodes/wizard/wizard.dm b/code/game/gamemodes/wizard/wizard.dm index 1b6b18b7c89..962e150df66 100644 --- a/code/game/gamemodes/wizard/wizard.dm +++ b/code/game/gamemodes/wizard/wizard.dm @@ -170,7 +170,7 @@ /datum/game_mode/wizard/check_finished() - if(config.continuous_round_wiz) + if(round_converted) return ..() var/wizards_alive = 0 @@ -192,11 +192,17 @@ if (wizards_alive || traitors_alive) return ..() - else - finished = 1 - return 1 + if(config.continuous_round_wiz) + if(!convert_roundtype()) + finished = 1 + return 1 + else + round_converted = 1 + return ..() + finished = 1 + return 1 /datum/game_mode/wizard/declare_completion() if(finished) diff --git a/config/game_options.txt b/config/game_options.txt index d2204a8ca61..89a17cc5fc5 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -102,6 +102,7 @@ PROBABILITY SANDBOX 0 #CONTINUOUS_ROUND_REV #CONTINUOUS_ROUND_WIZ #CONTINUOUS_ROUND_MALF +#CONTINUOUS_ROUND_BLOB ## The amount of time it takes for the emergency shuttle to be called, from round start. SHUTTLE_REFUEL_DELAY 12000