mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-29 19:43:16 +00:00
Added the ability to use multiple light icons to represent over four states.
This commit is contained in:
@@ -41,7 +41,7 @@ atom/proc/SetLuminosity(n)
|
||||
n = min(n,10) //Caelcode.
|
||||
if(n > 0)
|
||||
//world << "[name].SetLuminosity([n]) \[[max(1,n>>1)],[n]\]"
|
||||
SetLight(max(1,n>>1),n)
|
||||
SetLight(max(1,n),n)
|
||||
else
|
||||
//world << "[name].SetLuminosity(0)"
|
||||
SetLight(0,0)
|
||||
|
||||
@@ -41,11 +41,8 @@ var/list/lit_z_levels = list(1,5)
|
||||
|
||||
/datum/controller/lighting
|
||||
|
||||
var/starlight = 4
|
||||
var/starlight = LIGHT_STATES
|
||||
var/list/icon_updates = list()
|
||||
|
||||
var/list/light_border = list()
|
||||
|
||||
var/started = 0
|
||||
|
||||
//var/icon/border = icon('Icons/Test.dmi', "border")
|
||||
@@ -92,18 +89,12 @@ var/list/lit_z_levels = list(1,5)
|
||||
if(T.light_overlay)
|
||||
|
||||
T.ResetValue()
|
||||
T.light_overlay.icon_state = "[MAX_VALUE(T.lightSE)][MAX_VALUE(T.lightSW)][MAX_VALUE(T.lightNW)][MAX_VALUE(T.lightNE)]"
|
||||
T.light_overlay.set_state(MAX_VALUE(T.lightSE), MAX_VALUE(T.lightSW), MAX_VALUE(T.lightNW), MAX_VALUE(T.lightNE))
|
||||
|
||||
world << "<b><font color=red>Lighting initialization took [(world.timeofday-start_time)/world.fps] seconds.</font></b>"
|
||||
world << "<font color=red>Updated [turfs_updated] turfs.</font>"
|
||||
|
||||
/datum/controller/lighting/proc/AddBorder(turf/T)
|
||||
if(!T.is_border)
|
||||
light_border.Add(T)
|
||||
T.is_border = 1
|
||||
//T.overlays.Add(border)
|
||||
|
||||
/datum/controller/lighting/proc/RemoveBorder(turf/T)
|
||||
if(T.is_border)
|
||||
light_border.Remove(T)
|
||||
T.is_border = 0
|
||||
/datum/controller/lighting/proc/GetLightIcon(a,b,c,d)
|
||||
if(a <= 1) return LIGHT_ICON_1
|
||||
else if(a <= 3) return LIGHT_ICON_2
|
||||
else return LIGHT_ICON_3
|
||||
@@ -55,10 +55,12 @@ atom/movable/lighting_overlay
|
||||
anchored = 1
|
||||
layer = 9
|
||||
mouse_opacity = 0
|
||||
icon = 'icons/effects/ArynLights.dmi'
|
||||
icon_state = "0000"
|
||||
invisibility = INVISIBILITY_LIGHTING
|
||||
|
||||
atom/movable/lighting_overlay/proc/set_state(a,b,c,d)
|
||||
icon_state = "[a][b][c][d]"
|
||||
icon = lighting_controller.GetLightIcon(a,b,c,d)
|
||||
|
||||
atom/var/light/light
|
||||
|
||||
turf/var/atom/movable/lighting_overlay/light_overlay
|
||||
@@ -172,7 +174,7 @@ turf/proc/AddLight(light/light, brightness)
|
||||
|
||||
for(var/turf/T in range(1,src))
|
||||
if(T.light_overlay)
|
||||
T.light_overlay.icon_state = "[MAX_VALUE(T.lightSE)][MAX_VALUE(T.lightSW)][MAX_VALUE(T.lightNW)][MAX_VALUE(T.lightNE)]"
|
||||
T.light_overlay.set_state(MAX_VALUE(T.lightSE), MAX_VALUE(T.lightSW), MAX_VALUE(T.lightNW), MAX_VALUE(T.lightNE))
|
||||
|
||||
turf/proc/RemoveLight(light/light)
|
||||
if(lit_by)
|
||||
@@ -218,7 +220,7 @@ turf/proc/ResetValue()
|
||||
if(lightSW) lightSW.cached_value = -1
|
||||
for(var/turf/T in range(1,src))
|
||||
if(T.light_overlay)
|
||||
T.light_overlay.icon_state = "[MAX_VALUE(T.lightSE)][MAX_VALUE(T.lightSW)][MAX_VALUE(T.lightNW)][MAX_VALUE(T.lightNE)]"
|
||||
T.light_overlay.set_state(MAX_VALUE(T.lightSE), MAX_VALUE(T.lightSW), MAX_VALUE(T.lightNW), MAX_VALUE(T.lightNE))
|
||||
|
||||
turf/proc/CheckForOpaqueObjects()
|
||||
has_opaque = opacity
|
||||
|
||||
@@ -21,6 +21,7 @@ turf/verb/ShowData()
|
||||
set src in world
|
||||
|
||||
usr << "<b>[src]</b>"
|
||||
usr << "[MAX_VALUE(lightSE)][MAX_VALUE(lightSW)][MAX_VALUE(lightNW)][MAX_VALUE(lightNE)]"
|
||||
usr << "Lit Value: [lit_value]"
|
||||
usr << "Max Brightness: [max_brightness]"
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
#define LIGHT_ICON_1 'icons/effects/lights/lighting1.dmi'
|
||||
#define LIGHT_ICON_2 'icons/effects/lights/lighting2.dmi'
|
||||
#define LIGHT_ICON_3 'icons/effects/lights/lighting3.dmi'
|
||||
#define LIGHT_STATES 5
|
||||
|
||||
#define SQ(X) ((X)*(X))
|
||||
#define DISTSQ3(A,B,C) (SQ(A)+SQ(B)+SQ(C))
|
||||
#define FSQRT(X) (X >= fastroot.len ? new_fsqrt(X) : fastroot[(X)+1])
|
||||
#define MAX_VALUE(X) (X.cached_value < 0 ? X.max_value() : X.cached_value)
|
||||
#define VALUE_OF(X) ( !X ? 0 : ( X.is_outside ? LIGHTCLAMP(lighting_controller.starlight) : X.lit_value ) )
|
||||
#define LIGHTCLAMP(x) ( max(0,min(3,round(x,1))) )
|
||||
#define LIGHTCLAMP(x) ( max(0,min(LIGHT_STATES,round(x,1))) )
|
||||
|
||||
var/list/fastroot = list(0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5,
|
||||
5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
|
||||
Reference in New Issue
Block a user