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 1 commit
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
4 changes: 0 additions & 4 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ Additional game mode variables.
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]
Expand Down
4 changes: 1 addition & 3 deletions code/game/jobs/job/antag/xeno/queen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
selection_class = "job_xeno_queen"
total_positions = 1
spawn_positions = 1

/datum/job/antag/xenos/queen/set_spawn_positions(count)
return spawn_positions
current_positions = 0

/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
19 changes: 3 additions & 16 deletions code/game/jobs/job/civilians/other/mess_seargent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,9 @@
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
19 changes: 4 additions & 15 deletions code/game/jobs/job/civilians/support/doctor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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 +40,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
18 changes: 3 additions & 15 deletions code/game/jobs/job/civilians/support/researcher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,9 @@
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
18 changes: 3 additions & 15 deletions code/game/jobs/job/civilians/support/synthetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
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 +34,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
18 changes: 3 additions & 15 deletions code/game/jobs/job/civilians/support/working_joe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
flags_whitelist = WHITELIST_JOE
gear_preset = /datum/equipment_preset/synth/working_joe
gets_emergency_kit = FALSE
players_per_position = 30
minimal_open_positions = 3
maximal_open_positions = 6

job_options = list(STANDARD_VARIANT = "JOE", HAZMAT_VARIANT = "HAZ")
var/standard = TRUE
Expand All @@ -31,21 +34,6 @@
standard = FALSE
gear_preset = /datum/equipment_preset/synth/working_joe/engi

/datum/job/civilian/working_joe/set_spawn_positions(count)
spawn_positions = working_joe_slot_formula(count)

/datum/job/civilian/working_joe/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = working_joe_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

/datum/job/civilian/working_joe/generate_entry_message(mob/living/carbon/human/H)
if(standard)
. = {"You are a <a href='[generate_wiki_link()]'>Working Joe.</a> You are held to a higher standard and are required to obey not only the Server Rules but Marine Law, Roleplay Expectations and Synthetic Rules. Your primary task is to maintain the cleanliness of the ship, putting things in their proper place. Alternatively, your primary task may be to assist with manual labor in limited capacity, or clerical duties. Your capacities are limited, but you have all the equipment you need, and the central AI has a plan! Stay in character at all times. Use the APOLLO link to communicate with your uplink!"}
Expand Down
16 changes: 3 additions & 13 deletions code/game/jobs/job/command/auxiliary/intel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@
flags_startup_parameters = ROLE_ADD_TO_DEFAULT|ROLE_ADD_TO_SQUAD
gear_preset = "USCM Intelligence Officer (IO) (Cryo)"
entry_message_body = "<a href='"+WIKI_PLACEHOLDER+"'>Your job is to assist the marines in collecting intelligence related</a> to the current operation to better inform command of their opposition. You are in charge of gathering any data disks, folders, and notes you may find on the operational grounds and decrypt them to grant the USCM additional resources."

/datum/job/command/intel/set_spawn_positions(count)
spawn_positions = int_slot_formula(count)

/datum/job/command/intel/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = int_slot_formula(get_total_marines())
if(positions <= total_positions_so_far)
positions = total_positions_so_far
else
total_positions_so_far = positions
return positions
players_per_position = 30
minimal_open_positions = 1
maximal_open_positions = 3

