diff --git a/code/modules/hallucinations/effects/grenades.dm b/code/modules/hallucinations/effects/grenades.dm new file mode 100644 index 00000000000..8aa24b13bd3 --- /dev/null +++ b/code/modules/hallucinations/effects/grenades.dm @@ -0,0 +1,126 @@ + +/** + * # Hallucination - Fake Grenade + * + * A random grenade is thrown near the target from offscreen. + */ +/obj/effect/hallucination/fake_grenade + hallucination_layer = 3.1 + ///A list of potential grenades to pick from, one is picked at random to copy + var/list/grenade_type = list(/obj/item/grenade/chem_grenade, /obj/item/grenade/clusterbuster, /obj/item/grenade/spawnergrenade, /obj/item/grenade/empgrenade, /obj/item/grenade/flashbang, /obj/item/grenade/chem_grenade/large, /obj/item/grenade/syndieminibomb, /obj/item/grenade/chem_grenade/cryo, /obj/item/grenade/chem_grenade/pyro) + ///The turf the grenade will land on, and that sounds will play from + var/turf/grenade_turf + +/obj/effect/hallucination/fake_grenade/Destroy() + grenade_turf = null + return ..() + +/obj/effect/hallucination/fake_grenade/Initialize(mapload, mob/living/carbon/hallucination_target, override_direction, distance = 9) + var/obj/item/grenade/grenade_path = pick(grenade_type) + duration = grenade_path::det_time + . = ..() + var/direction = override_direction ? override_direction : pick(GLOB.alldirs) + grenade_turf = get_step(get_turf(src), direction) + hallucination_icon = grenade_path::icon + hallucination_icon_state = "[grenade_path::icon_state]_active" + hallucination_layer = grenade_path::layer + addtimer(CALLBACK(src, PROC_REF(ending_effect)), duration) + switch(direction) + if(NORTH) + pixel_y = 32 * distance + if(NORTHEAST) + pixel_x = 32 * distance + pixel_y = 32 * distance + if(EAST) + pixel_x = 32 * distance + if(SOUTHEAST) + pixel_x = 32 * distance + pixel_y = -32 * distance + if(SOUTH) + pixel_y = -32 * distance + if(SOUTHWEST) + pixel_x = -32 * distance + pixel_y = -32 * distance + if(WEST) + pixel_x = -32 * distance + if(NORTHWEST) + pixel_x = -32 * distance + pixel_y = 32 * distance + var/image/grenade = image(hallucination_icon, grenade_turf, hallucination_icon_state, pixel_x = pixel_x, pixel_y = pixel_y) + target.playsound_local(grenade_turf, 'sound/weapons/armbomb.ogg', 75, TRUE) + animate(grenade, 9, pixel_x = 0, pixel_y = 0, flags = ANIMATION_PARALLEL) + animate(transform = matrix(120, MATRIX_ROTATE), time = 3, flags = ANIMATION_PARALLEL) + animate(transform = matrix(240, MATRIX_ROTATE), time = 3) + animate(transform = matrix(360, MATRIX_ROTATE), time = 3) + add_icon(grenade) + +///Additional effects that occur after the grenade hallucination disappears to mimic the grenade detonating +/obj/effect/hallucination/fake_grenade/proc/ending_effect(distance) + distance = get_dist(src, target) + return distance <= 4 + +/** + * # Hallucination - Fake Grenade Flashbang + * + * A random grenade is thrown near the target from offscreen. + * The target will get flashbanged on 'detonation' if too close. + */ +/obj/effect/hallucination/fake_grenade/flashbang + grenade_type = list(/obj/item/grenade/flashbang) + +/obj/effect/hallucination/fake_grenade/flashbang/ending_effect(distance) + . = ..() + if(!.) + return + target.playsound_local(grenade_turf, 'sound/effects/bang.ogg', 60, TRUE) + target.show_message("BANG", 2) + var/weaken_time = 6 SECONDS + if(target.flash_eyes(visual = TRUE)) + weaken_time /= 2 + target.Weaken(weaken_time) + + if(target.check_ear_prot()) + return + switch(rand(1, 5)) + if(1, 2) + to_chat(target, "Your ears start to ring!") + if(3, 4) + to_chat(target, "Your ears start to ring badly!") + if(5) + to_chat(target, "You can't hear anything!") + target.Deaf(2 SECONDS) + +/** + * # Hallucination - Fake Grenade Spawner + * + * A random grenade is thrown near the target from offscreen. + * A space carp will spawn on the grenade upon 'detonation'. + */ +/obj/effect/hallucination/fake_grenade/spawner + grenade_type = list(/obj/item/grenade/spawnergrenade) + +/obj/effect/hallucination/fake_grenade/spawner/ending_effect(distance) + target.playsound_local(grenade_turf, 'sound/effects/phasein.ogg', 60, TRUE) + target.flash_eyes(visual = TRUE) + new /obj/effect/hallucination/chaser/attacker/space_carp(grenade_turf, target) + +/** + * # Hallucination - Space Carp + */ +/obj/effect/hallucination/chaser/attacker/space_carp + hallucination_icon = 'icons/mob/carp.dmi' + hallucination_icon_state = "base" + duration = 30 SECONDS + damage = 25 + +/obj/effect/hallucination/chaser/attacker/space_carp/Initialize(mapload, mob/living/carbon/hallucination_target) + . = ..() + name = "space carp" + +/obj/effect/hallucination/chaser/attacker/space_carp/attack_effects() + do_attack_animation(target, ATTACK_EFFECT_BITE) + target.playsound_local(get_turf(src), 'sound/weapons/bite.ogg', 50, TRUE) + to_chat(target, "[name] bites you!") + +/obj/effect/hallucination/chaser/attacker/space_carp/on_knockdown() + target.visible_message("[target] recoils as if hit by something, before suddenly collapsing!", "[name] bites you!") diff --git a/code/modules/hallucinations/hallucinations.dm b/code/modules/hallucinations/hallucinations.dm index a860b89377b..ea32a521942 100644 --- a/code/modules/hallucinations/hallucinations.dm +++ b/code/modules/hallucinations/hallucinations.dm @@ -10,10 +10,12 @@ GLOBAL_LIST_INIT(hallucinations, list( ), HALLUCINATE_MODERATE = list( /obj/effect/hallucination/delusion = 5, + /obj/effect/hallucination/fake_grenade/flashbang = 5, /obj/effect/hallucination/self_delusion = 5, /obj/effect/hallucination/bolts/moderate = 10, /obj/effect/hallucination/chasms = 10, /obj/effect/hallucination/fake_alert = 10, + /obj/effect/hallucination/fake_grenade = 10, /obj/effect/hallucination/gunfire = 10, /obj/effect/hallucination/plasma_flood = 10, /obj/effect/hallucination/stunprodding = 10, @@ -26,6 +28,7 @@ GLOBAL_LIST_INIT(hallucinations, list( HALLUCINATE_MAJOR = list( /obj/effect/hallucination/abduction = 10, /obj/effect/hallucination/assault = 10, + /obj/effect/hallucination/fake_grenade/spawner = 10, /obj/effect/hallucination/terror_infestation = 10, /obj/effect/hallucination/loose_energy_ball = 10, /datum/hallucination_manager/xeno_pounce = 10 diff --git a/paradise.dme b/paradise.dme index 695a754571e..b3304b92956 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1993,6 +1993,7 @@ #include "code\modules\hallucinations\hallucination_manager.dm" #include "code\modules\hallucinations\hallucinations.dm" #include "code\modules\hallucinations\effects\common.dm" +#include "code\modules\hallucinations\effects\grenades.dm" #include "code\modules\hallucinations\effects\major.dm" #include "code\modules\hallucinations\effects\minor.dm" #include "code\modules\hallucinations\effects\moderate.dm"