mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Categorized latejoin menu and made it into VueUI, improved crew manifest logic and made Verb manifest same as VueUI program, Job fixes (#10470)
This commit is contained in:
@@ -584,7 +584,6 @@
|
||||
SearchVar(MERCHANT)
|
||||
SearchVar(ASSISTANT)
|
||||
SearchVar(CONSULAR)
|
||||
SearchVar(assistant_occupations)
|
||||
SearchVar(command_positions)
|
||||
SearchVar(engineering_positions)
|
||||
SearchVar(medical_positions)
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
init_order = SS_INIT_JOBS
|
||||
|
||||
// Vars.
|
||||
var/list/occupations = list()
|
||||
var/list/name_occupations = list() //Dict of all jobs, keys are titles
|
||||
var/list/type_occupations = list() //Dict of all jobs, keys are types
|
||||
var/list/unassigned = list()
|
||||
var/list/datum/job/occupations = list()
|
||||
var/list/datum/job/name_occupations = list() //Dict of all jobs, keys are titles
|
||||
var/list/datum/job/type_occupations = list() //Dict of all jobs, keys are types
|
||||
var/list/mob/abstract/new_player/unassigned = list()
|
||||
var/list/job_debug = list()
|
||||
|
||||
var/list/factions = list()
|
||||
@@ -104,9 +104,9 @@
|
||||
to_chat(player, "<span class='warning'>Your character is too young!</span>")
|
||||
return FALSE
|
||||
|
||||
var/position_limit = job.total_positions
|
||||
var/position_limit = job.get_total_positions()
|
||||
if(!latejoin)
|
||||
position_limit = job.spawn_positions
|
||||
position_limit = job.get_spawn_positions()
|
||||
if((job.current_positions < position_limit) || position_limit == -1)
|
||||
Debug("Player: [player] is now Rank: [rank], JCP:[job.current_positions], JPL:[position_limit]")
|
||||
player.mind.assigned_role = rank
|
||||
@@ -117,14 +117,12 @@
|
||||
Debug("AR has failed, Player: [player], Rank: [rank]")
|
||||
return FALSE
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/FreeRole(rank)
|
||||
/datum/controller/subsystem/jobs/proc/FreeRole(var/rank)
|
||||
var/datum/job/job = GetJob(rank)
|
||||
if(!istype(job))
|
||||
return
|
||||
|
||||
if (job && job.current_positions >= job.total_positions && job.total_positions != -1)
|
||||
job.total_positions++
|
||||
return TRUE
|
||||
|
||||
return FALSE
|
||||
job.current_positions--
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/FindOccupationCandidates(datum/job/job, level, flag)
|
||||
Debug("Running FOC, Job: [job], Level: [level], Flag: [flag]")
|
||||
@@ -278,7 +276,7 @@
|
||||
if(player.client.prefs.GetJobDepartment(job, level) & job.flag)
|
||||
|
||||
// If the job isn't filled
|
||||
if((job.current_positions < job.spawn_positions) || job.spawn_positions == -1)
|
||||
if((job.current_positions < job.get_spawn_positions()) || job.get_spawn_positions() == -1)
|
||||
Debug("DO pass, Player: [player], Level:[level], Job:[job.title]")
|
||||
AssignRole(player, job.title)
|
||||
unassigned -= player
|
||||
@@ -348,16 +346,16 @@
|
||||
H.buckled.forceMove(H.loc)
|
||||
H.buckled.set_dir(H.dir)
|
||||
|
||||
// If they're head, give them the account info for their department
|
||||
if(H.mind && job.head_position)
|
||||
if(H.mind)
|
||||
// If they're a department supervisor/head give them the account info for that department
|
||||
var/remembered_info = ""
|
||||
var/datum/money_account/department_account = SSeconomy.get_department_account(job.department)
|
||||
|
||||
if(department_account)
|
||||
remembered_info += "<b>Your department's account number is:</b> #[department_account.account_number]<br>"
|
||||
remembered_info += "<b>Your department's account pin is:</b> [department_account.remote_access_pin]<br>"
|
||||
remembered_info += "<b>Your department's account funds are:</b> $[department_account.money]<br>"
|
||||
|
||||
for(var/department in job.departments)
|
||||
if(job.departments[department] & JOBROLE_SUPERVISOR)
|
||||
var/datum/money_account/department_account = SSeconomy.get_department_account(department)
|
||||
if(department_account)
|
||||
remembered_info += "<b>[department] department's account number is:</b> #[department_account.account_number]<br>"
|
||||
remembered_info += "<b>[department] department's account pin is:</b> [department_account.remote_access_pin]<br>"
|
||||
remembered_info += "<b>[department] department's account funds are:</b> $[department_account.money]<br>"
|
||||
H.mind.store_memory(remembered_info)
|
||||
|
||||
var/alt_title = null
|
||||
@@ -381,7 +379,7 @@
|
||||
if(H.needs_wheelchair())
|
||||
H.equip_wheelchair()
|
||||
|
||||
to_chat(H, "<B>You are [job.total_positions == 1 ? "the" : "a"] [alt_title ? alt_title : rank].</B>")
|
||||
to_chat(H, "<B>You are [job.get_total_positions() == 1 ? "the" : "a"] [alt_title ? alt_title : rank].</B>")
|
||||
|
||||
if(job.supervisors)
|
||||
to_chat(H, "<b>As [job.intro_prefix] [alt_title ? alt_title : rank] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")
|
||||
@@ -541,7 +539,7 @@
|
||||
var/obj/item/clothing/glasses/G = H.glasses
|
||||
G.prescription = 7
|
||||
G.autodrobe_no_remove = TRUE
|
||||
|
||||
|
||||
if(H.species && !H.species_items_equipped)
|
||||
H.species.equip_later_gear(H)
|
||||
H.species_items_equipped = TRUE
|
||||
@@ -585,11 +583,10 @@
|
||||
|
||||
if(name && value)
|
||||
var/datum/job/J = GetJob(name)
|
||||
if(!J) continue
|
||||
if(!istype(J))
|
||||
continue
|
||||
J.total_positions = text2num(value)
|
||||
J.spawn_positions = text2num(value)
|
||||
if(name == "AI" || name == "Cyborg")//I dont like this here but it will do for now // 6 years later and it's still not changed. Hue.
|
||||
J.total_positions = 0
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
var/list/warrants
|
||||
var/list/viruses
|
||||
|
||||
var/list/nameMap
|
||||
var/list/excluded_fields
|
||||
var/list/localized_fields
|
||||
|
||||
@@ -38,7 +37,6 @@
|
||||
excluded_fields = list()
|
||||
localized_fields = list()
|
||||
manifest = list()
|
||||
nameMap = list("heads" = "Heads", "sec" = "Security", "eng" = "Engineering", "med" = "Medical", "sci" = "Science", "car" = "Cargo", "civ" = "Civilian", "misc" = "Miscellaneous", "bot" = "Equipment")
|
||||
NEW_SS_GLOBAL(SSrecords)
|
||||
var/datum/D = new()
|
||||
for(var/v in D.vars)
|
||||
@@ -181,54 +179,27 @@
|
||||
/datum/controller/subsystem/records/proc/reset_manifest()
|
||||
manifest.Cut()
|
||||
|
||||
// The one and only method for showing a pop-up crew manifest (browser) window
|
||||
/proc/open_crew_manifest(var/mob/user, var/OOC = FALSE)
|
||||
if(!user)
|
||||
return
|
||||
var/const/windowname = "manifest"
|
||||
var/dat = {"<h2 style="text-align: center">Crew Manifest</h2>"}
|
||||
dat += SSrecords.get_manifest(OOC)
|
||||
send_theme_resources(user)
|
||||
user << browse(enable_ui_theme(user, dat), "window=[windowname];size=450x600")
|
||||
return windowname
|
||||
/datum/controller/subsystem/records/CanUseTopic(var/mob/user, var/datum/topic_state/state = default_state) // this is needed because VueUI closes otherwise
|
||||
if(isnewplayer(user))
|
||||
return STATUS_INTERACTIVE
|
||||
if(isobserver(user))
|
||||
return STATUS_INTERACTIVE
|
||||
if(issilicon(user)) // silicons have the show manifest verb
|
||||
return STATUS_INTERACTIVE
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/records/proc/get_manifest(var/OOC = FALSE)
|
||||
var/const/style = {"
|
||||
.manifest {border-collapse: collapse; width: 100%}
|
||||
.manifest td, th {border: 1px solid #DEF; background-color: white; color:black; padding: .25em}
|
||||
.manifest th {height: 2em; background-color: #3F668F; color: white}
|
||||
.manifest tr.head th {background-color: #006E7A;}
|
||||
.manifest td:first-child {text-align: right}
|
||||
.manifest tr.alt td {background-color: #DEF}
|
||||
"}
|
||||
var/dat = {"
|
||||
<head><style>[style]</style></head>
|
||||
<table class="manifest">
|
||||
<tr class='head'><th>Name</th><th>Rank</th><th>Activity</th></tr>
|
||||
"}
|
||||
var/even = 0
|
||||
var/list/isactive = new()
|
||||
for(var/mob/M in player_list)
|
||||
if (OOC)
|
||||
if(M.client && M.client.inactivity <= 10 * 60 * 10)
|
||||
isactive[M.real_name] = "Active"
|
||||
else
|
||||
isactive[M.real_name] = "Inactive"
|
||||
else
|
||||
isactive[M.real_name] = 0
|
||||
/datum/controller/subsystem/records/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui)
|
||||
. = ..()
|
||||
data = . || data || list()
|
||||
|
||||
var/manifest = get_manifest_list()
|
||||
for(var/dep in manifest)
|
||||
var/list/depI = manifest[dep]
|
||||
if(depI.len > 0)
|
||||
dat += "<tr><th colspan=3>[nameMap[dep]]</th></tr>"
|
||||
for(var/list/item in depI)
|
||||
dat += "<tr[even ? " class='alt'" : ""]><td>[item["name"]]</td><td>[item["rank"]]</td><td>[isactive[item["name"]] ? isactive[item["name"]] : item["active"]]</td></tr>"
|
||||
even = !even
|
||||
dat += "</table>"
|
||||
dat = replacetext(dat, "\n", "") // so it can be placed on paper correctly
|
||||
dat = replacetext(dat, "\t", "")
|
||||
return dat
|
||||
VUEUI_SET_CHECK_LIST(data["manifest"], SSrecords.get_manifest_list(), ., data)
|
||||
|
||||
/datum/controller/subsystem/records/proc/open_manifest_vueui(mob/user)
|
||||
var/datum/vueui/ui = SSvueui.get_open_ui(user, src)
|
||||
if (!ui)
|
||||
ui = new(user, src, "manifest", 450, 600, "Crew Manifest")
|
||||
ui.header = "minimal"
|
||||
ui.open()
|
||||
|
||||
/datum/controller/subsystem/records/proc/get_manifest_text()
|
||||
var/dat = "<h2>Crew Manifest</h2><em>as of [worlddate2text()] [worldtime2text()]</em>"
|
||||
@@ -239,56 +210,38 @@
|
||||
var/depDat
|
||||
for(var/list/item in depI)
|
||||
depDat += "<li><strong>[item["name"]]</strong> - [item["rank"]] ([item["active"]])</li>"
|
||||
dat += "<h3>[nameMap[dep]]</h3><ul>[depDat]</ul>"
|
||||
dat += "<h3>[dep]</h3><ul>[depDat]</ul>"
|
||||
return dat
|
||||
|
||||
/datum/controller/subsystem/records/proc/get_manifest_list()
|
||||
if(manifest.len)
|
||||
return manifest
|
||||
manifest = list(
|
||||
"heads" = list(),
|
||||
"sec" = list(),
|
||||
"eng" = list(),
|
||||
"med" = list(),
|
||||
"sci" = list(),
|
||||
"car" = list(),
|
||||
"civ" = list(),
|
||||
"bot" = list(),
|
||||
"misc" = list()
|
||||
)
|
||||
var/positions = list(
|
||||
"heads" = command_positions,
|
||||
"sec" = security_positions,
|
||||
"eng" = engineering_positions,
|
||||
"med" = medical_positions,
|
||||
"sci" = science_positions,
|
||||
"car" = cargo_positions,
|
||||
"civ" = civilian_positions,
|
||||
"bot" = nonhuman_positions
|
||||
)
|
||||
if(!SSjobs)
|
||||
error("SSjobs not available, cannot build manifest")
|
||||
return
|
||||
manifest = DEPARTMENTS_LIST_INIT
|
||||
for(var/datum/record/general/t in records)
|
||||
var/name = sanitize(t.name, encode = FALSE)
|
||||
var/rank = sanitize(t.rank, encode = FALSE)
|
||||
var/real_rank = make_list_rank(t.real_rank)
|
||||
|
||||
var/datum/job/job = SSjobs.GetJob(real_rank)
|
||||
var/isactive = t.physical_status
|
||||
var/department = 0
|
||||
var/depthead = 0 // Department Heads will be placed at the top of their lists.
|
||||
|
||||
for(var/positionType in positions)
|
||||
var/typesPositions = positions[positionType]
|
||||
if(real_rank in typesPositions)
|
||||
manifest[positionType][++manifest[positionType].len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
department = 1
|
||||
if ((depthead || rank == "Captain") && manifest[positionType].len != 1)
|
||||
manifest[positionType].Swap(1, manifest[positionType].len)
|
||||
manifest[positionType][1]["head"] = TRUE
|
||||
if(positionType == "head")
|
||||
depthead = 1
|
||||
var/list/departments
|
||||
if(job.departments.len > 0 && all_in_list(job.departments, manifest))
|
||||
departments = job.departments
|
||||
else // no department set or there's something weird
|
||||
departments = list(DEPARTMENT_MISCELLANEOUS = JOBROLE_DEFAULT)
|
||||
|
||||
if(!department && !(name in manifest["heads"]))
|
||||
manifest["misc"][++manifest["misc"].len] = list("name" = name, "rank" = rank, "active" = isactive)
|
||||
for(var/department in departments) // add them to their departments
|
||||
var/supervisor = departments[department] & JOBROLE_SUPERVISOR
|
||||
manifest[department][++manifest[department].len] = list("name" = name, "rank" = rank, "active" = isactive, "head" = supervisor)
|
||||
if(supervisor) // they are a supervisor/head, put them on top
|
||||
manifest[department].Swap(1, manifest[department].len)
|
||||
|
||||
// silicons are not in records, we need to add them manually
|
||||
var/dept = DEPARTMENT_EQUIPMENT
|
||||
for(var/mob/living/silicon/S in player_list)
|
||||
if(istype(S, /mob/living/silicon/robot))
|
||||
var/mob/living/silicon/robot/R = S
|
||||
@@ -297,12 +250,11 @@
|
||||
var/selected_module = "Default Module"
|
||||
if(R.module)
|
||||
selected_module = capitalize_first_letters(R.module.name)
|
||||
manifest["bot"][++manifest["bot"].len] = list("name" = sanitize(R.name), "rank" = selected_module, "active" = "Online")
|
||||
if(istype(S, /mob/living/silicon/ai))
|
||||
manifest[dept][++manifest[dept].len] = list("name" = sanitize(R.name), "rank" = selected_module, "active" = "Online", "head" = FALSE)
|
||||
else if(istype(S, /mob/living/silicon/ai))
|
||||
var/mob/living/silicon/ai/A = S
|
||||
manifest["bot"][++manifest["bot"].len] = list("name" = sanitize(A.name), "rank" = "Station Intelligence", "active" = "Online")
|
||||
if(manifest["bot"].len != 1)
|
||||
manifest["bot"].Swap(1, manifest["bot"].len)
|
||||
manifest[dept][++manifest[dept].len] = list("name" = sanitize(A.name), "rank" = "Station Intelligence", "active" = "Online", "head" = TRUE)
|
||||
manifest[dept].Swap(1, manifest[dept].len)
|
||||
|
||||
manifest_json = json_encode(manifest)
|
||||
return manifest
|
||||
|
||||
Reference in New Issue
Block a user