AddTimelock(/datum/job/command/intel, list(
JOB_SQUAD_ROLES = 5 HOURS
Expand Down
19 changes: 3 additions & 16 deletions code/game/jobs/job/command/cic/staffofficer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,9 @@
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
gear_preset = /datum/equipment_preset/uscm_ship/so
entry_message_body = "<a href='"+WIKI_PLACEHOLDER+"'>Your job is to monitor the Marines, man the CIC, and listen to your superior officers.</a> You are in charge of logistics and the overwatch system. You are also in line to take command after other eligible superior commissioned officers."

/datum/job/command/bridge/set_spawn_positions(count)
spawn_positions = so_slot_formula(count)

/datum/job/command/bridge/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = so_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 = 40
minimal_open_positions = 2
maximal_open_positions = 5

/datum/job/command/bridge/generate_entry_conditions(mob/living/M, whitelist_status)
. = ..()
Expand Down
19 changes: 4 additions & 15 deletions code/game/jobs/job/command/police/police.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,10 @@
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
gear_preset = /datum/equipment_preset/uscm_ship/uscm_police/mp
entry_message_body = "<a href='"+WIKI_PLACEHOLDER+"'>You</a> are held by a higher standard and are required to obey not only the server rules but the <a href='"+LAW_PLACEHOLDER+"'>Marine Law</a>. Failure to do so may result in a job ban or server ban. Your primary job is to maintain peace and stability aboard the ship. Marines can get rowdy after a few weeks of cryosleep! In addition, you are tasked with the security of high-ranking personnel, including the command staff. Keep them safe!"

/datum/job/command/police/set_spawn_positions(count)
spawn_positions = mp_slot_formula(count)

/datum/job/command/police/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = mp_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 = 25
factor = 2
minimal_open_positions = 4
maximal_open_positions = 8

AddTimelock(/datum/job/command/police, list(
JOB_SQUAD_ROLES = 10 HOURS
Expand Down
19 changes: 16 additions & 3 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
var/allow_additional = 0 //Can admins modify positions to it
var/scaled = 0
var/current_positions = 0 //How many players have this job
var/minimal_open_positions = 1 //minimal positions open for round
var/maximal_open_positions = 1 //maximal positions open for round
var/players_per_position = 1 //how many USCM players are needed per position
var/factor = 1 //how many multiplications of players per position are not needed before first increment
var/supervisors = "" //Supervisors, who this person answers to directly. Should be a string, shown to the player when they enter the game.
var/selection_class = "" // Job Selection span class (for background color)

Expand Down Expand Up @@ -168,7 +172,7 @@
return ""

/datum/job/proc/set_spawn_positions(count)
return spawn_positions
return job_slot_formula(count, players_per_position, 1, minimal_open_positions, maximal_open_positions )

/datum/job/proc/spawn_and_equip(mob/new_player/player)
CRASH("A job without a set spawn_and_equip proc has handle_spawn_and_equip set to TRUE!")
Expand Down Expand Up @@ -229,8 +233,17 @@

//This lets you scale max jobs at runtime
//All you have to do is rewrite the inheritance
/datum/job/proc/get_total_positions(latejoin)
return latejoin ? total_positions : spawn_positions
/datum/job/proc/get_total_positions(latejoin = FALSE)
var/positions = spawn_positions
if(latejoin)
positions = job_slot_formula(get_total_marines(), players_per_position, 1, minimal_open_positions, maximal_open_positions )
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

/datum/job/proc/spawn_in_player(mob/new_player/NP)
if(!istype(NP))
Expand Down
19 changes: 4 additions & 15 deletions code/game/jobs/job/logistics/cargo/cargo_tech.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,10 @@
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
gear_preset = /datum/equipment_preset/uscm_ship/cargo
entry_message_body = "<a href='"+WIKI_PLACEHOLDER+"'>Your job</a> is to dispense supplies to the marines, including weapon attachments. Stay in your department when possible to ensure the marines have full access to the supplies they may require. Listen to the radio in case someone requests a supply drop via the overwatch system."

/datum/job/logistics/cargo/set_spawn_positions(count)
spawn_positions = ct_slot_formula(count)

/datum/job/logistics/cargo/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = ct_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 = 30
factor = 0
minimal_open_positions = 2
maximal_open_positions = 3

/obj/effect/landmark/start/cargo
name = JOB_CARGO_TECH
Expand Down
18 changes: 3 additions & 15 deletions code/game/jobs/job/logistics/engi/ordnance_tech.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,9 @@
flags_startup_parameters = ROLE_ADD_TO_DEFAULT
gear_preset = /datum/equipment_preset/uscm_ship/ordn
entry_message_body = "<a href='"+WIKI_PLACEHOLDER+"'>Your job</a> is to maintain the integrity of the USCM weapons, munitions and equipment, including the orbital cannon. You can use the workshop in the portside hangar to construct new armaments for the marines. However you remain one of the more flexible roles on the ship and as such may receive other menial tasks from your superiors."

/datum/job/logistics/otech/set_spawn_positions(count)
spawn_positions = ot_slot_formula(count)

/datum/job/logistics/otech/get_total_positions(latejoin = 0)
var/positions = spawn_positions
if(latejoin)
positions = ot_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/logistics/otech, list(
JOB_ENGINEER_ROLES = 1 HOURS
Expand Down
25 changes: 8 additions & 17 deletions code/game/jobs/job/marine/squad/engineer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,17 @@
flags_startup_parameters = ROLE_ADD_TO_DEFAULT|ROLE_ADD_TO_SQUAD
gear_preset = /datum/equipment_preset/uscm/engineer
entry_message_body = "You have the <a href='"+WIKI_PLACEHOLDER+"'>equipment and skill</a> to build fortifications, reroute power lines, and bunker down. Your squaddies will look to you when it comes to construction in the field of battle."
players_per_position = 12.5
factor = 4
minimal_open_positions = 8
maximal_open_positions = 16


/datum/job/marine/engineer/set_spawn_positions(count)
var/slots_total = ..()
for(var/datum/squad/target_squad in GLOB.RoleAuthority.squads)
if(target_squad)
target_squad.roles_cap[title] = engi_slot_formula(count)

/datum/job/marine/engineer/get_total_positions(latejoin=0)
var/slots = engi_slot_formula(get_total_marines())

if(slots <= total_positions_so_far)
slots = total_positions_so_far
else
total_positions_so_far = slots

if(latejoin)
for(var/datum/squad/target_squad in GLOB.RoleAuthority.squads)
if(target_squad)
target_squad.roles_cap[title] = slots

return (slots*4)
if(target_squad && target_squad.faction == FACTION_MARINE)
target_squad.roles_cap[title] = slots_total/4

/datum/job/marine/engineer/whiskey
title = JOB_WO_SQUAD_ENGINEER
Expand Down
Loading
Loading