Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes Age-weighted RNG for Rolling Command Roles #18661

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@
var/item
for (item in L)
if (isnull(L[item]))
//Change by nanako, a default weight will no longer overwrite an explicitly set weight of 0
//A default weight will no longer overwrite an explicitly set weight of 0
//It will only use a default if no weight is defined
L[item] = 1
total += L[item]
total = rand() * total//Fix by nanako, allows it to handle noninteger weights
total = rand() * total//Allows it to handle noninteger weights
for (item in L)
total -= L[item]
if (total <= 0)
Expand Down
23 changes: 3 additions & 20 deletions code/controllers/subsystems/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,14 @@ SUBSYSTEM_DEF(jobs)
if(!candidates.len)
continue

// Build a weighted list, weight by age.
// Build a list of candidates.
var/list/weightedCandidates = list()
for(var/mob/V in candidates)
// Log-out during round-start? What a bad boy, no head position for you!
// Log-out during round-start? No point in considering the player for candidacy.
if(!V.client)
continue

var/age = V.client.prefs.age

var/min_job_age = job.get_minimum_character_age(V.get_species())
var/ideal_job_age = job.get_ideal_character_age(V.get_species())

if(age > (ideal_job_age + 20)) // Elderly for the position
weightedCandidates[V] = 3
else if(age > (ideal_job_age + 10)) // Good, but on the elderly side
weightedCandidates[V] = 6
else if(age > (ideal_job_age - 10)) // Perfect
weightedCandidates[V] = 10
else if(age > (min_job_age + 10)) // Good, but on the young side
weightedCandidates[V] = 6
else if(age >= min_job_age) // Too young
weightedCandidates[V] = 3
else
if(candidates.len == 1) // There's only one option
weightedCandidates[V] = 1
weightedCandidates[V] = 1
SleepyGemmy marked this conversation as resolved.
Show resolved Hide resolved

var/mob/abstract/new_player/candidate = pickweight(weightedCandidates)
if(AssignRole(candidate, command_position))
Expand Down
16 changes: 0 additions & 16 deletions code/game/jobs/job/captain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1)
SPECIES_SKRELL_AXIORI = 100
)

ideal_character_age = list(
SPECIES_HUMAN = 70,
SPECIES_SKRELL = 120,
SPECIES_SKRELL_AXIORI = 120
) // Old geezer captains ftw

outfit = /obj/outfit/job/captain

blacklisted_species = list(SPECIES_TAJARA, SPECIES_TAJARA_MSAI, SPECIES_TAJARA_ZHAN, SPECIES_UNATHI, SPECIES_DIONA, SPECIES_IPC, SPECIES_IPC_G1, SPECIES_IPC_G2, SPECIES_IPC_XION, SPECIES_IPC_ZENGHU, SPECIES_IPC_BISHOP, SPECIES_IPC_SHELL, SPECIES_VAURCA_WORKER, SPECIES_VAURCA_WARRIOR, SPECIES_VAURCA_BULWARK, SPECIES_VAURCA_BREEDER, SPECIES_DIONA, SPECIES_DIONA_COEUS)
Expand Down Expand Up @@ -94,11 +88,6 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1)
selection_color = "#1e59c9"
minimal_player_age = 10
economic_modifier = 10
ideal_character_age = list(
SPECIES_HUMAN = 50,
SPECIES_SKRELL = 100,
SPECIES_SKRELL_AXIORI = 100
)

minimum_character_age = list(
SPECIES_HUMAN = 30,
Expand Down Expand Up @@ -157,11 +146,6 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1)
selection_color = "#2b5bb5"
minimal_player_age = 20
economic_modifier = 5
ideal_character_age = list(
SPECIES_HUMAN = 30,
SPECIES_SKRELL = 75,
SPECIES_SKRELL_AXIORI = 75
)

minimum_character_age = list(
SPECIES_HUMAN = 25,
Expand Down
6 changes: 0 additions & 6 deletions code/game/jobs/job/civilian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,6 @@
minimal_access = list(ACCESS_MAILSORTING, ACCESS_CARGO, ACCESS_CARGO_BOT, ACCESS_QM, ACCESS_MINING, ACCESS_SHIP_WEAPONS, ACCESS_MINING_STATION, ACCESS_KEYCARD_AUTH, ACCESS_RC_ANNOUNCE, ACCESS_HEADS,
ACCESS_SEC_DOORS, ACCESS_RESEARCH, ACCESS_MEDICAL, ACCESS_ROBOTICS, ACCESS_ENGINE, ACCESS_TELEPORTER, ACCESS_EVA, ACCESS_INTREPID)

ideal_character_age = list(
SPECIES_HUMAN = 40,
SPECIES_SKRELL = 90,
SPECIES_SKRELL_AXIORI = 90
)

outfit = /obj/outfit/job/operations_manager

blacklisted_species = list(SPECIES_TAJARA_MSAI, SPECIES_TAJARA_ZHAN, SPECIES_VAURCA_WORKER, SPECIES_VAURCA_WARRIOR, SPECIES_VAURCA_BULWARK, SPECIES_VAURCA_BREEDER)
Expand Down
7 changes: 0 additions & 7 deletions code/game/jobs/job/engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
SPECIES_SKRELL_AXIORI = 80
)

