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

improved job code TM first #8254

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 2 additions & 48 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,7 @@ Additional game mode variables.
/datum/game_mode/proc/get_roles_list()
return GLOB.ROLES_USCM

//===================================================\\

//GAME MODE INITIATLIZE\\

//===================================================\\

/datum/game_mode/proc/initialize_special_clamps()
xeno_starting_num = clamp((GLOB.readied_players/CONFIG_GET(number/xeno_number_divider)), xeno_required_num, INFINITY) //(n, minimum, maximum)
surv_starting_num = clamp((GLOB.readied_players/CONFIG_GET(number/surv_number_divider)), 2, 8) //this doesnt run
marine_starting_num = length(GLOB.player_list) - xeno_starting_num - surv_starting_num
for(var/datum/squad/target_squad in GLOB.RoleAuthority.squads)
if(target_squad)
target_squad.roles_cap[JOB_SQUAD_ENGI] = engi_slot_formula(marine_starting_num)
target_squad.roles_cap[JOB_SQUAD_MEDIC] = medic_slot_formula(marine_starting_num)

for(var/i in GLOB.RoleAuthority.roles_by_name)
var/datum/job/J = GLOB.RoleAuthority.roles_by_name[i]
if(J.scaled)
J.set_spawn_positions(marine_starting_num)


//===================================================\\
Expand All @@ -145,34 +127,6 @@ Additional game mode variables.
if(!ignore_pred_num)
pred_current_num++

/datum/game_mode/proc/get_whitelisted_predators(readied = 1)
// Assemble a list of active players who are whitelisted.
var/players[] = new

var/mob/new_player/new_pred
for(var/mob/player in GLOB.player_list)
if(!player.client) continue //No client. DCed.
if(isyautja(player)) continue //Already a predator. Might be dead, who knows.
if(readied) //Ready check for new players.
new_pred = player
if(!istype(new_pred)) continue //Have to be a new player here.
if(!new_pred.ready) continue //Have to be ready.
else
if(!istype(player,/mob/dead)) continue //Otherwise we just want to grab the ghosts.

if(player?.client.check_whitelist_status(WHITELIST_PREDATOR)) //Are they whitelisted?
if(!player.client.prefs)
player.client.prefs = new /datum/preferences(player.client) //Somehow they don't have one.

if(player.client.prefs.get_job_priority(JOB_PREDATOR) > 0) //Are their prefs turned on?
if(!player.mind) //They have to have a key if they have a client.
player.mind_initialize() //Will work on ghosts too, but won't add them to active minds.
player.mind.setup_human_stats()
player.faction = FACTION_YAUTJA
player.faction_group = FACTION_LIST_YAUTJA
players += player.mind
return players

/datum/game_mode/proc/attempt_to_join_as_predator(mob/pred_candidate)
var/mob/living/carbon/human/new_predator = transform_predator(pred_candidate) //Initialized and ready.
if(!new_predator) return
Expand Down Expand Up @@ -291,7 +245,7 @@ Additional game mode variables.

for(var/job in FAX_RESPONDER_JOB_LIST)
var/datum/job/fax_responder_job = GLOB.RoleAuthority.roles_by_name[job]
var/job_max = fax_responder_job.total_positions
var/job_max = fax_responder_job.total_positions_so_far
if((fax_responder_job.current_positions < job_max) && fax_responder_job.can_play_role(responder_candidate.client))
options += job
return options
Expand Down Expand Up @@ -1178,7 +1132,7 @@ Additional game mode variables.

// council doesn't count towards this conditional.
if(joe_job.get_whitelist_status(joe_candidate.client) == WHITELIST_NORMAL)
var/joe_max = joe_job.total_positions
var/joe_max = joe_job.total_positions_so_far
if((joe_job.current_positions >= joe_max) && !MODE_HAS_MODIFIER(/datum/gamemode_modifier/ignore_wj_restrictions))
if(show_warning)
to_chat(joe_candidate, SPAN_WARNING("Only [joe_max] Working Joes may spawn per round."))
Expand Down
1 change: 0 additions & 1 deletion code/game/gamemodes/colonialmarines/colonialmarines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

/* Pre-pre-startup */
/datum/game_mode/colonialmarines/can_start(bypass_checks = FALSE)
initialize_special_clamps()
return TRUE

/datum/game_mode/colonialmarines/announce()
Expand Down
7 changes: 3 additions & 4 deletions code/game/gamemodes/colonialmarines/whiskey_outpost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@
var/datum/job/J = GLOB.RoleAuthority.roles_by_name[i]

