Merge remote-tracking branch 'upstream/development' into development

This commit is contained in:
skull132
2018-04-29 17:32:58 +03:00
26 changed files with 76352 additions and 70995 deletions

View File

@@ -3,13 +3,16 @@
#define PLANE_SPACE_DUST (PLANE_SPACE_PARALLAX + 1) // -96
#define PLANE_ABOVE_PARALLAX (PLANE_SPACE_BACKGROUND + 3) // -95
// Custom layer definitions, supplementing the default TURF_LAYER, MOB_LAYER, etc.
#define LOWER_ON_TURF_LAYER (TURF_LAYER + 0.05) // under the below
#define ON_TURF_LAYER (TURF_LAYER + 0.1) // sitting on the turf - should be preferred over direct use of TURF_LAYER
#define AO_LAYER (ON_TURF_LAYER + 0.1)
#define DOOR_OPEN_LAYER 2.7 //Under all objects if opened. 2.7 due to tables being at 2.6
#define UNDERDOOR 3.09 //Just barely under a closed door.
#define DOOR_CLOSED_LAYER 3.1 //Above most items if closed
#define BELOW_MOB_LAYER 3.7
#define ABOVE_MOB_LAYER 4.1
#define LIGHTING_LAYER 11
#define OBFUSCATION_LAYER 21 //Where images covering the view for eyes are put
#define HUD_LAYER 20 //Above lighting, but below obfuscation. For in-game HUD effects (whereas SCREEN_LAYER is for abstract/OOC things like inventory slots)
#define OBFUSCATION_LAYER 21 //Where images covering the view for eyes are put
#define SCREEN_LAYER 22 //Mob HUD/effects layer

View File

@@ -16,6 +16,13 @@
// If defined, instant updates will be used whenever server load permits. Otherwise queued updates are always used.
#define USE_INTELLIGENT_LIGHTING_UPDATES
// If defined, lighting corners will 'bleed' luminosity to corners above them to simulate cross-Z lighting upwards. Downwards Z-lighting will continue to work with this disabled.
#define USE_CORNER_ZBLEED
#define TURF_IS_DYNAMICALLY_LIT(T) (isturf(T) && T:dynamic_lighting && T:loc:dynamic_lighting)
// mostly identical to above, but doesn't make sure T is valid first. Should only be used by lighting code.
#define TURF_IS_DYNAMICALLY_LIT_UNSAFE(T) (T:dynamic_lighting && T:loc:dynamic_lighting)
// If I were you I'd leave this alone.
#define LIGHTING_BASE_MATRIX \
list \

View File

@@ -456,3 +456,13 @@ Define for getting a bitfield of adjacent turfs that meet a condition.
#define MAX_SOUND_Z_TRAVERSAL 2
#define Z_ALL_TURFS(Z) block(locate(1, 1, Z), locate(world.maxx, world.maxy, Z))
// Z-controller stuff - see basic.dm to see why the fuck this is the way it is.
#define IS_VALID_ZINDEX(z) !((z) > world.maxz || z > 17 || z < 2)
#define HAS_ABOVE(z) (IS_VALID_ZINDEX(z) && z_levels & (1 << (z - 1)))
#define HAS_BELOW(z) (IS_VALID_ZINDEX(z) && z_levels & (1 << (z - 2)))
#define GET_ABOVE(A) (HAS_ABOVE(A:z) ? get_step(A, UP) : null)
#define GET_BELOW(A) (HAS_BELOW(A:z) ? get_step(A, DOWN) : null)

View File

@@ -1,7 +1,7 @@
#define OPENTURF_MAX_PLANE -71
#define OPENTURF_CAP_PLANE -70 // The multiplier goes here so it'll be on top of every other overlay.
#define OPENTURF_MAX_DEPTH 10 // The maxiumum number of planes deep we'll go before we just dump everything on the same plane.
#define SHADOWER_DARKENING_FACTOR 0.4 // The multiplication factor for openturf shadower darkness. Lighting will be multiplied by this.
#define SHADOWER_DARKENING_FACTOR 0.85 // The multiplication factor for openturf shadower darkness. Lighting will be multiplied by this.
/var/datum/controller/subsystem/zcopy/SSzcopy

View File

@@ -213,7 +213,7 @@
to_chat(src, "<span class='warning'>Your powers are not capable of taking you that far.</span>")
return
if (!T.dynamic_lighting || T.get_lumcount() > 0.1)
if (T.get_lumcount() > 0.1)
// Too bright, cannot jump into.
to_chat(src, "<span class='warning'>The destination is too bright.</span>")
return

