diff --git a/code/__DEFINES/admin.dm b/code/__DEFINES/admin.dm index d549afab56e..2121a6bfa88 100644 --- a/code/__DEFINES/admin.dm +++ b/code/__DEFINES/admin.dm @@ -104,6 +104,7 @@ #define ADMIN_PUNISHMENT_SCARIFY "Scarify" #define ADMIN_PUNISHMENT_SHOES "Knot Shoes" #define ADMIN_PUNISHMENT_DOCK "Dock Pay" +#define ADMIN_PUNISHMENT_BREAD "Bread" #define AHELP_ACTIVE 1 #define AHELP_CLOSED 2 diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 884c8efe0c5..410ca0a92be 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -1220,3 +1220,61 @@ GLOBAL_DATUM_INIT(dummySave, /savefile, new("tmp/dummySave.sav")) //Cache of ico var/icon/I = getFlatIcon(thing) return icon2html(I, target) + +GLOBAL_LIST_EMPTY(transformation_animation_objects) + + +/* + * Creates animation that turns current icon into result appearance from top down. + * + * result_appearance - End result appearance/atom/image + * time - Animation duration + * transform_overlay - Appearance/atom/image of effect that moves along the animation - should be horizonatally centered + * reset_after - If FALSE, filters won't be reset and helper vis_objects will not be removed after animation duration expires. Cleanup must be handled by the caller! + */ +/atom/movable/proc/transformation_animation(result_appearance,time = 3 SECONDS,transform_overlay,reset_after=TRUE) + var/list/transformation_objects = GLOB.transformation_animation_objects[src] || list() + //Disappearing part + var/top_part_filter = filter(type="alpha",icon=icon('icons/effects/alphacolors.dmi',"white"),y=0) + filters += top_part_filter + var/filter_index = length(filters) + animate(filters[filter_index],y=-32,time=time) + //Appearing part + var/obj/effect/overlay/appearing_part = new + appearing_part.appearance = result_appearance + appearing_part.appearance_flags |= KEEP_TOGETHER | KEEP_APART + appearing_part.vis_flags = VIS_INHERIT_ID + appearing_part.filters = filter(type="alpha",icon=icon('icons/effects/alphacolors.dmi',"white"),y=0,flags=MASK_INVERSE) + animate(appearing_part.filters[1],y=-32,time=time) + transformation_objects += appearing_part + //Transform effect thing - todo make appearance passed in + if(transform_overlay) + var/obj/transform_effect = new + transform_effect.appearance = transform_overlay + transform_effect.vis_flags = VIS_INHERIT_ID + transform_effect.pixel_y = 16 + transform_effect.alpha = 255 + transformation_objects += transform_effect + animate(transform_effect,pixel_y=-16,time=time) + animate(alpha=0) + + GLOB.transformation_animation_objects[src] = transformation_objects + for(var/A in transformation_objects) + vis_contents += A + if(reset_after) + addtimer(CALLBACK(src,.proc/_reset_transformation_animation,filter_index),time) + +/* + * Resets filters and removes transformation animations helper objects from vis contents. +*/ +/atom/movable/proc/_reset_transformation_animation(filter_index) + var/list/transformation_objects = GLOB.transformation_animation_objects[src] + for(var/A in transformation_objects) + vis_contents -= A + qdel(A) + transformation_objects.Cut() + GLOB.transformation_animation_objects -= src + if(filters && length(filters) >= filter_index) + filters -= filters[filter_index] + //else + // filters = null diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm index fd0b3a4b5ac..52b6eff05cd 100644 --- a/code/modules/admin/verbs/randomverbs.dm +++ b/code/modules/admin/verbs/randomverbs.dm @@ -1072,7 +1072,8 @@ Traitors and the like can also be revived with the previous role mostly intact. ADMIN_PUNISHMENT_PERFORATE, ADMIN_PUNISHMENT_SCARIFY, ADMIN_PUNISHMENT_SHOES, - ADMIN_PUNISHMENT_DOCK + ADMIN_PUNISHMENT_DOCK, + ADMIN_PUNISHMENT_BREAD ) var/punishment = input("Choose a punishment", "DIVINE SMITING") as null|anything in sortList(punishment_list) @@ -1265,9 +1266,18 @@ Traitors and the like can also be revived with the previous role mostly intact. card.registered_account.account_balance = card.registered_account.account_balance - new_cost card.registered_account.bank_card_talk("[new_cost] credits deducted from your account based on performance review.") SEND_SOUND(target, 'sound/machines/buzz-sigh.ogg') + if(ADMIN_PUNISHMENT_BREAD) + var/mutable_appearance/bread_appearance = mutable_appearance('icons/obj/food/burgerbread.dmi',"bread") + var/mutable_appearance/transform_scanline = mutable_appearance('icons/effects/effects.dmi',"transform_effect") + target.transformation_animation(bread_appearance,time= 5 SECONDS,transform_overlay=transform_scanline,reset_after=TRUE) + addtimer(CALLBACK(GLOBAL_PROC, .proc/breadify, target), 5 SECONDS) punish_log(target, punishment) +/proc/breadify(atom/movable/target) + var/obj/item/food/bread/plain/bread = new(get_turf(target)) + target.forceMove(bread) + /** * firing_squad is a proc for the :B:erforate smite to shoot each individual bullet at them, so that we can add actual delays without sleep() nonsense * diff --git a/icons/effects/effects.dmi b/icons/effects/effects.dmi index a8d64492796..f306db41934 100644 Binary files a/icons/effects/effects.dmi and b/icons/effects/effects.dmi differ