Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev update from stable. #3470

Merged
merged 13 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 14 additions & 16 deletions code/controllers/subsystems/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -469,34 +469,32 @@ SUBSYSTEM_DEF(jobs)

return spawn_in_storage

/datum/controller/subsystem/jobs/proc/equip_rank(var/mob/living/carbon/human/H, var/rank, var/joined_late = 0)
/datum/controller/subsystem/jobs/proc/equip_job_title(var/mob/living/carbon/human/H, var/job_title, var/joined_late = 0)
if(!H)
return

var/datum/job/job = get_by_title(rank)
var/datum/job/job = get_by_title(job_title)
var/list/spawn_in_storage

if(job)
if(H.client)
if(global.using_map.flags & MAP_HAS_BRANCH)
H.char_branch = mil_branches.get_branch(H.client.prefs.branches[rank])
H.char_branch = mil_branches.get_branch(H.client.prefs.branches[job_title])
if(global.using_map.flags & MAP_HAS_RANK)
H.char_rank = mil_branches.get_rank(H.client.prefs.branches[rank], H.client.prefs.ranks[rank])
H.char_rank = mil_branches.get_rank(H.client.prefs.branches[job_title], H.client.prefs.ranks[job_title])

// Transfers the skill settings for the job to the mob
H.skillset.obtain_from_client(job, H.client)

//Equip job items.
job.equip(H, H.mind ? H.mind.role_alt_title : "", H.char_branch, H.char_rank)
job.setup_account(H)
job.equip_job(H, H.mind?.role_alt_title, H.char_branch, H.char_rank)
job.apply_fingerprints(H)
spawn_in_storage = equip_custom_loadout(H, job)
job.setup_account(H)
var/decl/hierarchy/outfit/outfit = job.get_outfit(H, H.mind ? H.mind.role_alt_title : "", H.char_branch, H.char_rank)
outfit.equip_id(H, H.mind ? H.mind.role_alt_title : "", H.char_branch, H.char_rank, job)
else
to_chat(H, "Your job is [rank] and the game just can't handle it! Please report this bug to an administrator.")
to_chat(H, "Your job is [job_title] and the game just can't handle it! Please report this bug to an administrator.")

H.job = rank
H.job = job_title

if(!joined_late || job.latejoin_at_spawnpoints)
var/obj/S = job.get_roundstart_spawnpoint()
Expand Down Expand Up @@ -533,26 +531,26 @@ SUBSYSTEM_DEF(jobs)
var/alt_title = null
if(!H.mind)
H.mind_initialize()
H.mind.assigned_job = job
H.mind.assigned_role = rank
H.mind.assigned_job = job
H.mind.assigned_role = job_title
alt_title = H.mind.role_alt_title

var/mob/other_mob = job.handle_variant_join(H, alt_title)
if(other_mob)
job.post_equip_rank(other_mob, alt_title || rank)
job.post_equip_job_title(other_mob, alt_title || job_title)
return other_mob

if(spawn_in_storage)
for(var/decl/loadout_option/G in spawn_in_storage)
G.spawn_in_storage_or_drop(H, H.client.prefs.Gear()[G.name])

to_chat(H, "<font size = 3><B>You are [job.total_positions == 1 ? "the" : "a"] [alt_title ? alt_title : rank].</B></font>")
to_chat(H, "<font size = 3><B>You are [job.total_positions == 1 ? "the" : "a"] [alt_title || job_title].</B></font>")

if(job.description)
to_chat(H, SPAN_BOLD("[job.description]"))

if(job.supervisors)
to_chat(H, "<b>As the [alt_title ? alt_title : rank] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")
to_chat(H, "<b>As the [alt_title || job_title] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")

if(H.has_headset_in_ears())
to_chat(H, "<b>To speak on your department's radio channel use [H.get_department_radio_prefix()]h. For the use of other channels, examine your headset.</b>")
Expand All @@ -567,7 +565,7 @@ SUBSYSTEM_DEF(jobs)
BITSET(H.hud_updateflag, IMPLOYAL_HUD)
BITSET(H.hud_updateflag, SPECIALROLE_HUD)

job.post_equip_rank(H, alt_title || rank)
job.post_equip_job_title(H, alt_title || job_title)

H.client.show_location_blurb(30)

Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Helpers
if(player.mind.assigned_role == "Captain")
captainless=0
if(!player_is_antag(player.mind, only_offstation_roles = 1))
SSjobs.equip_rank(player, player.mind.assigned_role, 0)
SSjobs.equip_job_title(player, player.mind.assigned_role, 0)
SScustomitems.equip_custom_items(player)
if(captainless)
for(var/mob/M in global.player_list)
Expand Down
9 changes: 0 additions & 9 deletions code/datums/outfits/jobs/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,3 @@
pda_type = /obj/item/modular_computer/pda

