diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 0d7d551921..1286775efa 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -48,6 +48,8 @@ var/oxygen = 0 // Moving this up here for easier debugging. + var/playingglowsound //for sound loop + //Temporary values so that we can optimize this //How much the bullets damage should be multiplied by when it is added to the internal variables var/config_bullet_energy = 2 @@ -164,11 +166,17 @@ if(oxygen > 0.8) // with a perfect gas mix, make the power less based on heat icon_state = "[base_icon_state]_glow" + if(!playingglowsound) + start_glow_sound() + else // in normal mode, base the produced energy around the heat temp_factor = 30 icon_state = base_icon_state + if(playingglowsound) + playingglowsound = FALSE + power = max( (removed.temperature * temp_factor / T0C) * oxygen + power, 0) //Total laser power plus an overload //We've generated power, now let's transfer it to the collectors for storing/usage @@ -209,6 +217,24 @@ return 1 +/obj/machinery/power/supermatter_shard/proc/start_glow_sound() //starts the loop + if(!playingglowsound) + playingglowsound = TRUE + playsound(src, 'sound/ambience/supermatterglow.ogg', 50, 0) + addtimer(src, "play_glow_sound", 1.2, FALSE) + return TRUE + else + return FALSE + +/obj/machinery/power/supermatter_shard/proc/play_glow_sound() // loop + if(playingglowsound) + playsound(src, 'sound/ambience/supermatterglow.ogg', 50, 0) + addtimer(src, "play_glow_sound", 1.2, FALSE) + return TRUE + else + playingglowsound = FALSE + return FALSE + /obj/machinery/power/supermatter_shard /obj/machinery/power/supermatter_shard/bullet_act(obj/item/projectile/Proj) diff --git a/sound/ambience/supermatterglow.ogg b/sound/ambience/supermatterglow.ogg new file mode 100644 index 0000000000..7d0632be22 Binary files /dev/null and b/sound/ambience/supermatterglow.ogg differ