From 8c6b8add20a44e5e155ebda8bc4489fcea0c2450 Mon Sep 17 00:00:00 2001 From: cib Date: Sun, 9 Jun 2013 01:13:13 +0200 Subject: [PATCH] Weights the likelihood of command positions by your age. For most head positions, a good age is between 25 and 60, with ages towards the middle of that being even better. 25 because I figure for stuff like research, engineer etc. they'll want someone with fresh knowledge. Captain's best age starts at 35 though, due to that being an "old geezer job". --- code/game/jobs/job_controller.dm | 35 +++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 4585837f802..3b6b584ee23 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -134,7 +134,40 @@ var/global/datum/controller/occupations/job_master if(!job) continue var/list/candidates = FindOccupationCandidates(job, level) if(!candidates.len) continue - var/mob/new_player/candidate = pick(candidates) + + // Build a weighted list, weight by age. + var/list/weightedCandidates = list() + + // Different head positions have different good ages. + var/good_age_minimal = 25 + var/good_age_maximal = 60 + if(command_position == "Captain") + good_age_minimal = 30 + good_age_maximal = 70 // Old geezer captains ftw + + for(var/mob/V in candidates) + // Log-out during round-start? What a bad boy, no head position for you! + if(!V.client) continue + var/age = V.client.prefs.age + switch(age) + if(good_age_minimal - 10 to good_age_minimal) + weightedCandidates[V] = 3 // Still a bit young. + if(good_age_minimal to good_age_minimal + 10) + weightedCandidates[V] = 6 // Better. + if(good_age_minimal + 10 to good_age_maximal - 10) + weightedCandidates[V] = 10 // Great. + if(good_age_maximal - 10 to good_age_maximal) + weightedCandidates[V] = 6 // Still good. + if(good_age_maximal to good_age_maximal + 10) + weightedCandidates[V] = 6 // Bit old, don't you think? + if(good_age_maximal to good_age_maximal + 50) + weightedCandidates[V] = 3 // Geezer. + else + // If there's ABSOLUTELY NOBODY ELSE + if(candidates.len == 1) weightedCandidates[V] = 1 + + + var/mob/new_player/candidate = pickweight(weightedCandidates) if(AssignRole(candidate, command_position)) return 1 return 0