View File

@@ -56,6 +56,7 @@
floor_markings = image('icons/obj/machines/stationmap.dmi', "decal_station_map")
floor_markings.dir = src.dir
floor_markings.layer = ON_TURF_LAYER
update_icon()
/obj/machinery/station_map/attack_hand(var/mob/user)

View File

@@ -1,7 +1,9 @@
#ifdef AO_USE_LIGHTING_OPACITY
#define AO_TURF_CHECK(T) (!T.has_opaque_atom || !T.permit_ao)
#define AO_SELF_CHECK(T) (!T.has_opaque_atom)
#else
#define AO_TURF_CHECK(T) (!T.density || !T.opacity || !T.permit_ao)
#define AO_SELF_CHECK(T) (!T.density && !T.opacity)
#endif
/turf
@@ -29,7 +31,7 @@
var/turf/T
if (flags & MIMIC_BELOW)
CALCULATE_NEIGHBORS(src, ao_neighbors_mimic, T, (T.flags & MIMIC_BELOW))
if (!has_opaque_atom && !(flags & MIMIC_NO_AO))
if (AO_SELF_CHECK(src) && !(flags & MIMIC_NO_AO))
CALCULATE_NEIGHBORS(src, ao_neighbors, T, AO_TURF_CHECK(T))
/proc/make_ao_image(corner, i, px = 0, py = 0, pz = 0, pw = 0)
@@ -41,6 +43,7 @@
I.alpha = WALL_AO_ALPHA
I.blend_mode = BLEND_OVERLAY
I.appearance_flags = RESET_ALPHA|RESET_COLOR|TILE_BOUND
I.layer = AO_LAYER
// If there's an offset, counteract it.
if (px || py || pz || pw)
I.pixel_x = -px
@@ -109,3 +112,5 @@
#undef REGEN_AO
#undef PROCESS_AO_CORNER
#undef AO_TURF_CHECK
#undef AO_SELF_CHECK

View File

