Merge pull request #3611 from Citadel-Station-13/upstream-merge-31945

[MIRROR] Adds ambience to the SM and portable generators
This commit is contained in:
LetterJay
2017-10-27 02:16:02 -04:00
committed by GitHub
11 changed files with 36 additions and 2 deletions

View File

@@ -15,6 +15,15 @@
var/power_output = 1
var/consumption = 0
var/base_icon = "portgen0"
var/datum/looping_sound/generator/soundloop
/obj/machinery/power/port_gen/Initialize()
. = ..()
soundloop = new(list(src), active)
/obj/machinery/power/port_gen/Destroy()
QDEL_NULL(soundloop)
return ..()
/obj/machinery/power/port_gen/proc/HasFuel() //Placeholder for fuel check.
return 1
@@ -36,11 +45,13 @@
add_avail(power_gen * power_output)
UseFuel()
src.updateDialog()
soundloop.start()
else
active = 0
handleInactive()
update_icon()
soundloop.stop()
/obj/machinery/power/port_gen/attack_hand(mob/user)
if(..())

View File

@@ -135,6 +135,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard)
var/is_main_engine = FALSE
var/datum/looping_sound/supermatter/soundloop
/obj/machinery/power/supermatter_shard/Initialize()
. = ..()
SSair.atmos_machinery += src
@@ -149,6 +151,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard)
if(is_main_engine)
GLOB.main_supermatter_engine = src
soundloop = new(list(src), TRUE)
/obj/machinery/power/supermatter_shard/Destroy()
investigate_log("has been destroyed.", INVESTIGATE_SUPERMATTER)
SSair.atmos_machinery -= src
@@ -157,7 +161,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard)
QDEL_NULL(countdown)
if(is_main_engine && GLOB.main_supermatter_engine == src)
GLOB.main_supermatter_engine = null
. = ..()
QDEL_NULL(soundloop)
return ..()
/obj/machinery/power/supermatter_shard/examine(mob/user)
..()
@@ -251,6 +256,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_shard)
if(!istype(T)) //We are in a crate or somewhere that isn't turf, if we return to turf resume processing but for now.
return //Yeah just stop.
if(power)
soundloop.volume = min(50, (round(power, 50)/50)+1) // 5 +1 volume per 20 power. 2500 power is max
//Ok, get the air from the turf
var/datum/gas_mixture/env = T.return_air()