From 0e2f41ea8688bf879cf6c79c5b18009676f8ac0a Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Sat, 17 Feb 2018 21:39:26 -0600 Subject: [PATCH] More optimizations for character joins --- code/__defines/misc.dm | 6 +----- code/datums/datacore.dm | 10 ++++++---- code/datums/outfits/outfit.dm | 8 +++++--- code/game/jobs/job_controller.dm | 3 ++- code/modules/client/preferences.dm | 2 +- code/modules/mob/new_player/new_player.dm | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index 3239b4a0226..3a8ee870e5b 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -236,8 +236,4 @@ #define USE_FAIL_DEAD 4 #define USE_FAIL_INCAPACITATED 5 #define USE_FAIL_NOT_IN_USER 6 -#define USE_FAIL_IS_SILICON 7 - -//Useful for building semicolon-delimited time readouts when trying to find slowdowns in procs -var/world_time_test = 0 -#define TIMETEST ;world << "TIME DBG;[__FILE__];[__LINE__]; [round(world.tick_usage)]% ([round(world.tick_usage - world_time_test)]%)";world_time_test = world.tick_usage \ No newline at end of file +#define USE_FAIL_IS_SILICON 7 \ No newline at end of file diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 291f41a8d88..b6654650847 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -260,11 +260,13 @@ ResetPDAManifest() var/icon/front var/icon/side - var/icon/charicon = cached_character_icon(H) - front = icon(charicon, dir = SOUTH) - side = icon(charicon, dir = WEST) + if(H) + var/icon/charicon = cached_character_icon(H) + front = icon(charicon, dir = SOUTH) + side = icon(charicon, dir = WEST) - if(!id) id = text("[]", add_zero(num2hex(rand(1, 65536)), 4)) + if(!id) + id = text("[]", add_zero(num2hex(rand(1, 65536)), 4)) var/datum/data/record/G = new /datum/data/record() G.name = "Employee Record #[id]" G.fields["name"] = "New Record" diff --git a/code/datums/outfits/outfit.dm b/code/datums/outfits/outfit.dm index ac653e2647b..a37c339e213 100644 --- a/code/datums/outfits/outfit.dm +++ b/code/datums/outfits/outfit.dm @@ -101,7 +101,6 @@ var/list/outfits_decls_by_type_ H.equip_to_slot_or_del(new path(H), slot_in_backpack) post_equip(H) - H.regenerate_icons() if(W) // We set ID info last to ensure the ID photo is as correct as possible. H.set_id_info(W) return 1 @@ -158,15 +157,18 @@ var/list/outfits_decls_by_type_ W.rank = rank if(assignment) W.assignment = assignment - H.set_id_info(W) if(H.equip_to_slot_or_del(W, id_slot)) return W -/decl/hierarchy/outfit/proc/equip_pda(mob/living/carbon/human/H, assignment) +/decl/hierarchy/outfit/proc/equip_pda(mob/living/carbon/human/H, rank, assignment) if(!pda_slot || !pda_type) return var/obj/item/device/pda/pda = new pda_type(H) if(H.equip_to_slot_or_del(pda, pda_slot)) + pda.owner = H.real_name + pda.ownjob = assignment + pda.ownrank = rank + pda.name = "PDA-[H.real_name] ([assignment])" return pda /decl/hierarchy/outfit/dd_SortValue() diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm index d40330ca485..75e17bd7922 100644 --- a/code/game/jobs/job_controller.dm +++ b/code/game/jobs/job_controller.dm @@ -507,7 +507,8 @@ var/global/datum/controller/occupations/job_master proc/spawnId(var/mob/living/carbon/human/H, rank, title) if(!H) return 0 - var/obj/item/weapon/card/id/C = null + var/obj/item/weapon/card/id/C = H.get_equipped_item(slot_wear_id) + if(istype(C)) return 0 var/datum/job/job = null for(var/datum/job/J in occupations) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 546c0594cf7..0b93d1bd648 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -273,7 +273,7 @@ datum/preferences ShowChoices(usr) return 1 -/datum/preferences/proc/copy_to(mob/living/carbon/human/character, icon_updates = 1) +/datum/preferences/proc/copy_to(mob/living/carbon/human/character, icon_updates = TRUE) // Sanitizing rather than saving as someone might still be editing when copy_to occurs. player_setup.sanitize_setup() diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 1d49c1aacb6..ce34765ac06 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -453,7 +453,7 @@ client.prefs.real_name = random_name(new_character.gender) client.prefs.randomize_appearance_and_body_for(new_character) else - client.prefs.copy_to(new_character) + client.prefs.copy_to(new_character, icon_updates = TRUE) src << sound(null, repeat = 0, wait = 0, volume = 85, channel = 1) // MAD JAMS cant last forever yo