@@ -140,11 +140,19 @@
gear_tweaks += new/datum/gear_tweak/path(taj_gloves)
/datum/gear/suit/tajara_coat
display_name = "tajaran naval coat (Tajara)"
display_name = "tajara coat selection (Tajara)"
path = /obj/item/clothing/suit/storage/tajaran
whitelisted = list("Tajara", "Zhan-Khazan Tajara", "M'sai Tajara")
sort_category = "Xenowear"
/datum/gear/suit/tajara_coat/New()
..()
var/coat = list()
coat["tajaran naval coat"] = /obj/item/clothing/suit/storage/tajaran
coat["commoner cloak"] = /obj/item/clothing/suit/storage/tajaran/cloak
coat["royal cloak"] = /obj/item/clothing/suit/storage/tajaran/cloak/fancy
gear_tweaks += new/datum/gear_tweak/path(coat)
/datum/gear/suit/tajaran_labcoat
display_name = "PRA medical coat (Tajara)"
path = /obj/item/clothing/suit/storage/toggle/labcoat/tajaran
@@ -152,6 +160,70 @@
allowed_roles = list("Chief Medical Officer", "Medical Doctor", "Chemist", "Geneticist", "Paramedic", "Medical Resident")
sort_category = "Xenowear"
/datum/gear/uniform/tajara
display_name = "tajaran uniform selection (Tajara)"
path = /obj/item/clothing/under/tajaran
whitelisted = list("Tajara", "Zhan-Khazan Tajara", "M'sai Tajara")
sort_category = "Xenowear"
/datum/gear/uniform/tajara/New()
..()
var/uniform = list()
uniform["laborers clothes"] = /obj/item/clothing/under/tajaran
uniform["fancy uniform"] = /obj/item/clothing/under/tajaran/fancy
uniform["NanoTrasen overalls"] = /obj/item/clothing/under/tajaran/nt
gear_tweaks += new/datum/gear_tweak/path(uniform)
/datum/gear/uniform/tajara_dress
display_name = "tajaran dress selection (Tajara)"
path = /obj/item/clothing/under/dress/tajaran
whitelisted = list("Tajara", "Zhan-Khazan Tajara", "M'sai Tajara")
sort_category = "Xenowear"
/datum/gear/uniform/tajara_dress/New()
..()
var/dress = list()
dress["white fancy adhomian dress"] = /obj/item/clothing/under/dress/tajaran
dress["blue fancy adhomian dress"] = /obj/item/clothing/under/dress/tajaran/blue
dress["green fancy adhomian dress"] = /obj/item/clothing/under/dress/tajaran/green
dress["red fancy adhomian dress"] = /obj/item/clothing/under/dress/tajaran/red
dress["red noble adhomian dress"] = /obj/item/clothing/under/dress/tajaran/fancy
dress["black noble adhomian dress"] = /obj/item/clothing/under/dress/tajaran/fancy/black
gear_tweaks += new/datum/gear_tweak/path(dress)
/datum/gear/accessory/tajara
display_name = "fur scarf (Tajara)"
path = /obj/item/clothing/accessory/tajaran
whitelisted = list("Tajara", "Zhan-Khazan Tajara", "M'sai Tajara")
sort_category = "Xenowear"
/datum/gear/accessory/tajara/New()
..()
var/scarf = list()
scarf["brown fur scarf"] = /obj/item/clothing/accessory/tajaran
scarf["light brown fur scarf"] = /obj/item/clothing/accessory/tajaran/lbrown
scarf["cinnamon fur scarf"] = /obj/item/clothing/accessory/tajaran/cinnamon
scarf["blue fur scarf"] = /obj/item/clothing/accessory/tajaran/blue
scarf["silver fur scarf"] = /obj/item/clothing/accessory/tajaran/silver
scarf["black fur scarf"] = /obj/item/clothing/accessory/tajaran/black
scarf["ruddy fur scarf"] = /obj/item/clothing/accessory/tajaran/ruddy
scarf["orange fur scarf"] = /obj/item/clothing/accessory/tajaran/orange
scarf["cream fur scarf"] = /obj/item/clothing/accessory/tajaran/cream
gear_tweaks += new/datum/gear_tweak/path(scarf)
/datum/gear/head/tajara
display_name = "dress circlet selection (Tajara)"
path = /obj/item/clothing/head/tajaran/circlet
whitelisted = list("Tajara", "Zhan-Khazan Tajara", "M'sai Tajara")
sort_category = "Xenowear"
/datum/gear/head/tajara/New()
..()
var/circlet = list()
circlet["golden dress circlet"] = /obj/item/clothing/head/tajaran/circlet
circlet["silver dress circlet"] = /obj/item/clothing/head/tajaran/circlet/silver
gear_tweaks += new/datum/gear_tweak/path(circlet)
//other things
/datum/gear/uniform/gearharness

View File

@@ -52,6 +52,45 @@
icon_open = "taj_jacket_open"
icon_closed = "taj_jacket"
/obj/item/clothing/suit/storage/tajaran/cloak
name = "commoner cloak"
desc = "A tajaran cloak made with the middle class in mind, fancy but nothing special."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_commoncloak"
item_state = "taj_commoncloak"
contained_sprite = TRUE
body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS
/obj/item/clothing/suit/storage/tajaran/cloak/fancy
name = "royal cloak"
desc = "A cloak fashioned from the best materials, meant for tajara of high standing."
icon_state = "taj_fancycloak"
item_state = "taj_fancycloak"
/obj/item/clothing/suit/storage/hooded/tajaran
name = "gruff cloak"
desc = "A cloak designated for the lowest classes."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_cloak"
item_state = "taj_cloak"
contained_sprite = TRUE
hoodtype = /obj/item/clothing/head/winterhood
/obj/item/clothing/head/tajaran/circlet
name = "golden dress circlet"
desc = "A golden circlet with a pearl in the middle of it."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_circlet"
item_state = "taj_circlet"
contained_sprite = TRUE
body_parts_covered = 0
/obj/item/clothing/head/tajaran/circlet/silver
name = "silver dress circlet"
desc = "A silver circlet with a pearl in the middle of it."
icon_state = "taj_circlet_s"
item_state = "taj_circlet_s"
//Vaurca clothing
/obj/item/clothing/suit/vaurca

View File

