From 3b475be87bc29fcbe0cebd93ee040cda62383738 Mon Sep 17 00:00:00 2001 From: BurgerLUA Date: Sat, 15 Dec 2018 15:35:13 -0800 Subject: [PATCH] Fixes antag spawning issues (#5773) Fixes #5772 This is a bug that seemed to have existed for a while and was not cause by my new system. --- code/game/gamemodes/game_mode.dm | 19 ++++++++------- html/changelogs/burgerbb - wew.yml | 37 ++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 html/changelogs/burgerbb - wew.yml diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 402269e5160..5334cdcb93c 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -152,36 +152,35 @@ var/global/list/additional_antag_types = list() var/playerC = 0 for(var/mob/abstract/new_player/player in player_list) - if((player.client)&&(player.ready)) + if(player.client && player.ready) playerC++ - if(playerC < required_players && required_players != 0) + if(required_players && playerC < required_players) returning |= GAME_FAILURE_NO_PLAYERS - if(playerC > max_players && max_players != 0) + if(max_players && playerC > max_players) returning |= GAME_FAILURE_TOO_MANY_PLAYERS + var/total_enemy_count = 0 if(antag_templates && antag_templates.len) - var/enemy_count = 0 if(antag_tags && antag_tags.len) for(var/antag_tag in antag_tags) var/datum/antagonist/antag = all_antag_types[antag_tag] if(!antag) continue - var/list/potential = list() + var/list/potential = list() //List of potential players to spawn as antagonists if(antag.flags & ANTAG_OVERRIDE_JOB) potential = antag.pending_antagonists else potential = antag.candidates if(islist(potential)) - if(potential.len) - enemy_count += potential.len - if(require_all_templates && potential.len < antag.initial_spawn_req) + total_enemy_count += potential.len + if(antag.initial_spawn_req && require_all_templates && potential.len < antag.initial_spawn_req) returning |= GAME_FAILURE_NO_ANTAGS - if(enemy_count < required_enemies) - returning |= GAME_FAILURE_NO_ANTAGS + if(required_enemies && total_enemy_count < required_enemies) + returning |= GAME_FAILURE_NO_ANTAGS return returning diff --git a/html/changelogs/burgerbb - wew.yml b/html/changelogs/burgerbb - wew.yml new file mode 100644 index 00000000000..d0d4608ee5a --- /dev/null +++ b/html/changelogs/burgerbb - wew.yml @@ -0,0 +1,37 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +################################# + +# Your name. +author: BurgerBB + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixes an age-old bug that caused antags not to spawn despite meeting the requirements, and antags to spawn despite not meeting the requirements."