Fixes it so that ling team objectives are correctly handed out and correctly find targets.

This commit is contained in:
Remie Richards
2015-08-15 16:58:28 +01:00
parent 06b94738fa
commit 651c7985a7
3 changed files with 39 additions and 14 deletions

View File

@@ -82,8 +82,10 @@ var/list/slot2type = list("head" = /obj/item/clothing/head/changeling, "wear_mas
//And then set it up to be handed out in forge_changeling_objectives
var/list/team_objectives = typesof(/datum/objective/changeling_team_objective) - /datum/objective/changeling_team_objective
var/list/possible_team_objectives = list()
for(var/datum/objective/changeling_team_objective/T in team_objectives)
if(changelings.len >= initial(T.min_lings))
for(var/T in team_objectives)
var/datum/objective/changeling_team_objective/CTO = T
if(changelings.len >= initial(CTO.min_lings))
possible_team_objectives += T
if(possible_team_objectives.len && prob(20*changelings.len))

View File

@@ -667,7 +667,7 @@ var/global/list/possible_items_special = list()
/datum/objective/changeling_team_objective //Abstract type
martyr_compatible = 0 //Suicide is not teamwork!
explanation_text = "Changeling Friendship!"
var/min_lings = 3 //Minimum amount of lings for this team objective to be possible
var/min_lings = 1//3 //Minimum amount of lings for this team objective to be possible
@@ -701,13 +701,18 @@ var/global/list/possible_items_special = list()
var/ling_count = ticker.mode.changelings
for(var/datum/mind/M in ticker.minds)
if(department_head in M.assigned_job.department_head)
if(M in ticker.mode.changelings)
continue
if(department_head in get_department_heads(M.assigned_role))
if(ling_count)
ling_count--
department_minds += M
department_real_names += M.current.real_name
else
break
if(!department_minds.len)
log_game("[type] has failed to find department staff, and has removed itself. the round will continue normally")
owner.objectives -= src
qdel(src)
return
@@ -724,16 +729,19 @@ var/global/list/possible_items_special = list()
var/needed_heads = rand(min_lings,command_positions.len)
needed_heads = min(ticker.mode.changelings.len,needed_heads)
for(var/datum/mind/possible_head in ticker.minds)
if(possible_head in ticker.mode.changelings) //Looking at you HoP.
var/list/heads = ticker.mode.get_living_heads()
for(var/datum/mind/head in heads)
if(head in ticker.mode.changelings) //Looking at you HoP.
continue
if(possible_head.assigned_job.title in command_positions)
if(needed_heads)
department_minds += possible_head
department_real_names += possible_head.current.real_name
department_minds += head
department_real_names += head.current.real_name
needed_heads--
else
break
if(!department_minds.len)
log_game("[type] has failed to find department heads, and has removed itself. the round will continue normally")
owner.objectives -= src
qdel(src)
return
@@ -783,6 +791,9 @@ var/global/list/possible_items_special = list()
//Check each department member's mind to see if any of them made it to centcomm alive, if they did it's an automatic fail
for(var/datum/mind/M in department_minds)
if(M in ticker.mode.changelings) //Lings aren't picked for this, but let's be safe
continue
if(M.current)
var/turf/mloc = get_turf(M.current)
if(mloc.onCentcom() && (M.current.stat != DEAD))

View File

@@ -125,3 +125,15 @@ var/list/nonhuman_positions = list(
/proc/guest_jobbans(job)
return ((job in command_positions) || (job in nonhuman_positions) || (job in security_positions))
//this is necessary because antags happen before job datums are handed out, but NOT before they come into existence
//so I can't simply use job datum.department_head straight from the mind datum, laaaaame.
/proc/get_department_heads(var/job_title)
if(!job_title)
return list()
for(var/datum/job/J in SSjob.occupations)
if(J.title == job_title)
return J.department_head //this is a list