From 74ced69d095a1369ba82fc7314f2008e7168b8ee Mon Sep 17 00:00:00 2001 From: Anewbe Date: Sat, 28 Apr 2018 23:03:52 -0500 Subject: [PATCH] Adds Job Description code --- code/_macros.dm | 11 ++++-- code/game/jobs/job/_alt_title_helpers.dm | 16 ++++++++ code/game/jobs/job/assistant.dm | 2 + code/game/jobs/job/captain.dm | 10 ++++- code/game/jobs/job/civilian.dm | 14 ++++++- code/game/jobs/job/civilian_chaplain.dm | 3 +- code/game/jobs/job/job.dm | 38 +++++++++++++++++-- code/game/jobs/job/security.dm | 11 ++++++ code/game/jobs/job/silicon.dm | 2 + code/game/jobs/job_controller.dm | 3 +- .../preference_setup/occupation/occupation.dm | 35 +++++++++++++++++ maps/southern_cross/southern_cross_jobs.dm | 4 ++ polaris.dme | 3 +- 13 files changed, 141 insertions(+), 11 deletions(-) create mode 100644 code/game/jobs/job/_alt_title_helpers.dm diff --git a/code/_macros.dm b/code/_macros.dm index efd1e72edd..4ee54056ad 100644 --- a/code/_macros.dm +++ b/code/_macros.dm @@ -58,9 +58,14 @@ #define to_world(message) world << message #define to_world_log(message) world.log << message // TODO - Baystation has this log to crazy places. For now lets just world.log, but maybe look into it later. -#define log_world(message) world.log << message -#define to_file(file_entry, source_var) file_entry << source_var -#define from_file(file_entry, target_var) file_entry >> target_var +#define log_world(message) world.log << message +#define to_file(file_entry, source_var) file_entry << source_var +#define from_file(file_entry, target_var) file_entry >> target_var +#define show_browser(target, browser_content, browser_name) target << browse(browser_content, browser_name) +#define close_browser(target, browser_name) target << browse(null, browser_name) +#define show_image(target, image) target << image +#define send_rsc(target, rsc_content, rsc_name) target << browse_rsc(rsc_content, rsc_name) +#define open_link(target, url) target << link(url) #define CanInteract(user, state) (CanUseTopic(user, state) == STATUS_INTERACTIVE) diff --git a/code/game/jobs/job/_alt_title_helpers.dm b/code/game/jobs/job/_alt_title_helpers.dm new file mode 100644 index 0000000000..0c8092f7ff --- /dev/null +++ b/code/game/jobs/job/_alt_title_helpers.dm @@ -0,0 +1,16 @@ +///////////////////////////////////////// +// Alt Title Code +///////////////////////////////////////// + +/datum/alt_title + var/title = "GENERIC ALT TITLE" // What the Alt-Title is called + var/title_outfit = null // The outfit used by the alt-title. If it's the same as the base job, leave this null. + var/title_blurb = null // What's amended to the job description for this Job title. If nothing's added, leave null. + + +// Inputs a string to return an alt_title datum +/datum/job/proc/find_alt_title(var/target_title) + for(var/datum/alt_title/A in alt_titles) + if(A.title == target_title) + return A + return null \ No newline at end of file diff --git a/code/game/jobs/job/assistant.dm b/code/game/jobs/job/assistant.dm index 4d86a3ed1c..9ec6e2106b 100644 --- a/code/game/jobs/job/assistant.dm +++ b/code/game/jobs/job/assistant.dm @@ -11,7 +11,9 @@ economic_modifier = 1 access = list() //See /datum/job/assistant/get_access() minimal_access = list() //See /datum/job/assistant/get_access() + outfit_type = /decl/hierarchy/outfit/job/assistant + job_description = "An Assistant does whatever is requested of them. Though they are part of the crew, they have no real authority." alt_titles = list("Technical Assistant","Medical Intern","Research Assistant", "Visitor" = /decl/hierarchy/outfit/job/assistant/visitor, "Resident" = /decl/hierarchy/outfit/job/assistant/resident) diff --git a/code/game/jobs/job/captain.dm b/code/game/jobs/job/captain.dm index 85afcaa294..8d4e47ee3f 100644 --- a/code/game/jobs/job/captain.dm +++ b/code/game/jobs/job/captain.dm @@ -22,6 +22,9 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) ideal_character_age = 70 // Old geezer captains ftw outfit_type = /decl/hierarchy/outfit/job/captain + job_description = "The Colony Director manages the other Command Staff, and through them the rest of the station. Though they have access to everything, \ + they do not understand everything, and are expected to delegate tasks to the appropriate crew member. The Colony Director is expected to \ + have an understanding of Standard Operating Procedure, and is subject to it, and legal action, in the same way as every other crew member." alt_titles = list("Site Manager", "Overseer") /* @@ -30,6 +33,7 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) if(.) H.implant_loyalty(src) */ + /datum/job/captain/get_access() return get_all_station_access() @@ -53,6 +57,9 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) ideal_character_age = 50 outfit_type = /decl/hierarchy/outfit/job/hop + job_description = "The Head of Personnel manages the Service department, the Exploration team, and most other civilians. They also \ + manage the Supply department, through the Quartermaster. In addition, the Head of Personnel oversees the personal accounts \ + of the crew, including their money and access. If necessary, the Head of Personnel is first in line to assume Acting Command." alt_titles = list("Crew Resources Officer") access = list(access_security, access_sec_doors, access_brig, access_forensics_lockers, @@ -72,7 +79,6 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) title = "Command Secretary" flag = BRIDGE department = "Command" - head_position = 1 department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -87,3 +93,5 @@ var/datum/announcement/minor/captain_announcement = new(do_newscast = 1) minimal_access = list(access_heads, access_keycard_auth) outfit_type = /decl/hierarchy/outfit/job/secretary + job_description = "A Command Secretary handles paperwork duty for the Heads of Staff, so they can better focus on managing their departments. \ + They are not Heads of Staff, and have no real authority." diff --git a/code/game/jobs/job/civilian.dm b/code/game/jobs/job/civilian.dm index d31a551726..a344b40985 100644 --- a/code/game/jobs/job/civilian.dm +++ b/code/game/jobs/job/civilian.dm @@ -14,6 +14,7 @@ minimal_access = list(access_bar) outfit_type = /decl/hierarchy/outfit/job/service/bartender + job_description = "A Bartender mixes drinks for the crew. They generally have permission to charge for drinks or deny service to unruly patrons." alt_titles = list("Barista" = /decl/hierarchy/outfit/job/service/bartender/barista) @@ -32,6 +33,7 @@ minimal_access = list(access_kitchen) outfit_type = /decl/hierarchy/outfit/job/service/chef + job_description = "A Chef cooks food for the crew. They generally have permission to charge for food or deny service to unruly diners." alt_titles = list("Cook") /datum/job/hydro @@ -49,6 +51,7 @@ minimal_access = list(access_hydroponics) outfit_type = /decl/hierarchy/outfit/job/service/gardener + job_description = "A Botanist grows plants for the Chef and Bartender." alt_titles = list("Gardener") //Cargo @@ -71,6 +74,7 @@ ideal_character_age = 40 outfit_type = /decl/hierarchy/outfit/job/cargo/qm + job_description = "The Quartermaster manages the Supply department, checking cargo orders and ensuring supplies get to where they are needed." alt_titles = list("Supply Chief") /datum/job/cargo_tech @@ -88,6 +92,8 @@ minimal_access = list(access_maint_tunnels, access_cargo, access_cargo_bot, access_mailsorting) outfit_type = /decl/hierarchy/outfit/job/cargo/cargo_tech + job_description = "A Cargo Technician fills and delivers cargo orders. They are encouraged to return delivered crates to the Cargo Shuttle, \ + because Central Command gives a partial refund." /datum/job/mining title = "Shaft Miner" @@ -105,6 +111,7 @@ minimal_access = list(access_mining, access_mining_station, access_mailsorting) outfit_type = /decl/hierarchy/outfit/job/cargo/mining + job_description = "A Shaft Miner mines and smelts minerals to be delivered to departments that need them." alt_titles = list("Drill Technician") //Service @@ -123,6 +130,7 @@ minimal_access = list(access_janitor, access_maint_tunnels) outfit_type = /decl/hierarchy/outfit/job/service/janitor + job_description = "A Janitor keeps the station clean, as long as it doesn't interfere with active crime scenes." alt_titles = list("Custodian") //More or less assistants @@ -141,13 +149,14 @@ minimal_access = list(access_library) outfit_type = /decl/hierarchy/outfit/job/librarian + job_description = "The Librarian curates the book selection in the Library, so the crew might enjoy it." alt_titles = list("Journalist", "Writer") //var/global/lawyer = 0//Checks for another lawyer //This changed clothes on 2nd lawyer, both IA get the same dreds. /datum/job/lawyer title = "Internal Affairs Agent" flag = LAWYER - department = "Civilian" + department = "Internal Affairs" department_flag = CIVILIAN faction = "Station" total_positions = 2 @@ -161,6 +170,9 @@ minimal_player_age = 7 outfit_type = /decl/hierarchy/outfit/job/internal_affairs_agent + job_description = "An Internal Affairs Agent makes sure that the crew is following Standard Operating Procedure. They also \ + handle complaints against crew members, and can have issues brought to the attention of Central Command, \ + assuming their paperwork is in order." /* /datum/job/lawyer/equip(var/mob/living/carbon/human/H) diff --git a/code/game/jobs/job/civilian_chaplain.dm b/code/game/jobs/job/civilian_chaplain.dm index 2eece781ec..643c7e258e 100644 --- a/code/game/jobs/job/civilian_chaplain.dm +++ b/code/game/jobs/job/civilian_chaplain.dm @@ -12,9 +12,10 @@ idtype = /obj/item/weapon/card/id/civilian/chaplain access = list(access_morgue, access_chapel_office, access_crematorium, access_maint_tunnels) minimal_access = list(access_chapel_office, access_crematorium) - alt_titles = list("Counselor") outfit_type = /decl/hierarchy/outfit/job/chaplain + job_description = "The Chaplain ministers to the spiritual needs of the crew." + alt_titles = list("Counselor") /datum/job/chaplain/equip(var/mob/living/carbon/human/H, var/alt_title, var/ask_questions = TRUE) . = ..() diff --git a/code/game/jobs/job/job.dm b/code/game/jobs/job/job.dm index 6a51a8a560..376dfab609 100644 --- a/code/game/jobs/job/job.dm +++ b/code/game/jobs/job/job.dm @@ -14,7 +14,7 @@ var/supervisors = null // Supervisors, who this person answers to directly var/selection_color = "#ffffff" // Selection screen color var/idtype = /obj/item/weapon/card/id // The type of the ID the player will have - var/list/alt_titles // List of alternate titles, if any + var/list/alt_titles = list() // List of alternate titles, if any var/req_admin_notify // If this is set to 1, a text is printed to the player when jobs are assigned, telling him that he should let admins know that he has to disconnect. var/minimal_player_age = 0 // If you have use_age_restriction_for_jobs config option enabled and the database set up, this option will add a requirement for players to be at least minimal_player_age days old. (meaning they first signed in at least that many days before.) var/department = null // Does this position have a department tag? @@ -25,7 +25,10 @@ var/account_allowed = 1 // Does this job type come with a station account? var/economic_modifier = 2 // With how much does this job modify the initial account amount? - var/outfit_type + var/outfit_type // What outfit datum does this job use in its default title? + + // Description of the job's role and minimum responsibilities. + var/job_description = "This Job doesn't have a description! Please report it!" /datum/job/proc/equip(var/mob/living/carbon/human/H, var/alt_title) var/decl/hierarchy/outfit/outfit = get_outfit(H, alt_title) @@ -117,4 +120,33 @@ return (current_positions < total_positions) || (total_positions == -1) /datum/job/proc/has_alt_title(var/mob/H, var/supplied_title, var/desired_title) - return (supplied_title == desired_title) || (H.mind && H.mind.role_alt_title == desired_title) \ No newline at end of file + return (supplied_title == desired_title) || (H.mind && H.mind.role_alt_title == desired_title) + +/datum/job/proc/get_description_blurb() + var/message = "" + message += job_description +/* if(alt_titles) + //DO THING + +*/ + return message + +/datum/job/proc/get_job_icon() + if(!job_master.job_icons[title]) + var/mob/living/carbon/human/dummy/mannequin/mannequin = get_mannequin("#job_icon") + dress_mannequin(mannequin) + mannequin.dir = SOUTH + var/icon/preview_icon = getFlatIcon(mannequin) + + preview_icon.Scale(preview_icon.Width() * 2, preview_icon.Height() * 2) // Scaling here to prevent blurring in the browser. + job_master.job_icons[title] = preview_icon + + return job_master.job_icons[title] + +/datum/job/proc/dress_mannequin(var/mob/living/carbon/human/dummy/mannequin/mannequin) + mannequin.delete_inventory(TRUE) + equip_preview(mannequin) + if(mannequin.back) + var/obj/O = mannequin.back + mannequin.drop_from_inventory(O) + qdel(O) \ No newline at end of file diff --git a/code/game/jobs/job/security.dm b/code/game/jobs/job/security.dm index 6b753f519c..a0688e7243 100644 --- a/code/game/jobs/job/security.dm +++ b/code/game/jobs/job/security.dm @@ -24,6 +24,10 @@ minimal_player_age = 14 outfit_type = /decl/hierarchy/outfit/job/security/hos + job_description = "You manage the Security Department, working to keep your Security Officers in place and able to properly handle threats, criminal or otherwise. \ + You are also expected to keep your fellow Department Heads, as well as the crew, aware of developing situations. \ + On top of your management role, you may, if necessary, perform the duties of absent Security roles, such as distributing gear from the Armory. \ + Remember: No one is above the Law. Not even you." alt_titles = list("Security Commander", "Chief of Security") /datum/job/warden @@ -41,7 +45,10 @@ access = list(access_security, access_eva, access_sec_doors, access_brig, access_armory, access_maint_tunnels, access_morgue, access_external_airlocks) minimal_access = list(access_security, access_eva, access_sec_doors, access_brig, access_armory, access_maint_tunnels, access_external_airlocks) minimal_player_age = 5 + outfit_type = /decl/hierarchy/outfit/job/security/warden + job_description = "You watch over the Armory, the Brig, and any prisoners brought in. You may be called upon to take charge of the Security Department, \ + if no Head of Security is present." /datum/job/detective title = "Detective" @@ -58,7 +65,9 @@ minimal_access = list(access_security, access_sec_doors, access_forensics_lockers, access_morgue, access_maint_tunnels, access_eva, access_external_airlocks) economic_modifier = 5 minimal_player_age = 3 + outfit_type = /decl/hierarchy/outfit/job/security/detective + job_description = "You use your forensics training to help determine who has commited crimes that no one witnessed, or no one survived." alt_titles = list("Forensic Technician" = /decl/hierarchy/outfit/job/security/detective/forensic, "Investigator") /datum/job/officer @@ -76,5 +85,7 @@ access = list(access_security, access_eva, access_sec_doors, access_brig, access_maint_tunnels, access_morgue, access_external_airlocks) minimal_access = list(access_security, access_eva, access_sec_doors, access_brig, access_maint_tunnels, access_external_airlocks) minimal_player_age = 3 + outfit_type = /decl/hierarchy/outfit/job/security/officer + job_description = "Get Baton. Set Intent to Harm." alt_titles = list("Junior Officer") \ No newline at end of file diff --git a/code/game/jobs/job/silicon.dm b/code/game/jobs/job/silicon.dm index 1b063894ba..f12503dd98 100644 --- a/code/game/jobs/job/silicon.dm +++ b/code/game/jobs/job/silicon.dm @@ -11,6 +11,7 @@ minimal_player_age = 7 account_allowed = 0 economic_modifier = 0 + outfit_type = /decl/hierarchy/outfit/job/silicon/ai /datum/job/ai/equip(var/mob/living/carbon/human/H) if(!H) return 0 @@ -45,6 +46,7 @@ alt_titles = list("Robot", "Drone") account_allowed = 0 economic_modifier = 0 + outfit_type = /decl/hierarchy/outfit/job/silicon/cyborg /datum/job/cyborg/equip(var/mob/living/carbon/human/H) if(!H) return 0 diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index 75e17bd792..efd749e54d 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -11,7 +11,8 @@ var/global/datum/controller/occupations/job_master var/list/unassigned = list() //Debug info var/list/job_debug = list() - + //Cache of icons for job info window + var/list/job_icons = list() proc/SetupOccupations(var/faction = "Station") occupations = list() diff --git a/code/modules/client/preference_setup/occupation/occupation.dm b/code/modules/client/preference_setup/occupation/occupation.dm index 58a8003cf9..e3639a2187 100644 --- a/code/modules/client/preference_setup/occupation/occupation.dm +++ b/code/modules/client/preference_setup/occupation/occupation.dm @@ -82,8 +82,10 @@ index = 0 . += "" + var/rank = job.title lastJob = job + . += "" if(jobban_isbanned(user, rank)) . += "[rank] \[BANNED]" continue @@ -166,6 +168,39 @@ else if(href_list["set_job"]) if(SetJob(user, href_list["set_job"])) return (pref.equip_preview_mob ? TOPIC_REFRESH_UPDATE_PREVIEW : TOPIC_REFRESH) + + else if(href_list["job_info"]) + var/rank = href_list["job_info"] + var/datum/job/job = job_master.GetJob(rank) + var/dat = list() + + dat += "



