[MIRROR] Adds bread smite and transformation animation helper. (#560)

* Merge pull request #53180 from AnturK/bread

Adds bread smite and transformation animation helper.

* Adds bread smite and transformation animation helper.

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-08-29 20:32:26 +01:00
committed by GitHub
co-authored by LemonInTheDark
parent da21387c8a
commit d36c3eb8cc
4 changed files with 70 additions and 1 deletions
+1
View File
@@ -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
+58
View File
@@ -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
+11 -1
View File
@@ -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
*
Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 KiB

After

Width:  |  Height:  |  Size: 885 KiB