Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Mar 17, 2024
1 parent ee5a956 commit 3312efc
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 10 deletions.
1 change: 1 addition & 0 deletions code/game/jobs/job/command/cic/staffofficer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ AddTimelock(/datum/job/command/bridge, list(
/datum/job/command/bridge/ai
total_positions = 1
spawn_positions = 1
prime_priorty = TRUE

/datum/job/command/bridge/ai/set_spawn_positions(count)
return spawn_positions
Expand Down
3 changes: 3 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
/// If TRUE, this job will spawn w/ a cryo emergency kit during evac/red alert
var/gets_emergency_kit = TRUE

/// Whether or not linking your discord account can let you get prime priority for this role
var/prime_priority = FALSE

/datum/job/New()
. = ..()

Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/marine/squad/leader.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ AddTimelock(/datum/job/marine/leader, list(
/datum/job/marine/leader/ai
total_positions = 1
spawn_positions = 1
prime_priority = TRUE

/datum/job/marine/leader/ai/upp
title = JOB_SQUAD_LEADER_UPP
Expand Down
11 changes: 8 additions & 3 deletions code/game/jobs/role_authority.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ var/global/datum/authority/branch/role/RoleAuthority
#define RETURN_TO_LOBBY 2

#define NEVER_PRIORITY 0
#define HIGH_PRIORITY 1
#define MED_PRIORITY 2
#define LOW_PRIORITY 3
#define PRIME_PRIORITY 1
#define HIGH_PRIORITY 2
#define MED_PRIORITY 3
#define LOW_PRIORITY 4

#define SHIPSIDE_ROLE_WEIGHT 0.25

Expand Down Expand Up @@ -245,6 +246,10 @@ I hope it's easier to tell what the heck this proc is even doing, unlike previou
if(!length(roles_to_assign) || !length(unassigned_players))
return

//for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players))
// var/wanted_jobs_by_name = shuffle(cycled_unassigned.client?.prefs?.get_jobs_by_priority(PRIME_PRIORITY))
// Set up prime priority first rolls, probably put line 257 in a new function and then pass priority through manually - Morrow

for(var/mob/new_player/cycled_unassigned in shuffle(unassigned_players))
var/player_assigned_job = FALSE
log_debug("ASSIGNMENT: We have started assigning for [cycled_unassigned].")
Expand Down
16 changes: 15 additions & 1 deletion code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,10 @@ var/const/MAX_SAVE_SLOTS = 10
if(!RoleAuthority)
return

var/host_bypass = FALSE
if(user.client?.admin_holder?.check_for_rights(R_HOST))
host_bypass = TRUE

var/HTML = "<body>"
HTML += "<tt><center>"
HTML += "<b>Choose occupation chances</b><br>Unavailable occupations are crossed out.<br><br>"
Expand Down Expand Up @@ -714,6 +718,9 @@ var/const/MAX_SAVE_SLOTS = 10
if(NEVER_PRIORITY)
b_color = "red"
priority_text = "NEVER"
if(PRIME_PRIORITY)
b_color = "purple"
priority_text = "PRIME"
if(HIGH_PRIORITY)
b_color = "blue"
priority_text = "HIGH"
Expand All @@ -724,6 +731,9 @@ var/const/MAX_SAVE_SLOTS = 10
b_color = "orange"
priority_text = "LOW"

if(j == PRIME_PRIORITY && !host_bypass && (!job.prime_option || !user.client?.player_data?.discord_link_id))
continue

HTML += "<a class='[j == cur_priority ? b_color : "inactive"]' href='?_src_=prefs;preference=job;task=input;text=[job.title];target_priority=[j];'>[priority_text]</a>"
if (j < 4)
HTML += "&nbsp"
Expand Down Expand Up @@ -922,11 +932,15 @@ var/const/MAX_SAVE_SLOTS = 10
if(!J || priority < 0 || priority > 4)
return FALSE


if(!length(job_preference_list))
ResetJobs()

// Need to set old HIGH priority to 2
if(priority == PRIME_PRIORITY)
for(var/job in job_preference_list)
if(job_preference_list[job] == PRIME_PRIORITY)
job_preference_list[job] = MED_PRIORITY

if(priority == HIGH_PRIORITY)
for(var/job in job_preference_list)
if(job_preference_list[job] == HIGH_PRIORITY)
Expand Down
8 changes: 6 additions & 2 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define SAVEFILE_VERSION_MIN 8
#define SAVEFILE_VERSION_MAX 22
#define SAVEFILE_VERSION_MAX 23

//handles converting savefiles to new formats
//MAKE SURE YOU KEEP THIS UP TO DATE!
Expand Down Expand Up @@ -96,6 +96,10 @@
temp_ooccolor = "#1c52f5"
S["ooccolor"] << temp_ooccolor

if(savefile_version < 23)
var/overwrite_job_preference_list = list()
S["job_preference_list"] << overwrite_job_preference_list

savefile_version = SAVEFILE_VERSION_MAX
return 1

Expand Down Expand Up @@ -574,7 +578,7 @@
ResetJobs()
else
for(var/job in job_preference_list)
job_preference_list[job] = sanitize_integer(job_preference_list[job], 0, 3, initial(job_preference_list[job]))
job_preference_list[job] = sanitize_integer(job_preference_list[job], 0, 4, initial(job_preference_list[job]))

if(!organ_data)
organ_data = list()
Expand Down
12 changes: 8 additions & 4 deletions code/modules/mob/new_player/preferences_setup.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,16 @@
rotate_right.screen_loc = "preview:1:-16,0"

/datum/preferences/proc/job_pref_to_gear_preset()
var/high_priority
var/highest_priority
for(var/job in job_preference_list)
if(job_preference_list[job] == 1)
high_priority = job
if(job_preference_list[job] == HIGH_PRIORITY)
highest_priority = job

switch(high_priority)
if(job_preference_list[job] == PRIME_PRIORITY)
highest_priority = job
break

switch(highest_priority)
if(JOB_SQUAD_MARINE)
return /datum/equipment_preset/uscm/private_equipped
if(JOB_SQUAD_ENGI)
Expand Down

0 comments on commit 3312efc

Please sign in to comment.