Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immersive AA Sequence (3) #11

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define AMBIENCE_YAUTJA 'sound/ambience/yautja_ship.ogg'

#define SOUND_MARINE_DRUMS 'sound/effects/drums.ogg'
#define SOUND_DISTANT_AA_FIRE list('sound/effects/distant_aa.ogg','sound/effects/distant_aa2.ogg','sound/effects/distant_minigun.ogg','sound/effects/distant_minigun_short.ogg','sound/effects/distant_minigun2.ogg','sound/effects/distant_aa_cannon.ogg')

#define AMBIENCE_ALMAYER 'sound/ambience/shipambience1.ogg'
#define AMBIENCE_LV624 'sound/ambience/ambienceLV624.ogg'
Expand Down
4 changes: 3 additions & 1 deletion code/datums/soundOutput.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var/list/soundscape_playlist = list() //Updated on changing areas
var/ambience = null //The file currently being played as ambience
var/status_flags = 0 //For things like ear deafness, psychodelic effects, and other things that change how all sounds behave

var/list/echo
/datum/soundOutput/New(client/C)
if(!C)
qdel(src)
Expand All @@ -22,6 +22,7 @@
S.frequency = T.frequency
S.falloff = T.falloff
S.status = T.status
S.echo = T.echo

if(T.x && T.y && T.z)
var/turf/owner_turf = get_turf(owner.mob)
Expand All @@ -39,6 +40,7 @@
S.x = T.x - owner_turf.x
S.y = 0
S.z = T.y - owner_turf.y
S.y += T.y_s_offset
if(owner.mob.ear_deaf > 0)
S.status |= SOUND_MUTE

Expand Down
28 changes: 17 additions & 11 deletions code/game/sound.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/datum/sound_template //Basically a sound datum, but only serves as a way to carry info to soundOutput
var/file //The sound itself
var/file_muffled // Muffled variant for those that are deaf
Expand All @@ -11,10 +10,11 @@
var/falloff = 1
var/volume_cat = VOLUME_SFX
var/range = 0
var/list/echo
var/x //Map coordinates, not sound coordinates
var/y
var/z

var/y_s_offset // Vertical sound offset
/proc/get_free_channel()
var/static/cur_chan = 1
. = cur_chan++
Expand All @@ -31,8 +31,10 @@
//channel: use this only when you want to force the sound to play on an specific channel
//status: the regular 4 sound flags
//falloff: max range till sound volume starts dropping as distance increases
//echo: Echo and reverb configuration.Byond sound var. Read http://www.byond.com/docs/ref/index.html#/sound/var/echo
//y_s_offset: Vertical 3d sound offset.

/proc/playsound(atom/source, soundin, vol = 100, vary = FALSE, sound_range, vol_cat = VOLUME_SFX, channel = 0, status , falloff = 1)
/proc/playsound(atom/source, soundin, vol = 100, vary = FALSE, sound_range, vol_cat = VOLUME_SFX, channel = 0, status , falloff = 1, echo, y_s_offset)
if(isarea(source))
error("[source] is an area and is trying to make the sound: [soundin]")
return FALSE
Expand All @@ -50,7 +52,8 @@
S.falloff = falloff
S.volume = vol
S.volume_cat = vol_cat

S.echo = echo
S.y_s_offset = y_s_offset
if(vary != FALSE)
if(vary > 1)
S.frequency = vary
Expand Down Expand Up @@ -120,17 +123,18 @@
S.status = status
SSsound.queue(S, list(C))

//Self explanatory
/proc/playsound_area(area/A, soundin, vol = 100, channel, status, vol_cat = VOLUME_SFX)
/// Plays sound to all mobs that are map-level contents of an area
/proc/playsound_area(area/A, soundin, vol = 100, channel = 0, status, vol_cat = VOLUME_SFX, list/echo, y_s_offset)
if(!isarea(A))
return FALSE
var/datum/sound_template/S = new()
S.file = soundin
S.volume = vol
S.channel = channel
S.channel = channel ? channel : get_free_channel()
S.status = status
S.volume_cat = vol_cat

S.echo = echo
S.y_s_offset = y_s_offset
var/list/hearers = list()
for(var/mob/living/M in A.contents)
if(!M || !M.client || !M.client.soundOutput)
Expand All @@ -144,16 +148,18 @@
if(prefs && prefs.toggles_sound & SOUND_LOBBY)
playsound_client(src, SSticker.login_music, null, 70, 0, VOLUME_LOBBY, SOUND_CHANNEL_LOBBY, SOUND_STREAM)


/proc/playsound_z(z, soundin, volume = 100, vol_cat = VOLUME_SFX) // Play sound for all online mobs on a given Z-level. Good for ambient sounds.
/// Play sound for all on-map clients on a given Z-level. Good for ambient sounds.
/proc/playsound_z(z, soundin, volume = 100, vol_cat = VOLUME_SFX, echo, y_s_offset)
var/datum/sound_template/S = new()
S.file = soundin
S.volume = volume
S.channel = SOUND_CHANNEL_Z
S.volume_cat = vol_cat
S.echo = echo
S.y_s_offset = y_s_offset
var/list/hearers = list()
for(var/mob/M in GLOB.player_list)
if (M.z in z && M.client.soundOutput)
if((M.z in z) && M.client.soundOutput)
hearers += M.client
SSsound.queue(S, hearers)

