diff --git a/code/__DEFINES/jobs.dm b/code/__DEFINES/jobs.dm index 21349fa19c6..8d83541b67f 100644 --- a/code/__DEFINES/jobs.dm +++ b/code/__DEFINES/jobs.dm @@ -48,14 +48,23 @@ #define JOB_DISPLAY_ORDER_PRISONER 35 -#define DEPARTMENT_SECURITY (1<<0) -#define DEPARTMENT_COMMAND (1<<1) -#define DEPARTMENT_SERVICE (1<<2) -#define DEPARTMENT_CARGO (1<<3) -#define DEPARTMENT_ENGINEERING (1<<4) -#define DEPARTMENT_SCIENCE (1<<5) -#define DEPARTMENT_MEDICAL (1<<6) -#define DEPARTMENT_SILICON (1<<7) +#define DEPARTMENT_UNASSIGNED "No department assigned" +#define DEPARTMENT_BITFLAG_SECURITY (1<<0) +#define DEPARTMENT_SECURITY "Security" +#define DEPARTMENT_BITFLAG_COMMAND (1<<1) +#define DEPARTMENT_COMMAND "Command" +#define DEPARTMENT_BITFLAG_SERVICE (1<<2) +#define DEPARTMENT_SERVICE "Service" +#define DEPARTMENT_BITFLAG_CARGO (1<<3) +#define DEPARTMENT_CARGO "Cargo" +#define DEPARTMENT_BITFLAG_ENGINEERING (1<<4) +#define DEPARTMENT_ENGINEERING "Engineering" +#define DEPARTMENT_BITFLAG_SCIENCE (1<<5) +#define DEPARTMENT_SCIENCE "Science" +#define DEPARTMENT_BITFLAG_MEDICAL (1<<6) +#define DEPARTMENT_MEDICAL "Medical" +#define DEPARTMENT_BITFLAG_SILICON (1<<7) +#define DEPARTMENT_SILICON "Silicon" /* Job datum job_flags */ /// Whether the mob is announced on arrival. @@ -68,6 +77,10 @@ #define JOB_CREW_MEMBER (1<<3) /// Whether this job can be joined through the new_player menu. #define JOB_NEW_PLAYER_JOINABLE (1<<4) +/// Whether this job appears in bold in the job menu. +#define JOB_BOLD_SELECT_TEXT (1<<5) +/// Reopens this position if we lose the player at roundstart. +#define JOB_REOPEN_ON_ROUNDSTART_LOSS (1<<6) #define FACTION_NONE "None" #define FACTION_STATION "Station" diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 836c8636236..f5f42abf106 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -120,7 +120,7 @@ #define INIT_ORDER_STATION 74 //This is high priority because it manipulates a lot of the subsystems that will initialize after it. #define INIT_ORDER_EVENTS 70 #define INIT_ORDER_IDACCESS 66 -#define INIT_ORDER_JOBS 65 +#define INIT_ORDER_JOBS 65 // Must init before atoms, to set up properly the dynamic job lists. #define INIT_ORDER_QUIRKS 60 #define INIT_ORDER_AI_MOVEMENT 56 //We need the movement setup #define INIT_ORDER_AI_CONTROLLERS 55 //So the controller can get the ref diff --git a/code/__HELPERS/cmp.dm b/code/__HELPERS/cmp.dm index 1ef29c62e3d..520182a754a 100644 --- a/code/__HELPERS/cmp.dm +++ b/code/__HELPERS/cmp.dm @@ -113,6 +113,9 @@ GLOBAL_VAR_INIT(cmp_field, "name") /proc/cmp_job_display_asc(datum/job/A, datum/job/B) return A.display_order - B.display_order +/proc/cmp_department_display_asc(datum/job_department/A, datum/job_department/B) + return A.display_order - B.display_order + /proc/cmp_reagents_asc(datum/reagent/a, datum/reagent/b) return sorttext(initial(b.name),initial(a.name)) diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 979af067e06..59d89b59ae3 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -546,7 +546,7 @@ if(!human.client || !human.mind) continue var/datum/job/human_job = human.mind.assigned_role - if(!(human_job.departments & DEPARTMENT_SERVICE)) + if(!(human_job.departments_bitflags & DEPARTMENT_SERVICE)) continue human_job.award_service(human.client, award) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index c690e7e9efe..c1f0d817f8e 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -192,6 +192,7 @@ /datum/config_entry/flag/use_exp_tracking +/// Enables head jobs time restrictions. /datum/config_entry/flag/use_exp_restrictions_heads /datum/config_entry/number/use_exp_restrictions_heads_hours @@ -201,6 +202,7 @@ /datum/config_entry/flag/use_exp_restrictions_heads_department +/// Enables non-head jobs time restrictions. /datum/config_entry/flag/use_exp_restrictions_other /datum/config_entry/flag/use_exp_restrictions_admin_bypass diff --git a/code/controllers/subsystem/job.dm b/code/controllers/subsystem/job.dm index 691adf7be17..0364af768fd 100644 --- a/code/controllers/subsystem/job.dm +++ b/code/controllers/subsystem/job.dm @@ -4,11 +4,22 @@ SUBSYSTEM_DEF(job) flags = SS_NO_FIRE /// List of all jobs. - var/list/all_occupations = list() + var/list/datum/job/all_occupations = list() /// List of jobs that can be joined through the starting menu. - var/list/joinable_occupations = list() - var/list/datum/job/name_occupations = list() //Dict of all jobs, keys are titles - var/list/type_occupations = list() //Dict of all jobs, keys are types + var/list/datum/job/joinable_occupations = list() + /// Dictionary of all jobs, keys are titles. + var/list/name_occupations = list() + /// Dictionary of all jobs, keys are types. + var/list/datum/job/type_occupations = list() + + /// Dictionary of jobs indexed by the experience type they grant. + var/list/experience_jobs_map = list() + + /// List of all departments with joinable jobs. + var/list/datum/job_department/joinable_departments = list() + /// List of all joinable departments indexed by their typepath, sorted by their own display order. + var/list/datum/job_department/joinable_departments_by_type = list() + var/list/unassigned = list() //Players who need jobs var/initial_players_to_assign = 0 //used for checking against population caps @@ -90,13 +101,25 @@ SUBSYSTEM_DEF(job) /datum/controller/subsystem/job/proc/SetupOccupations() - all_occupations = list() - joinable_occupations = list() + name_occupations = list() + type_occupations = list() + var/list/all_jobs = subtypesof(/datum/job) if(!length(all_jobs)) + all_occupations = list() + joinable_occupations = list() + joinable_departments = list() + joinable_departments_by_type = list() + experience_jobs_map = list() to_chat(world, span_boldannounce("Error setting up jobs, no job datums found")) return FALSE + var/list/new_all_occupations = list() + var/list/new_joinable_occupations = list() + var/list/new_joinable_departments = list() + var/list/new_joinable_departments_by_type = list() + var/list/new_experience_jobs_map = list() + for(var/job_type in all_jobs) var/datum/job/job = new job_type() if(!job.config_check()) @@ -104,11 +127,44 @@ SUBSYSTEM_DEF(job) if(!job.map_check()) //Even though we initialize before mapping, this is fine because the config is loaded at new testing("Removed [job.type] due to map config") continue - all_occupations += job + new_all_occupations += job name_occupations[job.title] = job type_occupations[job_type] = job if(job.job_flags & JOB_NEW_PLAYER_JOINABLE) - joinable_occupations += job + new_joinable_occupations += job + if(!LAZYLEN(job.departments_list)) + var/datum/job_department/department = new_joinable_departments_by_type[/datum/job_department/undefined] + if(!department) + department = new /datum/job_department/undefined() + new_joinable_departments_by_type[/datum/job_department/undefined] = department + department.add_job(job) + continue + for(var/department_type in job.departments_list) + var/datum/job_department/department = new_joinable_departments_by_type[department_type] + if(!department) + department = new department_type() + new_joinable_departments_by_type[department_type] = department + department.add_job(job) + + sortTim(new_all_occupations, /proc/cmp_job_display_asc) + for(var/datum/job/job as anything in new_all_occupations) + if(!job.exp_granted_type) + continue + new_experience_jobs_map[job.exp_granted_type] += list(job) + + sortTim(new_joinable_departments_by_type, /proc/cmp_department_display_asc, associative = TRUE) + for(var/department_type in new_joinable_departments_by_type) + var/datum/job_department/department = new_joinable_departments_by_type[department_type] + sortTim(department.department_jobs, /proc/cmp_job_display_asc) + new_joinable_departments += department + if(department.department_experience_type) + new_experience_jobs_map[department.department_experience_type] = department.department_jobs.Copy() + + all_occupations = new_all_occupations + joinable_occupations = sortTim(new_joinable_occupations, /proc/cmp_job_display_asc) + joinable_departments = new_joinable_departments + joinable_departments_by_type = new_joinable_departments_by_type + experience_jobs_map = new_experience_jobs_map return TRUE @@ -123,6 +179,11 @@ SUBSYSTEM_DEF(job) SetupOccupations() return type_occupations[jobtype] +/datum/controller/subsystem/job/proc/get_department_type(department_type) + if(!length(all_occupations)) + SetupOccupations() + return joinable_departments_by_type[department_type] + /datum/controller/subsystem/job/proc/AssignRole(mob/dead/new_player/player, datum/job/job, latejoin = FALSE) JobDebug("Running AR, Player: [player], Rank: [isnull(job) ? "null" : job.type], LJ: [latejoin]") @@ -188,7 +249,7 @@ SUBSYSTEM_DEF(job) if(istype(job, GetJobType(overflow_role))) // We don't want to give him assistant, that's boring! continue - if(job.title in GLOB.command_positions) //If you want a command position, select it! + if(job.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND) //If you want a command position, select it! continue if(is_banned_from(player.ckey, job.title) || QDELETED(player)) @@ -232,11 +293,11 @@ SUBSYSTEM_DEF(job) //it locates a head or runs out of levels to check //This is basically to ensure that there's atleast a few heads in the round /datum/controller/subsystem/job/proc/FillHeadPosition() + var/datum/job_department/command_department = get_department_type(/datum/job_department/command) + if(!command_department) + return FALSE for(var/level in level_order) - for(var/command_position in GLOB.command_positions) - var/datum/job/job = GetJob(command_position) - if(!job) - continue + for(var/datum/job/job as anything in command_department.department_jobs) if((job.current_positions >= job.total_positions) && job.total_positions != -1) continue var/list/candidates = FindOccupationCandidates(job, level) @@ -251,10 +312,10 @@ SUBSYSTEM_DEF(job) //This proc is called at the start of the level loop of DivideOccupations() and will cause head jobs to be checked before any other jobs of the same level //This is also to ensure we get as many heads as possible /datum/controller/subsystem/job/proc/CheckHeadPositions(level) - for(var/command_position in GLOB.command_positions) - var/datum/job/job = GetJob(command_position) - if(!job) - continue + var/datum/job_department/command_department = get_department_type(/datum/job_department/command) + if(!command_department) + return + for(var/datum/job/job as anything in command_department.department_jobs) if((job.current_positions >= job.total_positions) && job.total_positions != -1) continue var/list/candidates = FindOccupationCandidates(job, level) @@ -676,7 +737,7 @@ SUBSYSTEM_DEF(job) /datum/controller/subsystem/job/proc/get_living_heads() . = list() for(var/mob/living/carbon/human/player as anything in GLOB.human_list) - if(player.stat != DEAD && (player.mind?.assigned_role.departments & DEPARTMENT_COMMAND)) + if(player.stat != DEAD && (player.mind?.assigned_role.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND)) . += player.mind @@ -686,7 +747,7 @@ SUBSYSTEM_DEF(job) /datum/controller/subsystem/job/proc/get_all_heads() . = list() for(var/mob/living/carbon/human/player as anything in GLOB.human_list) - if(player.mind?.assigned_role.departments & DEPARTMENT_COMMAND) + if(player.mind?.assigned_role.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND) . += player.mind ////////////////////////////////////////////// @@ -695,7 +756,7 @@ SUBSYSTEM_DEF(job) /datum/controller/subsystem/job/proc/get_living_sec() . = list() for(var/mob/living/carbon/human/player as anything in GLOB.human_list) - if(player.stat != DEAD && (player.mind?.assigned_role.departments & DEPARTMENT_SECURITY)) + if(player.stat != DEAD && (player.mind?.assigned_role.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY)) . += player.mind //////////////////////////////////////// @@ -704,7 +765,7 @@ SUBSYSTEM_DEF(job) /datum/controller/subsystem/job/proc/get_all_sec() . = list() for(var/mob/living/carbon/human/player as anything in GLOB.human_list) - if(player.mind?.assigned_role.departments & DEPARTMENT_SECURITY) + if(player.mind?.assigned_role.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY) . += player.mind /datum/controller/subsystem/job/proc/JobDebug(message) diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index a11e07f2f33..516160a2e86 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -142,62 +142,50 @@ GLOBAL_DATUM_INIT(data_core, /datum/datacore, new) if(foundrecord) foundrecord.fields["rank"] = assignment -/datum/datacore/proc/get_manifest() - var/list/manifest_out = list( - "Command", - "Security", - "Engineering", - "Medical", - "Science", - "Supply", - "Service", - "Silicon" - ) - var/list/departments = list( - "Command" = GLOB.command_positions, - "Security" = GLOB.security_positions + GLOB.security_sub_positions, - "Engineering" = GLOB.engineering_positions, - "Medical" = GLOB.medical_positions, - "Science" = GLOB.science_positions, - "Supply" = GLOB.supply_positions, - "Service" = GLOB.service_positions, - "Silicon" = GLOB.nonhuman_positions - ) - var/list/heads = GLOB.command_positions + list("Quartermaster") - for(var/datum/data/record/t in GLOB.data_core.general) - var/name = t.fields["name"] - var/rank = t.fields["rank"] - var/has_department = FALSE - for(var/department in departments) - var/list/jobs = departments[department] - if(rank in jobs) - if(!manifest_out[department]) - manifest_out[department] = list() - // Append to beginning of list if captain or department head - if (rank == "Captain" || (department != "Command" && (rank in heads))) - manifest_out[department] = list(list( - "name" = name, - "rank" = rank - )) + manifest_out[department] - else - manifest_out[department] += list(list( - "name" = name, - "rank" = rank - )) - has_department = TRUE - if(!has_department) - if(!manifest_out["Misc"]) - manifest_out["Misc"] = list() - manifest_out["Misc"] += list(list( +/datum/datacore/proc/get_manifest() + // First we build up the order in which we want the departments to appear in. + var/list/manifest_out = list() + for(var/datum/job_department/department as anything in SSjob.joinable_departments) + manifest_out[department.department_name] = list() + manifest_out[DEPARTMENT_UNASSIGNED] = list() + + var/list/departments_by_type = SSjob.joinable_departments_by_type + for(var/datum/data/record/record as anything in GLOB.data_core.general) + var/name = record.fields["name"] + var/rank = record.fields["rank"] + var/datum/job/job = SSjob.GetJob(rank) + if(!job || !(job.job_flags & JOB_CREW_MANIFEST) || !LAZYLEN(job.departments_list)) // In case an unlawful custom rank is added. + var/list/misc_list = manifest_out[DEPARTMENT_UNASSIGNED] + misc_list[++misc_list.len] = list( "name" = name, - "rank" = rank - )) - for (var/department in departments) - if (!manifest_out[department]) + "rank" = rank, + ) + continue + for(var/department_type as anything in job.departments_list) + var/datum/job_department/department = departments_by_type[department_type] + if(!department) + stack_trace("get_manifest() failed to get job department for [department_type] of [job.type]") + continue + var/list/entry = list( + "name" = name, + "rank" = rank, + ) + var/list/department_list = manifest_out[department.department_name] + if(istype(job, department.department_head)) + department_list.Insert(1, null) + department_list[1] = entry + else + department_list[++department_list.len] = entry + + // Trim the empty categories. + for (var/department in manifest_out) + if(!length(manifest_out[department])) manifest_out -= department + return manifest_out + /datum/datacore/proc/get_manifest_html(monochrome = FALSE) var/list/manifest = get_manifest() var/dat = {" diff --git a/code/datums/mutations/holy_mutation/honorbound.dm b/code/datums/mutations/holy_mutation/honorbound.dm index 0426710fd67..693e90a3be6 100644 --- a/code/datums/mutations/holy_mutation/honorbound.dm +++ b/code/datums/mutations/holy_mutation/honorbound.dm @@ -80,7 +80,7 @@ var/datum/mind/guilty_conscience = user.mind if(guilty_conscience) //sec and medical are immune to becoming guilty through attack (we don't check holy because holy shouldn't be able to attack eachother anyways) var/datum/job/job = guilty_conscience.assigned_role - if(job.departments & (DEPARTMENT_MEDICAL | DEPARTMENT_SECURITY)) + if(job.departments_bitflags & (DEPARTMENT_BITFLAG_MEDICAL | DEPARTMENT_BITFLAG_SECURITY)) return if(declaration) to_chat(owner, span_notice("[user] is now considered guilty by [GLOB.deity] from your declaration.")) @@ -109,10 +109,10 @@ var/mob/living/carbon/human/target_human = target_creature var/datum/job/job = target_human.mind?.assigned_role var/is_holy = target_human.mind?.holy_role - if(is_holy || (job?.departments & DEPARTMENT_SECURITY)) + if(is_holy || (job?.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY)) to_chat(honorbound_human, span_warning("There is nothing righteous in attacking the just.")) return FALSE - if(job?.departments & DEPARTMENT_MEDICAL) + if(job?.departments_bitflags & DEPARTMENT_BITFLAG_MEDICAL) to_chat(honorbound_human, span_warning("If you truly think this healer is not innocent, declare them guilty.")) return FALSE //THE INNOCENT @@ -272,7 +272,7 @@ if(!silent) to_chat(user, span_warning("Followers of [GLOB.deity] cannot be evil!")) return FALSE - if(guilty_conscience.assigned_role.departments & DEPARTMENT_SECURITY) + if(guilty_conscience.assigned_role.departments_bitflags & DEPARTMENT_BITFLAG_SECURITY) if(!silent) to_chat(user, span_warning("Members of security are uncorruptable! You cannot declare one evil!")) return FALSE diff --git a/code/datums/station_traits/positive_traits.dm b/code/datums/station_traits/positive_traits.dm index e26c3d5232f..00ce85eeef0 100644 --- a/code/datums/station_traits/positive_traits.dm +++ b/code/datums/station_traits/positive_traits.dm @@ -149,7 +149,7 @@ /datum/station_trait/deathrattle_department/proc/on_job_after_spawn(datum/source, datum/job/job, mob/living/spawned, client/player_client) SIGNAL_HANDLER - if(!(job.departments & department_to_apply_to)) + if(!(job.departments_bitflags & department_to_apply_to)) return var/obj/item/implant/deathrattle/implant_to_give = new() @@ -160,43 +160,43 @@ /datum/station_trait/deathrattle_department/service trait_flags = NONE weight = 1 - department_to_apply_to = DEPARTMENT_SERVICE + department_to_apply_to = DEPARTMENT_BITFLAG_SERVICE department_name = "Service" /datum/station_trait/deathrattle_department/cargo trait_flags = NONE weight = 1 - department_to_apply_to = DEPARTMENT_CARGO + department_to_apply_to = DEPARTMENT_BITFLAG_CARGO department_name = "Cargo" /datum/station_trait/deathrattle_department/engineering trait_flags = NONE weight = 1 - department_to_apply_to = DEPARTMENT_ENGINEERING + department_to_apply_to = DEPARTMENT_BITFLAG_ENGINEERING department_name = "Engineering" /datum/station_trait/deathrattle_department/command trait_flags = NONE weight = 1 - department_to_apply_to = DEPARTMENT_COMMAND + department_to_apply_to = DEPARTMENT_BITFLAG_COMMAND department_name = "Command" /datum/station_trait/deathrattle_department/science trait_flags = NONE weight = 1 - department_to_apply_to = DEPARTMENT_SCIENCE + department_to_apply_to = DEPARTMENT_BITFLAG_SCIENCE department_name = "Science" /datum/station_trait/deathrattle_department/security trait_flags = NONE weight = 1 - department_to_apply_to = DEPARTMENT_SECURITY + department_to_apply_to = DEPARTMENT_BITFLAG_SECURITY department_name = "Security" /datum/station_trait/deathrattle_department/medical trait_flags = NONE weight = 1 - department_to_apply_to = DEPARTMENT_MEDICAL + department_to_apply_to = DEPARTMENT_BITFLAG_MEDICAL department_name = "Medical" /datum/station_trait/deathrattle_all diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm index b4eeae7ec9f..71778c7a117 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm @@ -96,7 +96,7 @@ return FALSE var/head_check = 0 for(var/mob/player in GLOB.alive_player_list) - if (player.mind.assigned_role.departments & DEPARTMENT_COMMAND) + if (player.mind.assigned_role.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND) head_check++ return (head_check >= required_heads_of_staff) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index e860e9e8483..ea52f5e1a81 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -874,8 +874,7 @@ || candidate.mind.has_antag_datum(/datum/antagonist/obsessed) \ || candidate.stat == DEAD \ || !(ROLE_OBSESSED in candidate.client?.prefs?.be_special) \ - || !SSjob.GetJob(candidate.mind.assigned_role) \ - || (candidate.mind.assigned_role in GLOB.nonhuman_positions) \ + || !candidate.mind.assigned_role \ ) candidates -= candidate diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index fc84b707fed..55522392bce 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -97,29 +97,17 @@ return /proc/reopen_roundstart_suicide_roles() - var/list/valid_positions = list() - valid_positions += GLOB.engineering_positions - valid_positions += GLOB.medical_positions - valid_positions += GLOB.science_positions - valid_positions += GLOB.supply_positions - valid_positions += GLOB.service_positions - valid_positions += GLOB.security_positions - if(CONFIG_GET(flag/reopen_roundstart_suicide_roles_command_positions)) - valid_positions += GLOB.command_positions //add any remaining command positions - else - valid_positions -= GLOB.command_positions //remove all command positions that were added from their respective department positions lists. - + var/include_command = CONFIG_GET(flag/reopen_roundstart_suicide_roles_command_positions) var/list/reopened_jobs = list() - for(var/X in GLOB.suicided_mob_list) - if(!isliving(X)) + + for(var/mob/living/quitter in GLOB.suicided_mob_list) + var/datum/job/job = SSjob.GetJob(quitter.job) + if(!job || !(job.job_flags & JOB_REOPEN_ON_ROUNDSTART_LOSS)) continue - var/mob/living/L = X - if(L.job in valid_positions) - var/datum/job/J = SSjob.GetJob(L.job) - if(!J) - continue - J.current_positions = max(J.current_positions-1, 0) - reopened_jobs += L.job + if(!include_command && job.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND) + continue + job.current_positions = max(job.current_positions - 1, 0) + reopened_jobs += quitter.job if(CONFIG_GET(flag/reopen_roundstart_suicide_roles_command_report)) if(reopened_jobs.len) diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index b3461eae575..7794f80b75e 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -546,6 +546,12 @@ DEFINE_BITFIELD(turret_flags, list( if(!allowed(perp)) return 10 + // If we aren't shooting heads then return a threatcount of 0 + if (!(turret_flags & TURRET_FLAG_SHOOT_HEADS)) + var/datum/job/apparent_job = SSjob.GetJob(perp.get_assignment()) + if(apparent_job?.departments_bitflags & DEPARTMENT_BITFLAG_COMMAND) + return 0 + if(turret_flags & TURRET_FLAG_AUTH_WEAPONS) //check for weapon authorization if(isnull(perp.wear_id) || istype(perp.wear_id.GetID(), /obj/item/card/id/advanced/chameleon)) @@ -566,10 +572,6 @@ DEFINE_BITFIELD(turret_flags, list( if((turret_flags & TURRET_FLAG_SHOOT_UNSHIELDED) && (!HAS_TRAIT(perp, TRAIT_MINDSHIELD))) threatcount += 4 - // If we aren't shooting heads then return a threatcount of 0 - if (!(turret_flags & TURRET_FLAG_SHOOT_HEADS) && (perp.get_assignment() in GLOB.command_positions)) - return 0 - return threatcount /obj/machinery/porta_turret/proc/in_faction(mob/target) diff --git a/code/game/objects/items/religion.dm b/code/game/objects/items/religion.dm index a7b2699ad5c..4a40c09ed30 100644 --- a/code/game/objects/items/religion.dm +++ b/code/game/objects/items/religion.dm @@ -12,8 +12,10 @@ var/inspiration_available = TRUE //If this banner can be used to inspire crew var/morale_time = 0 var/morale_cooldown = 600 //How many deciseconds between uses - var/list/job_loyalties //Mobs with any of these assigned roles will be inspired - var/list/role_loyalties //Mobs with any of these special roles will be inspired + /// Mobs with assigned roles whose department bitflags match these will be inspired. + var/job_loyalties = NONE + /// Mobs with any of these special roles will be inspired + var/list/role_loyalties var/warcry /obj/item/banner/examine(mob/user) @@ -38,14 +40,14 @@ morale_time = world.time + morale_cooldown var/list/inspired = list() - var/has_job_loyalties = LAZYLEN(job_loyalties) + var/has_job_loyalties = job_loyalties != NONE var/has_role_loyalties = LAZYLEN(role_loyalties) inspired += user //The user is always inspired, regardless of loyalties for(var/mob/living/carbon/human/H in range(4, get_turf(src))) if(H.stat == DEAD || H == user) continue if(H.mind && (has_job_loyalties || has_role_loyalties)) - if(has_job_loyalties && (H.mind.assigned_role.title in job_loyalties)) + if(has_job_loyalties && (H.mind.assigned_role.departments_bitflags & job_loyalties)) inspired += H else if(has_role_loyalties && (H.mind.special_role in role_loyalties)) inspired += H @@ -86,7 +88,7 @@ /obj/item/banner/security/Initialize() . = ..() - job_loyalties = GLOB.security_positions + job_loyalties = DEPARTMENT_BITFLAG_SECURITY /obj/item/banner/security/mundane inspiration_available = FALSE @@ -110,7 +112,7 @@ /obj/item/banner/medical/Initialize() . = ..() - job_loyalties = GLOB.medical_positions + job_loyalties = DEPARTMENT_BITFLAG_MEDICAL /obj/item/banner/medical/mundane inspiration_available = FALSE @@ -142,7 +144,7 @@ /obj/item/banner/science/Initialize() . = ..() - job_loyalties = GLOB.science_positions + job_loyalties = DEPARTMENT_BITFLAG_SCIENCE /obj/item/banner/science/mundane inspiration_available = FALSE @@ -169,7 +171,7 @@ /obj/item/banner/cargo/Initialize() . = ..() - job_loyalties = GLOB.supply_positions + job_loyalties = DEPARTMENT_BITFLAG_CARGO /obj/item/banner/cargo/mundane inspiration_available = FALSE @@ -193,7 +195,7 @@ /obj/item/banner/engineering/Initialize() . = ..() - job_loyalties = GLOB.engineering_positions + job_loyalties = DEPARTMENT_BITFLAG_ENGINEERING /obj/item/banner/engineering/mundane inspiration_available = FALSE @@ -217,7 +219,7 @@ /obj/item/banner/command/Initialize() . = ..() - job_loyalties = GLOB.command_positions + job_loyalties = DEPARTMENT_BITFLAG_COMMAND /obj/item/banner/command/mundane inspiration_available = FALSE diff --git a/code/modules/admin/sql_ban_system.dm b/code/modules/admin/sql_ban_system.dm index dd9e691ecc7..e5f7f304f14 100644 --- a/code/modules/admin/sql_ban_system.dm +++ b/code/modules/admin/sql_ban_system.dm @@ -110,7 +110,8 @@ var/datum/browser/panel = new(usr, "banpanel", "Banning Panel", 910, panel_height) panel.add_stylesheet("admin_panelscss", 'html/admin/admin_panels.css') panel.add_stylesheet("banpanelcss", 'html/admin/banpanel.css') - if(usr.client.prefs.tgui_fancy) //some browsers (IE8) have trouble with unsupported css3 elements and DOM methods that break the panel's functionality, so we won't load those if a user is in no frills tgui mode since that's for similar compatability support + var/tgui_fancy = usr.client.prefs.tgui_fancy + if(tgui_fancy) //some browsers (IE8) have trouble with unsupported css3 elements and DOM methods that break the panel's functionality, so we won't load those if a user is in no frills tgui mode since that's for similar compatability support panel.add_stylesheet("admin_panelscss3", 'html/admin/admin_panels_css3.css') panel.add_script("banpaneljs", 'html/admin/banpanel.js') var/list/output = list("
[HrefTokenFormField()]") @@ -195,6 +196,7 @@ "} + if(edit_id) output += {"