diff --git a/code/game/objects/items/devices/communicator/UI.dm b/code/game/objects/items/devices/communicator/UI.dm index 69f5bd0d4b7..e37587812a0 100644 --- a/code/game/objects/items/devices/communicator/UI.dm +++ b/code/game/objects/items/devices/communicator/UI.dm @@ -77,6 +77,8 @@ "Temperature" = planet.weather_holder.temperature - T0C, "High" = planet.weather_holder.current_weather.temp_high - T0C, "Low" = planet.weather_holder.current_weather.temp_low - T0C, + "WindDir" = planet.weather_holder.wind_dir ? dir2text(planet.weather_holder.wind_dir) : "None", + "WindSpeed" = planet.weather_holder.wind_speed ? "[planet.weather_holder.wind_speed > 2 ? "Severe" : "Normal"]" : "None", "Forecast" = english_list(planet.weather_holder.forecast, and_text = "→", comma_text = "→", final_comma_text = "→") // Unicode RIGHTWARDS ARROW. ) weather[++weather.len] = W diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 187ebd4e1ef..f0f24f0db2d 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -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) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 32cc8939bc3..fe409a9799f 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -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 diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index d13533a758d..8882274f7c8 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -146,7 +146,7 @@ return M return 0 -/mob/proc/movement_delay() +/mob/proc/movement_delay(oldloc, direct) return 0 /mob/proc/Life() diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index fb26891af52..3dc76769fba 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -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 diff --git a/code/modules/planet/sif.dm b/code/modules/planet/sif.dm index 3ee2fdd9769..eada6f33cbe 100644 --- a/code/modules/planet/sif.dm +++ b/code/modules/planet/sif.dm @@ -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 = "Rain falls on you." @@ -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 = "Rain falls on you, drenching you in water." @@ -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, "You struggle to keep hold of your umbrella!") - 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, "A gust of wind yanks the umbrella from your hand!") - 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 diff --git a/code/modules/planet/weather.dm b/code/modules/planet/weather.dm index 6e4447f4e9f..c5202ab067c 100644 --- a/code/modules/planet/weather.dm +++ b/code/modules/planet/weather.dm @@ -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]°K ([temperature - T0C]°C | [temperature * 1.8 - 459.67]°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 [dir2text(wind_dir)]." + 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) diff --git a/html/changelogs/Neerti-Wind.yml b/html/changelogs/Neerti-Wind.yml new file mode 100644 index 00000000000..928cbbbd0d4 --- /dev/null +++ b/html/changelogs/Neerti-Wind.yml @@ -0,0 +1,38 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Neerti + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "During severe weather such as storms and blizzards, wind can cause you to move slower or faster in specific directions." + - rscadd: "Weather application in the communicator displays wind direction and severity." + - rscdel: "Holding umbrellas while in a storm no longer stuns you." diff --git a/maps/tether/tether_virgo3b.dm b/maps/tether/tether_virgo3b.dm index d7208204dff..882e701abdf 100644 --- a/maps/tether/tether_virgo3b.dm +++ b/maps/tether/tether_virgo3b.dm @@ -171,8 +171,8 @@ var/datum/planet/virgo3b/planet_virgo3b = null /datum/weather/virgo3b/light_snow name = "light snow" icon_state = "snowfall_light" - temp_high = 235 - temp_low = 225 + temp_high = 235.15 + temp_low = 225.15 light_modifier = 0.7 transition_chances = list( WEATHER_OVERCAST = 20, @@ -189,8 +189,10 @@ var/datum/planet/virgo3b/planet_virgo3b = null /datum/weather/virgo3b/snow name = "moderate snow" icon_state = "snowfall_med" - temp_high = 230 - temp_low = 220 + temp_high = 230.15 + temp_low = 220.15 + wind_high = 2 + wind_low = 0 light_modifier = 0.5 flight_failure_modifier = 5 transition_chances = list( @@ -221,8 +223,10 @@ var/datum/planet/virgo3b/planet_virgo3b = null /datum/weather/virgo3b/blizzard name = "blizzard" icon_state = "snowfall_heavy" - temp_high = 215 - temp_low = 200 + temp_high = 215.15 + temp_low = 200.15 + wind_high = 4 + wind_low = 2 light_modifier = 0.3 flight_failure_modifier = 10 transition_chances = list( @@ -252,6 +256,8 @@ var/datum/planet/virgo3b/planet_virgo3b = null /datum/weather/virgo3b/rain name = "rain" icon_state = "rain" + wind_high = 2 + wind_low = 1 light_modifier = 0.5 effect_message = "Rain falls on you." @@ -296,6 +302,8 @@ var/datum/planet/virgo3b/planet_virgo3b = null /datum/weather/virgo3b/storm name = "storm" icon_state = "storm" + wind_high = 4 + wind_low = 2 light_modifier = 0.3 flight_failure_modifier = 10 effect_message = "Rain falls on you, drenching you in water." @@ -326,23 +334,6 @@ var/datum/planet/virgo3b/planet_virgo3b = null 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, "You struggle to keep hold of your umbrella!") - 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, "A gust of wind yanks the umbrella from your hand!") - 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() @@ -474,6 +465,8 @@ var/datum/planet/virgo3b/planet_virgo3b = 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 diff --git a/nano/templates/communicator.tmpl b/nano/templates/communicator.tmpl index 41d81391bd1..ed28ab828eb 100644 --- a/nano/templates/communicator.tmpl +++ b/nano/templates/communicator.tmpl @@ -282,6 +282,8 @@ Used In File(s): code\game\objects\items\devices\communicator\communicator.dm Time: {{:value.Time}}
Weather: {{:value.Weather}}, {{:helper.fixed(value.Temperature)}}°C
High: {{:helper.fixed(value.High)}}°C | Low: {{:helper.fixed(value.Low)}}°C
+ Wind Direction: {{:value.WindDir}}
+ Wind Speed: {{:value.WindSpeed}}
Forecast: {{:value.Forecast}}