From 044fa0ea453639d5d91c3b9cfe5e2ce7792053f5 Mon Sep 17 00:00:00 2001 From: Ashe Higgs Date: Fri, 30 Jun 2017 20:03:40 -0400 Subject: [PATCH] Cleans up godclash code (#28939) * Cleans up clash code, adds sound_to_playing_players * Removes some debug code * z-level check * Removes an old thing * Cyberboss changes * changes @ maintainer request --- .../ratvar_the_clockwork_justicar.dm | 41 +++++++++---------- code/game/sound.dm | 9 ++++ code/modules/power/singularity/narsie.dm | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/code/game/gamemodes/clock_cult/clock_structures/ratvar_the_clockwork_justicar.dm b/code/game/gamemodes/clock_cult/clock_structures/ratvar_the_clockwork_justicar.dm index c0f149cdef2..2bf2c67bbbb 100644 --- a/code/game/gamemodes/clock_cult/clock_structures/ratvar_the_clockwork_justicar.dm +++ b/code/game/gamemodes/clock_cult/clock_structures/ratvar_the_clockwork_justicar.dm @@ -24,7 +24,7 @@ O.ratvar_act() START_PROCESSING(SSobj, src) send_to_playing_players("\"[text2ratvar("ONCE AGAIN MY LIGHT SHALL SHINE ACROSS THIS PATHETIC REALM")]!!\"") - send_to_playing_players('sound/effects/ratvar_reveal.ogg') + sound_to_playing_players('sound/effects/ratvar_reveal.ogg') var/mutable_appearance/alert_overlay = mutable_appearance('icons/effects/clockwork_effects.dmi', "ratvar_alert") var/area/A = get_area(src) notify_ghosts("The Justiciar's light calls to you! Reach out to Ratvar in [A.name] to be granted a shell to spread his glory!", null, source = src, alert_overlay = alert_overlay) @@ -69,16 +69,19 @@ for(var/mob/living/L in GLOB.living_mob_list) //we want to know who's alive so we don't lose and retarget a single person if(L.z == z && !is_servant_of_ratvar(L) && L.mind) meals += L + if(GLOB.cult_narsie && GLOB.cult_narsie.z == z) + meals = list(GLOB.cult_narsie) //if you're in the way, handy for him, but ratvar only cares about nar-sie! + prey = GLOB.cult_narsie + if(get_dist(src, prey) <= 10) + clash() + return if(!prey) - for(var/obj/singularity/narsie/N in GLOB.singularities) - if(N.z == z) - prey = N - break if(!prey && LAZYLEN(meals)) + var/mob/living/L = prey prey = pick(meals) to_chat(prey, "\"You will do, heretic.\"\n\ You feel something massive turn its crushing focus to you...") - prey << 'sound/effects/ratvar_reveal.ogg' + L.playsound_local(prey, 'sound/effects/ratvar_reveal.ogg', 100, FALSE, pressure_affected = FALSE) else if((!istype(prey, /obj/singularity/narsie) && prob(10) && LAZYLEN(meals) > 1) || prey.z != z || !(prey in meals)) if(is_servant_of_ratvar(prey)) @@ -92,18 +95,14 @@ dir_to_step_in = get_dir(src, prey) //Unlike Nar-Sie, Ratvar ruthlessly chases down his target step(src, dir_to_step_in) -/obj/structure/destructible/clockwork/massive/ratvar/narsie_act() - if(clashing) - return FALSE +/obj/structure/destructible/clockwork/massive/ratvar/proc/clash() + if(clashing || prey != GLOB.cult_narsie) + return clashing = TRUE + GLOB.cult_narsie.clashing = TRUE to_chat(world, "\"[pick("BLOOD GOD!!!", "NAR-SIE!!!", "AT LAST, YOUR TIME HAS COME!")]\"") to_chat(world, "\"Ratvar?! How?!\"") - for(var/obj/singularity/narsie/N in range(15, src)) - if(N.clashing) - continue - N.clashing = TRUE - clash_of_the_titans(N) //IT'S TIME FOR THE BATTLE OF THE AGES - break + clash_of_the_titans(GLOB.cult_narsie) //IT'S TIME FOR THE BATTLE OF THE AGES return TRUE //Put me in Reebe, will you? Ratvar has found and is going to fucking murder Nar-Sie @@ -111,7 +110,7 @@ var/winner = "Undeclared" var/base_victory_chance = 1 while(src && narsie) - send_to_playing_players('sound/magic/clockwork/ratvar_attack.ogg') + sound_to_playing_players('sound/magic/clockwork/ratvar_attack.ogg') sleep(5.2) for(var/mob/M in GLOB.mob_list) if(!isnewplayer(M)) @@ -125,7 +124,7 @@ winner = "Ratvar" break sleep(rand(2,5)) - send_to_playing_players('sound/magic/clockwork/narsie_attack.ogg') + sound_to_playing_players('sound/magic/clockwork/narsie_attack.ogg') sleep(7.4) for(var/mob/M in GLOB.mob_list) if(!isnewplayer(M)) @@ -139,13 +138,13 @@ if("Ratvar") send_to_playing_players("\"[pick("DIE! DIE! DIE!", "FILTH!!!", "SUFFER!!!", text2ratvar("ROT FOR CENTURIES AS I HAVE!!"))]\"\n\ \"[pick("Nooooo...", "Not die. To y-", "Die. Ratv-", "Sas tyen re-")]\"") //nar-sie get out - send_to_playing_players('sound/magic/clockwork/anima_fragment_attack.ogg') - send_to_playing_players('sound/magic/demon_dies.ogg') + sound_to_playing_players('sound/magic/clockwork/anima_fragment_attack.ogg') + sound_to_playing_players('sound/magic/demon_dies.ogg', 50) clashing = FALSE qdel(narsie) if("Nar-Sie") send_to_playing_players("\"[pick("Ha.", "Ra'sha fonn dest.", "You fool. To come here.")]\"") //Broken English - send_to_playing_players('sound/magic/demon_attack1.ogg') - send_to_playing_players('sound/magic/clockwork/anima_fragment_death.ogg') + sound_to_playing_players('sound/magic/demon_attack1.ogg') + sound_to_playing_players('sound/magic/clockwork/anima_fragment_death.ogg', 50) narsie.clashing = FALSE qdel(src) diff --git a/code/game/sound.dm b/code/game/sound.dm index 7d63311d301..4b77222f19d 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -80,6 +80,13 @@ src << S +/proc/sound_to_playing_players(sound, volume = 100, vary) + sound = get_sfx(sound) + for(var/M in GLOB.player_list) + if(ismob(M) && !isnewplayer(M)) + var/mob/MO = M + MO.playsound_local(get_turf(MO), sound, volume, vary, pressure_affected = FALSE) + /proc/open_sound_channel() var/static/next_channel = 1 //loop through the available 1024 - (the ones we reserve) channels and pray that its not still being used . = ++next_channel @@ -133,6 +140,8 @@ 'sound/machines/terminal_button07.ogg', 'sound/machines/terminal_button08.ogg') if ("desceration") soundin = pick('sound/misc/desceration-01.ogg', 'sound/misc/desceration-02.ogg', 'sound/misc/desceration-03.ogg') + if ("im_here") + soundin = pick('sound/hallucinations/im_here1.ogg', 'sound/hallucinations/im_here2.ogg') if ("can_open") soundin = pick('sound/effects/can_open1.ogg', 'sound/effects/can_open2.ogg', 'sound/effects/can_open3.ogg') return soundin diff --git a/code/modules/power/singularity/narsie.dm b/code/modules/power/singularity/narsie.dm index 8cdaaf69ea0..4fed74d0b1b 100644 --- a/code/modules/power/singularity/narsie.dm +++ b/code/modules/power/singularity/narsie.dm @@ -30,7 +30,7 @@ /obj/singularity/narsie/large/Initialize() . = ..() send_to_playing_players("NAR-SIE HAS RISEN") - send_to_playing_players(pick('sound/hallucinations/im_here1.ogg', 'sound/hallucinations/im_here2.ogg')) + sound_to_playing_players("im_here") var/area/A = get_area(src) if(A)