Merge pull request #3891 from VOREStation/upstream-merge-5350

[MIRROR] Weather is shorter, hail is less deadly.
This commit is contained in:
Aronai Sieyes
2018-06-16 15:35:56 -04:00
committed by GitHub
3 changed files with 131 additions and 40 deletions

View File

@@ -184,6 +184,7 @@ datum/weather/sif
)
/datum/weather/sif/snow/process_effects()
..()
for(var/turf/simulated/floor/outdoors/snow/S in SSplanets.new_outdoor_turfs) //This didn't make any sense before SSplanets, either
if(S.z in holder.our_planet.expected_z_levels)
for(var/dir_checked in cardinal)
@@ -207,6 +208,7 @@ datum/weather/sif
)
/datum/weather/sif/blizzard/process_effects()
..()
for(var/turf/simulated/floor/outdoors/snow/S in SSplanets.new_outdoor_turfs) //This didn't make any sense before SSplanets, either
if(S.z in holder.our_planet.expected_z_levels)
for(var/dir_checked in cardinal)
@@ -219,6 +221,8 @@ datum/weather/sif
name = "rain"
icon_state = "rain"
light_modifier = 0.5
effect_message = "<span class='warning'>Rain falls on you.</span>"
transition_chances = list(
WEATHER_OVERCAST = 25,
WEATHER_LIGHT_SNOW = 10,
@@ -228,6 +232,7 @@ datum/weather/sif
)
/datum/weather/sif/rain/process_effects()
..()
for(var/mob/living/L in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
@@ -238,16 +243,19 @@ datum/weather/sif
if(istype(L.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_active_hand()
if(U.open)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
if(show_message)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
continue
else if(istype(L.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_inactive_hand()
if(U.open)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
if(show_message)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
continue
L.water_act(1)
to_chat(L, "<span class='warning'>Rain falls on you.</span>")
if(show_message)
to_chat(L, effect_message)
/datum/weather/sif/storm
name = "storm"
@@ -256,6 +264,8 @@ datum/weather/sif
temp_low = 233.15 // -40c
light_modifier = 0.3
flight_failure_modifier = 10
transition_chances = list(
WEATHER_RAIN = 45,
WEATHER_STORM = 40,
@@ -264,6 +274,7 @@ datum/weather/sif
)
/datum/weather/sif/storm/process_effects()
..()
for(var/mob/living/L in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
@@ -294,6 +305,10 @@ datum/weather/sif
temp_low = 243.15 // -30c
light_modifier = 0.3
flight_failure_modifier = 15
timer_low_bound = 2
timer_high_bound = 5
effect_message = "<span class='warning'>The hail smacks into you!</span>"
transition_chances = list(
WEATHER_RAIN = 45,
WEATHER_STORM = 40,
@@ -302,6 +317,7 @@ datum/weather/sif
)
/datum/weather/sif/hail/process_effects()
..()
for(var/mob/living/carbon/human/H in living_mob_list)
if(H.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(H)
@@ -309,15 +325,18 @@ datum/weather/sif
continue // They're indoors, so no need to pelt them with ice.
// If they have an open umbrella, it'll guard from rain
// Message plays every time the umbrella gets stolen, just so they're especially aware of what's happening
if(istype(H.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = H.get_active_hand()
if(U.open)
to_chat(H, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
if(show_message)
to_chat(H, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
continue
else if(istype(H.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = H.get_inactive_hand()
if(U.open)
to_chat(H, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
if(show_message)
to_chat(H, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
continue
var/target_zone = pick(BP_ALL)
@@ -330,8 +349,9 @@ datum/weather/sif
if(amount_soaked >= 10)
continue // No need to apply damage.
H.apply_damage(rand(5, 10), BRUTE, target_zone, amount_blocked, amount_soaked, used_weapon = "hail")
to_chat(H, "<span class='warning'>The hail smacks into you!</span>")
H.apply_damage(rand(1, 3), BRUTE, target_zone, amount_blocked, amount_soaked, used_weapon = "hail")
if(show_message)
to_chat(H, effect_message)
/datum/weather/sif/blood_moon
name = "blood moon"

View File

@@ -25,7 +25,7 @@
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.
current_weather = allowed_weather_types[new_weather]
next_weather_shift = world.time + rand(20, 30) MINUTES
next_weather_shift = world.time + rand(current_weather.timer_low_bound, current_weather.timer_high_bound) MINUTES
update_icon_effects()
update_temperature()
@@ -66,8 +66,20 @@
var/flight_failure_modifier = 0 // Some types of weather make flying harder, and therefore make crashes more likely.
var/transition_chances = list() // Assoc list
var/datum/weather_holder/holder = null
var/timer_low_bound = 5 // How long this weather must run before it tries to change, in minutes
var/timer_high_bound = 10 // How long this weather can run before it tries to change, in minutes
var/effect_message = null // Should be a string, this is what is shown to a mob caught in the weather
var/last_message = 0 // Keeps track of when the weather last tells EVERY player it's hitting them
var/message_delay = 10 SECONDS // Delay in between weather hit messages
var/show_message = FALSE // Is set to TRUE and plays the messsage every [message_delay]
/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
if(world.time >= last_message + message_delay)
last_message = world.time // Reset the timer
show_message = TRUE // Tell the rest of the process that we need to make a message
return
// All this does is hold the weather icon.

View File

@@ -127,7 +127,7 @@ var/datum/planet/virgo3b/planet_virgo3b = null
WEATHER_HAIL = 2.5
)
datum/weather/virgo3b
/datum/weather/virgo3b
name = "virgo3b base"
temp_high = 243.15 // -20c
temp_low = 233.15 // -30c
@@ -154,8 +154,8 @@ datum/weather/virgo3b
/datum/weather/virgo3b/light_snow
name = "light snow"
icon_state = "snowfall_light"
temp_high = 238.15 // -25c
temp_low = 228.15 // -35c
temp_high = 235
temp_low = 225
light_modifier = 0.7
transition_chances = list(
WEATHER_OVERCAST = 20,
@@ -167,9 +167,10 @@ datum/weather/virgo3b
/datum/weather/virgo3b/snow
name = "moderate snow"
icon_state = "snowfall_med"
temp_high = 233.15 // -30c
temp_low = 223.15 // -40c
temp_high = 230
temp_low = 220
light_modifier = 0.5
flight_failure_modifier = 5
transition_chances = list(
WEATHER_LIGHT_SNOW = 20,
WEATHER_SNOW = 50,
@@ -179,7 +180,8 @@ datum/weather/virgo3b
)
/datum/weather/virgo3b/snow/process_effects()
for(var/turf/simulated/floor/outdoors/snow/S in SSplanets.new_outdoor_turfs) //This does not make sense
..()
for(var/turf/simulated/floor/outdoors/snow/S in SSplanets.new_outdoor_turfs) //This didn't make any sense before SSplanets, either
if(S.z in holder.our_planet.expected_z_levels)
for(var/dir_checked in cardinal)
var/turf/simulated/floor/T = get_step(S, dir_checked)
@@ -190,9 +192,10 @@ datum/weather/virgo3b
/datum/weather/virgo3b/blizzard
name = "blizzard"
icon_state = "snowfall_heavy"
temp_high = 223.15 // -40c
temp_low = 203.15 // -60c
temp_high = 215
temp_low = 200
light_modifier = 0.3
flight_failure_modifier = 10
transition_chances = list(
WEATHER_SNOW = 45,
WEATHER_BLIZZARD = 40,
@@ -201,7 +204,8 @@ datum/weather/virgo3b
)
/datum/weather/virgo3b/blizzard/process_effects()
for(var/turf/simulated/floor/outdoors/snow/S in SSplanets.new_outdoor_turfs) //This does not make sense
..()
for(var/turf/simulated/floor/outdoors/snow/S in SSplanets.new_outdoor_turfs) //This didn't make any sense before SSplanets, either
if(S.z in holder.our_planet.expected_z_levels)
for(var/dir_checked in cardinal)
var/turf/simulated/floor/T = get_step(S, dir_checked)
@@ -213,6 +217,8 @@ datum/weather/virgo3b
name = "rain"
icon_state = "rain"
light_modifier = 0.5
effect_message = "<span class='warning'>Rain falls on you.</span>"
transition_chances = list(
WEATHER_OVERCAST = 25,
WEATHER_LIGHT_SNOW = 10,
@@ -222,21 +228,38 @@ datum/weather/virgo3b
)
/datum/weather/virgo3b/rain/process_effects()
..()
for(var/mob/living/L in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
if(!T.outdoors)
return // They're indoors, so no need to rain on them.
continue // They're indoors, so no need to rain on them.
L.adjust_fire_stacks(-5)
to_chat(L, "<span class='warning'>Rain falls on you.</span>")
// If they have an open umbrella, it'll guard from rain
if(istype(L.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_active_hand()
if(U.open)
if(show_message)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
continue
else if(istype(L.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_inactive_hand()
if(U.open)
if(show_message)
to_chat(L, "<span class='notice'>Rain patters softly onto your umbrella</span>")
continue
L.water_act(1)
if(show_message)
to_chat(L, effect_message)
/datum/weather/virgo3b/storm
name = "storm"
icon_state = "storm"
temp_high = 233.15 // -30c
temp_low = 213.15 // -50c
light_modifier = 0.3
flight_failure_modifier = 10
transition_chances = list(
WEATHER_RAIN = 45,
WEATHER_STORM = 40,
@@ -244,53 +267,89 @@ datum/weather/virgo3b
WEATHER_OVERCAST = 5
)
/datum/weather/virgo3b/rain/process_effects()
/datum/weather/virgo3b/storm/process_effects()
..()
for(var/mob/living/L in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
if(!T.outdoors)
return // They're indoors, so no need to rain on them.
continue // They're indoors, so no need to rain on them.
L.adjust_fire_stacks(-10)
// If they have an open umbrella, it'll get stolen by the wind
if(istype(L.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_active_hand()
if(U.open)
to_chat(L, "<span class='warning'>A gust of wind yanks the umbrella from your hand!</span>")
L.drop_from_inventory(U)
U.throw_at(get_edge_target_turf(U, pick(alldirs)), 8, 1, L)
else if(istype(L.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = L.get_inactive_hand()
if(U.open)
to_chat(L, "<span class='warning'>A gust of wind yanks the umbrella from your hand!</span>")
L.drop_from_inventory(U)
U.throw_at(get_edge_target_turf(U, pick(alldirs)), 8, 1, L)
L.water_act(2)
to_chat(L, "<span class='warning'>Rain falls on you, drenching you in water.</span>")
/datum/weather/virgo3b/hail
name = "hail"
icon_state = "hail"
temp_high = 233.15 // -30c
temp_low = 213.15 // -50c
light_modifier = 0.3
flight_failure_modifier = 15
timer_low_bound = 2
timer_high_bound = 5
effect_message = "<span class='warning'>The hail smacks into you!</span>"
transition_chances = list(
WEATHER_RAIN = 45,
WEATHER_STORM = 10,
WEATHER_HAIL = 40,
WEATHER_STORM = 40,
WEATHER_HAIL = 10,
WEATHER_OVERCAST = 5
)
/datum/weather/virgo3b/hail/process_effects()
for(var/mob/living/L in living_mob_list)
if(L.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(L)
..()
for(var/mob/living/carbon/human/H in living_mob_list)
if(H.z in holder.our_planet.expected_z_levels)
var/turf/T = get_turf(H)
if(!T.outdoors)
return // They're indoors, so no need to pelt them with ice.
continue // They're indoors, so no need to pelt them with ice.
// If they have an open umbrella, it'll guard from rain
// Message plays every time the umbrella gets stolen, just so they're especially aware of what's happening
if(istype(H.get_active_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = H.get_active_hand()
if(U.open)
if(show_message)
to_chat(H, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
continue
else if(istype(H.get_inactive_hand(), /obj/item/weapon/melee/umbrella))
var/obj/item/weapon/melee/umbrella/U = H.get_inactive_hand()
if(U.open)
if(show_message)
to_chat(H, "<span class='notice'>Hail patters gently onto your umbrella.</span>")
continue
var/target_zone = pick(BP_ALL)
var/amount_blocked = L.run_armor_check(target_zone, "melee")
var/amount_soaked = L.get_armor_soak(target_zone, "melee")
var/amount_blocked = H.run_armor_check(target_zone, "melee")
var/amount_soaked = H.get_armor_soak(target_zone, "melee")
if(amount_blocked >= 100)
return // No need to apply damage.
continue // No need to apply damage.
if(amount_soaked >= 10)
return // No need to apply damage.
continue // No need to apply damage.
L.apply_damage(rand(5, 10), BRUTE, target_zone, amount_blocked, amount_soaked, used_weapon = "hail")
to_chat(L, "<span class='warning'>The hail raining down on you [L.can_feel_pain() ? "hurts" : "damages you"]!</span>")
H.apply_damage(rand(1, 3), BRUTE, target_zone, amount_blocked, amount_soaked, used_weapon = "hail")
if(show_message)
to_chat(H, effect_message)
/datum/weather/virgo3b/blood_moon
name = "blood moon"
light_modifier = 0.5
light_color = "#FF0000"
flight_failure_modifier = 25
transition_chances = list(
WEATHER_BLOODMOON = 100
)
)