flags = OUTFIT_HAS_BACKPACK

/decl/hierarchy/outfit/job/equip_id(var/mob/living/carbon/human/H, var/rank, var/assignment, var/equip_adjustments, var/datum/job/job)
var/obj/item/card/id/C = ..()
if(!C)
return
if(H.mind)
if(H.mind.initial_account)
C.associated_account_number = H.mind.initial_account.account_number
return C
15 changes: 8 additions & 7 deletions code/datums/outfits/outfit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ var/global/list/outfits_decls_by_type_
J.toggle()
J.toggle_valve()

/decl/hierarchy/outfit/proc/equip(mob/living/carbon/human/H, var/rank, var/assignment, var/equip_adjustments)
/decl/hierarchy/outfit/proc/equip_outfit(mob/living/carbon/human/H, assignment, equip_adjustments, datum/job/job, datum/mil_rank/rank)
equip_base(H, equip_adjustments)

equip_id(H, assignment, equip_adjustments, job, rank)
for(var/path in backpack_contents)
var/number = backpack_contents[path]
for(var/i=0,i<number,i++)
Expand Down Expand Up @@ -169,30 +169,31 @@ var/global/list/outfits_decls_by_type_
if(H.client?.prefs?.give_passport)
global.using_map.create_passport(H)

/decl/hierarchy/outfit/proc/equip_id(var/mob/living/carbon/human/H, var/rank, var/assignment, var/equip_adjustments, var/datum/job/job)
/decl/hierarchy/outfit/proc/equip_id(mob/living/carbon/human/H, assignment, equip_adjustments, datum/job/job, datum/mil_rank/rank)
if(!id_slot || !id_type)
return
if(OUTFIT_ADJUSTMENT_SKIP_ID_PDA & equip_adjustments)
return
var/obj/item/card/id/W = new id_type(H)
if(id_desc)
W.desc = id_desc
if(rank)
W.rank = rank
if(assignment)
W.assignment = assignment
if(job)
W.position = job.title
LAZYDISTINCTADD(W.access, job.get_access())
if(!W.detail_color)
W.detail_color = job.selection_color
W.update_icon()
H.update_icon()
H.set_id_info(W)
equip_pda(H, rank, assignment, equip_adjustments)
if(H.mind?.initial_account)
W.associated_account_number = H.mind.initial_account.account_number
equip_pda(H, assignment, equip_adjustments)
if(H.equip_to_slot_or_store_or_drop(W, id_slot))
return W

/decl/hierarchy/outfit/proc/equip_pda(var/mob/living/carbon/human/H, var/rank, var/assignment, var/equip_adjustments)
/decl/hierarchy/outfit/proc/equip_pda(var/mob/living/carbon/human/H, var/assignment, var/equip_adjustments)
if(!pda_slot || !pda_type)
return
if(OUTFIT_ADJUSTMENT_SKIP_ID_PDA & equip_adjustments)
Expand Down
2 changes: 1 addition & 1 deletion code/game/antagonist/antagonist_equip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

if(default_outfit)
var/decl/hierarchy/outfit/outfit = GET_DECL(default_outfit)
outfit.equip(player)
outfit.equip_outfit(player)

if(default_access)
var/obj/item/card/id/id = player.get_equipped_item(slot_wear_id_str)
Expand Down
6 changes: 3 additions & 3 deletions code/game/jobs/access.dm
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ var/global/list/priv_region_access
var/job_icons = get_all_job_icons()
if(I.assignment in job_icons) //Check if the job has a hud icon
return I.assignment
if(I.rank in job_icons)
return I.rank
if(I.position in job_icons)
return I.position

var/centcom = get_all_centcom_jobs()
if(I.assignment in centcom)
return "Centcom"
if(I.rank in centcom)
if(I.position in centcom)
return "Centcom"
else
return
Expand Down
8 changes: 4 additions & 4 deletions code/game/jobs/job/_job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@
/datum/job/dd_SortValue()
return title

