-
Notifications
You must be signed in to change notification settings - Fork 555
/
static_lighting_turf.dm
64 lines (47 loc) · 2.1 KB
/
static_lighting_turf.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/turf
var/tmp/lighting_corners_initialised = FALSE
var/tmp/datum/static_lighting_object/static_lighting_object
///Lighting Corner datums.
var/tmp/datum/static_lighting_corner/lighting_corner_NE
var/tmp/datum/static_lighting_corner/lighting_corner_SE
var/tmp/datum/static_lighting_corner/lighting_corner_SW
var/tmp/datum/static_lighting_corner/lighting_corner_NW
/turf/proc/static_lighting_clear_overlay()
if (static_lighting_object)
qdel(static_lighting_object, TRUE)
/// Builds a lighting object for us, but only if our area is dynamic.
/turf/proc/static_lighting_build_overlay(area/our_area = loc)
if(static_lighting_object)
qdel(static_lighting_object, force=TRUE) //Shitty fix for lighting objects persisting after death
new/datum/static_lighting_object(src)
// Returns a boolean whether the turf is on soft lighting.
// Soft lighting being the threshold at which point the overlay considers
// itself as too dark to allow sight and see_in_dark becomes useful.
// So basically if this returns true the tile is unlit black.
/turf/proc/static_is_softly_lit()
if (!static_lighting_object)
return FALSE
return !(luminosity || dynamic_lumcount)
///Transfer the lighting of one area to another
/turf/proc/transfer_area_lighting(area/old_area, area/new_area)
if(SSlighting.initialized)
if (new_area.static_lighting != old_area.static_lighting)
if (new_area.static_lighting)
static_lighting_build_overlay(new_area)
else
static_lighting_clear_overlay()
//Inherit overlay of new area
if(old_area.lighting_effect)
overlays -= old_area.lighting_effect
if(new_area.lighting_effect)
overlays += new_area.lighting_effect
/turf/proc/static_generate_missing_corners()
if (!lighting_corner_NE)
lighting_corner_NE = new/datum/static_lighting_corner(src, NORTH|EAST)
if (!lighting_corner_SE)
lighting_corner_SE = new/datum/static_lighting_corner(src, SOUTH|EAST)
if (!lighting_corner_SW)
lighting_corner_SW = new/datum/static_lighting_corner(src, SOUTH|WEST)
if (!lighting_corner_NW)
lighting_corner_NW = new/datum/static_lighting_corner(src, NORTH|WEST)
lighting_corners_initialised = TRUE