mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-02 04:52:10 +00:00
[MIRROR] Space/Changeturf fixes and optimizations [MDB IGNORE] (#19201)
Space/Changeturf fixes and optimizations Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com> Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
@@ -28,9 +28,7 @@
|
||||
/// Will update the light (duh).
|
||||
/// Creates or destroys it if needed, makes it update values, makes sure it's got the correct source turf...
|
||||
/atom/proc/update_light()
|
||||
set waitfor = FALSE
|
||||
if (QDELETED(src))
|
||||
return
|
||||
SHOULD_NOT_SLEEP(TRUE)
|
||||
|
||||
if(light_system != STATIC_LIGHT)
|
||||
CRASH("update_light() for [src] with following light_system value: [light_system]")
|
||||
|
||||
@@ -34,7 +34,7 @@ GLOBAL_LIST_EMPTY(default_lighting_underlays_by_z)
|
||||
// Really this should be a global var or something, but lets not think about that yes?
|
||||
if(CONFIG_GET(flag/starlight))
|
||||
for(var/turf/open/space/space_tile in RANGE_TURFS(1, affected_turf))
|
||||
space_tile.update_starlight()
|
||||
space_tile.enable_starlight()
|
||||
|
||||
needs_update = TRUE
|
||||
SSlighting.objects_queue += src
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
for(var/turf/T as anything in A.get_contained_turfs())
|
||||
if(T.space_lit)
|
||||
continue
|
||||
new/datum/lighting_object(T)
|
||||
new /datum/lighting_object(T)
|
||||
CHECK_TICK
|
||||
CHECK_TICK
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
if (lighting_object)
|
||||
qdel(lighting_object, force=TRUE) //Shitty fix for lighting objects persisting after death
|
||||
|
||||
new/datum/lighting_object(src)
|
||||
new /datum/lighting_object(src)
|
||||
|
||||
// Used to get a scaled lumcount.
|
||||
/turf/proc/get_lumcount(minlum = 0, maxlum = 1)
|
||||
@@ -81,19 +81,20 @@
|
||||
reconsider_lights()
|
||||
return
|
||||
directional_opacity = NONE
|
||||
for(var/atom/movable/opacity_source as anything in opacity_sources)
|
||||
if(opacity_source.flags_1 & ON_BORDER_1)
|
||||
directional_opacity |= opacity_source.dir
|
||||
else //If fulltile and opaque, then the whole tile blocks view, no need to continue checking.
|
||||
directional_opacity = ALL_CARDINALS
|
||||
break
|
||||
if(opacity_sources)
|
||||
for(var/atom/movable/opacity_source as anything in opacity_sources)
|
||||
if(opacity_source.flags_1 & ON_BORDER_1)
|
||||
directional_opacity |= opacity_source.dir
|
||||
else //If fulltile and opaque, then the whole tile blocks view, no need to continue checking.
|
||||
directional_opacity = ALL_CARDINALS
|
||||
break
|
||||
if(. != directional_opacity && (. == ALL_CARDINALS || directional_opacity == ALL_CARDINALS))
|
||||
reconsider_lights() //The lighting system only cares whether the tile is fully concealed from all directions or not.
|
||||
|
||||
|
||||
///Transfer the lighting of one area to another
|
||||
/turf/proc/transfer_area_lighting(area/old_area, area/new_area)
|
||||
if(SSlighting.initialized)
|
||||
if(SSlighting.initialized && !space_lit)
|
||||
if (new_area.static_lighting != old_area.static_lighting)
|
||||
if (new_area.static_lighting)
|
||||
lighting_build_overlay()
|
||||
@@ -109,3 +110,7 @@
|
||||
cut_overlay(old_area.lighting_effects[index])
|
||||
if(new_area.lighting_effects)
|
||||
add_overlay(new_area.lighting_effects[index])
|
||||
|
||||
// If we're changing into an area with no lighting, and we're lit, light ourselves
|
||||
if(!new_area.lighting_effects && old_area.lighting_effects && space_lit)
|
||||
overlays += GLOB.fullbright_overlays[GET_TURF_PLANE_OFFSET(src) + 1]
|
||||
|
||||
Reference in New Issue
Block a user