diff --git a/code/modules/hallucination/delusions.dm b/code/modules/hallucination/delusions.dm index 2ef224ddf97..106988f7327 100644 --- a/code/modules/hallucination/delusions.dm +++ b/code/modules/hallucination/delusions.dm @@ -18,8 +18,13 @@ var/delusion_icon_file /// The icon state of the delusion image var/delusion_icon_state - /// Do we use a generated icon? If yes no icon file or state needed. - var/dynamic_icon = FALSE + + /// Do we use an appearance/generated icon? If yes no icon file or state needed. + var/dynamic_delusion = FALSE + /// Appearance to use as a source for our image + /// If this exists we'll ignore the icon/state from above + var/mutable_appearance/delusion_appearance + /// The name of the delusion image var/delusion_name @@ -96,7 +101,11 @@ return TRUE /datum/hallucination/delusion/proc/make_delusion_image(mob/over_who) - var/image/funny_image = image(delusion_icon_file, over_who, dynamic_icon ? "" : delusion_icon_state) + var/image/funny_image + if(delusion_appearance) + funny_image = image(delusion_appearance, over_who) + else + funny_image = image(delusion_icon_file, over_who, delusion_icon_state) funny_image.name = delusion_name funny_image.override = TRUE return funny_image @@ -197,14 +206,14 @@ return funny_image /datum/hallucination/delusion/preset/syndies + dynamic_delusion = TRUE random_hallucination_weight = 1 - dynamic_icon = TRUE delusion_name = "Syndicate" affects_others = TRUE affects_us = FALSE /datum/hallucination/delusion/preset/syndies/make_delusion_image(mob/over_who) - delusion_icon_file = getFlatIcon(get_dynamic_human_appearance( + delusion_appearance = get_dynamic_human_appearance( mob_spawn_path = pick( /obj/effect/mob_spawn/corpse/human/syndicatesoldier, /obj/effect/mob_spawn/corpse/human/syndicatecommando, @@ -217,7 +226,7 @@ /obj/item/gun/ballistic/automatic/c20r, /obj/item/gun/ballistic/shotgun/bulldog, ), - )) + ) return ..() @@ -241,18 +250,19 @@ // Hallucination used by heretic paintings /datum/hallucination/delusion/preset/heretic + dynamic_delusion = TRUE random_hallucination_weight = 0 - dynamic_icon = TRUE delusion_name = "Heretic" affects_others = TRUE affects_us = FALSE duration = 11 SECONDS /datum/hallucination/delusion/preset/heretic/make_delusion_image(mob/over_who) - var/static/icon/heretic_icon - if(isnull(heretic_icon)) - heretic_icon = getFlatIcon(get_dynamic_human_appearance(/datum/outfit/heretic, r_hand = NO_REPLACE)) - delusion_icon_file = heretic_icon + // This code is dummy hot for DUMB reasons so let's not make a mob constantly yeah? + var/static/mutable_appearance/heretic_appearance + if(isnull(heretic_appearance)) + heretic_appearance = get_dynamic_human_appearance(/datum/outfit/heretic, r_hand = NO_REPLACE) + delusion_appearance = heretic_appearance return ..() /datum/hallucination/delusion/preset/heretic/gate diff --git a/code/modules/unit_tests/hallucination_icons.dm b/code/modules/unit_tests/hallucination_icons.dm index 6477e94714c..c9f9cf8237c 100644 --- a/code/modules/unit_tests/hallucination_icons.dm +++ b/code/modules/unit_tests/hallucination_icons.dm @@ -19,7 +19,7 @@ // Test preset delusion hallucinations for invalid image setups for(var/datum/hallucination/delusion/preset/hallucination as anything in subtypesof(/datum/hallucination/delusion/preset)) - if(initial(hallucination.dynamic_icon)) + if(initial(hallucination.dynamic_delusion)) continue var/icon = initial(hallucination.delusion_icon_file) var/icon_state = initial(hallucination.delusion_icon_state)