// If the job has unlimited job slots, We set the amount of slots to the amount it has at the moment this is called
if (J.spawn_positions < 0)
J.spawn_positions = J.current_positions
J.total_positions = J.current_positions
J.current_positions = J.get_total_positions(TRUE)
if (!J.limited_slots)
J.limited_slots = TRUE
J.current_positions = J.set_spawn_positions()
to_world("<B>New players may no longer join the game.</B>")
message_admins("Wave one has begun. Disabled new player game joining.")
message_admins("Wave one has begun. Disabled new player game joining except for replacement of cryoed marines.")
Expand Down
3 changes: 1 addition & 2 deletions code/game/jobs/job/antag/other/pred.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
)

/datum/job/antag/predator/set_spawn_positions(count)
spawn_positions = max((floor(count * PREDATOR_TO_TOTAL_SPAWN_RATIO)), 4)
total_positions = spawn_positions
total_positions_so_far = max((floor(count * PREDATOR_TO_TOTAL_SPAWN_RATIO)), 4)

/datum/job/antag/predator/spawn_and_equip(mob/new_player/player)
player.spawning = TRUE
Expand Down
7 changes: 2 additions & 5 deletions code/game/jobs/job/antag/xeno/queen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
role_ban_alternative = "Queen"
supervisors = "Queen Mother"
selection_class = "job_xeno_queen"
total_positions = 1
spawn_positions = 1

/datum/job/antag/xenos/queen/set_spawn_positions(count)
return spawn_positions
minimal_open_positions = 1
maximal_open_positions = 1

/datum/job/antag/xenos/queen/transform_to_xeno(mob/living/carbon/human/human_to_transform, hive_index)
SSticker.mode.pick_queen_spawn(human_to_transform, hive_index)
Expand Down
5 changes: 1 addition & 4 deletions code/game/jobs/job/antag/xeno/xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
selection_class = "job_xeno"
// Unlimited for the precount purposes, later set_spawn_positions gets called and sets
// a proper limit.
spawn_positions = -1
total_positions = -1

/datum/job/antag/xenos/proc/calculate_extra_spawn_positions(count)
return max((floor(count * XENO_TO_TOTAL_SPAWN_RATIO)), 0)

/datum/job/antag/xenos/set_spawn_positions(count)
spawn_positions = max((floor(count * XENO_TO_TOTAL_SPAWN_RATIO)), 1)
total_positions = spawn_positions
total_positions_so_far = max((floor(count * XENO_TO_TOTAL_SPAWN_RATIO)), 1)

/datum/job/antag/xenos/spawn_in_player(mob/new_player/NP)
. = ..()
Expand Down
2 changes: 0 additions & 2 deletions code/game/jobs/job/civilians/other/liaison.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/datum/job/civilian/liaison
title = JOB_CORPORATE_LIAISON
total_positions = 1
spawn_positions = 1
supervisors = "the Wey-Yu corporate office"
selection_class = "job_cl"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
Expand Down
23 changes: 3 additions & 20 deletions code/game/jobs/job/civilians/other/mess_seargent.dm
Original file line number Diff line number Diff line change
@@ -1,30 +1,13 @@
/datum/job/civilian/chef
title = JOB_MESS_SERGEANT
total_positions = 2
spawn_positions = 1
allow_additional = TRUE
scaled = TRUE
selection_class = "job_ot"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
supervisors = "the auxiliary support officer"
gear_preset = /datum/equipment_preset/uscm_ship/chef
entry_message_body = "<a href='"+WIKI_PLACEHOLDER+"'>Your job is to service the marines with excellent food</a>, drinks and entertaining the shipside crew when needed. You have a lot of freedom and it is up to you, to decide what to do with it. Good luck!"

/datum/job/civilian/chef/set_spawn_positions(count)
spawn_positions = mess_sergeant_slot_formula(count)

/datum/job/civilian/chef/get_total_positions(latejoin = FALSE)
var/positions = spawn_positions
if(latejoin)
positions = mess_sergeant_slot_formula(get_total_marines())
if(positions <= total_positions_so_far)
positions = total_positions_so_far
else
total_positions_so_far = positions
else
total_positions_so_far = positions

return positions
players_per_position = 70
minimal_open_positions = 1
maximal_open_positions = 2

/obj/effect/landmark/start/chef
name = JOB_MESS_SERGEANT
Expand Down
2 changes: 0 additions & 2 deletions code/game/jobs/job/civilians/other/reporter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

