Revert "Revert "Upgrades Planetary Weather to vis_contents (#5170)""

This commit is contained in:
Aronai Sieyes
2018-06-01 20:35:28 -04:00
committed by GitHub
parent e04212d616
commit 40b1a56bdc
6 changed files with 16 additions and 36 deletions

View File

@@ -10,6 +10,5 @@
#define WEATHER_HOT "hot"
#define WEATHER_BLOOD_MOON "blood moon" // For admin fun or cult later on.
#define PLANET_PROCESS_WEATHER 0x1
#define PLANET_PROCESS_SUN 0x2
#define PLANET_PROCESS_TEMP 0x4
#define PLANET_PROCESS_SUN 0x1
#define PLANET_PROCESS_TEMP 0x2

View File

@@ -21,6 +21,7 @@ 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?
@@ -36,6 +37,7 @@ 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)
@@ -44,19 +46,6 @@ 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)

View File

@@ -84,9 +84,6 @@ 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)

View File

@@ -7,8 +7,6 @@ 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"
@@ -32,7 +30,7 @@ var/list/outdoor_turfs = list()
/turf/simulated/floor/Destroy()
if(outdoors)
planet_controller.unallocateTurf(src)
..()
return ..()
/turf/simulated/proc/make_outdoors()
outdoors = TRUE
@@ -44,20 +42,14 @@ 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)

View File

@@ -39,7 +39,6 @@
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]"
@@ -58,9 +57,6 @@
if(old_fire)
fire = old_fire
if(old_weather_overlay)
W.weather_overlay = old_weather_overlay
if (istype(W,/turf/simulated/floor))
W.RemoveLattice()
@@ -85,9 +81,6 @@
if(old_fire)
old_fire.RemoveFire()
if(old_weather_overlay)
W.weather_overlay = old_weather_overlay
if(tell_universe)
universe.OnTurfChange(W)

View File

@@ -8,6 +8,9 @@
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
@@ -15,6 +18,7 @@
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
@@ -41,7 +45,7 @@
current_weather.process_effects()
/datum/weather_holder/proc/update_icon_effects()
our_planet.needs_work |= PLANET_PROCESS_WEATHER
visuals.icon_state = current_weather.icon_state
/datum/weather_holder/proc/update_temperature()
temperature = Interpolate(current_weather.temp_low, current_weather.temp_high, weight = our_planet.sun_position)
@@ -65,3 +69,9 @@
/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