Expand Down
10 changes: 6 additions & 4 deletions code/modules/cm_marines/anti_air.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var/obj/structure/anti_air_cannon/almayer_aa_cannon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this variable

You don't need GLOB.AAgunLocation because you can just make a global variable called GLOB.aa_gun and then do GLOB.aa_gun.loc


GLOBAL_VAR_INIT(AAgunLocation,0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not how you do global variables, look at using GLOBAL_DATUM

/obj/structure/anti_air_cannon
name = "\improper IX-50 MGAD Cannon"
desc = "The IX-50 is a state-of-the-art Micro-Gravity and Air Defense system capable of independently tracking and neutralizing threats with rockets strapped onto them."
desc = "This is one of the IX-50 MGAD defense stations. The IX-50 is a state-of-the-art Micro-Gravity and Air Defense system capable of independently tracking and neutralizing threats."
icon = 'icons/effects/128x128.dmi'
icon_state = "anti_air_cannon"
density = 1
Expand All @@ -18,10 +18,12 @@ var/obj/structure/anti_air_cannon/almayer_aa_cannon
var/protecting_section = ""
var/is_disabled = FALSE

/obj/structure/anti_air_cannon/New()
/obj/structure/anti_air_cannon/Initialize()
. = ..()
//()
if(!almayer_aa_cannon)
almayer_aa_cannon = src
GLOB.AAgunLocation = loc

/obj/structure/anti_air_cannon/ex_act()
return
Expand Down Expand Up @@ -70,7 +72,7 @@ var/obj/structure/anti_air_cannon/almayer_aa_cannon
dat += "No MGAD System Detected!<br/>"
else
var/tracking_desc = almayer_aa_cannon.protecting_section ? almayer_aa_cannon.protecting_section : "SYSTEM INACTIVE"
dat += "<h2>MGA defense system</h2>"
dat += "<h2>MGA Point Defense System</h2>"
dat += "<p>Currently tracking: [tracking_desc]</p>"
dat += "<hr/>"

Expand Down
69 changes: 68 additions & 1 deletion code/modules/shuttles/marine_ferry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
// At halftime, we announce whether or not the AA forced the dropship to divert
// The rounding is because transit time is decreased by 10 each loop. Travel time, however, might not be a multiple of 10
if(in_transit_time_left == round(travel_time / 2, 10) && true_crash_target_section != crash_target_section)
marine_announcement("A hostile aircraft on course for the [true_crash_target_section] has been successfully deterred.", "IX-50 MGAD System")
INVOKE_ASYNC(src, .proc/AA_sequence, turfs_int)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this snake_case


var/area/shuttle_area
for(var/turf/T in turfs_int)
Expand Down Expand Up @@ -590,7 +590,74 @@
if(SSticker.mode)
SSticker.mode.is_in_endgame = TRUE
SSticker.mode.force_end_at = world.time + 15000 // 25 mins
//////
////// Le funny immersive crash sequence
////// independent of main crash proc so sleep()s don't matter here. Try keep it under 15s as we only have 45s before crash and we run on BYOND time. We wouldn't want
////// the ds still getting hit during,and after the crash.

////// No combat is really occuring during this point of the round so it should give us more performance overhead to give a nice fireworks display (:
/datum/shuttle/ferry/marine/proc/AA_sequence(turfs_int)
set waitfor = 0
var/sound_to_play = pick(SOUND_DISTANT_AA_FIRE)
var/sound_to_play2 = pick(SOUND_DISTANT_AA_FIRE)
//init the funny spark system
var/datum/effect_system/spark_spread/s = new
var/turf/T
var/mob/M
Comment on lines +605 to +606
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more detailed variable names

var/cause = create_cause_data("IX-50 MGAD")
// Used to define shuttle area during crash
var/area/shuttle_area
var/ship_zlevels = SSmapping.levels_by_trait(ZTRAIT_MARINE_MAIN_SHIP)
// define all shuttle turfs as shuttle_area. This includes some deadspace outside of DS, in which some effects may randomly spawn there. Consider that variety, if you will.
if(!shuttle_area)
for(T as anything in turfs_int)
if(T?.loc)
shuttle_area = T.loc
break
marine_announcement("A hostile aircraft has been detected on course for the [true_crash_target_section]. IX-50 MGAD & ASAT missiles are locked onto target trajectory. Firing for effect.", "ARES")
playsound_z(ship_zlevels, 'sound/effects/alert.ogg', 75, echo = list(-500, -2000, 1000, 500, 0, 0.8, 5, 5), y_s_offset = 10)
for(M in shuttle_area)
if(isXeno(M))
to_chat(M, SPAN_HIGHDANGER("Alarms blare throughout the bird! The fleshy hosts are definately trying something!"))
else
to_chat(M, SPAN_HIGHDANGER("Lock-on alarms and missile warnings blare from the cockpit! Oh crap!"))
Comment on lines +619 to +623
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improve your variable names please they should not be single-letter var names.

Comment on lines +619 to +623
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This micro optimization is just not worth it. Just define M here instead of defining it early on

playsound_area(shuttle_area, 'sound/effects/alert.ogg',75, echo = list(-500, -1500, 1000, 500, 0, 0.8, 5, 5), y_s_offset = 10)
sleep(5 SECONDS)
playsound(GLOB.AAgunLocation, sound_to_play, 100, sound_range = 300, falloff = 250, echo = list(-1000, -3500, 1000, 0, 0, 1, -2000, 0.5, 6, 2), y_s_offset = 10)
playsound_area(shuttle_area, sound_to_play, echo = list(-500, -2000, 1000, 500, 0, 0.8, 5, 5), y_s_offset = 10)
sleep(4 SECONDS) //bullet time lulz
for(M in shuttle_area)
to_chat(M, SPAN_HIGHDANGER("The ship jostles violently as explosions rock the ship!")) //xenos getting hit
to_chat(M, SPAN_HIGHDANGER("You feel the ship turning sharply as it adjusts its course!"))
shake_camera(M, 60, 2)
playsound_area(shuttle_area, 'sound/effects/antiair_explosions.ogg', echo = list(-500, -1500, 1000, 500, 0, 0.8, 5, 5))
// Shit hits the fan
// Everything here is and should be non lethal to even larva. Even if the RNG gods somehow smited one with all of these explosions they will still live.
addtimer(CALLBACK(GLOBAL_PROC, .proc/cell_explosion,pick(turfs_int),5,1,EXPLOSION_FALLOFF_SHAPE_LINEAR,null,cause), 1 SECONDS)
sleep(5)
addtimer(CALLBACK(GLOBAL_PROC, .proc/cell_explosion,pick(turfs_int),5,1,EXPLOSION_FALLOFF_SHAPE_LINEAR,null,cause), 2 SECONDS)
sleep(5)
addtimer(CALLBACK(GLOBAL_PROC, .proc/cell_explosion,pick(turfs_int),5,1,EXPLOSION_FALLOFF_SHAPE_LINEAR,null,cause), 3 SECONDS)
sleep(2 SECONDS)
addtimer(CALLBACK(GLOBAL_PROC, .proc/cell_explosion,pick(turfs_int),5,1,EXPLOSION_FALLOFF_SHAPE_LINEAR,null,cause), 2 SECONDS)
create_shrapnel(pick(turfs_int), rand(5,9), , ,/datum/ammo/bullet/shrapnel/light/effect/, cause)
s.set_up(10, 1, pick(turfs_int)) // Spark system funny
s.start()
sleep(1 SECONDS)
INVOKE_ASYNC(GLOBAL_PROC, .proc/flame_radius,cause, 1, pick(turfs_int), 1, 16, FLAMESHAPE_DEFAULT, null)
create_shrapnel(pick(turfs_int), rand(5,9), , ,/datum/ammo/bullet/shrapnel/light/effect/ver2, cause)
addtimer(CALLBACK(GLOBAL_PROC, .proc/cell_explosion,pick(turfs_int),5,1,EXPLOSION_FALLOFF_SHAPE_LINEAR,null,cause), 3 SECONDS)
new /obj/effect/spawner/gibspawner/robot(pick(turfs_int))
new /obj/effect/spawner/gibspawner/robot(pick(turfs_int)) // A few random ass gibs
s.set_up(10, 1, pick(turfs_int))
s.start()
playsound(GLOB.AAgunLocation, sound_to_play2, 100, sound_range = 300, falloff = 250, echo = list(-1000, -3500, 1000, 0, 0, 1, -2000, 0.5, 6, 2), y_s_offset = 10) // making sure?
playsound_area(shuttle_area, sound_to_play, echo = list(-500, -2000, 1000, 500, 0, 0.8, 5, 5), y_s_offset = 10)
sleep(1 SECONDS)
s.set_up(10, 1, pick(turfs_int))
s.start()
create_shrapnel(pick(turfs_int), rand(5,9), , ,/datum/ammo/bullet/shrapnel/light/effect/ver1, cause)
marine_announcement("A hostile aircraft on course for the [true_crash_target_section] has been successfully deterred. ASAT-21 Rapier IV missiles have misfired and failed to intercept target. Please check ASAT tubes number 2 and 9.", "IX-50 MGAD System")

/datum/shuttle/ferry/marine/short_jump()

Expand Down
Binary file modified sound/effects/alert.ogg
Binary file not shown.
Binary file added sound/effects/distant_aa.ogg
Binary file not shown.
Binary file added sound/effects/distant_aa2.ogg
Binary file not shown.
Binary file added sound/effects/distant_aa_cannon.ogg
Binary file not shown.
Binary file added sound/effects/distant_minigun.ogg
Binary file not shown.
Binary file added sound/effects/distant_minigun2.ogg
Binary file not shown.
Binary file added sound/effects/distant_minigun_short.ogg
Binary file not shown.