Skip to content

Commit

Permalink
Merge pull request #2570 from ARF-SS13/manniquin-fixub
Browse files Browse the repository at this point in the history
Fixes mannequins
  • Loading branch information
Tk420634 committed Jun 28, 2023
2 parents 0e81196 + 995b1ac commit fb6708a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
46 changes: 29 additions & 17 deletions code/controllers/subsystem/dummies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 9 additions & 2 deletions code/game/objects/items/mannequin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..()
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit fb6708a

Please sign in to comment.