This commit is contained in:
zerothebigboy
2023-01-30 00:01:22 -05:00
parent 2d5e163916
commit 091d9ec00f
44 changed files with 277 additions and 256 deletions

View File

@@ -64,8 +64,8 @@
var/overlay_plane = BLACKNESS_PLANE
/// If the weather has no purpose but aesthetics.
var/aesthetic = FALSE
/// Used by mobs to prevent them from being affected by the weather
var/immunity_type = "storm"
/// Used by mobs (or movables containing mobs, such as enviro bags) to prevent them from being affected by the weather.
var/immunity_type
/// The stage of the weather, from 1-4
var/stage = END_STAGE
@@ -133,15 +133,18 @@
/datum/weather/proc/start()
if(stage >= MAIN_STAGE)
return
SEND_GLOBAL_SIGNAL(COMSIG_WEATHER_START(type))
stage = MAIN_STAGE
update_areas()
for(var/M in GLOB.player_list)
var/turf/mob_turf = get_turf(M)
if(mob_turf && (mob_turf.z in impacted_z_levels))
for(var/z_level in impacted_z_levels)
for(var/mob/player as anything in SSmobs.clients_by_zlevel[z_level])
var/turf/mob_turf = get_turf(player)
if(!mob_turf)
continue
if(weather_message)
to_chat(M, weather_message)
to_chat(player, weather_message)
if(weather_sound)
SEND_SOUND(M, sound(weather_sound))
SEND_SOUND(player, sound(weather_sound))
if(!perpetual)
addtimer(CALLBACK(src, .proc/wind_down), weather_duration)
@@ -192,14 +195,27 @@
* Returns TRUE if the living mob can be affected by the weather
*
*/
/datum/weather/proc/can_weather_act(mob/living/L)
var/turf/mob_turf = get_turf(L)
if(mob_turf && !(mob_turf.z in impacted_z_levels))
/datum/weather/proc/can_weather_act(mob/living/mob_to_check)
var/turf/mob_turf = get_turf(mob_to_check)
if(!mob_turf)
return
if(immunity_type in L.weather_immunities)
if(!(mob_turf.z in impacted_z_levels))
return
if(!(get_area(L) in impacted_areas))
if((immunity_type && HAS_TRAIT(mob_to_check, immunity_type)) || HAS_TRAIT(mob_to_check, TRAIT_WEATHER_IMMUNE))
return
var/atom/loc_to_check = mob_to_check.loc
while(loc_to_check != mob_turf)
if((immunity_type && HAS_TRAIT(loc_to_check, immunity_type)) || HAS_TRAIT(loc_to_check, TRAIT_WEATHER_IMMUNE))
return
loc_to_check = loc_to_check.loc
if(!(get_area(mob_to_check) in impacted_areas))
return
return TRUE
/**

View File

@@ -1,32 +0,0 @@
//Acid rain is part of the natural weather cycle in the humid forests of Planetstation, and cause acid damage to anyone unprotected.
/datum/weather/acid_rain
name = "acid rain"
desc = "The planet's thunderstorms are by nature acidic, and will incinerate anyone standing beneath them without protection."
telegraph_duration = 400
telegraph_message = "<span class='boldwarning'>Thunder rumbles far above. You hear droplets drumming against the canopy. Seek shelter.</span>"
telegraph_sound = 'sound/ambience/acidrain_start.ogg'
weather_message = "<span class='userdanger'><i>Acidic rain pours down around you! Get inside!</i></span>"
weather_overlay = "acid_rain"
weather_duration_lower = 600
weather_duration_upper = 1500
weather_sound = 'sound/ambience/acidrain_mid.ogg'
end_duration = 100
end_message = "<span class='boldannounce'>The downpour gradually slows to a light shower. It should be safe outside now.</span>"
end_sound = 'sound/ambience/acidrain_end.ogg'
area_type = /area
protect_indoors = TRUE
target_trait = ZTRAIT_ACIDRAIN
immunity_type = "acid" // temp
barometer_predictable = TRUE
/datum/weather/acid_rain/weather_act(mob/living/L)
var/resist = L.getarmor(null, ACID)
if(prob(max(0,100-resist)))
L.acid_act(20,20)

View File

@@ -1,6 +1,5 @@
//A reference to this list is passed into area sound managers, and it's modified in a manner that preserves that reference in ash_storm.dm
GLOBAL_LIST_EMPTY(ash_storm_sounds)
//Ash storms happen frequently on lavaland. They heavily obscure vision, and cause high fire damage to anyone caught outside.
/datum/weather/ash_storm
name = "ash storm"
desc = "An intense atmospheric storm lifts ash off of the planet's surface and billows it down across the area, dealing intense fire damage to the unprotected."
@@ -22,7 +21,7 @@ GLOBAL_LIST_EMPTY(ash_storm_sounds)
protect_indoors = TRUE
target_trait = ZTRAIT_ASHSTORM
immunity_type = "ash"
immunity_type = TRAIT_ASHSTORM_IMMUNE
probability = 90
@@ -72,10 +71,6 @@ GLOBAL_LIST_EMPTY(ash_storm_sounds)
var/thermal_protection = H.easy_thermal_protection()
if(thermal_protection >= FIRE_IMMUNITY_MAX_TEMP_PROTECT)
return TRUE
if(isliving(L))// if we're a non immune mob inside an immune mob we have to reconsider if that mob is immune to protect ourselves
var/mob/living/the_mob = L
if("ash" in the_mob.weather_immunities)
return TRUE
// if(istype(L, /obj/structure/closet))
// var/obj/structure/closet/the_locker = L
// if(the_locker.weather_protection)
@@ -93,7 +88,6 @@ GLOBAL_LIST_EMPTY(ash_storm_sounds)
return
L.adjustFireLoss(4)
//Emberfalls are the result of an ash storm passing by close to the playable area of lavaland. They have a 10% chance to trigger in place of an ash storm.
/datum/weather/ash_storm/emberfall
name = "emberfall"

View File

@@ -19,19 +19,23 @@
target_trait = ZTRAIT_STATION
overlay_layer = ABOVE_OPEN_TURF_LAYER //Covers floors only
immunity_type = "lava"
immunity_type = TRAIT_LAVA_IMMUNE
/datum/weather/floor_is_lava/weather_act(mob/living/L)
if(issilicon(L))
return
if(istype(L.buckled, /obj/structure/bed))
return
for(var/obj/structure/O in L.loc)
if(O.density)
return
if(L.loc.density)
return
if(!L.client) //Only sentient people are going along with it!
return
L.adjustFireLoss(3)
/datum/weather/floor_is_lava/can_weather_act(mob/living/mob_to_check)
if(!mob_to_check.client) //Only sentient people are going along with it!
return FALSE
. = ..()
if(!. || issilicon(mob_to_check) || istype(mob_to_check.buckled, /obj/structure/bed))
return FALSE
var/turf/mob_turf = get_turf(mob_to_check)
if(mob_turf.density) //Walls are not floors.
return FALSE
for(var/obj/structure/structure_to_check in mob_turf)
if(structure_to_check.density)
return FALSE
if(mob_to_check.movement_type & FLYING)
return FALSE
/datum/weather/floor_is_lava/weather_act(mob/living/victim)
victim.adjustFireLoss(3)

View File

@@ -21,7 +21,7 @@
protected_areas = list(/area/edina/protected)
target_trait = ZTRAIT_ICESTORM
immunity_type = "rad"
immunity_type = TRAIT_SNOWSTORM_IMMUNE
/datum/weather/ice_storm/weather_act(mob/living/L)
//L.adjust_bodytemperature(-rand(10,20))

View File

@@ -21,7 +21,7 @@
/area/ai_monitored/turret_protected/ai, /area/commons/storage/emergency/starboard, /area/commons/storage/emergency/port, /area/shuttle, /area/ruin/lavaland)
target_trait = ZTRAIT_STATION
immunity_type = "rad"
immunity_type = TRAIT_RADSTORM_IMMUNE
var/radiation_intensity = 100

View File

@@ -19,7 +19,7 @@
protect_indoors = TRUE
target_trait = ZTRAIT_SNOWSTORM
immunity_type = "snow"
immunity_type = TRAIT_SNOWSTORM_IMMUNE
barometer_predictable = TRUE

View File

@@ -17,15 +17,18 @@
protect_indoors = FALSE
target_trait = ZTRAIT_VOIDSTORM
immunity_type = "void"
immunity_type = TRAIT_VOIDSTORM_IMMUNE
barometer_predictable = FALSE
perpetual = TRUE
/datum/weather/void_storm/weather_act(mob/living/L)
if(IS_HERETIC(L) || IS_HERETIC_MONSTER(L))
return
L.adjustOxyLoss(rand(1,3))
L.adjustFireLoss(rand(1,3))
L.adjust_blurriness(rand(0,1))
L.adjust_bodytemperature(-rand(5,15))
/datum/weather/void_storm/can_weather_act(mob/living/mob_to_check)
. = ..()
if(IS_HERETIC(mob_to_check) || IS_HERETIC_MONSTER(mob_to_check))
return FALSE
/datum/weather/void_storm/weather_act(mob/living/victim)
victim.adjustOxyLoss(rand(1,3))
victim.adjustFireLoss(rand(1,3))
victim.adjust_blurriness(rand(0,1))
victim.adjust_bodytemperature(-rand(5,15))