Merge pull request #5142 from VOREStation/upstream-merge-6058

[MIRROR] Removes umbrella permastuns. Adds wind mechanics.
This commit is contained in:
Novacat
2019-04-27 22:42:42 -04:00
committed by GitHub
10 changed files with 116 additions and 61 deletions
@@ -1,6 +1,6 @@
#define HUMAN_LOWEST_SLOWDOWN -3
/mob/living/carbon/human/movement_delay()
/mob/living/carbon/human/movement_delay(oldloc, direct)
var/tally = 0
@@ -84,7 +84,7 @@
// Turf related slowdown
var/turf/T = get_turf(src)
tally += calculate_turf_slowdown(T)
tally += calculate_turf_slowdown(T, direct)
// Item related slowdown.
var/item_tally = calculate_item_encumbrance()
@@ -133,8 +133,11 @@
. += max(I.slowdown, 0)
// Similar to above, but for turf slowdown.
/mob/living/carbon/human/proc/calculate_turf_slowdown(turf/T)
if(T && T.movement_cost)
/mob/living/carbon/human/proc/calculate_turf_slowdown(turf/T, direct)
if(!T)
return 0
if(T.movement_cost)
var/turf_move_cost = T.movement_cost
if(istype(T, /turf/simulated/floor/water))
if(species.water_movement)
@@ -144,6 +147,7 @@
if(feet.water_speed)
turf_move_cost = CLAMP(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + feet.water_speed, 15)
. += turf_move_cost
if(istype(T, /turf/simulated/floor/outdoors/snow))
if(species.snow_movement)
turf_move_cost = CLAMP(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + species.snow_movement, 15)
@@ -153,6 +157,19 @@
turf_move_cost = CLAMP(HUMAN_LOWEST_SLOWDOWN, turf_move_cost + feet.snow_speed, 15)
. += turf_move_cost
// Wind makes it easier or harder to move, depending on if you're with or against the wind.
if(T.outdoors)
var/datum/planet/P = SSplanets.z_to_planet[z]
if(P)
var/datum/weather_holder/WH = P.weather_holder
if(WH && WH.wind_speed) // Is there any wind?
// With the wind.
if(direct & WH.wind_dir)
. = max(. - WH.wind_speed, -1) // Wind speedup is capped to prevent supersonic speeds from a storm.
// Against it.
else if(direct & reverse_dir[WH.wind_dir])
. += WH.wind_speed
#undef HUMAN_LOWEST_SLOWDOWN
/mob/living/carbon/human/Process_Spacemove(var/check_drift = 0)
@@ -1785,12 +1785,6 @@
hud_updateflag = 0
/mob/living/carbon/human/handle_stunned()
if(!can_feel_pain())
stunned = 0
return 0
return ..()
/mob/living/carbon/human/handle_fire()
if(..())
return
+1 -1
View File
@@ -146,7 +146,7 @@
return M
return 0
/mob/proc/movement_delay()
/mob/proc/movement_delay(oldloc, direct)
return 0
/mob/proc/Life()
+1 -1
View File
@@ -203,7 +203,7 @@
mob.move_delay += config.run_speed
if("walk")
mob.move_delay += config.walk_speed
mob.move_delay += mob.movement_delay()
mob.move_delay += mob.movement_delay(n, direct)
if(istype(mob.buckled, /obj/vehicle) || istype(mob.buckled, /mob)) //VOREStation Edit: taur riding. I think.
//manually set move_delay for vehicles so we don't inherit any mob movement penalties
+10 -18
View File
@@ -197,6 +197,8 @@ var/datum/planet/sif/planet_sif = null
icon_state = "snowfall_med"
temp_high = T0C // 0c
temp_low = 243.15 // -30c
wind_high = 2
wind_low = 0
light_modifier = 0.5
flight_failure_modifier = 5
transition_chances = list(
@@ -229,6 +231,8 @@ var/datum/planet/sif/planet_sif = null
icon_state = "snowfall_heavy"
temp_high = 243.15 // -30c
temp_low = 233.15 // -40c
wind_high = 4
wind_low = 2
light_modifier = 0.3
flight_failure_modifier = 10
transition_chances = list(
@@ -258,6 +262,8 @@ var/datum/planet/sif/planet_sif = null
/datum/weather/sif/rain
name = "rain"
icon_state = "rain"
wind_high = 2
wind_low = 1
light_modifier = 0.5
effect_message = "<span class='warning'>Rain falls on you.</span>"
@@ -306,6 +312,8 @@ var/datum/planet/sif/planet_sif = null
icon_state = "storm"
temp_high = 243.15 // -30c
temp_low = 233.15 // -40c
wind_high = 4
wind_low = 2
light_modifier = 0.3
flight_failure_modifier = 10
effect_message = "<span class='warning'>Rain falls on you, drenching you in water.</span>"
@@ -337,24 +345,6 @@ var/datum/planet/sif/planet_sif = null
var/turf/T = get_turf(L)
if(!T.outdoors)
continue // They're indoors, so no need to rain on them.
// Lazy wind code
if(prob(10))
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='danger'>You struggle to keep hold of your umbrella!</span>")
L.Stun(20) // This is not nearly as long as it seems
playsound(L, 'sound/effects/rustle1.ogg', 100, 1) // Closest sound I've got to "Umbrella in the wind"
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='danger'>A gust of wind yanks the umbrella from your hand!</span>")
playsound(L, 'sound/effects/rustle1.ogg', 100, 1)
L.drop_from_inventory(U)
U.toggle_umbrella()
U.throw_at(get_edge_target_turf(U, pick(alldirs)), 8, 1, L)
// 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()
@@ -492,6 +482,8 @@ var/datum/planet/sif/planet_sif = null
light_color = "#FF0000"
temp_high = 323.15 // 50c
temp_low = 313.15 // 40c
wind_high = 6
wind_low = 3
flight_failure_modifier = 50
transition_chances = list(
WEATHER_ASH_STORM = 100
+25 -8
View File
@@ -2,8 +2,8 @@
var/datum/planet/our_planet = null // Reference to the planet datum that holds this datum.
var/datum/weather/current_weather = null // The current weather that is affecting the planet.
var/temperature = T20C // The temperature to set planetary walls to.
var/wind_dir = 0 // Not implemented.
var/wind_speed = 0 // Not implemented.
var/wind_dir = 0 // The direction the wind is blowing. Moving against the wind slows you down, while moving with it speeds you up.
var/wind_speed = 0 // How fast or slow a mob can be due to wind acting on them.
var/list/allowed_weather_types = list() // Assoc list of weather identifiers, containing the actual weather datum.
var/list/roundstart_weather_chances = list() // Assoc list of weather identifiers and their odds of being picked to happen at roundstart.
var/next_weather_shift = null // world.time when the weather subsystem will advance the forecast.
@@ -42,6 +42,7 @@
update_icon_effects()
update_temperature()
update_wind()
if(old_light_modifier && current_weather.light_modifier != old_light_modifier) // Updating the sun should be done sparingly.
our_planet.update_sun()
log_debug("[our_planet.name]'s weather is now [new_weather], with a temperature of [temperature]&deg;K ([temperature - T0C]&deg;C | [temperature * 1.8 - 459.67]&deg;F).")
@@ -107,6 +108,25 @@
temperature = LERP(current_weather.temp_low, current_weather.temp_high, our_planet.sun_position)
our_planet.needs_work |= PLANET_PROCESS_TEMP
/datum/weather_holder/proc/update_wind()
var/new_wind_speed = rand(current_weather.wind_low, current_weather.wind_high)
if(!new_wind_speed)
wind_speed = 0
wind_dir = 0
return
wind_speed = new_wind_speed
wind_dir = pick(alldirs)
var/message = "You feel the wind blowing [wind_speed > 2 ? "strongly ": ""]towards the <b>[dir2text(wind_dir)]</b>."
message_all_outdoor_players(span("warning", message))
/datum/weather_holder/proc/message_all_outdoor_players(message)
for(var/mob/M in player_list) // Don't need to care about clientless mobs.
if(M.z in our_planet.expected_z_levels)
var/turf/T = get_turf(M)
if(!T.outdoors)
continue
to_chat(M, message)
/datum/weather_holder/proc/get_weather_datum(desired_type)
return allowed_weather_types[desired_type]
@@ -116,12 +136,7 @@
return
var/message = pick(current_weather.transition_messages) // So everyone gets the same message.
for(var/mob/M in player_list) // Don't need to care about clientless mobs.
if(M.z in our_planet.expected_z_levels)
var/turf/T = get_turf(M)
if(!T.outdoors)
continue
to_chat(M, message)
message_all_outdoor_players(message)
/datum/weather
var/name = "weather base"
@@ -129,6 +144,8 @@
var/icon_state = null // Icon to apply to turf undergoing weather.
var/temp_high = T20C // Temperature to apply when at noon.
var/temp_low = T0C // Temperature to apply when at midnight.
var/wind_high = 0 // Upper bound for mob slowdown when walking against the wind, and speedup when walking with it. Randomized between this and wind_low.
var/wind_low = 0 // Lower bound for above.
var/light_modifier = 1.0 // Lower numbers means more darkness.
var/light_color = null // If set, changes how the day/night light looks.
var/flight_failure_modifier = 0 // Some types of weather make flying harder, and therefore make crashes more likely. (This is not implemented)