Adds Various Sounds, Looping Sound System

This commit is contained in:
Anewbe
2018-12-31 09:01:31 -06:00
committed by Novacat
parent 7a13562736
commit 09b01407e3
133 changed files with 1313 additions and 206 deletions

View File

@@ -14,7 +14,7 @@
var/sun_position = 0 // 0 means midnight, 1 means noon.
var/list/sun = list("range","brightness","color","lum_r","lum_g","lum_b")
var/list/datum/lighting_corner/sunlit_corners = list()
var/expected_z_levels = list()
var/list/expected_z_levels = list()
var/turf/unsimulated/wall/planetary/planetary_wall_type = /turf/unsimulated/wall/planetary

View File

@@ -121,7 +121,10 @@ var/datum/planet/sif/planet_sif = null
WEATHER_RAIN = new /datum/weather/sif/rain(),
WEATHER_STORM = new /datum/weather/sif/storm(),
WEATHER_HAIL = new /datum/weather/sif/hail(),
WEATHER_BLOOD_MOON = new /datum/weather/sif/blood_moon()
WEATHER_BLOOD_MOON = new /datum/weather/sif/blood_moon(),
WEATHER_EMBERFALL = new /datum/weather/sif/emberfall(),
WEATHER_ASH_STORM = new /datum/weather/sif/ash_storm(),
WEATHER_FALLOUT = new /datum/weather/sif/fallout()
)
roundstart_weather_chances = list(
WEATHER_CLEAR = 30,
@@ -208,6 +211,8 @@ var/datum/planet/sif/planet_sif = null
"It's starting to snow.",
"The air feels much colder as snowflakes fall from above."
)
outdoor_sounds_type = /datum/looping_sound/weather/outside_snow
indoor_sounds_type = /datum/looping_sound/weather/inside_snow
/datum/weather/sif/snow/process_effects()
..()
@@ -237,6 +242,8 @@ var/datum/planet/sif/planet_sif = null
"Strong winds howl around you as a blizzard appears.",
"It starts snowing heavily, and it feels extremly cold now."
)
outdoor_sounds_type = /datum/looping_sound/weather/outside_blizzard
indoor_sounds_type = /datum/looping_sound/weather/inside_blizzard
/datum/weather/sif/blizzard/process_effects()
..()
@@ -265,6 +272,8 @@ var/datum/planet/sif/planet_sif = null
transition_messages = list(
"The sky is dark, and rain falls down upon you."
)
// outdoor_sounds_type = /datum/looping_sound/weather/rain
// indoor_sounds_type = /datum/looping_sound/weather/rain/indoors
/datum/weather/sif/rain/process_effects()
..()
@@ -310,6 +319,8 @@ var/datum/planet/sif/planet_sif = null
"Loud thunder is heard in the distance.",
"A bright flash heralds the approach of a storm."
)
// outdoor_sounds_type = /datum/looping_sound/weather/rain
// indoor_sounds_type = /datum/looping_sound/weather/rain/indoors
transition_chances = list(
@@ -417,7 +428,7 @@ var/datum/planet/sif/planet_sif = null
if(show_message)
to_chat(H, "<span class='notice'>Hail patters onto your umbrella.</span>")
continue
var/target_zone = pick(BP_ALL)
var/amount_blocked = H.run_armor_check(target_zone, "melee")
var/amount_soaked = H.get_armor_soak(target_zone, "melee")
@@ -435,6 +446,10 @@ var/datum/planet/sif/planet_sif = null
if(show_message)
to_chat(H, effect_message)
// These never happen naturally, and are for adminbuse.
// A culty weather.
/datum/weather/sif/blood_moon
name = "blood moon"
light_modifier = 0.5
@@ -446,4 +461,114 @@ var/datum/planet/sif/planet_sif = null
observed_message = "Everything is red. Something really wrong is going on."
transition_messages = list(
"The sky turns blood red!"
<<<<<<< refs/remotes/VOREStation/master
)
=======
<<<<<<< HEAD
)
=======
)
outdoor_sounds_type = /datum/looping_sound/weather/wind
indoor_sounds_type = /datum/looping_sound/weather/wind/indoors
// Ash and embers fall forever, such as from a volcano or something.
/datum/weather/sif/emberfall
name = "emberfall"
icon_state = "ashfall_light"
light_modifier = 0.7
light_color = "#880000"
temp_high = 293.15 // 20c
temp_low = 283.15 // 10c
flight_failure_modifier = 20
transition_chances = list(
WEATHER_EMBERFALL = 100
)
observed_message = "Soot, ash, and embers float down from above."
transition_messages = list(
"Gentle embers waft down around you like grotesque snow."
)
outdoor_sounds_type = /datum/looping_sound/weather/wind
indoor_sounds_type = /datum/looping_sound/weather/wind/indoors
// Like the above but a lot more harmful.
/datum/weather/sif/ash_storm
name = "ash storm"
icon_state = "ashfall_heavy"
light_modifier = 0.1
light_color = "#FF0000"
temp_high = 323.15 // 50c
temp_low = 313.15 // 40c
flight_failure_modifier = 50
transition_chances = list(
WEATHER_ASH_STORM = 100
)
observed_message = "All that can be seen is black smoldering ash."
transition_messages = list(
"Smoldering clouds of scorching ash billow down around you!"
)
// Lets recycle.
outdoor_sounds_type = /datum/looping_sound/weather/outside_blizzard
indoor_sounds_type = /datum/looping_sound/weather/inside_blizzard
/datum/weather/sif/ash_storm/process_effects()
..()
for(var/thing in living_mob_list)
var/mob/living/L = thing
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
if(!T.outdoors)
continue // They're indoors, so no need to burn them with ash.
L.inflict_heat_damage(rand(1, 3))
// Totally radical.
/datum/weather/sif/fallout
name = "fallout"
icon_state = "fallout"
light_modifier = 0.7
light_color = "#CCFFCC"
flight_failure_modifier = 30
transition_chances = list(
WEATHER_FALLOUT = 100
)
observed_message = "Radioactive soot and ash rains down from the heavens."
transition_messages = list(
"Radioactive soot and ash start to float down around you, contaminating whatever they touch."
)
outdoor_sounds_type = /datum/looping_sound/weather/wind
indoor_sounds_type = /datum/looping_sound/weather/wind/indoors
// How much radiation a mob gets while on an outside tile.
var/direct_rad_low = RAD_LEVEL_LOW
var/direct_rad_high = RAD_LEVEL_MODERATE
// How much radiation is bursted onto a random tile near a mob.
var/fallout_rad_low = RAD_LEVEL_HIGH
var/fallout_rad_high = RAD_LEVEL_VERY_HIGH
/datum/weather/sif/fallout/process_effects()
..()
for(var/thing in living_mob_list)
var/mob/living/L = thing
if(L.z in holder.our_planet.expected_z_levels)
irradiate_nearby_turf(L)
var/turf/T = get_turf(L)
if(!T.outdoors)
continue // They're indoors, so no need to irradiate them with fallout.
L.rad_act(rand(direct_rad_low, direct_rad_high))
// This makes random tiles near people radioactive for awhile.
// Tiles far away from people are left alone, for performance.
/datum/weather/sif/fallout/proc/irradiate_nearby_turf(mob/living/L)
if(!istype(L))
return
var/list/turfs = RANGE_TURFS(world.view, L)
var/turf/T = pick(turfs) // We get one try per tick.
if(!istype(T))
return
if(T.outdoors)
radiation_repository.radiate(T, rand(fallout_rad_low, fallout_rad_high))
>>>>>>> 5fb77b3... Merge pull request #5791 from Neerti/looping_sounds
>>>>>>> Adds Various Sounds, Looping Sound System

