diff --git a/code/__defines/planets.dm b/code/__defines/planets.dm index 98b10b328a..e8f526382e 100644 --- a/code/__defines/planets.dm +++ b/code/__defines/planets.dm @@ -10,5 +10,6 @@ #define WEATHER_HOT "hot" #define WEATHER_BLOOD_MOON "blood moon" // For admin fun or cult later on. -#define PLANET_PROCESS_SUN 0x1 -#define PLANET_PROCESS_TEMP 0x2 \ No newline at end of file +#define PLANET_PROCESS_WEATHER 0x1 +#define PLANET_PROCESS_SUN 0x2 +#define PLANET_PROCESS_TEMP 0x4 \ No newline at end of file diff --git a/code/controllers/Processes/planet.dm b/code/controllers/Processes/planet.dm index 770b3a5e87..9ab541c80d 100644 --- a/code/controllers/Processes/planet.dm +++ b/code/controllers/Processes/planet.dm @@ -21,7 +21,6 @@ var/datum/controller/process/planet/planet_controller = null for(var/datum/planet/P in planets) if(OT.z in P.expected_z_levels) P.planet_floors |= OT - OT.vis_contents |= P.weather_holder.visuals break outdoor_turfs.Cut() //Why were you in there INCORRECTLY? @@ -37,7 +36,6 @@ var/datum/controller/process/planet/planet_controller = null var/datum/planet/P = planet if(T.z in P.expected_z_levels) P.planet_floors -= T - T.vis_contents -= P.weather_holder.visuals /datum/controller/process/planet/doWork() if(outdoor_turfs.len || planetary_walls.len) @@ -46,6 +44,19 @@ var/datum/controller/process/planet/planet_controller = null for(var/datum/planet/P in planets) P.process(schedule_interval / 10) SCHECK //Your process() really shouldn't take this long... + //Weather style needs redrawing + if(P.needs_work & PLANET_PROCESS_WEATHER) + P.needs_work &= ~PLANET_PROCESS_WEATHER + var/image/new_overlay = image(icon = P.weather_holder.current_weather.icon, icon_state = P.weather_holder.current_weather.icon_state) + new_overlay.plane = PLANE_PLANETLIGHTING + //Redraw weather icons + for(var/T in P.planet_floors) + var/turf/simulated/turf = T + // turf.overlays -= turf.weather_overlay + turf.weather_overlay = new_overlay + // turf.overlays += turf.weather_overlay + turf.update_icon() + SCHECK //Sun light needs changing if(P.needs_work & PLANET_PROCESS_SUN) diff --git a/code/game/turfs/simulated/floor_icon.dm b/code/game/turfs/simulated/floor_icon.dm index cf5396aa96..a7cab51424 100644 --- a/code/game/turfs/simulated/floor_icon.dm +++ b/code/game/turfs/simulated/floor_icon.dm @@ -84,6 +84,9 @@ var/image/no_ceiling_image = null if(!isnull(burnt) && (flooring.flags & TURF_CAN_BURN)) add_overlay(get_flooring_overlay("[flooring.icon_base]-burned-[burnt]","burned[burnt]")) // VOREStation Edit - Eris overlays + if(weather_overlay) + add_overlay(weather_overlay) + if(update_neighbors) for(var/turf/simulated/floor/F in range(src, 1)) if(F == src) diff --git a/code/game/turfs/simulated/outdoors/outdoors.dm b/code/game/turfs/simulated/outdoors/outdoors.dm index 729095a666..cd358b7d5e 100644 --- a/code/game/turfs/simulated/outdoors/outdoors.dm +++ b/code/game/turfs/simulated/outdoors/outdoors.dm @@ -7,6 +7,8 @@ var/list/outdoor_turfs = list() var/edge_blending_priority = 0 // Outdoors var determines if the game should consider the turf to be 'outdoors', which controls certain things such as weather effects. var/outdoors = FALSE + // This holds the image for the current weather effect. + var/image/weather_overlay = null /turf/simulated/floor/outdoors name = "generic ground" @@ -30,7 +32,7 @@ var/list/outdoor_turfs = list() /turf/simulated/floor/Destroy() if(outdoors) planet_controller.unallocateTurf(src) - return ..() + ..() /turf/simulated/proc/make_outdoors() outdoors = TRUE @@ -42,14 +44,20 @@ var/list/outdoor_turfs = list() planet_controller.unallocateTurf(src) else // This is happening during map gen, if there's no planet_controller (hopefully). outdoor_turfs -= src + if(weather_overlay) + cut_overlay(weather_overlay) + qdel_null(weather_overlay) + update_icon() /turf/simulated/post_change() ..() // If it was outdoors and still is, it will not get added twice when the planet controller gets around to putting it in. if(outdoors) make_outdoors() + // outdoor_turfs += src else make_indoors() + // planet_controller.unallocateTurf(src) /turf/simulated/proc/update_icon_edge() if(edge_blending_priority) diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm index b355ec6328..89940e5532 100644 --- a/code/game/turfs/turf_changing.dm +++ b/code/game/turfs/turf_changing.dm @@ -39,6 +39,7 @@ var/old_dynamic_lighting = dynamic_lighting var/old_affecting_lights = affecting_lights var/old_lighting_overlay = lighting_overlay + var/old_weather_overlay = weather_overlay var/old_corners = corners //world << "Replacing [src.type] with [N]" @@ -57,6 +58,9 @@ if(old_fire) fire = old_fire + if(old_weather_overlay) + W.weather_overlay = old_weather_overlay + if (istype(W,/turf/simulated/floor)) W.RemoveLattice() @@ -81,6 +85,9 @@ if(old_fire) old_fire.RemoveFire() + if(old_weather_overlay) + W.weather_overlay = old_weather_overlay + if(tell_universe) universe.OnTurfChange(W) diff --git a/code/modules/planet/weather.dm b/code/modules/planet/weather.dm index a0fa603980..512981d44e 100644 --- a/code/modules/planet/weather.dm +++ b/code/modules/planet/weather.dm @@ -8,9 +8,6 @@ var/list/roundstart_weather_chances = list() var/next_weather_shift = null - // Holds the weather icon, using vis_contents. Documentation says an /atom/movable is required for placing inside another atom's vis_contents. - var/atom/movable/weather_visuals/visuals = null - /datum/weather_holder/New(var/source) ..() our_planet = source @@ -18,7 +15,6 @@ var/datum/weather/W = allowed_weather_types[A] if(istype(W)) W.holder = src - visuals = new() /datum/weather_holder/proc/change_weather(var/new_weather) var/old_light_modifier = null @@ -45,7 +41,7 @@ current_weather.process_effects() /datum/weather_holder/proc/update_icon_effects() - visuals.icon_state = current_weather.icon_state + our_planet.needs_work |= PLANET_PROCESS_WEATHER /datum/weather_holder/proc/update_temperature() temperature = Interpolate(current_weather.temp_low, current_weather.temp_high, weight = our_planet.sun_position) @@ -69,9 +65,3 @@ /datum/weather/proc/process_effects() return - -// All this does is hold the weather icon. -/atom/movable/weather_visuals - icon = 'icons/effects/weather.dmi' - mouse_opacity = 0 - plane = PLANE_PLANETLIGHTING