Files
Bubberstation/code/modules/hallucination/shock.dm
Fikou fc4de530ce reorganizes the human sprite folder and replaces the human_basic sprite with an updated one (#77323)
instead of mob/species/human the icon folders are now mob/human/species,
this makes much more sense imo than having human stuff like hair or
bodyparts (which are a GENERAL thing, not human species only) be behind
a folder while you see shit like podperson hair and golem in the main
folder
the icon for human is replaced by the new sprites instead of the old
yellow guy with green eyes
2023-08-05 14:12:05 +00:00

64 lines
2.2 KiB
Plaintext

/// Causes a fake "zap" to the hallucinator.
/datum/hallucination/shock
random_hallucination_weight = 1
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
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.adjustStaminaLoss(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)