View File

@@ -25,13 +25,19 @@
/datum/weather_holder/proc/change_weather(var/new_weather)
var/old_light_modifier = null
var/old_weather = null
var/datum/weather/old_weather = null
if(current_weather)
old_light_modifier = current_weather.light_modifier // We store the old one, so we can determine if recalculating the sun is needed.
old_weather = current_weather
current_weather = allowed_weather_types[new_weather]
next_weather_shift = world.time + rand(current_weather.timer_low_bound, current_weather.timer_high_bound) MINUTES
if(new_weather != old_weather)
if(istype(old_weather)) // At roundstart this is null.
old_weather.process_sounds() // Ensure that people who should hear the ending sound will hear it.
old_weather.stop_sounds()
current_weather.process_sounds() // Same story, make sure the starting sound is heard.
current_weather.start_sounds()
show_transition_message()
update_icon_effects()
@@ -48,7 +54,7 @@
advance_forecast()
else
current_weather.process_effects()
current_weather.process_sounds()
// Should only have to be called once.
@@ -140,6 +146,18 @@
var/list/transition_messages = list()// List of messages shown to all outdoor mobs when this weather is transitioned to, for flavor. Not shown if already this weather.
var/observed_message = null // What is shown to a player 'examining' the weather.
// Looping sound datums for weather sounds, both inside and outside.
var/datum/looping_sound/outdoor_sounds = null
var/datum/looping_sound/indoor_sounds = null
var/outdoor_sounds_type = null
var/indoor_sounds_type = null
/datum/weather/New()
if(outdoor_sounds_type)
outdoor_sounds = new outdoor_sounds_type(list(), FALSE, TRUE)
if(indoor_sounds_type)
indoor_sounds = new indoor_sounds_type(list(), FALSE, TRUE)
/datum/weather/proc/process_effects()
show_message = FALSE // Need to reset the show_message var, just in case
if(effect_message) // Only bother with the code below if we actually need to display something
@@ -148,6 +166,71 @@
show_message = TRUE // Tell the rest of the process that we need to make a message
return
/datum/weather/proc/process_sounds()
if(!outdoor_sounds && !indoor_sounds) // No point bothering if we have no sounds.
return
for(var/z_level in 1 to world.maxz)
for(var/a in GLOB.players_by_zlevel[z_level])
var/mob/M = a
// Check if the mob left the z-levels we control. If so, make the sounds stop for them.
if(!(z_level in holder.our_planet.expected_z_levels))
hear_indoor_sounds(M, FALSE)
hear_outdoor_sounds(M, FALSE)
continue
// Otherwise they should hear some sounds, depending on if they're inside or not.
var/turf/T = get_turf(M)
if(istype(T))
if(T.outdoors) // Mob is currently outdoors.
hear_outdoor_sounds(M, TRUE)
hear_indoor_sounds(M, FALSE)
else // Mob is currently indoors.
hear_outdoor_sounds(M, FALSE)
hear_indoor_sounds(M, TRUE)
else
hear_indoor_sounds(M, FALSE)
hear_outdoor_sounds(M, FALSE)
/datum/weather/proc/start_sounds()
if(outdoor_sounds)
outdoor_sounds.start()
if(indoor_sounds)
indoor_sounds.start()
/datum/weather/proc/stop_sounds()
if(outdoor_sounds)
outdoor_sounds.stop()
if(indoor_sounds)
indoor_sounds.stop()
// Stop everything just in case.
for(var/z_level in 1 to world.maxz)
for(var/a in GLOB.players_by_zlevel[z_level])
hear_indoor_sounds(a, FALSE)
hear_outdoor_sounds(a, FALSE)
// Adds or removes someone from the outdoor list.
/datum/weather/proc/hear_outdoor_sounds(mob/M, adding)
if(!outdoor_sounds)
return
if(adding)
outdoor_sounds.output_atoms |= M
return
outdoor_sounds.output_atoms -= M
// Ditto, for indoors.
/datum/weather/proc/hear_indoor_sounds(mob/M, adding)
if(!indoor_sounds)
return
if(adding)
indoor_sounds.output_atoms |= M
return
indoor_sounds.output_atoms -= M
// All this does is hold the weather icon.
/atom/movable/weather_visuals
icon = 'icons/effects/weather.dmi'