diff --git a/code/__HELPERS/global_lists.dm b/code/__HELPERS/global_lists.dm index 35e7f4850ce..2c5cd3e8c6d 100644 --- a/code/__HELPERS/global_lists.dm +++ b/code/__HELPERS/global_lists.dm @@ -9,6 +9,7 @@ var/global/list/player_list = list() //List of all mobs **with clients attach var/global/list/mob_list = list() //List of all mobs, including clientless var/global/list/living_mob_list = list() //List of all alive mobs, including clientless. Excludes /mob/new_player var/global/list/dead_mob_list = list() //List of all dead mobs, including clientless. Excludes /mob/new_player +var/global/list/joined_player_list = list() //List of all clients that have joined the game at round-start or as a latejoin. var/global/list/cable_list = list() //Index for all cables, so that powernets don't have to look through the entire world all the time var/global/list/chemical_reactions_list //list of all /datum/chemical_reaction datums. Used during chemical reactions @@ -73,4 +74,4 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel") for(var/path in typesof(prototype)) if(path == prototype) continue L += new path() - return L + return L diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 992466d45f0..f4b7db38a85 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -78,6 +78,7 @@ var/traitor_scaling = 0 //if amount of traitors scales based on amount of players var/protect_roles_from_antagonist = 0// If security and such can be tratior/cult/other + var/allow_latejoin_antagonists = 0 // If late-joining players can be traitor/changeling var/continous_rounds = 0 // Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke. var/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced." @@ -337,6 +338,8 @@ if("protect_roles_from_antagonist") config.protect_roles_from_antagonist = 1 + if("allow_latejoin_antagonists") + config.allow_latejoin_antagonists = 1 if("allow_random_events") config.allow_random_events = 1 if("jobs_have_minimal_access") diff --git a/code/game/gamemodes/changeling/changeling.dm b/code/game/gamemodes/changeling/changeling.dm index 1a4a2d58886..c646abec4c1 100644 --- a/code/game/gamemodes/changeling/changeling.dm +++ b/code/game/gamemodes/changeling/changeling.dm @@ -85,6 +85,15 @@ var/list/possible_changeling_IDs = list("Alpha","Beta","Gamma","Delta","Epsilon" ..() return +/datum/game_mode/changeling/make_antag_chance(var/mob/living/carbon/human/character) //Assigns changeling to latejoiners + if(changelings.len >= round(joined_player_list.len / changeling_scaling_coeff) + 1) //Caps number of latejoin antagonists + return + if (prob(100/changeling_scaling_coeff)) + if(character.client.prefs.be_special & BE_CHANGELING) + if(!jobban_isbanned(character.client, "changeling") && !jobban_isbanned(character.client, "Syndicate")) + if(!(character.job in ticker.mode.restricted_jobs)) + character.mind.make_Changling() + ..() /datum/game_mode/proc/forge_changeling_objectives(var/datum/mind/changeling) //OBJECTIVES - Always absorb 5 genomes, plus random traitor objectives. diff --git a/code/game/gamemodes/changeling/traitor_chan.dm b/code/game/gamemodes/changeling/traitor_chan.dm index 1928ee303f5..197ca4e22cd 100644 --- a/code/game/gamemodes/changeling/traitor_chan.dm +++ b/code/game/gamemodes/changeling/traitor_chan.dm @@ -51,4 +51,14 @@ forge_changeling_objectives(changeling) greet_changeling(changeling) ..() - return \ No newline at end of file + return + +/datum/game_mode/traitor/changeling/make_antag_chance(var/mob/living/carbon/human/character) //Assigns changeling to latejoiners + if(changelings.len >= round(joined_player_list.len / changeling_scaling_coeff) + 1) //Caps number of latejoin antagonists + return + if (prob(100/changeling_scaling_coeff)) + if(character.client.prefs.be_special & BE_CHANGELING) + if(!jobban_isbanned(character.client, "changeling") && !jobban_isbanned(character.client, "Syndicate")) + if(!(character.job in ticker.mode.restricted_jobs)) + character.mind.make_Changling() + ..() \ No newline at end of file diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 18452b0952b..2cf88fb6b1a 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -70,6 +70,10 @@ feedback_set_details("server_ip","[world.internet_address]:[world.port]") return 1 +///make_antag_chance() +///Handles late-join antag assignments +/datum/game_mode/proc/make_antag_chance(var/mob/living/carbon/human/character) + return ///process() ///Called by the gameticker @@ -302,7 +306,6 @@ if(P.client && P.ready) . ++ - /////////////////////////////////// //Keeps track of all living heads// /////////////////////////////////// diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 32f16352f49..0eb3987c1b4 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -236,6 +236,7 @@ var/global/datum/controller/gameticker/ticker proc/create_characters() for(var/mob/new_player/player in player_list) if(player.ready && player.mind) + joined_player_list += player.ckey if(player.mind.assigned_role=="AI") player.close_spawn_windows() player.AIize() diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 1b6f936b6c6..a255abe0a5f 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -75,6 +75,15 @@ ..() return 1 +/datum/game_mode/traitor/make_antag_chance(var/mob/living/carbon/human/character) //Assigns traitor to latejoiners + if(traitors.len >= round(joined_player_list.len / traitor_scaling_coeff) + 1) //Caps number of latejoin antagonists + return + if (prob(100/traitor_scaling_coeff)) + if(character.client.prefs.be_special & BE_TRAITOR) + if(!jobban_isbanned(character.client, "traitor") && !jobban_isbanned(character.client, "Syndicate")) + if(!(character.job in ticker.mode.restricted_jobs)) + character.mind.make_Tratior() + ..() /datum/game_mode/proc/forge_traitor_objectives(var/datum/mind/traitor) if(istype(traitor.current, /mob/living/silicon)) @@ -273,4 +282,4 @@ else traitor_mob << "Unfortunately, the Syndicate did not provide you with a code response." traitor_mob << "Use the code words in the order provided, during regular conversation, to identify other agents. Proceed with caution, however, as everyone is a potential foe." - //End code phrase. \ No newline at end of file + //End code phrase. diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 049c457967a..ce0086175f5 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -1053,7 +1053,7 @@ var/global/list/g_fancy_list_of_safe_types = null set name = "Debug Mob Lists" set desc = "For when you just gotta know" - switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs", "Clients")) + switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Clients","Joined Clients")) if("Players") usr << dd_list2text(player_list,",") if("Admins") @@ -1066,3 +1066,5 @@ var/global/list/g_fancy_list_of_safe_types = null usr << dd_list2text(dead_mob_list,",") if("Clients") usr << dd_list2text(clients,",") + if("Joined Clients") + usr << dd_list2text(joined_player_list,",") diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 667acfb45a8..b46272ac37e 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -259,8 +259,12 @@ AnnounceArrival(character, rank) else character.Robotize() - del(src) + joined_player_list += character.ckey + + if(config.allow_latejoin_antagonists && emergency_shuttle.timeleft() > 300) //Don't make them antags if the station is evacuating + ticker.mode.make_antag_chance(character) + del(src) proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank) if (ticker.current_state == GAME_STATE_PLAYING) @@ -319,7 +323,7 @@ mind.transfer_to(new_character) //won't transfer key since the mind is not active new_character.name = real_name - + ready_dna(new_character, client.prefs.b_type) new_character.key = key //Manually transfer the key to log them in diff --git a/config/game_options.txt b/config/game_options.txt index f05502c4399..a298711fed5 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -102,6 +102,8 @@ PROBABILITY SANDBOX 0 ## implants from being most antagonists. #PROTECT_ROLES_FROM_ANTAGONIST +## If late-joining players have a chance to become a traitor/changeling +ALLOW_LATEJOIN_ANTAGONISTS ### RANDOM EVENTS ###