turf
var/obj/lighting/lightsource = new/obj/lighting()
New()
..()
src.overlays += src.lightsource
obj
lighting
var/setlighting = "1"
icon = 'lighting.dmi'
icon_state = "1"
layer = 100
proc
updateworldlighting(number)
for(var/turf/a in world)
if(!(isnull(a.lightsource)))
if(!(a.lightsource.icon_state == a.lightsource.setlighting))
a.lightsource.setlighting = num2text(number)
a.overlays -= a.lightsource
updatesetlight(a.lightsource)
a.overlays += a.lightsource
updatesetlight(obj/lighting/light)
light.icon_state = light.setlighting
Problem description: ok so i see no errors, DM sees no errors, but for some reason it wont create a new /turf/lighting and set it to the turfs overlays, can someone help me?
edit: updatesetlight will be used later and more stuff will be added to it
if(!(a.lightsource.icon_state == a.lightsource.setlighting))
Your default values for setlighting and icon_state are the same, so the code wont ever go past this. You may want to do something like:
if(!(num2text(number) == a.lightsource.setlighting))