Fixes luminosity checks

They should now be more in-line with how they worked under the old
lighting system.
This commit is contained in:
Krausus
2015-05-15 01:07:08 -04:00
parent eac7bb075c
commit f5f15881c2
9 changed files with 24 additions and 15 deletions
+1 -1
View File
@@ -281,7 +281,7 @@
if(!light_supplied)
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in current_turf
if(L)
light_supplied = max(0,min(10,L.lum_r + L.lum_g + L.lum_b)-5)
light_supplied = L.get_clamped_lum()*10
else
light_supplied = 5
+1 -1
View File
@@ -810,7 +810,7 @@
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
var/light_available
if(L)
light_available = max(0,min(10,L.lum_r + L.lum_g + L.lum_b))
light_available = L.get_clamped_lum()*10
else
light_available = 5
light_string = "a light level of [light_available] lumens"
@@ -25,6 +25,15 @@
. = ..()
verbs.Cut()
/atom/movable/lighting_overlay/proc/get_clamped_lum(var/minlum = 0, var/maxlum = 1)
var/lum = max(lum_r, lum_g, lum_b)
if(lum <= minlum)
return 0
else if(lum >= maxlum)
return 1
else
return (lum - minlum) / (maxlum - minlum)
/atom/movable/lighting_overlay/proc/update_lumcount(delta_r, delta_g, delta_b)
lum_r += delta_r
lum_g += delta_g
+2 -2
View File
@@ -746,7 +746,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
var/turf/T = loc
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L)
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
light_amount = (L.get_clamped_lum()*10) - 5 //hardcapped so it's not abused by having a ton of flashlights
else
light_amount = 5
nutrition += light_amount
@@ -768,7 +768,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc
var/turf/T = loc
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L)
light_amount = L.lum_r + L.lum_g + L.lum_b //hardcapped so it's not abused by having a ton of flashlights
light_amount = L.get_clamped_lum()*10
else
light_amount = 10
if(light_amount > species.light_dam) //if there's enough light, start dying
@@ -442,7 +442,7 @@
var/turf/T = loc
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L)
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
light_amount = (L.get_clamped_lum()*10) - 5 //hardcapped so it's not abused by having a ton of flashlights
else
light_amount = 5
@@ -672,4 +672,4 @@
proc/handle_wetness()
if(mob_master.current_cycle%20==2) //dry off a bit once every 20 ticks or so
wetlevel = max(wetlevel - 1,0)
return
return
@@ -116,19 +116,19 @@
var/DLlight_amount
var/atom/movable/lighting_overlay/L = locate(/atom/movable/lighting_overlay) in T
if(L)
light_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
light_amount = L.lum_r + L.lum_g + L.lum_b
else
light_amount = 5
var/atom/movable/lighting_overlay/DL = locate(/atom/movable/lighting_overlay) in destination
if(DL)
DLlight_amount = min(10,L.lum_r + L.lum_g + L.lum_b) - 5 //hardcapped so it's not abused by having a ton of flashlights
DLlight_amount = L.lum_r + L.lum_g + L.lum_b
else
DLlight_amount = 5
if(T && destination)
// Don't check it twice if our destination is the tile we are on or we can't even get to our destination
if(T == destination)
destination = null
else if(light_amount <= 1 && DLlight_amount <= 1) // No one can see us in the darkness, right?
else if(light_amount < 0.1 && DLlight_amount < 0.1) // No one can see us in the darkness, right?
return null
// We aren't in darkness, loop for viewers.