@@ -0,0 +1,105 @@
/obj/item/clothing/under/tajaran
name = "laborers clothes"
desc = "A rough but thin outfit, providing air flow but also protection from working hazards."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_labor"
item_state = "taj_labor"
contained_sprite = TRUE
/obj/item/clothing/under/tajaran/fancy
name = "fancy uniform"
desc = "Worn by princess, barons and lords of Adhomai, now in stores near you!"
icon_state = "male_taj_fancy"
item_state = "male_taj_fancy"
/obj/item/clothing/under/tajaran/nt
name = "NanoTrasen overalls"
desc = "Overalls meant for NanoTrasen employees of xeno descend, modified to prevent overheating."
icon_state = "ntoveralls"
item_state = "ntoveralls"
/obj/item/clothing/under/dress/tajaran
name = "fancy adhomian dress"
desc = "Created for the rich and party-loving circles of Adhomai, this dress is fashioned from smooth silk and is see through at parts. This one is white."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_dress_white"
item_state = "taj_dress_white"
contained_sprite = TRUE
/obj/item/clothing/under/dress/tajaran/blue
desc = "Created for the rich and party-loving circles of Adhomai, this dress is fashioned from smooth silk and is see through at parts. This one is blue."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_dress_skyblue"
item_state = "taj_dress_skyblue"
/obj/item/clothing/under/dress/tajaran/green
desc = "Created for the rich and party-loving circles of Adhomai, this dress is fashioned from smooth silk and is see through at parts. This one is green."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_dress_green"
item_state = "taj_dress_green"
/obj/item/clothing/under/dress/tajaran/red
desc = "Created for the rich and party-loving circles of Adhomai, this dress is fashioned from smooth silk and is see through at parts. This one is red."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_dress_red"
item_state = "taj_dress_red"
/obj/item/clothing/under/dress/tajaran/fancy
name = "noble adhomian dress"
desc = "The classical dress of the Adhomai royalty, only to be worn during the special occassions. This one is crimson red."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "taj_dress_fancy"
item_state = "taj_dress_fancy"
/obj/item/clothing/under/dress/tajaran/fancy/black
desc = "The classical dress of the Adhomai royalty, only to be worn during the special occassions. This one is dark black."
icon_state = "taj_dress_fancy_dark"
item_state = "taj_dress_fancy_dark"
/obj/item/clothing/accessory/tajaran
name = "fur scarf"
desc = "A furred scarf, a common tajaran vanity item, this one is brown."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "furscarf_brown"
item_state = "furscarf_brown"
contained_sprite = TRUE
/obj/item/clothing/accessory/tajaran/lbrown
desc = "A furred scarf, a common tajaran vanity item, this one is light brown."
icon_state = "furscarf_lbrown"
item_state = "furscarf_lbrown"
/obj/item/clothing/accessory/tajaran/cinnamon
desc = "A furred scarf, a common tajaran vanity item, this one is cinnamon."
icon_state = "furscarf_cinnamon"
item_state = "furscarf_cinnamon"
/obj/item/clothing/accessory/tajaran/blue
desc = "A furred scarf, a common tajaran vanity item, this one is blue."
icon_state = "furscarf_blue"
item_state = "furscarf_blue"
/obj/item/clothing/accessory/tajaran/silver
desc = "A furred scarf, a common tajaran vanity item, this one is silver."
icon_state = "furscarf_silver"
item_state = "furscarf_silver"
/obj/item/clothing/accessory/tajaran/black
desc = "A furred scarf, a common tajaran vanity item, this one is black."
icon_state = "furscarf_black"
item_state = "furscarf_black"
/obj/item/clothing/accessory/tajaran/ruddy
desc = "A furred scarf, a common tajaran vanity item, this one is ruddy."
icon_state = "furscarf_ruddy"
item_state = "furscarf_ruddy"
/obj/item/clothing/accessory/tajaran/orange
desc = "A furred scarf, a common tajaran vanity item, this one is orange."
icon_state = "furscarf_lasaga"
item_state = "furscarf_lasaga"
/obj/item/clothing/accessory/tajaran/cream
desc = "A furred scarf, a common tajaran vanity item, this one is cream."
icon_state = "furscarf_cream"
item_state = "furscarf_cream"

View File

@@ -292,7 +292,7 @@
// Handle light requirements.
if(!light_supplied)
if (current_turf.dynamic_lighting)
if (TURF_IS_DYNAMICALLY_LIT(current_turf))
light_supplied = current_turf.get_lumcount(0, 3) * 10
else
light_supplied = 5

View File

