mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-21 19:19:12 +01:00
Probably fixes problems with darksight outdoors
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
var/datum/sun_holder/sun_holder
|
||||
|
||||
var/sun_position = 0 // 0 means midnight, 1 means noon.
|
||||
var/list/sun = list("range","brightness","color")
|
||||
var/list/sun = list("brightness","color")
|
||||
var/list/expected_z_levels = list()
|
||||
|
||||
var/turf/unsimulated/wall/planetary/planetary_wall_type = /turf/unsimulated/wall/planetary
|
||||
@@ -62,8 +62,7 @@
|
||||
if(weather_holder)
|
||||
weather_holder.process()
|
||||
|
||||
/datum/planet/proc/update_sun_deferred(var/new_range, var/new_brightness, var/new_color)
|
||||
sun["range"] = new_range
|
||||
/datum/planet/proc/update_sun_deferred(var/new_brightness, var/new_color)
|
||||
sun["brightness"] = new_brightness
|
||||
sun["color"] = new_color
|
||||
needs_work |= PLANET_PROCESS_SUN
|
||||
|
||||
@@ -95,7 +95,7 @@ var/datum/planet/sif/planet_sif = null
|
||||
new_color = rgb(new_r, new_g, new_b)
|
||||
|
||||
spawn(1)
|
||||
update_sun_deferred(2, new_brightness, new_color)
|
||||
update_sun_deferred(new_brightness, new_color)
|
||||
|
||||
// We're gonna pretend there are 32 hours in a Sif day instead of 32.64 for the purposes of not losing sanity. We lose 38m 24s but the alternative is a path to madness.
|
||||
/datum/time/sif
|
||||
|
||||
@@ -2,26 +2,50 @@
|
||||
var/atom/movable/sun_visuals/sun = new
|
||||
var/datum/planet/our_planet
|
||||
|
||||
var/our_color = "#FFFFFF"
|
||||
var/our_brightness = 1.0
|
||||
|
||||
/datum/sun_holder/New(var/source)
|
||||
our_planet = source
|
||||
|
||||
/datum/sun_holder/proc/update_color(new_color)
|
||||
sun.color = new_color
|
||||
|
||||
/datum/sun_holder/proc/update_brightness(new_brightness)
|
||||
sun.alpha = round(CLAMP01(new_brightness)*255,1)
|
||||
// Doesn't save much work, but might save a smidge of client work
|
||||
if(our_color == new_color)
|
||||
return
|
||||
|
||||
// Visible change
|
||||
sun.color = our_color = new_color
|
||||
|
||||
/datum/sun_holder/proc/update_brightness(new_brightness, list/turfs)
|
||||
// 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.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")
|
||||
return
|
||||
T.vis_contents += sun
|
||||
T.dynamic_lumcount += our_brightness
|
||||
|
||||
/datum/sun_holder/proc/remove_from_turf(turf/T)
|
||||
if(!(sun in T.vis_contents))
|
||||
warning("Was asked to remove fake sun from [T.x], [T.y], [T.z] despite it not having us in it's vis contents")
|
||||
return
|
||||
T.vis_contents -= sun
|
||||
T.dynamic_lumcount -= our_brightness
|
||||
|
||||
/datum/sun_holder/proc/rainbow()
|
||||
var/end = world.time + 30 SECONDS
|
||||
|
||||
@@ -94,7 +94,7 @@ var/datum/planet/virgo3b/planet_virgo3b = null
|
||||
new_color = rgb(new_r, new_g, new_b)
|
||||
|
||||
spawn(1)
|
||||
update_sun_deferred(2, new_brightness, new_color)
|
||||
update_sun_deferred(new_brightness, new_color)
|
||||
|
||||
|
||||
/datum/weather_holder/virgo3b
|
||||
|
||||
@@ -92,7 +92,7 @@ var/datum/planet/virgo4/planet_virgo4 = null
|
||||
new_color = rgb(new_r, new_g, new_b)
|
||||
|
||||
spawn(1)
|
||||
update_sun_deferred(2, new_brightness, new_color)
|
||||
update_sun_deferred(new_brightness, new_color)
|
||||
|
||||
|
||||
/datum/weather_holder/virgo4
|
||||
|
||||
Reference in New Issue
Block a user