Merge pull request #10422 from VOREStation/Arokha/fakesun

Adds a fake sun object for mapper usage
This commit is contained in:
Novacat
2021-05-26 21:09:45 -04:00
committed by GitHub
4 changed files with 52 additions and 0 deletions
@@ -51,6 +51,7 @@
name = "ice"
icon_state = "ice"
desc = "Looks slippery."
edge_blending_priority = 0
/turf/simulated/floor/outdoors/ice/Entered(var/mob/living/M)
sleep(1 * world.tick_lag)
@@ -0,0 +1,50 @@
/obj/effect/fake_sun
name = "fake sun"
desc = "Deletes itself, but first updates all the lighting on outdoor turfs."
icon = 'icons/effects/effects_vr.dmi'
icon_state = "fakesun"
var/list/possible_light_setups = list(
list(
"brightness" = 1.0,
"color" = "#f3932d"
),
list(
"brightness" = 6.0,
"color" = "#abfff7"
)
)
/obj/effect/fake_sun/Initialize()
..()
return INITIALIZE_HINT_LATELOAD
/obj/effect/fake_sun/LateInitialize()
. = ..()
var/list/our_choice = pick(possible_light_setups)
// Calculate new values to apply
var/new_brightness = our_choice["brightness"]
var/new_color = our_choice["color"]
var/lum_r = new_brightness * GetRedPart (new_color) / 255
var/lum_g = new_brightness * GetGreenPart(new_color) / 255
var/lum_b = new_brightness * GetBluePart (new_color) / 255
var/static/update_gen = -1 // Used to prevent double-processing corners. Otherwise would happen when looping over adjacent turfs.
var/list/turfs = block(locate(1,1,z),locate(world.maxx,world.maxy,z))
var/count = 0
for(var/turf/simulated/T as anything in turfs)
if(!T.lighting_overlay)
T.lighting_build_overlay()
if(!T.outdoors)
continue
for(var/C in T.get_corners())
var/datum/lighting_corner/LC = C
if(LC.update_gen != update_gen && LC.active)
LC.update_gen = update_gen
LC.update_lumcount(lum_r, lum_g, lum_b)
count++
update_gen--
qdel(src)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

+1
View File
@@ -2425,6 +2425,7 @@
#include "code\modules\lighting\lighting_area.dm"
#include "code\modules\lighting\lighting_atom.dm"
#include "code\modules\lighting\lighting_corner.dm"
#include "code\modules\lighting\lighting_fake_sun_vr.dm"
#include "code\modules\lighting\lighting_overlay.dm"
#include "code\modules\lighting\lighting_setup.dm"
#include "code\modules\lighting\lighting_source.dm"