Gamemode Start Tweaks (#5719)

When the round refuses to start because of a lack of players or lack of antags, it will properly state this instead of stating that there aren't enough players.

The Wizard gamemode, and the Ninja gamemode, both have restrictions that prevent the gamemode from being launched if there are more than 15 players, unless it was voted specifically.
This commit is contained in:
BurgerLUA
2018-12-11 20:38:31 +01:00
committed by Werner
parent 7a813942a1
commit 4cbd2f4e2c
8 changed files with 101 additions and 29 deletions
+31 -22
View File
@@ -10,6 +10,7 @@ var/global/list/additional_antag_types = list()
var/probability = 0
var/required_players = 0 // Minimum players for round to start if voted in.
var/max_players = 0 // Maximum players for round to start for secret voting. 0 means "doesn't matter"
var/required_enemies = 0 // Minimum antagonists for round to start.
var/newscaster_announcements = null
var/end_on_antag_death = 0 // Round will end when all antagonists are dead.
@@ -146,35 +147,43 @@ var/global/list/additional_antag_types = list()
///can_start()
///Checks to see if the game can be setup and ran with the current number of players or whatnot.
/datum/game_mode/proc/can_start(var/do_not_spawn)
var/returning = GAME_FAILURE_NONE
var/playerC = 0
for(var/mob/abstract/new_player/player in player_list)
if((player.client)&&(player.ready))
playerC++
if(playerC < required_players)
return 0
if(playerC < required_players && required_players != 0)
returning |= GAME_FAILURE_NO_PLAYERS
if(!(antag_templates && antag_templates.len))
return 1
if(playerC > max_players && max_players != 0)
returning |= GAME_FAILURE_TOO_MANY_PLAYERS
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()
if(antag.flags & ANTAG_OVERRIDE_JOB)
potential = antag.pending_antagonists
else
potential = antag.candidates
if(islist(potential))
if(require_all_templates && potential.len < antag.initial_spawn_req)
return 0
enemy_count += potential.len
if(enemy_count >= required_enemies)
return 1
return 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()
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)
returning |= GAME_FAILURE_NO_ANTAGS
if(enemy_count < required_enemies)
returning |= GAME_FAILURE_NO_ANTAGS
return returning
/datum/game_mode/proc/refresh_event_modifiers()
if(event_delay_mod_moderate || event_delay_mod_major)
+7 -4
View File
@@ -39,8 +39,11 @@
world << "<B>An unknown creature has infested the mind of a crew member. Find and destroy it by any means necessary.</B>"
/datum/game_mode/meme/can_start()
if(!..())
return 0
. = ..()
if(. != "true")
return .
// for every 10 players, get 1 meme, and for each meme, get a host
// also make sure that there's at least one meme and one host
@@ -50,7 +53,7 @@
if(possible_memes.len < 2)
log_admin("MODE FAILURE: MEME. NOT ENOUGH MEME CANDIDATES.")
return 0 // not enough candidates for meme
return GAME_FAILURE_NO_ANTAGS
// for each 2 possible memes, add one meme and one host
while(possible_memes.len >= 2)
@@ -68,7 +71,7 @@
meme.assigned_role = "MODE" //So they aren't chosen for other jobs.
meme.special_role = "Meme"
return 1
return GAME_FAILURE_NONE
/datum/game_mode/meme/pre_setup()
return 1
+1
View File
@@ -10,6 +10,7 @@
only hope this unknown assassin isn't here for you."
config_tag = "ninja"
required_players = 2
max_players = 15
required_enemies = 1
end_on_antag_death = 1
antag_tags = list(MODE_NINJA)
+1
View File
@@ -4,6 +4,7 @@
extended_round_description = "A powerful entity capable of manipulating the elements around him, most commonly referred to as a 'wizard', has infiltrated the station. They have a wide variety of powers and spells available to them that makes your own simple moral self tremble with fear and excitement. Ultimately, their purpose is unknown. However, it is up to you and your crew to decide if their powers can be used for good or if their arrival foreshadows the destruction of the entire station."
config_tag = "wizard"
required_players = 3
max_players = 20
required_enemies = 1
end_on_antag_death = 1
antag_tags = list(MODE_WIZARD)