/datum/job/proc/equip(var/mob/living/carbon/human/H, var/alt_title, var/datum/mil_branch/branch, var/datum/mil_rank/grade)
/datum/job/proc/equip_job(var/mob/living/carbon/human/H, var/alt_title, var/datum/mil_branch/branch, var/datum/mil_rank/grade)
if (required_language)
H.add_language(required_language)
H.set_default_language(required_language)
H.add_language(/decl/language/human/common)
H.set_default_language(/decl/language/human/common)
var/decl/hierarchy/outfit/outfit = get_outfit(H, alt_title, branch, grade)
if(outfit)
return outfit.equip(H, title, alt_title)
return outfit.equip_outfit(H, alt_title || title, job = src, rank = grade)

/datum/job/proc/get_outfit(var/mob/living/carbon/human/H, var/alt_title, var/datum/mil_branch/branch, var/datum/mil_rank/grade)
if(alt_title && alt_titles)
Expand Down Expand Up @@ -163,7 +163,7 @@
var/decl/hierarchy/outfit/outfit = get_outfit(H, alt_title, branch, grade)
if(!outfit)
return FALSE
. = outfit.equip(H, title, alt_title, OUTFIT_ADJUSTMENT_SKIP_POST_EQUIP|OUTFIT_ADJUSTMENT_SKIP_ID_PDA|additional_skips)
. = outfit.equip_outfit(H, alt_title || title, equip_adjustments = (OUTFIT_ADJUSTMENT_SKIP_POST_EQUIP|OUTFIT_ADJUSTMENT_SKIP_ID_PDA|additional_skips), job = src, rank = grade)

/datum/job/proc/get_access()
if(minimal_access.len && (!config || config.jobs_have_minimal_access))
Expand Down Expand Up @@ -445,7 +445,7 @@
break
return spawnpos

/datum/job/proc/post_equip_rank(var/mob/person, var/alt_title)
/datum/job/proc/post_equip_job_title(var/mob/person, var/alt_title, var/rank)
if(is_semi_antagonist && person.mind)
var/decl/special_role/provocateur/provocateurs = GET_DECL(/decl/special_role/provocateur)
provocateurs.add_antagonist(person.mind)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/guestpass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

if(giver)
data["giver"] = !!giver
data["giver_name"] = giver.rank || giver.assignment
data["giver_name"] = giver.position || giver.assignment
data["giv_name"] = giv_name

var/list/giver_access = list()
Expand Down
37 changes: 23 additions & 14 deletions code/game/objects/item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,33 @@

// This is going to need a solid go-over to properly integrate all the movement procs into each
// other and make sure everything is updating nicely. Snowflaking it for now. ~Jan 2020
/obj/item/check_mousedrop_adjacency(var/atom/over, var/mob/user)
. = (loc == user && istype(over, /obj/screen/inventory)) || ..()

/obj/item/handle_mouse_drop(atom/over, mob/user)

if(over == user)
usr.face_atom(src)
dragged_onto(over)
return TRUE

// Try to drag-equip the item.
var/obj/screen/inventory/inv = over
if(user.client && istype(inv) && inv.slot_id && (over in user.client.screen))
// Remove the item from our bag if necessary.
if(istype(loc, /obj/item/storage))
var/obj/item/storage/bag = loc
bag.remove_from_storage(src)
dropInto(get_turf(bag))
// Otherwise remove it from our inventory if necessary.
else if(ismob(loc))
var/mob/M = loc
if(!M.try_unequip(src, get_turf(src)))
return ..()
user.equip_to_slot_if_possible(src, inv.slot_id)
// Equip to the slot we dragged over.
if(isturf(loc) && mob_can_equip(user, inv.slot_id, disable_warning = TRUE))
add_fingerprint(user)
user.equip_to_slot_if_possible(src, inv.slot_id)
return TRUE

. = ..()
Expand Down Expand Up @@ -449,46 +458,46 @@
//the mob M is attempting to equip this item into the slot passed through as 'slot'. Return 1 if it can do this and 0 if it can't.
//Set disable_warning to 1 if you wish it to not give you outputs.
//Set ignore_equipped to 1 if you wish to ignore covering checks etc. when this item is already equipped.
/obj/item/proc/mob_can_equip(mob/M, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE)
if(!slot || !M)
/obj/item/proc/mob_can_equip(mob/user, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE)
if(!slot || !user)
return FALSE