ideal_character_age = list(
SPECIES_HUMAN = 50,
SPECIES_SKRELL = 100,
SPECIES_SKRELL_AXIORI = 100
)


access = list(ACCESS_ENGINE, ACCESS_ENGINE_EQUIP, ACCESS_TECH_STORAGE, ACCESS_MAINT_TUNNELS,
ACCESS_TELEPORTER, ACCESS_EXTERNAL_AIRLOCKS, ACCESS_ATMOSPHERICS, ACCESS_EMERGENCY_STORAGE, ACCESS_EVA, ACCESS_LEVIATHAN, ACCESS_SHIP_WEAPONS,
ACCESS_HEADS, ACCESS_CONSTRUCTION, ACCESS_SEC_DOORS, ACCESS_RESEARCH, ACCESS_MEDICAL, ACCESS_MINING, ACCESS_MAILSORTING,
Expand Down
5 changes: 0 additions & 5 deletions code/game/jobs/job/hra.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
supervisors = "SCC and the Internal Affairs department"
minimal_player_age = 10
economic_modifier = 10
ideal_character_age = list(
SPECIES_HUMAN = 30,
SPECIES_SKRELL = 60,
SPECIES_SKRELL_AXIORI = 60
)

selection_color = "#c9ad12"

Expand Down
15 changes: 0 additions & 15 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@
SPECIES_SKRELL_AXIORI = 50
)
var/list/alt_ages = null // assoc list of alt titles to minimum character ages assoc lists (see above -- yes this is slightly awful)
var/list/ideal_character_age = list( // Ideal character ages (for heads), assoc list of species define -> age, see above
SPECIES_HUMAN = 30,
SPECIES_SKRELL = 100,
SPECIES_SKRELL_AXIORI = 100
)

var/latejoin_at_spawnpoints = FALSE //If this job should use roundstart spawnpoints for latejoin (offstation jobs etc)

Expand Down Expand Up @@ -185,16 +180,6 @@
else if(title in alt_ages)
return (species in alt_ages[title]) ? alt_ages[title][species] : alt_ages[title][SPECIES_HUMAN]

/datum/job/proc/get_ideal_character_age(var/species)
if(!species)
species = SPECIES_HUMAN
else if(!(species in ideal_character_age))
// try to see if there's a min age set -- ideally this shouldn't happen, but better to take a min age than fall back to human just yet
if(species in minimum_character_age) // if there is one, just add 20 and send it
return minimum_character_age[species] + 20
species = SPECIES_HUMAN // no such luck
return ideal_character_age[species]

/datum/job/proc/fetch_age_restriction()
if (!GLOB.config.age_restrictions_from_file)
return
Expand Down
5 changes: 0 additions & 5 deletions code/game/jobs/job/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
ACCESS_FIRST_RESPONDER, ACCESS_MAINT_TUNNELS, ACCESS_INTREPID, ACCESS_TELEPORTER)

minimal_player_age = 10
ideal_character_age = list(
SPECIES_HUMAN = 50,
SPECIES_SKRELL = 100,
SPECIES_SKRELL_AXIORI = 100
)
outfit = /obj/outfit/job/cmo

blacklisted_species = list(SPECIES_TAJARA_MSAI, SPECIES_TAJARA_ZHAN, SPECIES_VAURCA_WORKER, SPECIES_VAURCA_WARRIOR, SPECIES_VAURCA_BULWARK, SPECIES_VAURCA_BREEDER)
Expand Down
5 changes: 0 additions & 5 deletions code/game/jobs/job/outsider/merchant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
supervisors = "yourself and the market"
minimal_player_age = 10
economic_modifier = 5
ideal_character_age = list(
SPECIES_HUMAN = 30,
SPECIES_SKRELL = 60,
SPECIES_SKRELL_AXIORI = 60
)

create_record = FALSE
account_allowed = TRUE
Expand Down
6 changes: 0 additions & 6 deletions code/game/jobs/job/outsider/representative.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@
SPECIES_SKRELL_AXIORI = 150
)

ideal_character_age = list(
SPECIES_HUMAN = 30,
SPECIES_SKRELL = 170,
SPECIES_SKRELL_AXIORI = 170
)

access = list(ACCESS_CONSULAR, ACCESS_MAINT_TUNNELS)
minimal_access = list(ACCESS_CONSULAR)
outfit = /obj/outfit/job/representative/consular
Expand Down
5 changes: 0 additions & 5 deletions code/game/jobs/job/science.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@
ACCESS_XENOARCH, ACCESS_NETWORK, ACCESS_MAINT_TUNNELS, ACCESS_IT, ACCESS_INTREPID
)
minimal_player_age = 14
ideal_character_age = list(
SPECIES_HUMAN = 50,
SPECIES_SKRELL = 100,
SPECIES_SKRELL_AXIORI = 100
)
outfit = /obj/outfit/job/rd

blacklisted_species = list(SPECIES_TAJARA_MSAI, SPECIES_TAJARA_ZHAN, SPECIES_VAURCA_BREEDER, SPECIES_VAURCA_WORKER, SPECIES_VAURCA_WARRIOR, SPECIES_VAURCA_BULWARK)
Expand Down
6 changes: 6 additions & 0 deletions html/changelogs/SleepyGemmy-biased_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
author: SleepyGemmy

delete-after: True

changes:
- tweak: "Removed age-weighted RNG when rolling for command roles."