Refactor area and turf lighting (#60954)

This commit is contained in:
TiviPlus
2021-08-25 15:07:38 -07:00
committed by GitHub
parent 256bfdd7d2
commit e629c36feb
33 changed files with 183 additions and 129 deletions
+2
View File
@@ -120,6 +120,8 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define NO_ALERTS (1<<12)
/// If blood cultists can draw runes or build structures on this AREA.
#define CULT_PERMITTED (1<<13)
///Whther this area is iluminated by starlight
#define AREA_USES_STARLIGHT (1<<14)
/*
These defines are used specifically with the atom/pass_flags bitmask
+5
View File
@@ -125,6 +125,11 @@
#define ABOVE_LIGHTING_PLANE 120
#define ABOVE_LIGHTING_RENDER_TARGET "ABOVE_LIGHTING_PLANE"
#define LIGHTING_PRIMARY_LAYER 15 //The layer for the main lights of the station
#define LIGHTING_PRIMARY_DIMMER_LAYER 15.1 //The layer that dims the main lights of the station
#define LIGHTING_SECONDARY_LAYER 16 //The colourful, usually small lights that go on top
///visibility + hiding of things outside of light source range
#define BYOND_LIGHTING_PLANE 130
#define BYOND_LIGHTING_RENDER_TARGET "BYOND_LIGHTING_PLANE"
-11
View File
@@ -53,17 +53,6 @@
#define LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE 128
#define LIGHTING_PLANE_ALPHA_INVISIBLE 0
//lighting area defines
/// dynamic lighting disabled (area stays at full brightness)
#define DYNAMIC_LIGHTING_DISABLED 0
/// dynamic lighting enabled
#define DYNAMIC_LIGHTING_ENABLED 1
/// dynamic lighting enabled even if the area doesn't require power
#define DYNAMIC_LIGHTING_FORCED 2
/// dynamic lighting enabled only if starlight is.
#define DYNAMIC_LIGHTING_IFSTARLIGHT 3
#define IS_DYNAMIC_LIGHTING(A) A.dynamic_lighting
//code assumes higher numbers override lower numbers.
#define LIGHTING_NO_UPDATE 0
-1
View File
@@ -82,7 +82,6 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin
return
newA = new area_choice
newA.setup(str)
newA.set_dynamic_lighting()
newA.has_gravity = oldA.has_gravity
else
newA = area_choice
+1
View File
@@ -63,6 +63,7 @@ DEFINE_BITFIELD(area_flags, list(
"VALID_TERRITORY" = VALID_TERRITORY,
"XENOBIOLOGY_COMPATIBLE" = XENOBIOLOGY_COMPATIBLE,
"NO_ALERTS" = NO_ALERTS,
"AREA_USES_STARLIGHT" = AREA_USES_STARLIGHT,
))
DEFINE_BITFIELD(turf_flags, list(
+1 -7
View File
@@ -14,12 +14,6 @@ SUBSYSTEM_DEF(lighting)
/datum/controller/subsystem/lighting/Initialize(timeofday)
if(!initialized)
if (CONFIG_GET(flag/starlight))
for(var/I in GLOB.sortedAreas)
var/area/A = I
if (A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT)
A.luminosity = 0
create_all_lighting_objects()
initialized = TRUE
@@ -57,7 +51,7 @@ SUBSYSTEM_DEF(lighting)
C.needs_update = FALSE //update_objects() can call qdel if the corner is storing no data
C.update_objects()
if(init_tick_checks)
CHECK_TICK
else if (MC_TICK_CHECK)
+3 -1
View File
@@ -87,5 +87,7 @@
/area/mine/planetgeneration
name = "planet generation area"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
map_generator = /datum/map_generator/jungle_generator
+8 -9
View File
@@ -150,6 +150,10 @@ GLOBAL_LIST_EMPTY(teleportlocs)
icon_state = ""
if(!ambientsounds)
ambientsounds = GLOB.ambience_assoc[ambience_index]
if(area_flags & AREA_USES_STARLIGHT)
static_lighting = CONFIG_GET(flag/starlight)
if(requires_power)
luminosity = 0
else
@@ -157,20 +161,13 @@ GLOBAL_LIST_EMPTY(teleportlocs)
power_equip = TRUE
power_environ = TRUE
if(dynamic_lighting == DYNAMIC_LIGHTING_FORCED)
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
if(static_lighting)
luminosity = 0
else if(dynamic_lighting != DYNAMIC_LIGHTING_IFSTARLIGHT)
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
if(dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT)
dynamic_lighting = CONFIG_GET(flag/starlight) ? DYNAMIC_LIGHTING_ENABLED : DYNAMIC_LIGHTING_DISABLED
. = ..()
if(!IS_DYNAMIC_LIGHTING(src))
if(!static_lighting)
blend_mode = BLEND_MULTIPLY
add_overlay(/obj/effect/fullbright)
reg_in_areas_in_z()
@@ -179,6 +176,8 @@ GLOBAL_LIST_EMPTY(teleportlocs)
network_root_id = STATION_NETWORK_ROOT // default to station root because this might be created with a blueprint
SSnetworks.assign_area_network_id(src)
update_base_lighting()
return INITIALIZE_HINT_LATELOAD
/**
+4 -10
View File
@@ -14,21 +14,15 @@ Unused icons for new areas are "awaycontent1" ~ "awaycontent30"
/area/awaymission/beach
name = "Beach"
icon_state = "away"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
ambientsounds = list('sound/ambience/shore.ogg', 'sound/ambience/seag1.ogg','sound/ambience/seag2.ogg','sound/ambience/seag2.ogg','sound/ambience/ambiodd.ogg','sound/ambience/ambinice.ogg')
/area/awaymission/errorroom
name = "Super Secret Room"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
has_gravity = STANDARD_GRAVITY
/area/awaymission/vr
name = "Virtual Reality"
icon_state = "awaycontent1"
requires_power = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
var/pacifist = TRUE // if when you enter this zone, you become a pacifist or not
var/death = FALSE // if when you enter this zone, you die
network_root_id = "VR"
+17 -7
View File
@@ -8,7 +8,9 @@
/area/centcom
name = "CentCom"
icon_state = "centcom"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
area_flags = UNIQUE_AREA | NOTELEPORT
@@ -39,7 +41,6 @@
/area/centcom/supplypod
name = "Supplypod Facility"
icon_state = "supplypod"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
/area/centcom/supplypod/pod_storage
name = "Supplypod Storage"
@@ -82,7 +83,9 @@
/area/tdome
name = "Thunderdome"
icon_state = "yellow"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
flags_1 = NONE
@@ -90,12 +93,10 @@
/area/tdome/arena
name = "Thunderdome Arena"
icon_state = "thunder"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
/area/tdome/arena_source
name = "Thunderdome Arena Template"
icon_state = "thunder"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
/area/tdome/tdome1
name = "Thunderdome (Team 1)"
@@ -120,7 +121,9 @@
/area/wizard_station
name = "Wizard's Den"
icon_state = "yellow"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
area_flags = UNIQUE_AREA | NOTELEPORT
@@ -133,6 +136,8 @@
icon_state = "yellow"
requires_power = FALSE
area_flags = UNIQUE_AREA | NOTELEPORT
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
has_gravity = STANDARD_GRAVITY
flags_1 = NONE
network_root_id = "ALIENS"
@@ -151,7 +156,9 @@
/area/syndicate_mothership/control
name = "Syndicate Control Room"
icon_state = "syndie-control"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
network_root_id = SYNDICATE_NETWORK_ROOT
/area/syndicate_mothership/elite_squad
@@ -164,6 +171,9 @@
name = "Capture the Flag"
icon_state = "yellow"
requires_power = FALSE
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
has_gravity = STANDARD_GRAVITY
flags_1 = NONE
+3 -1
View File
@@ -1,7 +1,9 @@
/area/holodeck
name = "Holodeck"
icon_state = "Holodeck"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
flags_1 = NONE
sound_environment = SOUND_ENVIRONMENT_PADDED_CELL
+1 -1
View File
@@ -5,7 +5,7 @@
icon_state = "away"
has_gravity = STANDARD_GRAVITY
area_flags = HIDDEN_AREA | BLOBS_ALLOWED | UNIQUE_AREA | NO_ALERTS
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = TRUE
ambience_index = AMBIENCE_RUINS
flags_1 = CAN_BE_DIRTY_1
sound_environment = SOUND_ENVIRONMENT_STONEROOM
+4 -4
View File
@@ -5,7 +5,7 @@
/area/shuttle
name = "Shuttle"
requires_power = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = TRUE
has_gravity = STANDARD_GRAVITY
always_unpowered = FALSE
// Loading the same shuttle map at a different time will produce distinct area instances.
@@ -63,7 +63,7 @@
/area/shuttle/hunter
name = "Hunter Shuttle"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
////////////////////////////White Ship////////////////////////////
@@ -97,7 +97,7 @@
/area/shuttle/transit
name = "Hyperspace"
desc = "Weeeeee"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
/area/shuttle/arrival
@@ -167,7 +167,7 @@
name = "Medieval Reality Simulation Dome"
icon_state = "shuttlectf"
area_flags = NOTELEPORT
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
/area/shuttle/escape/arena
name = "The Arena"
+9 -6
View File
@@ -25,7 +25,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
icon_state = "space"
requires_power = TRUE
always_unpowered = TRUE
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
power_light = FALSE
power_equip = FALSE
power_environ = FALSE
@@ -37,13 +39,13 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
/area/space/nearstation
icon_state = "space_near"
dynamic_lighting = DYNAMIC_LIGHTING_IFSTARLIGHT
area_flags = UNIQUE_AREA | NO_ALERTS | AREA_USES_STARLIGHT
/area/start
name = "start area"
icon_state = "start"
requires_power = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
has_gravity = STANDARD_GRAVITY
@@ -68,7 +70,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
max_ambience_cooldown = 220 SECONDS
/area/asteroid/nearstation
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
ambience_index = AMBIENCE_RUINS
always_unpowered = FALSE
requires_power = TRUE
@@ -923,8 +927,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
/area/solars
requires_power = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_IFSTARLIGHT
area_flags = UNIQUE_AREA
area_flags = UNIQUE_AREA | AREA_USES_STARLIGHT
flags_1 = NONE
ambience_index = AMBIENCE_ENGI
airlock_wires = /datum/wires/airlock/engineering
+8 -7
View File
@@ -77,7 +77,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
if(flags & CHANGETURF_SKIP)
return new path(src)
var/old_dynamic_lighting = dynamic_lighting
var/old_always_lit = always_lit
var/old_lighting_object = lighting_object
var/old_lighting_corner_NE = lighting_corner_NE
var/old_lighting_corner_SE = lighting_corner_SE
@@ -132,18 +132,19 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
dynamic_lumcount = old_dynamic_lumcount
if(always_lit != old_always_lit)
if(always_lit)
add_overlay(GLOB.fullbright_overlay)
else
cut_overlay(GLOB.fullbright_overlay)
if(SSlighting.initialized)
lighting_object = old_lighting_object
directional_opacity = old_directional_opacity
recalculate_directional_opacity()
if (dynamic_lighting != old_dynamic_lighting)
if (IS_DYNAMIC_LIGHTING(src))
lighting_build_overlay()
else
lighting_clear_overlay()
else if(lighting_object && !lighting_object.needs_update)
if(lighting_object && !lighting_object.needs_update)
lighting_object.update()
for(var/turf/open/space/space_tile in RANGE_TURFS(1, src))
+1 -4
View File
@@ -16,7 +16,7 @@
plane = PLANE_SPACE
layer = SPACE_LAYER
light_power = 0.25
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
always_lit = TRUE
bullet_bounce_sound = null
vis_flags = VIS_INHERIT_ID //when this be added to vis_contents of something it be associated with something on clicking, important for visualisation of turf in openspace and interraction with openspace that show you turf.
@@ -49,9 +49,6 @@
smoothing_flags |= SMOOTH_OBJ
SET_BITFLAG_LIST(canSmoothWith)
var/area/A = loc
if(!IS_DYNAMIC_LIGHTING(src) && IS_DYNAMIC_LIGHTING(A))
add_overlay(/obj/effect/fullbright)
if(requires_activation)
SSair.add_to_active(src, TRUE)
+4 -4
View File
@@ -42,7 +42,8 @@ GLOBAL_LIST_EMPTY(station_turfs)
///Lumcount added by sources other than lighting datum objects, such as the overlay lighting component.
var/dynamic_lumcount = 0
var/dynamic_lighting = TRUE
///Bool, whether this turf will always be illuminated no matter what area it is in
var/always_lit = FALSE
var/tmp/lighting_corners_initialised = FALSE
@@ -108,9 +109,8 @@ GLOBAL_LIST_EMPTY(station_turfs)
for(var/atom/movable/content as anything in src)
Entered(content, null)
var/area/A = loc
if(!IS_DYNAMIC_LIGHTING(src) && IS_DYNAMIC_LIGHTING(A))
add_overlay(/obj/effect/fullbright)
if(always_lit)
add_overlay(GLOB.fullbright_overlay)
if(requires_activation)
CALCULATE_ADJACENT_TURFS(src, KILL_EXCITED)
@@ -4,12 +4,12 @@
name = "Cabin"
icon_state = "away2"
requires_power = TRUE
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
static_lighting = TRUE
/area/awaymission/cabin/snowforest
name = "Snow Forest"
icon_state = "away"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
/area/awaymission/cabin/snowforest/sovietsurface
name = "Snow Forest"
@@ -20,7 +20,7 @@
name = "Lumbermill"
icon_state = "away3"
requires_power = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
/area/awaymission/cabin/caves/sovietcave
name = "Soviet Bunker"
@@ -29,7 +29,9 @@
/area/awaymission/cabin/caves
name = "North Snowdin Caves"
icon_state = "awaycontent15"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
/area/awaymission/cabin/caves/mountain
name = "North Snowdin Mountains"
@@ -41,7 +43,7 @@
icon = 'icons/obj/fireplace.dmi'
icon_state = "firepit-active"
density = FALSE
var/active = 1
var/active = TRUE
/obj/structure/firepit/Initialize()
. = ..()
@@ -19,7 +19,7 @@
/area/awaymission/caves/research
name = "Research Outpost"
icon_state = "awaycontent5"
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
static_lighting = TRUE
/area/awaymission/caves/northblock //engineering, bridge (not really north but it doesnt really need its own APC)
@@ -1,7 +1,3 @@
/area/awaymission/vr/murderdome
name = "Murderdome"
icon_state = "awaycontent8"
pacifist = FALSE
/obj/structure/window/reinforced/fulltile/indestructable
name = "robust window"
@@ -3,7 +3,7 @@
/area/awaymission/research
name = "Research Outpost"
icon_state = "away"
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
static_lighting = TRUE
/area/awaymission/research/interior
name = "Research Inside"
@@ -4,7 +4,7 @@
name = "Snowdin"
icon_state = "awaycontent1"
requires_power = FALSE
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
/area/awaymission/snowdin/outside
name = "Snowdin Tundra Plains"
@@ -14,7 +14,7 @@
name = "Snowdin Outpost"
icon_state = "awaycontent2"
requires_power = TRUE
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
static_lighting = TRUE
/area/awaymission/snowdin/post/medbay
name = "Snowdin Outpost - Medbay"
@@ -96,12 +96,16 @@
/area/awaymission/snowdin/igloo
name = "Snowdin Igloos"
icon_state = "awaycontent14"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
/area/awaymission/snowdin/cave
name = "Snowdin Caves"
icon_state = "awaycontent15"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
/area/awaymission/snowdin/cave/cavern
name = "Snowdin Depths"
@@ -115,18 +119,18 @@
/area/awaymission/snowdin/base
name = "Snowdin Main Base"
icon_state = "awaycontent16"
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
static_lighting = TRUE
requires_power = TRUE
/area/awaymission/snowdin/dungeon1
name = "Snowdin Depths"
icon_state = "awaycontent17"
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
static_lighting = TRUE
/area/awaymission/snowdin/sekret
name = "Snowdin Operations"
icon_state = "awaycontent18"
dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
static_lighting = TRUE
requires_power = TRUE
/area/shuttle/snowdin/elevator1
+3 -3
View File
@@ -29,7 +29,7 @@
/datum/round_event/aurora_caelus/start()
for(var/area in GLOB.sortedAreas)
var/area/A = area
if(initial(A.dynamic_lighting) == DYNAMIC_LIGHTING_IFSTARLIGHT)
if(A.area_flags & AREA_USES_STARLIGHT)
for(var/turf/open/space/S in A)
S.set_light(S.light_range * 3, S.light_power * 0.5)
@@ -39,14 +39,14 @@
var/aurora_color = aurora_colors[aurora_progress]
for(var/area in GLOB.sortedAreas)
var/area/A = area
if(initial(A.dynamic_lighting) == DYNAMIC_LIGHTING_IFSTARLIGHT)
if(A.area_flags & AREA_USES_STARLIGHT)
for(var/turf/open/space/S in A)
S.set_light(l_color = aurora_color)
/datum/round_event/aurora_caelus/end()
for(var/area in GLOB.sortedAreas)
var/area/A = area
if(initial(A.dynamic_lighting) == DYNAMIC_LIGHTING_IFSTARLIGHT)
if(A.area_flags & AREA_USES_STARLIGHT)
for(var/turf/open/space/S in A)
fade_to_black(S)
priority_announce("The aurora caelus event is now ending. Starlight conditions will slowly return to normal. When this has concluded, please return to your workplace and continue work as normal. Have a pleasant shift, [station_name()], and thank you for watching with us.",
+50 -23
View File
@@ -1,32 +1,59 @@
/area
luminosity = TRUE
var/dynamic_lighting = DYNAMIC_LIGHTING_ENABLED
luminosity = 1
///The mutable appearance we underlay to show light
var/mutable_appearance/lighting_effect = null
///Whether this area has a currently active base lighting, bool
var/area_has_base_lighting = FALSE
///alpha 0-255 of lighting_effect and thus baselighting intensity
var/base_lighting_alpha = 0
///The colour of the light acting on this area
var/base_lighting_color = null
/area/proc/set_dynamic_lighting(new_dynamic_lighting = DYNAMIC_LIGHTING_ENABLED)
if (new_dynamic_lighting == dynamic_lighting)
/area/proc/set_base_lighting(new_base_lighting_color = -1, new_alpha = -1)
if(base_lighting_alpha == new_alpha && base_lighting_color == new_base_lighting_color)
return FALSE
dynamic_lighting = new_dynamic_lighting
if (IS_DYNAMIC_LIGHTING(src))
cut_overlay(/obj/effect/fullbright)
blend_mode = BLEND_DEFAULT
for (var/turf/T in src)
if (IS_DYNAMIC_LIGHTING(T))
T.lighting_build_overlay()
else
add_overlay(/obj/effect/fullbright)
blend_mode = BLEND_MULTIPLY
for (var/turf/T in src)
if (T.lighting_object)
T.lighting_clear_overlay()
if(new_alpha != -1)
base_lighting_alpha = new_alpha
if(new_base_lighting_color != -1)
base_lighting_color = new_base_lighting_color
update_base_lighting()
return TRUE
/area/vv_edit_var(var_name, var_value)
switch(var_name)
if(NAMEOF(src, dynamic_lighting))
set_dynamic_lighting(var_value)
if("base_lighting_color")
set_base_lighting(new_base_lighting_color = var_value)
return TRUE
if("base_lighting_alpha")
set_base_lighting(new_alpha = var_value)
return TRUE
return ..()
/area/proc/update_base_lighting()
if(!area_has_base_lighting && (!base_lighting_alpha || !base_lighting_color))
return
if(!area_has_base_lighting)
add_base_lighting()
return
remove_base_lighting()
if(base_lighting_alpha && base_lighting_color)
add_base_lighting()
/area/proc/remove_base_lighting()
for(var/turf/T in src)
T.cut_overlay(lighting_effect)
QDEL_NULL(lighting_effect)
area_has_base_lighting = FALSE
/area/proc/add_base_lighting()
lighting_effect = mutable_appearance('icons/effects/alphacolors.dmi', "white")
lighting_effect.plane = LIGHTING_PLANE
lighting_effect.layer = LIGHTING_PRIMARY_LAYER
lighting_effect.blend_mode = BLEND_ADD
lighting_effect.alpha = base_lighting_alpha
lighting_effect.color = base_lighting_color
for(var/turf/T in src)
T.add_overlay(lighting_effect)
T.luminosity = 1
area_has_base_lighting = TRUE
+2 -4
View File
@@ -1,14 +1,12 @@
/proc/create_all_lighting_objects()
for(var/area/A in world)
if(!IS_DYNAMIC_LIGHTING(A))
if(!A.static_lighting)
continue
for(var/turf/T in A)
if(!IS_DYNAMIC_LIGHTING(T))
if(T.always_lit)
continue
new/datum/lighting_object(T)
CHECK_TICK
CHECK_TICK
+8 -3
View File
@@ -15,7 +15,7 @@
qdel(lighting_object, force=TRUE) //Shitty fix for lighting objects persisting after death
var/area/our_area = loc
if (!IS_DYNAMIC_LIGHTING(our_area) && !light_sources)
if (!our_area.static_lighting && !light_sources)
return
new/datum/lighting_object(src)
@@ -97,11 +97,16 @@
/turf/proc/change_area(area/old_area, area/new_area)
if(SSlighting.initialized)
if (new_area.dynamic_lighting != old_area.dynamic_lighting)
if (new_area.dynamic_lighting)
if (new_area.static_lighting != old_area.static_lighting)
if (new_area.static_lighting)
lighting_build_overlay()
else
lighting_clear_overlay()
//Inherit overlay of new area
if(old_area.lighting_effect)
cut_overlay(old_area.lighting_effect)
if(new_area.lighting_effect)
add_overlay(new_area.lighting_effect)
/turf/proc/generate_missing_corners()
if (!lighting_corner_NE)
@@ -0,0 +1,17 @@
GLOBAL_DATUM_INIT(fullbright_overlay, /mutable_appearance, create_fullbright_overlay())
/proc/create_fullbright_overlay()
var/mutable_appearance/lighting_effect = mutable_appearance('icons/effects/alphacolors.dmi', "white")
lighting_effect.plane = LIGHTING_PLANE
lighting_effect.layer = LIGHTING_PRIMARY_LAYER
lighting_effect.blend_mode = BLEND_ADD
return lighting_effect
/area
///Whether this area allows static lighting and thus loads the lighting objects
var/static_lighting = TRUE
//Non static lighting areas.
//Any lighting area that wont support static lights.
//These areas will NOT have corners generated.
+3 -1
View File
@@ -29,7 +29,9 @@
/area/mafia
name = "Mafia Minigame"
icon_state = "mafia"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
flags_1 = NONE
@@ -2,7 +2,7 @@
/area/survivalpod
name = "\improper Emergency Shelter"
icon_state = "away"
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = TRUE
requires_power = FALSE
has_gravity = STANDARD_GRAVITY
area_flags = BLOBS_ALLOWED | UNIQUE_AREA | CULT_PERMITTED
@@ -91,7 +91,9 @@
/area/ai_multicam_room
name = "ai_multicam_room"
icon_state = "ai_camera_room"
dynamic_lighting = DYNAMIC_LIGHTING_DISABLED
static_lighting = FALSE
base_lighting_color = COLOR_WHITE
base_lighting_alpha = 255
area_flags = NOTELEPORT | HIDDEN_AREA | UNIQUE_AREA
ambientsounds = null
flags_1 = NONE
@@ -16,7 +16,7 @@
if(!..())
return
var/area/local_area = get_area(user)
if(!IS_DYNAMIC_LIGHTING(local_area))
if(!local_area.static_lighting)
to_chat(user, span_warning("You cannot place [src] in this area!"))
return
return TRUE
@@ -351,7 +351,9 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999))
requires_power = FALSE
has_gravity = TRUE
area_flags = NOTELEPORT | HIDDEN_AREA
dynamic_lighting = DYNAMIC_LIGHTING_FORCED
static_lighting = FALSE
base_lighting_alpha = 255
base_lighting_color = COLOR_WHITE
ambientsounds = list('sound/ambience/servicebell.ogg')
var/roomnumber = 0
var/obj/item/hilbertshotel/parentSphere
+1
View File
@@ -2581,6 +2581,7 @@
#include "code\modules\lighting\lighting_setup.dm"
#include "code\modules\lighting\lighting_source.dm"
#include "code\modules\lighting\lighting_turf.dm"
#include "code\modules\lighting\static_lighting_area.dm"
#include "code\modules\mafia\_defines.dm"
#include "code\modules\mafia\controller.dm"
#include "code\modules\mafia\map_pieces.dm"