// Some slots don't have an associated handler as they are shorthand for various setup functions.
if(slot in global.abstract_inventory_slots)
switch(slot)
// Putting stuff into backpacks.
if(slot_in_backpack_str)
var/obj/item/storage/backpack/backpack = M.get_equipped_item(slot_back_str)
return istype(backpack) && backpack.can_be_inserted(src, M, TRUE)
var/obj/item/storage/backpack/backpack = user.get_equipped_item(slot_back_str)
return istype(backpack) && backpack.can_be_inserted(src, user, TRUE)
// Equipping accessories.
if(slot_tie_str)
// Find something to equip the accessory to.
for(var/check_slot in list(slot_w_uniform_str, slot_wear_suit_str))
var/obj/item/clothing/check_gear = M.get_equipped_item(check_slot)
var/obj/item/clothing/check_gear = user.get_equipped_item(check_slot)
if(istype(check_gear) && check_gear.can_attach_accessory(src))
return TRUE
if(!disable_warning)
to_chat(M, SPAN_WARNING("You need to be wearing something you can attach \the [src] to."))
to_chat(user, SPAN_WARNING("You need to be wearing something you can attach \the [src] to."))
return FALSE

var/datum/inventory_slot/inv_slot = M.get_inventory_slot_datum(slot)
var/datum/inventory_slot/inv_slot = user.get_inventory_slot_datum(slot)
if(!inv_slot)
return FALSE

if(!force)
if(!ignore_equipped && !inv_slot.is_accessible(M, src, disable_warning))
if(!ignore_equipped && !inv_slot.is_accessible(user, src, disable_warning))
return FALSE

if(!inv_slot.can_equip_to_slot(M, src, disable_warning, ignore_equipped))
if(!inv_slot.can_equip_to_slot(user, src, disable_warning, ignore_equipped))
return FALSE

return TRUE

/obj/item/proc/mob_can_unequip(mob/M, slot, disable_warning = 0)
if(!slot || !M || !canremove)
/obj/item/proc/mob_can_unequip(mob/user, slot, disable_warning = FALSE)
if(!slot || !user || !canremove)
return FALSE
var/datum/inventory_slot/inv_slot = M.get_inventory_slot_datum(slot)
return inv_slot?.is_accessible(M, src, disable_warning)
var/datum/inventory_slot/inv_slot = user.get_inventory_slot_datum(slot)
return inv_slot?.is_accessible(user, src, disable_warning)

/obj/item/proc/can_be_dropped_by_client(mob/M)
return M.canUnEquip(src)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/auto_cpr.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
var/last_pump
var/skilled_setup

/obj/item/auto_cpr/mob_can_equip(mob/living/carbon/human/H, slot, disable_warning = 0, force = 0, ignore_equipped = 0)
/obj/item/auto_cpr/mob_can_equip(mob/user, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE)
. = ..()
if(. && slot == slot_wear_suit_str)
. = H.get_bodytype_category() == BODYTYPE_HUMANOID
. = user?.get_bodytype_category() == BODYTYPE_HUMANOID

/obj/item/auto_cpr/attack(mob/living/carbon/human/M, mob/living/user, var/target_zone)
if(istype(M) && user.a_intent == I_HELP)
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/items/weapons/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ var/global/const/NO_EMAG_ACT = -50
var/icon/side

//alt titles are handled a bit weirdly in order to unobtrusively integrate into existing ID system
var/assignment = null //can be alt title or the actual job
var/rank = null //actual job
var/assignment //can be alt title or the actual job
var/position // actual job

var/datum/mil_branch/military_branch = null //Vars for tracking branches and ranks on multi-crewtype maps
var/datum/mil_rank/military_rank = null
Expand Down Expand Up @@ -302,6 +302,7 @@ var/global/const/NO_EMAG_ACT = -50
return access.Copy()

/obj/item/card/id/GetIdCard()
RETURN_TYPE(/obj/item/card/id)
return src

/obj/item/card/id/GetIdCards()
Expand Down
10 changes: 0 additions & 10 deletions code/game/objects/items/weapons/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@
toggle_paddles()
return TRUE

// what is this proc doing?
/obj/item/defibrillator/handle_mouse_drop(var/atom/over, var/mob/user)
if(ismob(loc))
var/mob/M = loc
if(M.try_unequip(src))
add_fingerprint(usr)
M.put_in_hands(src)
return TRUE
. = ..()

/obj/item/defibrillator/attackby(obj/item/W, mob/user, params)
if(W == paddles)
reattach_paddles(user)
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/weapons/storage/internal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
SHOULD_CALL_PARENT(FALSE)
return TRUE //make sure this is never picked up

/obj/item/storage/internal/mob_can_equip(mob/M, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE)
/obj/item/storage/internal/mob_can_equip(mob/user, slot, disable_warning = FALSE, force = FALSE, ignore_equipped = FALSE)
SHOULD_CALL_PARENT(FALSE)
return FALSE //make sure this is never picked up

//Helper procs to cleanly implement internal storages - storage items that provide inventory slots for other items.
Expand Down
Loading