Merge pull request #312 from skull132/antagonist-fixes

Antagonist fixes
This commit is contained in:
skull132
2016-05-18 21:50:54 +03:00
7 changed files with 41 additions and 7 deletions

View File

@@ -90,3 +90,27 @@
// Minimum: initial_spawn_target
// Maximum: hard_cap or hard_cap_round
cur_max = max(initial_spawn_target,min(round(count/ticker.mode.antag_scaling_coeff),cur_max))
// Updates the initial spawn target to match the player count.
// Intended to stop 6 nuke ops in a 15 player round. RIP those rounds.
/datum/antagonist/proc/update_initial_spawn_target()
// Default is a linear rise of one antag per 5 players.
var/modifier = 5
if (ticker.mode.antag_scaling_coeff)
modifier = ticker.mode.antag_scaling_coeff
var/count = 0
for (var/mob/living/M in player_list)
if (M.client)
count++
// Never pick less antags than we need to!
var/new_cap = max(initial_spawn_req, round(count/modifier))
// Default to the hardcap if we're about to surpass it
if (new_cap > hard_cap)
initial_spawn_target = hard_cap
else
initial_spawn_target = new_cap

View File

@@ -17,7 +17,7 @@ var/datum/antagonist/mercenary/mercs
hard_cap = 4
hard_cap_round = 8
initial_spawn_req = 4
initial_spawn_target = 6
initial_spawn_target = 4
/datum/antagonist/mercenary/New()
..()

View File

@@ -6,5 +6,5 @@
required_players = 2
required_enemies = 1
end_on_antag_death = 1
antag_scaling_coeff = 10
antag_scaling_coeff = 8
antag_tags = list(MODE_CHANGELING)

View File

@@ -264,6 +264,7 @@ var/global/list/additional_antag_types = list()
/datum/game_mode/proc/pre_setup()
for(var/datum/antagonist/antag in antag_templates)
antag.update_current_antag_max()
antag.update_initial_spawn_target()
antag.build_candidate_list() //compile a list of all eligible candidates
//antag roles that replace jobs need to be assigned before the job controller hands out jobs.
@@ -273,6 +274,8 @@ var/global/list/additional_antag_types = list()
///post_setup()
/datum/game_mode/proc/post_setup()
next_spawn = world.time + rand(min_autotraitor_delay, max_autotraitor_delay)
refresh_event_modifiers()
spawn (ROUNDSTART_LOGOUT_REPORT_TIME)

View File

@@ -6,7 +6,7 @@
///process()
///Called by the gameticker
/datum/game_mode/proc/process()
if(round_autoantag && world.time < next_spawn && !emergency_shuttle.departed)
if(round_autoantag && world.time >= next_spawn && !emergency_shuttle.departed)
process_autoantag()
//This can be overriden in case a game mode needs to do stuff when a player latejoins
@@ -21,21 +21,21 @@
if(A.can_late_spawn())
message_admins("[uppertext(name)]: [A.id] selected for spawn attempt.")
usable_templates |= A
if(!usable_templates.len)
message_admins("[uppertext(name)]: Failed to find configured mode spawn templates, please re-enable auto-antagonists after one is added.")
round_autoantag = 0
return
while(usable_templates.len)
var/datum/antagonist/spawn_antag = pick(usable_templates)
usable_templates -= spawn_antag
if(spawn_antag.attempt_auto_spawn())
message_admins("[uppertext(name)]: Auto-added a new [spawn_antag.role_text].")
message_admins("There are now [spawn_antag.get_active_antag_count()]/[spawn_antag.cur_max] active [spawn_antag.role_text_plural].")
next_spawn = world.time + rand(min_autotraitor_delay, max_autotraitor_delay)
return
message_admins("[uppertext(name)]: Failed to proc a viable spawn template.")
next_spawn = world.time + min_autotraitor_delay //recheck again in the miniumum time

View File

@@ -14,6 +14,7 @@
var/nuke_off_station = 0 //Used for tracking if the syndies actually haul the nuke to the station
var/syndies_didnt_escape = 0 //Used for tracking if the syndies got the shuttle off of the z-level
antag_tags = list(MODE_MERCENARY)
antag_scaling_coeff = 6
/datum/game_mode/nuclear/declare_completion()
if(config.objectives_disabled)