" + if(job.alt_titles) + dat += "Alternate titles: [english_list(job.alt_titles)]." + send_rsc(user, job.get_job_icon(), "job[ckey(rank)].png") + dat += "" + if(job.department) + dat += "Department: [job.department]." + if(job.head_position) + dat += "You manage this department." + + dat += "You answer to [job.supervisors] normally." + + dat += "


" + if(config.wikiurl) + dat += "
Open wiki page in browser" + + var/description = job.get_description_blurb() + if(description) + dat += html_encode(description) + var/datum/browser/popup = new(user, "Job Info", "[capitalize(rank)]", 430, 520, src) + popup.set_content(jointext(dat,"
")) + popup.open() + + else if(href_list["job_wiki"]) + var/rank = href_list["job_wiki"] + open_link(user,"[config.wikiurl][rank]") + return ..() /datum/category_item/player_setup_item/occupation/proc/SetPlayerAltTitle(datum/job/job, new_title) diff --git a/maps/southern_cross/southern_cross_jobs.dm b/maps/southern_cross/southern_cross_jobs.dm index 12166d1478..ac74199d42 100644 --- a/maps/southern_cross/southern_cross_jobs.dm +++ b/maps/southern_cross/southern_cross_jobs.dm @@ -82,7 +82,9 @@ var/const/access_explorer = 43 economic_modifier = 4 access = list(access_pilot, access_cargo, access_mining, access_mining_station) minimal_access = list(access_pilot, access_cargo, access_mining, access_mining_station) + outfit_type = /decl/hierarchy/outfit/job/pilot + job_description = "You fly one of the shuttles that dock in the station hangars." /datum/job/explorer title = "Explorer" @@ -98,7 +100,9 @@ var/const/access_explorer = 43 economic_modifier = 4 access = list(access_explorer) minimal_access = list(access_explorer) + outfit_type = /decl/hierarchy/outfit/job/explorer2 + /* alt_titles = list( "Explorer Technician" = /decl/hierarchy/outfit/job/explorer2/technician, diff --git a/polaris.dme b/polaris.dme index 611d1daa6b..7d6311ba1c 100644 --- a/polaris.dme +++ b/polaris.dme @@ -578,6 +578,7 @@ #include "code\game\jobs\job_controller.dm" #include "code\game\jobs\jobs.dm" #include "code\game\jobs\whitelist.dm" +#include "code\game\jobs\job\_alt_title_helpers.dm" #include "code\game\jobs\job\assistant.dm" #include "code\game\jobs\job\captain.dm" #include "code\game\jobs\job\civilian.dm" @@ -2433,7 +2434,7 @@ #include "code\ZAS\Zone.dm" #include "interface\interface.dm" #include "interface\skin.dmf" -#include "maps\southern_cross\southern_cross.dm" +#include "maps\example\example.dm" #include "maps\submaps\_readme.dm" #include "maps\submaps\space_submaps\space.dm" #include "maps\submaps\surface_submaps\mountains\mountains.dm"