From 586dcb6f81e8aa1b54e0ab3db72e6b286c09955c Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 15 Dec 2019 00:15:32 -0700 Subject: [PATCH] welp i got lazy --- code/__HELPERS/custom_holoforms.dm | 19 ++++++++++++------- code/game/objects/items.dm | 2 -- code/modules/client/preferences.dm | 2 +- code/modules/client/verbs/custom_holoform.dm | 4 ++-- .../mob/dead/new_player/preferences_setup.dm | 15 +++++++++------ 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/code/__HELPERS/custom_holoforms.dm b/code/__HELPERS/custom_holoforms.dm index b20a41ea34..471b67da65 100644 --- a/code/__HELPERS/custom_holoforms.dm +++ b/code/__HELPERS/custom_holoforms.dm @@ -1,9 +1,14 @@ // Generates a holoform appearance // Equipment list is slot = path. -/proc/generate_custom_holoform_from_prefs(datum/preferences/prefs, filter_type = HOLOFORM_FILTER_AI, list/equipment_by_slot, list/inhand_equipment) +/proc/generate_custom_holoform_from_prefs(datum/preferences/prefs, list/equipment_by_slot, list/inhand_equipment, copy_job_first = FALSE) ASSERT(prefs) var/mob/living/carbon/human/dummy/mannequin = generate_or_wait_for_human_dummy(DUMMY_HUMAN_SLOT_HOLOFORM) prefs.copy_to(mannequin) + if(copy_job_first) + var/datum/job/highest = prefs.get_highest_job() + if(highest && !istype(highest, /datum/job/ai) && !istype(highest, /datum/job/cyborg)) + highest.equip(mannequin, TRUE, preference_source = prefs) + if(length(equipment_by_slot)) LAZYINITLIST(spawned) for(var/slot in equipment_by_slot) @@ -14,12 +19,11 @@ for(var/path in inhand_equipment) var/obj/item/I = new path mannequin.equip_to_slot_if_possible(I, SLOT_IN_HANDS, TRUE, TRUE, TRUE, TRUE) - var/icon/result = get_custom_holoform_icon(mannequin, filter_type) + var/icon/result = getFlatIcon(mannequin) unset_busy_human_dummy(DUMMY_HUMAN_SLOT_HOLOFORM) return result -/proc/get_custom_holoform_icon(atom/A, filter_type) - var/icon/I = getFlatIcon(A) +/proc/process_holoform_icon_filter(icon/I, filter_type) switch(filter_type) if(HOLOFORM_FILTER_AI) I = getHologramIcon(I) @@ -30,7 +34,7 @@ return I //Errors go to user. -/proc/generate_custom_holoform_from_prefs_safe(datum/preferences/prefs, filter_type, list/equipment_by_slot, list/inhand_equipment, mob/user) +/proc/generate_custom_holoform_from_prefs_safe(datum/preferences/prefs, list/equipment_by_slot, list/inhand_equipment, mob/user, copy_job_first = FALSE) if(user) if(user.prefs.last_custom_holoform < world.time + CUSTOM_HOLOFORM_DELAY) return @@ -59,10 +63,11 @@ inhand_equipment -= slot to_chat(user, "[path] is not an allowed path and has been removed.") continue - return generate_custom_holoform_from_prefs(prefs, filter_type, equipment_by_slot, inhand_equipment) + return generate_custom_holoform_from_prefs(prefs, equipment_by_slot, inhand_equipment, copy_job_first) //Prompts this client for custom holoform parameters. /proc/user_interface_custom_holoform(client/C) var/datum/preferences/target_prefs = C.prefs ASSERT(target_prefs) - + //In the future, maybe add custom path allowances a la admin create outfit but for now.. + return generate_custom_holoform_from_prefs_safe(target_prefs, null, null, C.mob, TRUE) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index eca75def83..c5d198c05f 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -109,8 +109,6 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) var/list/grind_results //A reagent list containing the reagents this item produces when ground up in a grinder - this can be an empty list to allow for reagent transferring only var/list/juice_results //A reagent list containing blah blah... but when JUICED in a grinder! - var/allow_virtual_spawn = TRUE //allow players to use this in holoforms, which will cause it to be instantiated in nullspace for long enough for us to grab the appearance/icons. - /obj/item/Initialize() materials = typelist("materials", materials) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 70a287bf2a..3865ab39db 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -21,7 +21,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/last_ip var/last_id - var/mutable_appearance/custom_holoform + var/icon/custom_holoform_icon var/last_custom_holoform = 0 //Cooldowns for saving/loading. These are four are all separate due to loading code calling these one after another diff --git a/code/modules/client/verbs/custom_holoform.dm b/code/modules/client/verbs/custom_holoform.dm index 0e63d83d82..aaf4bc53c8 100644 --- a/code/modules/client/verbs/custom_holoform.dm +++ b/code/modules/client/verbs/custom_holoform.dm @@ -11,8 +11,8 @@ if(prefs.last_custom_holoform < world.time + CUSTOM_HOLOFORM_DELAY) to_chat(src, "You are attempting to change custom holoforms too fast!") - var/mutable_appearance/new_holoform = user_interface_custom_holoform(src) + var/icon/new_holoform = user_interface_custom_holoform(src) if(new_holoform) - prefs.custom_holoform = new_holoform + prefs.custom_holoform_icon = new_holoform prefs.last_custom_holoform = world.time to_chat(src, "Holoform set.") diff --git a/code/modules/mob/dead/new_player/preferences_setup.dm b/code/modules/mob/dead/new_player/preferences_setup.dm index 7aae26526e..5b664dc01a 100644 --- a/code/modules/mob/dead/new_player/preferences_setup.dm +++ b/code/modules/mob/dead/new_player/preferences_setup.dm @@ -27,12 +27,7 @@ /datum/preferences/proc/update_preview_icon(equip_job = TRUE) // Determine what job is marked as 'High' priority, and dress them up as such. - var/datum/job/previewJob - var/highest_pref = 0 - for(var/job in job_preferences) - if(job_preferences["[job]"] > highest_pref) - previewJob = SSjob.GetJob(job) - highest_pref = job_preferences["[job]"] + var/datum/job/previewJob = get_highest_job() if(previewJob) // Silicons only need a very basic preview since there is no customization for them. @@ -57,3 +52,11 @@ parent.show_character_previews(new /mutable_appearance(mannequin)) unset_busy_human_dummy(DUMMY_HUMAN_SLOT_PREFERENCES) +/datum/preferences/proc/get_highest_job() + var/highest_pref = 0 + var/datum/job/highest_job + for(var/job in job_preferences) + if(job_preferences["[job]"] > highest_pref) + highest_job = SSjob.GetJob(job) + highest_pref = job_preferences["[job]"] + return highest_job