welp i got lazy

This commit is contained in:
kevinz000
2019-12-15 00:15:32 -07:00
parent 4970675467
commit 586dcb6f81
5 changed files with 24 additions and 18 deletions
+12 -7
View File
@@ -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, "<span class='boldwarning'>[path] is not an allowed path and has been removed.</span>")
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)
-2
View File
@@ -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)
+1 -1
View File
@@ -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
+2 -2
View File
@@ -11,8 +11,8 @@
if(prefs.last_custom_holoform < world.time + CUSTOM_HOLOFORM_DELAY)
to_chat(src, "<span class='warning'>You are attempting to change custom holoforms too fast!</span>")
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, "<span class='boldnotice'>Holoform set.</span>")
@@ -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