mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-01-28 01:42:50 +00:00
Fixes planet lights (hopefully not too hard)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
var/tmp/lighting_corners_initialised = FALSE
|
||||
|
||||
var/tmp/outdoors_adjacent = FALSE
|
||||
///Our lighting object.
|
||||
var/tmp/datum/lighting_object/lighting_object
|
||||
///Lighting Corner datums.
|
||||
@@ -96,9 +97,9 @@
|
||||
///Setter for the byond luminosity var
|
||||
/turf/proc/set_luminosity(new_luminosity, force)
|
||||
// SSplanets handles outdoor turfs
|
||||
if(is_outdoors() && !force)
|
||||
if((is_outdoors() && !force) || outdoors_adjacent)
|
||||
return
|
||||
|
||||
|
||||
luminosity = new_luminosity
|
||||
|
||||
///Calculate on which directions this turfs block view.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// Doesn't save much work, but might save a smidge of client work
|
||||
if(our_color == new_color)
|
||||
return
|
||||
|
||||
|
||||
// Visible change
|
||||
our_color = new_color
|
||||
sun.set_color(new_color)
|
||||
@@ -22,19 +22,19 @@
|
||||
// Doesn't save much work, but might save a smidge of client work
|
||||
if(our_brightness == new_brightness)
|
||||
return
|
||||
|
||||
|
||||
// Store the old for math
|
||||
. = our_brightness
|
||||
our_brightness = new_brightness
|
||||
|
||||
|
||||
// Visible change
|
||||
sun.set_alpha(round(CLAMP01(our_brightness)*255,1))
|
||||
|
||||
|
||||
// Update dynamic lumcount so darksight and stuff works
|
||||
var/difference = . - our_brightness
|
||||
for(var/turf/T as anything in turfs)
|
||||
T.dynamic_lumcount -= difference
|
||||
|
||||
|
||||
/datum/sun_holder/proc/apply_to_turf(turf/T)
|
||||
if(sun in T.vis_contents)
|
||||
warning("Was asked to add fake sun to [T.x], [T.y], [T.z] despite already having us in it's vis contents")
|
||||
@@ -49,21 +49,21 @@
|
||||
|
||||
/datum/sun_holder/proc/rainbow()
|
||||
var/end = world.time + 30 SECONDS
|
||||
|
||||
|
||||
var/col_index = 1
|
||||
|
||||
|
||||
var/list/colors = list("#ff5d5d","#ffd17b","#ffff5e","#7eff7e","#6868ff","#b753ff","#d08fff","#ffffff")
|
||||
var/original_brightness = sun.alpha/255
|
||||
var/original_color = sun.color
|
||||
|
||||
|
||||
update_brightness(0.8)
|
||||
|
||||
|
||||
while(world.time < end)
|
||||
update_color(colors[col_index])
|
||||
if(++col_index > colors.len)
|
||||
col_index = 1
|
||||
sleep(3)
|
||||
|
||||
|
||||
update_brightness(original_brightness)
|
||||
update_color(original_color)
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
mouse_opacity = 0
|
||||
alpha = 0
|
||||
color = "#FFFFFF"
|
||||
|
||||
|
||||
var/turfs_providing_spreads = list()
|
||||
var/spreads = list()
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
T.vis_contents += src
|
||||
T.dynamic_lumcount += 0.5
|
||||
T.set_luminosity(1, TRUE)
|
||||
|
||||
|
||||
var/list/localspreads
|
||||
// Test for corners
|
||||
for(var/direction in cornerdirs)
|
||||
@@ -120,7 +120,7 @@
|
||||
if(dirturf && !dirturf.is_outdoors())
|
||||
var/turf/TL = get_step(T, turn(direction, -45))
|
||||
var/turf/TR = get_step(T, turn(direction, 45))
|
||||
|
||||
|
||||
// If outdoors at 45 degrees are the same, then this is a corner
|
||||
if(TL && TR && TL.is_outdoors() == TR.is_outdoors())
|
||||
var/atom/movable/sun_visuals_overlap/OL
|
||||
@@ -132,10 +132,11 @@
|
||||
OL = spreads["i[direction]"]
|
||||
dirturf.vis_contents += OL
|
||||
dirturf.set_luminosity(1)
|
||||
dirturf.outdoors_adjacent = TRUE
|
||||
LAZYINITLIST(localspreads)
|
||||
LAZYINITLIST(localspreads[dirturf])
|
||||
LAZYADD(localspreads[dirturf], OL)
|
||||
|
||||
|
||||
// Take all orthagonals
|
||||
for(var/direction in cardinal)
|
||||
var/turf/dirturf = get_step(T, direction)
|
||||
@@ -148,6 +149,7 @@
|
||||
var/atom/movable/sun_visuals_overlap/OL = spreads["[direction]"]
|
||||
dirturf.vis_contents += OL
|
||||
dirturf.set_luminosity(1)
|
||||
dirturf.outdoors_adjacent = TRUE
|
||||
LAZYINITLIST(localspreads)
|
||||
LAZYINITLIST(localspreads[dirturf])
|
||||
LAZYADD(localspreads[dirturf], OL)
|
||||
@@ -163,6 +165,14 @@
|
||||
if(LAZYLEN(applied))
|
||||
for(var/turf/old as anything in applied)
|
||||
old.vis_contents -= applied[old]
|
||||
var/old_lit = FALSE
|
||||
for(var/direction in alldirs)
|
||||
var/turf/CT = get_step(old, direction)
|
||||
if(CT && CT.is_outdoors())
|
||||
old_lit = TRUE
|
||||
if(!old_lit)
|
||||
old.outdoors_adjacent = TRUE
|
||||
old.set_luminosity(0)
|
||||
applied -= old
|
||||
turfs_providing_spreads -= T
|
||||
applied.Cut()
|
||||
|
||||
Reference in New Issue
Block a user