[MIRROR] Fixes station trait jobs and bank accounts ignoring the concept of jobs being singletons (#26720)

* Fixes station trait jobs and bank accounts ignoring the concept of jobs being singletons (#81756)

## About The Pull Request

Jobs are singletons don't make new ones!!

Also this tweaks job station traits slightly so that traits in the
future support multiple slots without breaking

* Fixes station trait jobs and bank accounts ignoring the concept of jobs being singletons

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-03-05 17:31:32 -05:00
committed by GitHub
co-authored by MrMelbert
parent 6cb52ccd22
commit e21ee685d1
3 changed files with 11 additions and 17 deletions
+8 -11
View File
@@ -60,21 +60,18 @@
for (var/mob/dead/new_player/signee as anything in lobby_candidates)
if (isnull(signee) || !signee.client || !signee.mind || signee.ready != PLAYER_READY_TO_PLAY)
LAZYREMOVE(lobby_candidates, signee)
if (!LAZYLEN(lobby_candidates))
on_failed_assignment()
return // Nobody signed up :(
for(var/_ in 1 to position_amount)
var/datum/job/our_job = SSjob.GetJobType(job_to_add)
while(length(lobby_candidates) && position_amount > 0)
var/mob/dead/new_player/picked_player = pick_n_take(lobby_candidates)
picked_player.mind.assigned_role = new job_to_add()
picked_player.mind.set_assigned_role(our_job)
position_amount--
our_job.total_positions = max(0, position_amount)
lobby_candidates = null
/// Called if we didn't assign a role before the round began, we add it to the latejoin menu instead
/datum/station_trait/job/proc/on_failed_assignment()
var/datum/job/our_job = SSjob.GetJob(job_to_add::title)
our_job.total_positions = position_amount
/datum/station_trait/job/can_display_lobby_button(client/player)
var/datum/job/our_job = SSjob.GetJob(job_to_add::title)
var/datum/job/our_job = SSjob.GetJobType(job_to_add)
return our_job.player_old_enough(player) && ..()
/// Adds a gorilla to the cargo department, replacing the sloth and the mech
+1 -3
View File
@@ -21,10 +21,9 @@
for(var/current_account as anything in SSeconomy.bank_accounts_by_id)
var/datum/bank_account/current_bank_account = SSeconomy.bank_accounts_by_id[current_account]
var/job_title = current_bank_account.account_job?.title
player_accounts += list(list(
"name" = current_bank_account.account_holder,
"job" = job_title ? job_title : "No Job", // because this can be null
"job" = current_bank_account.account_job?.title || "No job", // because this can be null
"balance" = round(current_bank_account.account_balance),
"modifier" = round((current_bank_account.payday_modifier * 0.9), 0.1),
))
@@ -32,4 +31,3 @@
data["AuditLog"] = audit_list
data["Crashing"] = HAS_TRAIT(SSeconomy, TRAIT_MARKET_CRASHING)
return data
+2 -3
View File
@@ -125,9 +125,8 @@
/obj/item/card/id/Initialize(mapload)
. = ..()
var/datum/bank_account/blank_bank_account = new /datum/bank_account("Unassigned", player_account = FALSE)
var/datum/bank_account/blank_bank_account = new("Unassigned", SSjob.GetJobType(/datum/job/unassigned), player_account = FALSE)
registered_account = blank_bank_account
blank_bank_account.account_job = new /datum/job/unassigned
registered_account.replaceable = TRUE
// Applying the trim updates the label and icon, so don't do this twice.
@@ -1234,7 +1233,7 @@
/obj/item/card/id/advanced/debug/Initialize(mapload)
. = ..()
registered_account = SSeconomy.get_dep_account(ACCOUNT_CAR)
registered_account.account_job = new /datum/job/admin // so we can actually use this account without being filtered as a "departmental" card
registered_account.account_job = SSjob.GetJobType(/datum/job/admin) // so we can actually use this account without being filtered as a "departmental" card
/obj/item/card/id/advanced/prisoner
name = "prisoner ID card"