Centralized dummy lookalike generation (#58366)

This commit is contained in:
Trigg
2021-04-15 17:53:27 -03:00
committed by GitHub
parent c54afc5dce
commit 075cd60828
5 changed files with 39 additions and 18 deletions
+3 -8
View File
@@ -37,12 +37,7 @@
/datum/outfit_editor/proc/init_dummy()
dummy_key = "outfit_editor_[owner]"
var/mob/living/carbon/human/dummy/dummy = generate_or_wait_for_human_dummy(dummy_key)
var/mob/living/carbon/carbon_target = owner.mob
if(istype(carbon_target))
carbon_target.dna.transfer_identity(dummy)
dummy.updateappearance()
generate_dummy_lookalike(dummy_key, owner.mob)
unset_busy_human_dummy(dummy_key)
/datum/outfit_editor/ui_interact(mob/user, datum/tgui/ui)
@@ -78,9 +73,9 @@
data["outfit"] = serialize_outfit()
data["saveable"] = !GLOB.custom_outfits.Find(drip)
var/datum/preferences/prefs = owner.prefs
if(!dummy_key)
init_dummy()
var/icon/dummysprite = get_flat_human_icon(null,
prefs = prefs,
dummy_key = dummy_key,
showDirs = list(SOUTH),
outfit_override = drip)
+6 -10
View File
@@ -23,7 +23,6 @@
var/mob/target_mob
var/dummy_key
var/mob/living/carbon/human/dummy/dummy
//static list to share all the outfit typepaths between all instances of this datum.
var/static/list/cached_outfits
@@ -63,12 +62,7 @@
/datum/select_equipment/proc/init_dummy()
dummy_key = "selectequipmentUI_[target_mob]"
dummy = generate_or_wait_for_human_dummy(dummy_key)
var/mob/living/carbon/carbon_target = target_mob
if(istype(carbon_target))
carbon_target.dna.transfer_identity(dummy)
dummy.updateappearance()
generate_dummy_lookalike(dummy_key, target_mob)
unset_busy_human_dummy(dummy_key)
return
@@ -112,14 +106,16 @@
/datum/select_equipment/ui_data(mob/user)
var/list/data = list()
if(!dummy)
if(!dummy_key)
init_dummy()
var/datum/preferences/prefs = target_mob?.client?.prefs
var/icon/dummysprite = get_flat_human_icon(null, prefs=prefs, dummy_key = dummy_key, outfit_override = selected_outfit)
var/icon/dummysprite = get_flat_human_icon(null,
dummy_key = dummy_key,
outfit_override = selected_outfit)
data["icon64"] = icon2base64(dummysprite)
data["name"] = target_mob
var/datum/preferences/prefs = user?.client?.prefs
data["favorites"] = list()
if(prefs)
data["favorites"] = prefs.favorite_outfits
@@ -45,6 +45,28 @@ GLOBAL_LIST_EMPTY(dummy_mob_list)
D.in_use = TRUE
return D
/proc/generate_dummy_lookalike(slotkey, mob/target)
if(!istype(target))
return generate_or_wait_for_human_dummy(slotkey)
var/mob/living/carbon/human/dummy/copycat = generate_or_wait_for_human_dummy(slotkey)
if(iscarbon(target))
var/mob/living/carbon/carbon_target = target
carbon_target.dna.transfer_identity(copycat, transfer_SE = TRUE)
if(ishuman(target))
var/mob/living/carbon/human/human_target = target
human_target.copy_clothing_prefs(copycat)
copycat.updateappearance(icon_update=TRUE, mutcolor_update=TRUE, mutations_overlay_update=TRUE)
else
//even if target isn't a carbon, if they have a client we can make the
//dummy look like what their human would look like based on their prefs
target?.client?.prefs?.copy_to(copycat, icon_updates=TRUE, roundstart_checks=FALSE, character_setup=TRUE)
return copycat
/proc/unset_busy_human_dummy(slotkey)
if(!slotkey)
return
@@ -32,6 +32,7 @@
var/age = 30 //Player's age
//consider updating /mob/living/carbon/human/copy_clothing_prefs() if adding more of these
var/underwear = "Nude" //Which underwear the player wants
var/underwear_color = "000"
var/undershirt = "Nude" //Which undershirt the player wants
@@ -231,3 +231,10 @@
else
return "<span class='deadsay'>[t_He] [t_is] limp and unresponsive; there are no signs of life and [t_his] soul has departed...</span>"
///copies over clothing preferences like underwear to another human
/mob/living/carbon/human/proc/copy_clothing_prefs(mob/living/carbon/human/destination)
destination.underwear = underwear
destination.underwear_color = underwear_color
destination.undershirt = undershirt
destination.socks = socks
destination.jumpsuit_style = jumpsuit_style