Files
MrMelbert 0ac95930a9 Apply height filters to electrocution animation (#95455)
## About The Pull Request

The skeleton from being shocked matches your height.

## Changelog

🆑 Melbert
fix: The skeleton from being shocked matches your height
/🆑
2026-03-23 18:02:04 -04:00

71 lines
2.6 KiB
Plaintext

/// Causes a fake "zap" to the hallucinator.
/datum/hallucination/shock
random_hallucination_weight = 1 // really low weight, as it also has a snowflake check to trigger when bumping airlocks
hallucination_tier = HALLUCINATION_TIER_COMMON
var/electrocution_icon = 'icons/mob/human/human.dmi'
var/electrocution_icon_state = "electrocuted_base"
var/image/shock_image
var/image/electrocution_skeleton_anim
/datum/hallucination/shock/New(mob/living/hallucinator)
electrocution_icon_state = ishuman(hallucinator) ? "electrocuted_base" : "electrocuted_generic"
return ..()
/datum/hallucination/shock/Destroy()
if(shock_image)
hallucinator.client?.images -= shock_image
shock_image = null
if(electrocution_skeleton_anim)
hallucinator.client?.images -= electrocution_skeleton_anim
electrocution_skeleton_anim = null
return ..()
/datum/hallucination/shock/start()
shock_image = image(hallucinator, hallucinator, dir = hallucinator.dir)
shock_image.appearance_flags |= KEEP_APART
shock_image.color = rgb(0, 0, 0)
shock_image.override = TRUE
electrocution_skeleton_anim = image(electrocution_icon, hallucinator, icon_state = electrocution_icon_state, layer = ABOVE_MOB_LAYER)
electrocution_skeleton_anim.appearance_flags |= RESET_COLOR|KEEP_APART
if(ishuman(hallucinator))
var/mob/living/carbon/human/human_hallucinator = hallucinator
human_hallucinator.apply_height_filters(electrocution_skeleton_anim)
SET_PLANE_EXPLICIT(shock_image, ABOVE_GAME_PLANE, hallucinator)
SET_PLANE_EXPLICIT(electrocution_skeleton_anim, ABOVE_GAME_PLANE, hallucinator)
to_chat(hallucinator, span_userdanger("You feel a powerful shock course through your body!"))
hallucinator.visible_message(span_warning("[hallucinator] falls to the ground, shaking!"), ignored_mobs = hallucinator)
hallucinator.client?.images |= shock_image
hallucinator.client?.images |= electrocution_skeleton_anim
hallucinator.playsound_local(get_turf(src), SFX_SPARKS, 100, TRUE)
hallucinator.adjust_stamina_loss(50)
hallucinator.Stun(4 SECONDS)
hallucinator.do_jitter_animation(300) // Maximum jitter
hallucinator.adjust_jitter(20 SECONDS)
addtimer(CALLBACK(src, PROC_REF(reset_shock_animation)), 4 SECONDS)
addtimer(CALLBACK(src, PROC_REF(shock_drop)), 2 SECONDS)
QDEL_IN(src, 4 SECONDS)
return TRUE
/datum/hallucination/shock/proc/reset_shock_animation()
if(QDELETED(hallucinator))
return
hallucinator.client?.images -= shock_image
shock_image = null
hallucinator.client?.images -= electrocution_skeleton_anim
electrocution_skeleton_anim = null
/datum/hallucination/shock/proc/shock_drop()
if(QDELETED(hallucinator))
return
hallucinator.Paralyze(6 SECONDS)