/datum/job/civilian/reporter
title = JOB_COMBAT_REPORTER
total_positions = 1
spawn_positions = 1
selection_class = "job_cl"
supervisors = "the acting commanding officer"
gear_preset = /datum/equipment_preset/uscm_ship/reporter
Expand Down
18 changes: 7 additions & 11 deletions code/game/jobs/job/civilians/other/survivors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
title = JOB_SURVIVOR
selection_class = "job_special"
// For the roundstart precount, then gets further limited by set_spawn_positions.
total_positions = 8
flags_startup_parameters = ROLE_ADD_TO_DEFAULT|ROLE_CUSTOM_SPAWN
late_joinable = FALSE
job_options = SURVIVOR_VARIANT_LIST
Expand All @@ -14,8 +13,7 @@
var/hostile = FALSE

/datum/job/civilian/survivor/set_spawn_positions(count)
spawn_positions = clamp((floor(count * SURVIVOR_TO_TOTAL_SPAWN_RATIO)), 2, 8)
total_positions = spawn_positions
total_positions_so_far = clamp((floor(count * SURVIVOR_TO_TOTAL_SPAWN_RATIO)), 2, 8)

/datum/job/civilian/survivor/equip_job(mob/living/survivor)
var/generated_account = generate_money_account(survivor)
Expand Down Expand Up @@ -154,12 +152,12 @@ AddTimelock(/datum/job/civilian/survivor, list(
selection_class = "job_synth"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT|ROLE_ADMIN_NOTIFY|ROLE_WHITELISTED|ROLE_CUSTOM_SPAWN
flags_whitelist = WHITELIST_SYNTHETIC
total_positions = 1
spawn_positions = 1
job_options = null
minimal_open_positions = 1
maximal_open_positions = 1

/datum/job/civilian/survivor/synth/set_spawn_positions(count)
return spawn_positions
return maximal_open_positions

/datum/job/civilian/survivor/synth/handle_equip_gear(mob/living/carbon/human/equipping_human, obj/effect/landmark/survivor_spawner/picked_spawner)
if(picked_spawner.synth_equipment)
Expand All @@ -181,16 +179,14 @@ AddTimelock(/datum/job/civilian/survivor, list(
selection_class = "job_co"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT|ROLE_ADMIN_NOTIFY|ROLE_WHITELISTED|ROLE_CUSTOM_SPAWN
flags_whitelist = WHITELIST_COMMANDER
total_positions = 0
spawn_positions = 0
job_options = null
total_positions_so_far = 0

/datum/job/civilian/survivor/commanding_officer/set_spawn_positions()
var/list/CO_survivor_types = SSmapping.configs[GROUND_MAP].CO_survivor_types
if(length(CO_survivor_types))
total_positions = 1
spawn_positions = 1
return spawn_positions
total_positions_so_far = 1
return total_positions_so_far

/datum/job/civilian/survivor/commanding_officer/handle_equip_gear(mob/living/carbon/human/equipping_human, obj/effect/landmark/survivor_spawner/picked_spawner)
if(picked_spawner.CO_equipment)
Expand Down
2 changes: 0 additions & 2 deletions code/game/jobs/job/civilians/support/cmo.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/datum/job/civilian/professor
title = JOB_CMO
total_positions = 1
spawn_positions = 1
supervisors = "the acting commanding officer"
selection_class = "job_cmo"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
Expand Down
23 changes: 4 additions & 19 deletions code/game/jobs/job/civilians/support/doctor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
// Doctor
/datum/job/civilian/doctor
title = JOB_DOCTOR
total_positions = 5
spawn_positions = 5
allow_additional = 1
scaled = 1
supervisors = "the chief medical officer"
selection_class = "job_doctor"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
Expand All @@ -18,6 +14,10 @@
// job option
job_options = list(DOCTOR_VARIANT = "Doc", SURGEON_VARIANT = "Sur")
/// If this job is a doctor variant of the doctor role

players_per_position = 25
minimal_open_positions = 4
maximal_open_positions = 6
var/doctor = TRUE

//check the job option. and change the gear preset
Expand All @@ -36,21 +36,6 @@
else
. = {"You're a commissioned officer of the USCM. <a href='[generate_wiki_link()]'>You are a surgeon and tasked with keeping the marines healthy and strong, usually in the form of surgery.</a> You are a doctor that specializes in surgery, but you are also very capable in pharmacy and triage. If you do not know what you are doing, mentorhelp so a mentor can assist you."}

/datum/job/civilian/doctor/set_spawn_positions(count)
spawn_positions = doc_slot_formula(count)

/datum/job/civilian/doctor/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = doc_slot_formula(get_total_marines())
if(positions <= total_positions_so_far)
positions = total_positions_so_far
else
total_positions_so_far = positions
else
total_positions_so_far = positions
return positions

AddTimelock(/datum/job/civilian/doctor, list(
JOB_MEDIC_ROLES = 1 HOURS
))
Expand Down
4 changes: 2 additions & 2 deletions code/game/jobs/job/civilians/support/nurse.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/datum/job/civilian/nurse
title = JOB_NURSE
total_positions = 3
spawn_positions = 3
supervisors = "the chief medical officer"
selection_class = "job_doctor"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
gear_preset = /datum/equipment_preset/uscm_ship/uscm_medical/nurse
entry_message_body = "<a href='"+WIKI_PLACEHOLDER+"'>You are tasked with keeping the Marines healthy and strong.</a> You are also an expert when it comes to medication and treatment, and can do minor surgical procedures. Focus on assisting doctors and triaging wounded marines."
minimal_open_positions = 3
maximal_open_positions = 3

/obj/effect/landmark/start/nurse
name = JOB_NURSE
Expand Down
22 changes: 3 additions & 19 deletions code/game/jobs/job/civilians/support/researcher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,14 @@
//Researcher
/datum/job/civilian/researcher
title = JOB_RESEARCHER
total_positions = 2
spawn_positions = 2
allow_additional = 1
scaled = 1
supervisors = "chief medical officer"
selection_class = "job_researcher"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
gear_preset = /datum/equipment_preset/uscm_ship/uscm_medical/researcher
entry_message_body = "You're a commissioned officer of the USCM. You are tasked with <a href='"+WIKI_PLACEHOLDER+"'>researching</a> and developing new medical treatments, helping your fellow doctors, and generally learning new things. Your role involves a lot of roleplaying, but you can perform the function of a regular doctor. Do not hand out things to Marines without getting permission from your supervisor."

/datum/job/civilian/researcher/set_spawn_positions(count)
spawn_positions = rsc_slot_formula(count)

/datum/job/civilian/researcher/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = rsc_slot_formula(get_total_marines())
if(positions <= total_positions_so_far)
positions = total_positions_so_far
else
total_positions_so_far = positions
else
total_positions_so_far = positions
return positions
players_per_position = 60
minimal_open_positions = 2
maximal_open_positions = 3

AddTimelock(/datum/job/civilian/researcher, list(
JOB_MEDIC_ROLES = 5 HOURS
Expand Down
22 changes: 3 additions & 19 deletions code/game/jobs/job/civilians/support/synthetic.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/datum/job/civilian/synthetic
title = JOB_SYNTH
total_positions = 2
spawn_positions = 1
allow_additional = 1
scaled = 1
supervisors = "the acting commanding officer"
selection_class = "job_synth"
flags_startup_parameters = ROLE_ADD_TO_DEFAULT|ROLE_ADMIN_NOTIFY|ROLE_WHITELISTED|ROLE_CUSTOM_SPAWN
flags_whitelist = WHITELIST_SYNTHETIC
gear_preset = /datum/equipment_preset/synth/uscm
entry_message_body = "You are a <a href='"+WIKI_PLACEHOLDER+"'>Synthetic!</a> You are held to a higher standard and are required to obey not only the Server Rules but Marine Law and Synthetic Rules. Failure to do so may result in your White-list Removal. Your primary job is to support and assist all USCM Departments and Personnel on-board. In addition, being a Synthetic gives you knowledge in every field and specialization possible on-board the ship. As a Synthetic you answer to the acting commanding officer. Special circumstances may change this!"
players_per_position = 120
minimal_open_positions = 1
maximal_open_positions = 2

/datum/job/civilian/synthetic/New()
. = ..()
Expand All @@ -31,21 +30,6 @@
if(player.check_whitelist_status(WHITELIST_SYNTHETIC))
return get_desired_status(player.prefs.synth_status, WHITELIST_NORMAL)

/datum/job/civilian/synthetic/set_spawn_positions(count)
spawn_positions = synth_slot_formula(count)

/datum/job/civilian/synthetic/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = synth_slot_formula(get_total_marines())
if(positions <= total_positions_so_far)
positions = total_positions_so_far
else
total_positions_so_far = positions
else
total_positions_so_far = positions
return positions

/obj/effect/landmark/start/synthetic
name = JOB_SYNTH
icon_state = "syn_spawn"
Expand Down
Loading