From 03ff22fbbc0fe328a674cb83b6ec74c71ca8957a Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Thu, 29 Oct 2015 22:31:08 -0700 Subject: [PATCH] Adds the ability to set a light source's high end Makes starlight use new system to have far spreading low levels of light rather then near spreading high levels of light. --- code/game/turfs/space/space.dm | 2 +- code/modules/lighting/lighting_system.dm | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index cc02c1959aa..292166d30dd 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -23,7 +23,7 @@ if(config) if(config.starlight) for(var/turf/simulated/T in RANGE_TURFS(1,src)) //RANGE_TURFS is in code\__HELPERS\game.dm - SetLuminosity(3) + SetLuminosity(5,1.5) return SetLuminosity(0) diff --git a/code/modules/lighting/lighting_system.dm b/code/modules/lighting/lighting_system.dm index e332250336c..55b936cb283 100644 --- a/code/modules/lighting/lighting_system.dm +++ b/code/modules/lighting/lighting_system.dm @@ -38,6 +38,7 @@ /datum/light_source var/atom/owner var/radius = 0 + var/cap = 0 var/changed = 1 var/list/effect = list() var/__x = 0 //x coordinate at last update @@ -130,7 +131,7 @@ #else distance = max(abs(x - L.__x), abs(y - L.__y)) #endif - return LIGHTING_CAP * (L.radius - distance) / L.radius + return ( L.cap ? L.cap : LIGHTING_CAP ) * (L.radius - distance) / L.radius //LIGHTING_CAP == strength for now @@ -178,7 +179,8 @@ //If we are setting luminosity to 0 the light will be cleaned up by the controller and garbage collected once all its //queues are complete. //if we have a light already it is merely updated, rather than making a new one. -/atom/proc/SetLuminosity(new_luminosity) +//The second arg allows you to scale the light cap for calculating falloff. (0 for default, null for no change) +/atom/proc/SetLuminosity(new_luminosity, new_cap) if(new_luminosity < 0) new_luminosity = 0 @@ -187,10 +189,12 @@ return light = new(src) else - if(light.radius == new_luminosity) + if(light.radius == new_luminosity && (new_cap == null || light.cap == new_cap)) return light.radius = new_luminosity luminosity = new_luminosity + if (new_cap != null) + light.cap = new_cap light.changed() /atom/proc/AddLuminosity(delta_luminosity)