@@ -647,10 +647,11 @@
light_string = "that the internal lights are set to [tray_light] lumens"
else
var/light_available
if(T.dynamic_lighting)
if(TURF_IS_DYNAMICALLY_LIT(T))
light_available = T.get_lumcount(0, 3) * 10
else
light_available = 5
light_available = 5
light_string = "a light level of [light_available] lumens"
usr << "The tray's sensor suite is reporting [light_string] and a temperature of [environment.temperature]K."

View File

@@ -11,16 +11,20 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
/datum/lighting_corner
var/turf/t1 // These are in no particular order.
var/t1i // Our index in this turf's corners list.
var/turf/t2
var/t2i
var/turf/t3
var/t3i
var/turf/t4
var/t4i
var/list/datum/light_source/affecting // Light sources affecting us.
var/active = FALSE // TRUE if one of our masters has dynamic lighting.
var/x = 0
var/y = 0
var/z = 0
var/x = 0
var/y = 0
var/z = 0
var/lum_r = 0
var/lum_g = 0
@@ -34,11 +38,12 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
var/cache_b = LIGHTING_SOFT_THRESHOLD
var/cache_mx = 0
/datum/lighting_corner/New(var/turf/new_turf, var/diagonal)
/datum/lighting_corner/New(turf/new_turf, diagonal)
SSlighting.lighting_corners += src
t1 = new_turf
z = new_turf.z
t1i = REVERSE_LIGHTING_CORNER_DIAGONAL[diagonal]
var/vertical = diagonal & ~(diagonal - 1) // The horizontal directions (4 and 8) are bigger than the vertical ones (1 and 2), so we can reliably say the lsb is the horizontal direction.
var/horizontal = diagonal & ~vertical // Now that we know the horizontal one we can get the vertical one.
@@ -60,6 +65,7 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
t2 = T
i = REVERSE_LIGHTING_CORNER_DIAGONAL[diagonal]
t2i = i
T.corners[i] = src
// Now the horizontal one.
@@ -70,6 +76,7 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
t3 = T
i = REVERSE_LIGHTING_CORNER_DIAGONAL[((T.x > x) ? EAST : WEST) | ((T.y > y) ? NORTH : SOUTH)] // Get the dir based on coordinates.
t3i = i
T.corners[i] = src
// And finally the vertical one.
@@ -80,6 +87,7 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
t4 = T
i = REVERSE_LIGHTING_CORNER_DIAGONAL[((T.x > x) ? EAST : WEST) | ((T.y > y) ? NORTH : SOUTH)] // Get the dir based on coordinates.
t4i = i
T.corners[i] = src
update_active()
@@ -95,18 +103,21 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
#undef OVERLAY_PRESENT
// God that was a mess, now to do the rest of the corner code! Hooray!
/datum/lighting_corner/proc/update_lumcount(var/delta_r, var/delta_g, var/delta_b, var/delta_u, var/now = FALSE)
/datum/lighting_corner/proc/update_lumcount(delta_r, delta_g, delta_b, delta_u, now = FALSE)
if (!(delta_r + delta_g + delta_b)) // Don't check u since the overlay doesn't care about it.
return
lum_r += delta_r
lum_g += delta_g
lum_b += delta_b
lum_u += delta_u
if (needs_update || !(delta_r + delta_g + delta_b)) // Don't check u since the overlay doesn't care about it.
// This needs to be down here instead of the above if so the lum values are properly updated.
if (needs_update)
return
if (!now)
needs_update = TRUE
update_overlays(FALSE)
SSlighting.corner_queue += src
else
update_overlays(TRUE)
@@ -122,9 +133,60 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
} \
}
/datum/lighting_corner/proc/update_overlays(var/now = FALSE)
#define AVERAGE_BELOW_CORNER(Tt, Ti) \
if (TURF_IS_MIMICING(Tt)) { \
T = GET_BELOW(Tt); \
if (T && T.corners && TURF_IS_DYNAMICALLY_LIT_UNSAFE(T)) { \
C = T.corners[Ti]; \
if (C) { \
divisor += 1; \
lr += C.lum_r; \
lg += C.lum_g; \
lb += C.lum_b; \
} \
} \
}
#define UPDATE_ABOVE_CORNER(Tt, Ti) \
if (Tt) { \
T = GET_ABOVE(Tt); \
if (TURF_IS_MIMICING(T) && TURF_IS_DYNAMICALLY_LIT_UNSAFE(T)) { \
if (!T.corners) { \
T.generate_missing_corners(); \
} \
C = T.corners[Ti]; \
if (C && !C.needs_update) { \
C.update_overlays(FALSE); \
} \
} \
}
/datum/lighting_corner/proc/update_overlays(now = FALSE)
var/lr = lum_r
var/lg = lum_g
var/lb = lum_b
#ifdef USE_CORNER_ZBLEED
var/divisor = 1
var/datum/lighting_corner/C
var/turf/T
AVERAGE_BELOW_CORNER(t1, t1i)
AVERAGE_BELOW_CORNER(t2, t2i)
AVERAGE_BELOW_CORNER(t3, t3i)
AVERAGE_BELOW_CORNER(t4, t4i)
if (divisor > 1)
lr /= divisor
lg /= divisor
lb /= divisor
#endif
// Cache these values a head of time so 4 individual lighting overlays don't all calculate them individually.
var/mx = max(lum_r, lum_g, lum_b) // Scale it so 1 is the strongest lum, if it is above 1.
var/mx = max(lr, lg, lb) // Scale it so 1 is the strongest lum, if it is above 1.
. = 1 // factor
if (mx > 1)
. = 1 / mx
@@ -132,9 +194,13 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
else if (mx < LIGHTING_SOFT_THRESHOLD)
. = 0 // 0 means soft lighting.
cache_r = round(lum_r * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
cache_g = round(lum_g * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
if (.)
cache_r = round(lr * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
cache_g = round(lg * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
cache_b = round(lb * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
else
cache_r = cache_g = cache_b = LIGHTING_SOFT_THRESHOLD
cache_mx = round(mx, LIGHTING_ROUND_VALUE)
UPDATE_MASTER(t1)
@@ -142,7 +208,18 @@ var/list/REVERSE_LIGHTING_CORNER_DIAGONAL = list(0, 0, 0, 0, 3, 4, 0, 0, 2, 1)
UPDATE_MASTER(t3)
UPDATE_MASTER(t4)
#ifdef USE_CORNER_ZBLEED
UPDATE_ABOVE_CORNER(t1, t1i)
UPDATE_ABOVE_CORNER(t2, t2i)
UPDATE_ABOVE_CORNER(t3, t3i)
UPDATE_ABOVE_CORNER(t4, t4i)
#endif
#undef UPDATE_MASTER
#undef AVERAGE_BELOW_CORNER
#undef UPDATE_ABOVE_CORNER
/datum/lighting_corner/Destroy(force = FALSE)
crash_with("Some fuck [force ? "force-" : ""]deleted a lighting corner.")

View File

@@ -355,12 +355,7 @@
var/test_x
var/test_y
var/zlights_going_up = FALSE
var/turf/originalT // This is needed to reset our search point for bidirectional Z-lights.
FOR_DVIEW(originalT, Ceiling(actual_range), source_turf, 0)
T = originalT
zlights_going_up = FALSE
FOR_DVIEW(T, Ceiling(actual_range), source_turf, 0)
check_t:
if (light_angle && !facing_opaque) // Directional lighting coordinate filter.
@@ -371,7 +366,7 @@
if ((PSEUDO_WEDGE(limit_a_x, limit_a_y, test_x, test_y) > 0) || (PSEUDO_WEDGE(test_x, test_y, limit_b_x, limit_b_y) > 0))
continue
if (T.dynamic_lighting || T.light_sources)
if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(T) || T.light_sources)
Tcorners = T.corners
if (!T.lighting_corners_initialised)
T.lighting_corners_initialised = TRUE
@@ -396,19 +391,10 @@
// Note: above is defined on ALL turfs, but below is only defined on OPEN TURFS.
zlight_check:
if (zlights_going_up) // If we're searching upwards, check above.
if (istype(T.above)) // We escape the goto loop if this condition is false.
T = T.above
goto check_t
else
if (T && (T.flags & MIMIC_BELOW) && T.below) // Not searching upwards and we have a below turf.
T = T.below // Consider the turf below us as well. (Z-lights)
goto check_t
else // Not searching upwards and we don't have a below turf.
zlights_going_up = TRUE
T = originalT
goto zlight_check
// Upwards lights are handled at the corner level, so only search down.
if (T && (T.flags & MIMIC_BELOW) && T.below)
T = T.below
goto check_t
END_FOR_DVIEW

View File

@@ -73,7 +73,7 @@
check_t:
if (T.dynamic_lighting || T.light_sources)
if (TURF_IS_DYNAMICALLY_LIT_UNSAFE(T) || T.light_sources)
Tcorners = T.corners
if (!T.lighting_corners_initialised)
T.lighting_corners_initialised = TRUE

View File

@@ -49,7 +49,7 @@ var/list/admin_verbs_lighting = list(
if (!check_rights(R_DEBUG|R_DEV)) return
if (!T.dynamic_lighting)
if (TURF_IS_DYNAMICALLY_LIT(T))
src << "That turf is not dynamically lit."
return

View File

@@ -549,7 +549,7 @@
src << "<span class='warning'>Your powers are not capable of taking you that far.</span>"
return
if (!T.dynamic_lighting || T.get_lumcount() > 0.1)
if (T.get_lumcount() > 0.1)
src << "<span class='warning'>The destination is too bright.</span>"
return

View File

@@ -1287,7 +1287,7 @@
//0.1% chance of playing a scary sound to someone who's in complete darkness
if(isturf(loc) && rand(1,1000) == 1)
var/turf/T = loc
if(T.dynamic_lighting && T.get_lumcount() < 0.01) // give a little bit of tolerance for near-dark areas.
if(T.get_lumcount() < 0.01) // give a little bit of tolerance for near-dark areas.
playsound_local(src,pick(scarySounds),50, 1, -1)
/mob/living/carbon/human/proc/handle_changeling()

View File

@@ -17,35 +17,25 @@ var/z_levels = 0 // Each bit represents a connection between adjacent levels. S
SSatlas.height_markers -= src
return ..()
// The storage of connections between adjacent levels means some bitwise magic is needed.
// Legacy shims.
/proc/HasAbove(var/z)
if(z >= world.maxz || z > 16 || z < 1)
return 0
return z_levels & (1 << (z - 1))
return HAS_ABOVE(z)
/proc/HasBelow(var/z)
if(z > world.maxz || z > 17 || z < 2)
return 0
return z_levels & (1 << (z - 2))
return HAS_BELOW(z)
// Thankfully, no bitwise magic is needed here.
/proc/GetAbove(var/atom/atom)
var/turf/turf = get_turf(atom)
if(!turf)
return null
return HasAbove(turf.z) ? get_step(turf, UP) : null
/proc/GetAbove(atom/A)
return A ? GET_ABOVE(A) : null
/proc/GetBelow(var/atom/atom)
var/turf/turf = get_turf(atom)
if(!turf)
return null
return HasBelow(turf.z) ? get_step(turf, DOWN) : null
/proc/GetBelow(atom/A)
return A ? GET_BELOW(A) : null
/proc/GetConnectedZlevels(z)
. = list(z)
for(var/level = z, HasBelow(level), level--)
for(var/level = z, HAS_BELOW(level), level--)
. += level-1
for(var/level = z, HasAbove(level), level++)
for(var/level = z, HAS_ABOVE(level), level++)
. += level+1
/proc/AreConnectedZLevels(var/zA, var/zB)
@@ -68,9 +58,10 @@ var/z_levels = 0 // Each bit represents a connection between adjacent levels. S
return new_entry[zB]
/proc/get_zstep(ref, dir)
if(dir == UP)
. = GetAbove(ref)
else if (dir == DOWN)
. = GetBelow(ref)
else
. = get_step(ref, dir)
switch (dir)
if (UP)
. = GET_ABOVE(ref)
if (DOWN)
. = GET_BELOW(ref)
else
. = get_step(ref, dir)

View File

@@ -1,6 +1,3 @@
#define GET_BELOW_OR_NULL(atom, z) \
(!(z > world.maxz || z > 17 || z < 2) && z_levels & (1 << (z - 2))) ? get_step(atom, DOWN) : null
/datum/random_map/automata/cave_system
iterations = 5
descriptor = "moon caves"
@@ -131,7 +128,7 @@
if(EMPTY_CHAR)
new_path = mineral_rich
if(FLOOR_CHAR)
var/turf/below = GET_BELOW_OR_NULL(T, T.z)
var/turf/below = GET_BELOW(T)
if(below)
var/area/below_area = below.loc // Let's just assume that the turf is not in nullspace.
if(below_area.station_area)
@@ -164,5 +161,3 @@
target_turf_type = /turf/unsimulated/chasm_mask
mineral_sparse = /turf/simulated/floor/asteroid/ash
mineral_rich = /turf/simulated/floor/asteroid/ash
#undef GET_BELOW_OR_NULL