From 995b1ac32f9d568e012722c535e9b27927187047 Mon Sep 17 00:00:00 2001 From: Superlagg Date: Wed, 28 Jun 2023 12:21:10 -0700 Subject: [PATCH] ckey cbt --- code/controllers/subsystem/dummies.dm | 46 +++++++++++++++++---------- code/game/objects/items/mannequin.dm | 11 +++++-- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/code/controllers/subsystem/dummies.dm b/code/controllers/subsystem/dummies.dm index c237a6fb39b..0ad8d1fc6d5 100644 --- a/code/controllers/subsystem/dummies.dm +++ b/code/controllers/subsystem/dummies.dm @@ -268,24 +268,36 @@ SUBSYSTEM_DEF(dummy) // who ya callin dummy, dummy? return COOLDOWN_START(src, snapshot_cooldown, 5 MINUTES) for(var/client/C in GLOB.clients) - if(!ishuman(C.mob)) - continue - var/mob/living/carbon/human/H = C.mob - if(!LAZYACCESS(naked_player_cache, "[C.ckey]%%[H.real_name]")) - naked_player_cache["[C.ckey]%%[H.real_name]"] = list() - if(!LAZYACCESS(clothed_player_cache, "[C.ckey]%%[H.real_name]")) - clothed_player_cache["[C.ckey]%%[H.real_name]"] = list() - var/image/naked = get_dummy_image("PLAYER", template = H, client_or_prefs = C, random_body = FALSE, random_species = FALSE, random_clothes = FALSE) - var/image/clothed = get_dummy_image("PLAYER", template = H, client_or_prefs = C, random_body = FALSE, random_species = FALSE, random_clothes = FALSE, copy_equipment = TRUE) - var/image/clothed2 = get_dummy_image("PLAYER", template = H, client_or_prefs = C, random_body = FALSE, random_species = FALSE, random_clothes = TRUE) - if(naked) - naked_player_cache["[C.ckey]%%[H.real_name]"] |= naked - if(clothed) - clothed_player_cache["[C.ckey]%%[H.real_name]"] |= clothed - if(clothed2) - randomclothed_player_cache["[C.ckey]%%[H.real_name]"] |= clothed2 - + snapshot_player(C) +/datum/controller/subsystem/dummy/proc/snapshot_player(client_or_ckey) + var/mob/living/carbon/human/H + var/client/C + if(isclient(client_or_ckey)) + C = client_or_ckey + H = C.mob + else if(istext(client_or_ckey)) + C = LAZYACCESS(GLOB.directory, client_or_ckey) + if(!C) + return + H = C.mob + if(!ishuman(H)) + return + if(!LAZYACCESS(naked_player_cache, "[C.ckey]%%[H.real_name]")) + naked_player_cache["[C.ckey]%%[H.real_name]"] = list() + if(!LAZYACCESS(clothed_player_cache, "[C.ckey]%%[H.real_name]")) + clothed_player_cache["[C.ckey]%%[H.real_name]"] = list() + if(!LAZYACCESS(randomclothed_player_cache, "[C.ckey]%%[H.real_name]")) + randomclothed_player_cache["[C.ckey]%%[H.real_name]"] = list() + var/image/naked = get_dummy_image("PLAYER", template = H, client_or_prefs = C, random_body = FALSE, random_species = FALSE, random_clothes = FALSE) + var/image/clothed = get_dummy_image("PLAYER", template = H, client_or_prefs = C, random_body = FALSE, random_species = FALSE, random_clothes = FALSE, copy_equipment = TRUE) + var/image/clothed2 = get_dummy_image("PLAYER", template = H, client_or_prefs = C, random_body = FALSE, random_species = FALSE, random_clothes = TRUE) + if(naked) + naked_player_cache["[C.ckey]%%[H.real_name]"] |= naked + if(clothed) + clothed_player_cache["[C.ckey]%%[H.real_name]"] |= clothed + if(clothed2) + randomclothed_player_cache["[C.ckey]%%[H.real_name]"] |= clothed2 /mob/living/carbon/human/dummy real_name = "Test Dummy" diff --git a/code/game/objects/items/mannequin.dm b/code/game/objects/items/mannequin.dm index 41db8394be4..07265026b6c 100644 --- a/code/game/objects/items/mannequin.dm +++ b/code/game/objects/items/mannequin.dm @@ -165,6 +165,12 @@ var/nude = TRUE var/random_clothes = FALSE +/obj/item/ckey_mannequin/clothed + nude = FALSE + +/obj/item/ckey_mannequin/clothed/random + random_clothes = TRUE + /obj/item/ckey_mannequin/attack_hand(mob/user, act_intent, attackchain_flags) if(!attune_to(user)) return ..() @@ -187,7 +193,7 @@ /obj/item/ckey_mannequin/process() update_icon() - if(prob(0.5)) + if(prob(1)) switch(rand(1,5)) if(1) step_rand(src) @@ -209,7 +215,7 @@ name = initial(name) desc = initial(desc) return - SSdummy.capture_snapshot_of_players(TRUE) + SSdummy.snapshot_player(my_ckey) var/list/imglist var/list/cool_list if(nude) @@ -222,6 +228,7 @@ if(findtext(kye, my_ckey) || findtext(kye, my_name)) imglist = cool_list[kye] if(!imglist) + visible_message("[src] panics and disappears!") return if(!my_image) my_image = LAZYACCESS(imglist, 1)