ID:158293
 
Hi, im trying to make a lighting system. where a light is an object, and the world is covered in a area like "Dark" or somthing. and the icon that the area uses is alpha colored to 100. pretty much it makes it look likes its night time, and i want the light to check within a view of however much i assign it and make the dark area not dark. But wat seems to happen is it makes the whole world not dark.. any help?



area
dark
icon='Objects.dmi'
icon_state="Dark"
layer=MOB_LAYER+30



obj/LightCast
var/lightdist=3
var/lit=1
New()
src.SetLight()
proc/SetLight()
for(var/area/dark/A in view(src.lightdist,src))
A.icon_state=null
light1
icon='Objects.dmi'
icon_state="light1on"
lightdist=5
If your map is small, you would convert them all to null. Try adding a break inside your loop to see if it changes to just one. Then try changing your lightdist to 2 and see what happens.


Just a modified version I used to play around with it.
turf
dark
icon='Objects.dmi'
icon_state="Dark"

obj/LightCast
var/lightdist=2
var/lit=1
New()
src.SetLight()
proc/SetLight()
{
for(var/turf/dark/A in view(src.lightdist, src))
{
A.icon_state = null
}
}