From 5d1ac25a64f34c451f7335a5295f53d73b43242b Mon Sep 17 00:00:00 2001 From: Squirgenheimer Date: Mon, 5 Nov 2018 02:02:40 -0500 Subject: [PATCH 1/3] moves skip_antag to client level, adds checks for it in autotraitor.dm and blob.dm --- .../game/gamemodes/autotraitor/autotraitor.dm | 19 ++++++++++--------- code/game/gamemodes/blob/blob.dm | 2 +- code/game/gamemodes/game_mode.dm | 2 +- code/modules/client/client defines.dm | 1 + code/modules/mob/new_player/new_player.dm | 7 +++---- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/code/game/gamemodes/autotraitor/autotraitor.dm b/code/game/gamemodes/autotraitor/autotraitor.dm index 26b95eb77e1..281e0ef9f04 100644 --- a/code/game/gamemodes/autotraitor/autotraitor.dm +++ b/code/game/gamemodes/autotraitor/autotraitor.dm @@ -78,12 +78,13 @@ for(var/mob/living/player in GLOB.mob_list) if(player.client && player.stat != DEAD) playercount += 1 - if(player.client && player.mind && player.mind.special_role && player.stat != DEAD) - traitorcount += 1 - if(player.client && player.mind && !player.mind.special_role && player.stat != DEAD) - if(ishuman(player) || isrobot(player) || isAI(player)) - if(player.client && (ROLE_TRAITOR in player.client.prefs.be_special) && !jobban_isbanned(player, ROLE_TRAITOR) && !jobban_isbanned(player, "Syndicate")) - possible_traitors += player.mind + if(player.mind) + if(player.mind.special_role) + traitorcount += 1 + else + if(ishuman(player) || isrobot(player) || isAI(player)) + if((ROLE_TRAITOR in player.client.prefs.be_special) && !player.client.skip_antag && !jobban_isbanned(player, ROLE_TRAITOR) && !jobban_isbanned(player, "Syndicate")) + possible_traitors += player.mind for(var/datum/mind/player in possible_traitors) for(var/job in restricted_jobs) if(player.assigned_role == job) @@ -159,7 +160,7 @@ if(SSshuttle.emergency.mode >= SHUTTLE_ESCAPE) return //message_admins("Late Join Check") - if(character.client && (ROLE_TRAITOR in character.client.prefs.be_special) && !jobban_isbanned(character, ROLE_TRAITOR) && !jobban_isbanned(character, "Syndicate")) + if(character.client && (ROLE_TRAITOR in character.client.prefs.be_special) && !character.client.skip_antag && !jobban_isbanned(character, ROLE_TRAITOR) && !jobban_isbanned(character, "Syndicate")) //message_admins("Late Joiner has Be Syndicate") //message_admins("Checking number of players") var/playercount = 0 @@ -167,8 +168,8 @@ for(var/mob/living/player in GLOB.mob_list) if(player.client && player.stat != DEAD) playercount += 1 - if(player.client && player.mind && player.mind.special_role && player.stat != DEAD) - traitorcount += 1 + if(player.mind && player.mind.special_role) + traitorcount += 1 //message_admins("Live Players: [playercount]") //message_admins("Live Traitors: [traitorcount]") diff --git a/code/game/gamemodes/blob/blob.dm b/code/game/gamemodes/blob/blob.dm index 2056c6c6260..42a42240ad5 100644 --- a/code/game/gamemodes/blob/blob.dm +++ b/code/game/gamemodes/blob/blob.dm @@ -55,7 +55,7 @@ var/list/blob_nodes = list() /datum/game_mode/blob/proc/get_blob_candidates() var/list/candidates = list() for(var/mob/living/carbon/human/player in GLOB.player_list) - if(!player.stat && player.mind && !player.mind.special_role && !jobban_isbanned(player, "Syndicate") && (ROLE_BLOB in player.client.prefs.be_special)) + if(!player.stat && player.mind && !player.client.skip_antag && !player.mind.special_role && !jobban_isbanned(player, "Syndicate") && (ROLE_BLOB in player.client.prefs.be_special)) candidates += player return candidates diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index de10fa34c01..08ab2b54c5d 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -271,7 +271,7 @@ // Get a list of all the people who want to be the antagonist for this round, except those with incompatible species for(var/mob/new_player/player in players) - if(!player.skip_antag) + if(!player.client.skip_antag) if((role in player.client.prefs.be_special) && !(player.client.prefs.species in protected_species)) player_draft_log += "[player.key] had [roletext] enabled, so we are drafting them." candidates += player.mind diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index b64f965a81a..5327eca3838 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -12,6 +12,7 @@ //OTHER// ///////// var/datum/preferences/prefs = null + var/skip_antag = FALSE //Decline to be selected as a game mode antagonist. var/move_delay = 1 var/moving = null var/adminobs = null diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index a1be1db4c63..2e2f3bf8ac8 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -1,6 +1,5 @@ /mob/new_player var/ready = 0 - var/skip_antag = 0 //For declining an antag roll this round. var/spawning = 0 //Referenced when you want to delete the new_player later on in the code. var/totalPlayers = 0 //Player counts for the Lobby tab var/totalPlayersReady = 0 @@ -68,9 +67,9 @@ var/list/antags = client.prefs.be_special if(antags && antags.len) - if(!skip_antag) output += "

