Ports revised job backend from TG
This commit is contained in:
@@ -13,8 +13,12 @@
|
||||
canmove = FALSE
|
||||
|
||||
anchored = TRUE // don't get pushed around
|
||||
|
||||
var/mob/living/new_character //for instant transfer once the round is set up
|
||||
|
||||
//Used to make sure someone doesn't get spammed with messages if they're ineligible for roles
|
||||
var/ineligible_for_roles = FALSE
|
||||
|
||||
/mob/dead/new_player/Initialize()
|
||||
if(client && SSticker.state == GAME_STATE_STARTUP)
|
||||
var/obj/screen/splash/S = new(client, TRUE, TRUE)
|
||||
@@ -33,8 +37,7 @@
|
||||
return
|
||||
|
||||
/mob/dead/new_player/proc/new_player_panel()
|
||||
var/output = "<center><p>Welcome, <b>[client ? client.prefs.real_name : "Unknown User"]</b></p>"
|
||||
output += "<p><a href='byond://?src=[REF(src)];show_preferences=1'>Setup Character</a></p>"
|
||||
var/output = "<center><p><a href='byond://?src=[REF(src)];show_preferences=1'>Setup Character</a></p>"
|
||||
|
||||
if(SSticker.current_state <= GAME_STATE_PREGAME)
|
||||
switch(ready)
|
||||
@@ -75,7 +78,7 @@
|
||||
var/datum/browser/popup = new(src, "playersetup", "<div align='center'>New Player Options</div>", 250, 265)
|
||||
popup.set_window_options("can_close=0")
|
||||
popup.set_content(output)
|
||||
popup.open(0)
|
||||
popup.open(FALSE)
|
||||
|
||||
/mob/dead/new_player/Topic(href, href_list[])
|
||||
if(src != usr)
|
||||
@@ -429,8 +432,7 @@
|
||||
|
||||
|
||||
/mob/dead/new_player/proc/LateChoices()
|
||||
var/dat = "<div class='notice'>Round Duration: [DisplayTimeText(world.time - SSticker.round_start_time)]</div>"
|
||||
|
||||
var/list/dat = list("<div class='notice'>Round Duration: [DisplayTimeText(world.time - SSticker.round_start_time)]</div>")
|
||||
if(SSshuttle.emergency)
|
||||
switch(SSshuttle.emergency.mode)
|
||||
if(SHUTTLE_ESCAPE)
|
||||
@@ -438,57 +440,49 @@
|
||||
if(SHUTTLE_CALL)
|
||||
if(!SSshuttle.canRecall())
|
||||
dat += "<div class='notice red'>The station is currently undergoing evacuation procedures.</div><br>"
|
||||
for(var/datum/job/prioritized_job in SSjob.prioritized_jobs)
|
||||
if(prioritized_job.current_positions >= prioritized_job.total_positions)
|
||||
SSjob.prioritized_jobs -= prioritized_job
|
||||
dat += "<table><tr><td valign='top'>"
|
||||
var/column_counter = 0
|
||||
for(var/list/category in list(GLOB.command_positions) + list(GLOB.engineering_positions) + list(GLOB.supply_positions) + list(GLOB.nonhuman_positions - "pAI") + list(GLOB.civilian_positions) + list(GLOB.medical_positions) + list(GLOB.science_positions) + list(GLOB.security_positions))
|
||||
var/cat_color = SSjob.name_occupations[category[1]].selection_color //use the color of the first job in the category (the department head) as the category color
|
||||
dat += "<fieldset style='width: 185px; border: 2px solid [cat_color]; display: inline'>"
|
||||
dat += "<legend align='center' style='color: [cat_color]'>[SSjob.name_occupations[category[1]].exp_type_department]</legend>"
|
||||
var/list/dept_dat = list()
|
||||
for(var/job in category)
|
||||
var/datum/job/job_datum = SSjob.name_occupations[job]
|
||||
if(job_datum && IsJobUnavailable(job_datum.title, TRUE) == JOB_AVAILABLE)
|
||||
var/command_bold = ""
|
||||
if(job in GLOB.command_positions)
|
||||
command_bold = " command"
|
||||
if(job_datum in SSjob.prioritized_jobs)
|
||||
dept_dat += "<a class='job[command_bold]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job_datum.title]'><span class='priority'>[job_datum.title] ([job_datum.current_positions])</span></a>"
|
||||
else
|
||||
dept_dat += "<a class='job[command_bold]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job_datum.title]'>[job_datum.title] ([job_datum.current_positions])</a>"
|
||||
if(!dept_dat.len)
|
||||
dept_dat += "<span class='nopositions'>No positions open.</span>"
|
||||
dat += jointext(dept_dat, "")
|
||||
dat += "</fieldset><br>"
|
||||
column_counter++
|
||||
if(column_counter > 0 && (column_counter % 3 == 0))
|
||||
dat += "</td><td valign='top'>"
|
||||
dat += "</td></tr></table></center>"
|
||||
dat += "</div></div>"
|
||||
|
||||
var/available_job_count = 0
|
||||
for(var/datum/job/job in SSjob.occupations)
|
||||
if(job && IsJobUnavailable(job.title, TRUE) == JOB_AVAILABLE)
|
||||
available_job_count++
|
||||
var/available_ghosts = 0
|
||||
for(var/spawner in GLOB.mob_spawners)
|
||||
available_job_count++
|
||||
available_ghosts++
|
||||
break
|
||||
|
||||
if(!available_job_count)
|
||||
dat += "<div class='notice red'>There are currently no open positions!</div>"
|
||||
|
||||
if(!available_ghosts)
|
||||
dat += "<div class='notice red'>There are currently no open ghost spawners.</div>"
|
||||
else
|
||||
dat += "<div class='clearBoth'>Choose from the following open positions:</div><br>"
|
||||
var/list/categorizedJobs = list(
|
||||
"Command" = list(jobs = list(), titles = GLOB.command_positions, color = "#aac1ee"),
|
||||
"Engineering" = list(jobs = list(), titles = GLOB.engineering_positions, color = "#ffd699"),
|
||||
"Supply" = list(jobs = list(), titles = GLOB.supply_positions, color = "#ead4ae"),
|
||||
"Miscellaneous" = list(jobs = list(), titles = list(), color = "#ffffff", colBreak = TRUE),
|
||||
"Ghost Role" = list(jobs = list(), titles = GLOB.mob_spawners, color = "#ffffff"),
|
||||
"Synthetic" = list(jobs = list(), titles = GLOB.nonhuman_positions, color = "#ccffcc"),
|
||||
"Service" = list(jobs = list(), titles = GLOB.civilian_positions, color = "#cccccc"),
|
||||
"Medical" = list(jobs = list(), titles = GLOB.medical_positions, color = "#99ffe6", colBreak = TRUE),
|
||||
"Science" = list(jobs = list(), titles = GLOB.science_positions, color = "#e6b3e6"),
|
||||
"Security" = list(jobs = list(), titles = GLOB.security_positions, color = "#ff9999"),
|
||||
)
|
||||
dat += "<div class='clearBoth'>Currently open Ghost roles:</div><br>"
|
||||
var/list/categorizedJobs = list("Ghost Role" = list(jobs = list(), titles = GLOB.mob_spawners, color = "#ffffff"))
|
||||
for(var/spawner in GLOB.mob_spawners)
|
||||
categorizedJobs["Ghost Role"]["jobs"] += spawner
|
||||
|
||||
for(var/datum/job/job in SSjob.occupations)
|
||||
if(job && IsJobUnavailable(job.title, TRUE) == JOB_AVAILABLE)
|
||||
var/categorized = FALSE
|
||||
for(var/jobcat in categorizedJobs)
|
||||
var/list/jobs = categorizedJobs[jobcat]["jobs"]
|
||||
if(job.title in categorizedJobs[jobcat]["titles"])
|
||||
categorized = TRUE
|
||||
if(jobcat == "Command")
|
||||
|
||||
if(job.title == "Captain") // Put captain at top of command jobs
|
||||
jobs.Insert(1, job)
|
||||
else
|
||||
jobs += job
|
||||
else // Put heads at top of non-command jobs
|
||||
if(job.title in GLOB.command_positions)
|
||||
jobs.Insert(1, job)
|
||||
else
|
||||
jobs += job
|
||||
if(!categorized)
|
||||
categorizedJobs["Miscellaneous"]["jobs"] += job
|
||||
|
||||
|
||||
dat += "<table><tr><td valign='top'>"
|
||||
for(var/jobcat in categorizedJobs)
|
||||
if(categorizedJobs[jobcat]["colBreak"])
|
||||
@@ -498,16 +492,6 @@
|
||||
var/color = categorizedJobs[jobcat]["color"]
|
||||
dat += "<fieldset style='border: 2px solid [color]; display: inline'>"
|
||||
dat += "<legend align='center' style='color: [color]'>[jobcat]</legend>"
|
||||
for(var/datum/job/job in categorizedJobs[jobcat]["jobs"])
|
||||
var/position_class = "otherPosition"
|
||||
if(job.title in GLOB.command_positions)
|
||||
position_class = "commandPosition"
|
||||
if(job in SSjob.prioritized_jobs)
|
||||
dat += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job.title]'><font color='lime'><b>[job.title] ([job.current_positions])</b></font></a>"
|
||||
else
|
||||
dat += "<a class='[position_class]' style='display:block;width:170px' href='byond://?src=[REF(src)];SelectedJob=[job.title]'>[job.title] ([job.current_positions])</a>"
|
||||
categorizedJobs[jobcat]["jobs"] -= job
|
||||
|
||||
for(var/spawner in categorizedJobs[jobcat]["jobs"])
|
||||
dat += "<a class='otherPosition' style='display:block;width:170px' href='byond://?src=[REF(src)];JoinAsGhostRole=[spawner]'>[spawner]</a>"
|
||||
|
||||
@@ -515,16 +499,11 @@
|
||||
dat += "</td></tr></table></center>"
|
||||
dat += "</div></div>"
|
||||
|
||||
// Removing the old window method but leaving it here for reference
|
||||
//src << browse(dat, "window=latechoices;size=300x640;can_close=1")
|
||||
|
||||
// Added the new browser window method
|
||||
var/datum/browser/popup = new(src, "latechoices", "Choose Profession", 680, 580)
|
||||
popup.add_stylesheet("playeroptions", 'html/browser/playeroptions.css')
|
||||
popup.set_content(dat)
|
||||
popup.set_content(jointext(dat, ""))
|
||||
popup.open(FALSE) // FALSE is passed to open so that it doesn't use the onclose() proc
|
||||
|
||||
|
||||
/mob/dead/new_player/proc/create_character(transfer_after)
|
||||
spawning = 1
|
||||
close_spawn_windows()
|
||||
@@ -533,7 +512,7 @@
|
||||
|
||||
var/frn = CONFIG_GET(flag/force_random_names)
|
||||
if(!frn)
|
||||
frn = jobban_isbanned(src, "appearance")
|
||||
frn = jobban_isbanned(src, "Appearance")
|
||||
if(QDELETED(src))
|
||||
return
|
||||
if(frn)
|
||||
@@ -580,3 +559,31 @@
|
||||
src << browse(null, "window=preferences") //closes job selection
|
||||
src << browse(null, "window=mob_occupation")
|
||||
src << browse(null, "window=latechoices") //closes late job selection
|
||||
|
||||
/* Used to make sure that a player has a valid job preference setup, used to knock players out of eligibility for anything if their prefs don't make sense.
|
||||
A "valid job preference setup" in this situation means at least having one job set to low, or not having "return to lobby" enabled
|
||||
Prevents "antag rolling" by setting antag prefs on, all jobs to never, and "return to lobby if preferences not availible"
|
||||
Doing so would previously allow you to roll for antag, then send you back to lobby if you didn't get an antag role
|
||||
This also does some admin notification and logging as well, as well as some extra logic to make sure things don't go wrong
|
||||
*/
|
||||
|
||||
/mob/dead/new_player/proc/check_preferences()
|
||||
if(!client)
|
||||
return FALSE //Not sure how this would get run without the mob having a client, but let's just be safe.
|
||||
if(client.prefs.joblessrole != RETURNTOLOBBY)
|
||||
return TRUE
|
||||
// If they have antags enabled, they're potentially doing this on purpose instead of by accident. Notify admins if so.
|
||||
var/has_antags = FALSE
|
||||
if(client.prefs.be_special.len > 0)
|
||||
has_antags = TRUE
|
||||
if(client.prefs.job_preferences.len == 0)
|
||||
if(!ineligible_for_roles)
|
||||
to_chat(src, "<span class='danger'>You have no jobs enabled, along with return to lobby if job is unavailable. This makes you ineligible for any round start role, please update your job preferences.</span>")
|
||||
ineligible_for_roles = TRUE
|
||||
ready = PLAYER_NOT_READY
|
||||
if(has_antags)
|
||||
log_admin("[src.ckey] just got booted back to lobby with no jobs, but antags enabled.")
|
||||
message_admins("[src.ckey] just got booted back to lobby with no jobs enabled, but antag rolling enabled. Likely antag rolling abuse.")
|
||||
|
||||
return FALSE //This is the only case someone should actually be completely blocked from antag rolling as well
|
||||
return TRUE
|
||||
@@ -21,50 +21,35 @@
|
||||
age = rand(AGE_MIN,AGE_MAX)
|
||||
|
||||
/datum/preferences/proc/update_preview_icon()
|
||||
// Silicons only need a very basic preview since there is no customization for them.
|
||||
// var/wide_icon = FALSE //CITDEL THINGS
|
||||
// if(features["taur"] != "None")
|
||||
// wide_icon = TRUE
|
||||
if(job_engsec_high)
|
||||
switch(job_engsec_high)
|
||||
if(AI_JF)
|
||||
parent.show_character_previews(image('icons/mob/ai.dmi', resolve_ai_icon(preferred_ai_core_display), dir = SOUTH))
|
||||
return
|
||||
if(CYBORG)
|
||||
parent.show_character_previews(image('icons/mob/robots.dmi', icon_state = "robot", dir = SOUTH))
|
||||
return
|
||||
// Determine what job is marked as 'High' priority, and dress them up as such.
|
||||
var/datum/job/previewJob
|
||||
var/highest_pref = 0
|
||||
for(var/job in job_preferences)
|
||||
if(job_preferences[job] > highest_pref)
|
||||
previewJob = SSjob.GetJob(job)
|
||||
highest_pref = job_preferences[job]
|
||||
|
||||
if(previewJob)
|
||||
// Silicons only need a very basic preview since there is no customization for them.
|
||||
if(istype(previewJob,/datum/job/ai))
|
||||
parent.show_character_previews(image('icons/mob/ai.dmi', icon_state = resolve_ai_icon(preferred_ai_core_display), dir = SOUTH))
|
||||
return
|
||||
if(istype(previewJob,/datum/job/cyborg))
|
||||
parent.show_character_previews(image('icons/mob/robots.dmi', icon_state = "robot", dir = SOUTH))
|
||||
return
|
||||
|
||||
// Set up the dummy for its photoshoot
|
||||
var/mob/living/carbon/human/dummy/mannequin = generate_or_wait_for_human_dummy(DUMMY_HUMAN_SLOT_PREFERENCES)
|
||||
mannequin.cut_overlays()
|
||||
// Apply the Dummy's preview background first so we properly layer everything else on top of it.
|
||||
mannequin.add_overlay(mutable_appearance('modular_citadel/icons/ui/backgrounds.dmi', bgstate, layer = SPACE_LAYER))
|
||||
copy_to(mannequin)
|
||||
|
||||
// Determine what job is marked as 'High' priority, and dress them up as such.
|
||||
var/datum/job/previewJob
|
||||
var/highRankFlag = job_civilian_high | job_medsci_high | job_engsec_high
|
||||
|
||||
if(job_civilian_low & ASSISTANT)
|
||||
previewJob = SSjob.GetJob("Assistant")
|
||||
else if(highRankFlag)
|
||||
var/highDeptFlag
|
||||
if(job_civilian_high)
|
||||
highDeptFlag = CIVILIAN
|
||||
else if(job_medsci_high)
|
||||
highDeptFlag = MEDSCI
|
||||
else if(job_engsec_high)
|
||||
highDeptFlag = ENGSEC
|
||||
|
||||
for(var/datum/job/job in SSjob.occupations)
|
||||
if(job.flag == highRankFlag && job.department_flag == highDeptFlag)
|
||||
previewJob = job
|
||||
break
|
||||
|
||||
if(previewJob)
|
||||
if(current_tab != 2)
|
||||
mannequin.job = previewJob.title
|
||||
previewJob.equip(mannequin, TRUE)
|
||||
mannequin.job = previewJob.title
|
||||
previewJob.equip(mannequin, TRUE, preference_source = parent)
|
||||
|
||||
COMPILE_OVERLAYS(mannequin)
|
||||
parent.show_character_previews(new /mutable_appearance(mannequin))
|
||||
unset_busy_human_dummy(DUMMY_HUMAN_SLOT_PREFERENCES)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user