Global Antag Candidacy" + if(!client.skip_antag) output += "

Global Antag Candidacy" else output += "

Global Antag Candidacy" - output += "
You are [skip_antag ? "ineligible" : "eligible"] for all antag roles.

" + output += "
You are [client.skip_antag ? "ineligible" : "eligible"] for all antag roles.

" else output += "

View the Crew Manifest

" output += "

Join Game!

" @@ -172,7 +171,7 @@ new_player_panel_proc() if(href_list["skip_antag"]) - skip_antag = !skip_antag + client.skip_antag = !client.skip_antag new_player_panel_proc() if(href_list["refresh"]) From fcc86e1903a0c53820a7e21125b99f6a186a5af6 Mon Sep 17 00:00:00 2001 From: Squirgenheimer Date: Mon, 5 Nov 2018 02:14:28 -0500 Subject: [PATCH 2/3] antag candidacy button can be clicked after join --- code/modules/mob/new_player/new_player.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 2e2f3bf8ac8..5b3fd873777 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -64,16 +64,16 @@ if(!ticker || ticker.current_state <= GAME_STATE_PREGAME) if(!ready) output += "

Declare Ready

" else output += "

You are ready (Cancel)

" - - var/list/antags = client.prefs.be_special - if(antags && antags.len) - if(!client.skip_antag) output += "

Global Antag Candidacy" - else output += "

Global Antag Candidacy" - output += "
You are [client.skip_antag ? "ineligible" : "eligible"] for all antag roles.

" else output += "

View the Crew Manifest

" output += "

Join Game!

" + var/list/antags = client.prefs.be_special + if(antags && antags.len) + if(!client.skip_antag) output += "

Global Antag Candidacy" + else output += "

Global Antag Candidacy" + output += "
You are [client.skip_antag ? "ineligible" : "eligible"] for all antag roles.

" + output += "

Observe

" if(GLOB.join_tos) From 4b29a45263a6346e7dfee2bfc00e1b2e755c9a05 Mon Sep 17 00:00:00 2001 From: Squirgenheimer Date: Mon, 5 Nov 2018 22:05:03 -0500 Subject: [PATCH 3/3] autotraitor.dm: opted for continue statement in a couple of places, reworded a comment --- .../game/gamemodes/autotraitor/autotraitor.dm | 27 ++++++++++--------- code/modules/client/client defines.dm | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/code/game/gamemodes/autotraitor/autotraitor.dm b/code/game/gamemodes/autotraitor/autotraitor.dm index 281e0ef9f04..bf9fbb5a9e5 100644 --- a/code/game/gamemodes/autotraitor/autotraitor.dm +++ b/code/game/gamemodes/autotraitor/autotraitor.dm @@ -78,23 +78,24 @@ for(var/mob/living/player in GLOB.mob_list) if(player.client && player.stat != DEAD) playercount += 1 - if(player.mind) - if(player.mind.special_role) - traitorcount += 1 - else - if(ishuman(player) || isrobot(player) || isAI(player)) - if((ROLE_TRAITOR in player.client.prefs.be_special) && !player.client.skip_antag && !jobban_isbanned(player, ROLE_TRAITOR) && !jobban_isbanned(player, "Syndicate")) - possible_traitors += player.mind + if(!player.mind) + continue + if(player.mind.special_role) + traitorcount += 1 + continue + if(ishuman(player) || isrobot(player) || isAI(player)) + if((ROLE_TRAITOR in player.client.prefs.be_special) && !player.client.skip_antag && !jobban_isbanned(player, ROLE_TRAITOR) && !jobban_isbanned(player, "Syndicate")) + possible_traitors += player.mind for(var/datum/mind/player in possible_traitors) for(var/job in restricted_jobs) if(player.assigned_role == job) possible_traitors -= player - if(player.current) // Remove mindshield-implanted mobs from the list - if(ishuman(player.current)) - var/mob/living/carbon/human/H = player.current - for(var/obj/item/implant/mindshield/I in H.contents) - if(I && I.implanted) - possible_traitors -= player + if(!player.current || !ishuman(player.current)) // Remove mindshield-implanted mobs from the list + continue + var/mob/living/carbon/human/H = player.current + for(var/obj/item/implant/mindshield/I in H.contents) + if(I && I.implanted) + possible_traitors -= player //message_admins("Live Players: [playercount]") //message_admins("Live Traitors: [traitorcount]") diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index 5327eca3838..c88347a305b 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -12,7 +12,7 @@ //OTHER// ///////// var/datum/preferences/prefs = null - var/skip_antag = FALSE //Decline to be selected as a game mode antagonist. + var/skip_antag = FALSE //TRUE when a player declines to be included for the selection process of game mode antagonists. var/move_delay = 1 var/moving = null var/adminobs = null