obj
table
icon = 'Table.dmi'
icon_state = "x"
density = 1
New()
..()
spawn lighten_darken()
turf
table
icon = 'Table.dmi'
icon_state = "x"
density = 1
New()
..()
spawn lighten_darken()
obj
light
light = 50
New()
spawn cast_light()
green{color="green"}
red{color="red"}
blue{color="blue"}
yellow{color="yellow"}
obj
overlay
mouse_opacity = 0
atom
var
lit = 0
list/colors = list()
proc
lighten_darken()
while(src)
lit = round(lit)
if(lit < 0) lit = 0
if(lit > 100) lit = 100
overlays = null
var/obj/overlay/i = new()
i.layer = MOB_LAYER-1
i.icon = icon
if(lit <= 4) i.icon_state = "0"
else if(lit >= 100) i.icon_state = null
else i.icon_state = num2text(round(lit,5))
overlays += i
for(var/atom/a in colors)
var/obj/overlay/ii = new()
ii.layer = MOB_LAYER-2
ii.icon = icon
ii.icon_state = a.color
overlays += ii
lit = 0
for(var/b in colors) colors -= b
sleep(2)
sleep(0)
atom
var
light = 0
color = null
proc
cast_light()
var/distance = 0
while(src)
for(var/atom/a in oview(src))
distance = 100-(sqrt(abs(a.x-x)**2+abs(a.y-y)**2)*16)
if(light*distance/100 <= 0) continue
else a.lit += light*distance/100
if(color) a.colors += src
sleep(2)
sleep(0)
Problem description:
This code lightens/darkens all atoms in the world.
How light or dark an atom is is determined by an atom that casts light (in this case, obj/light/Any_and_all_of_its_children)
At the beginning of the code, I made 2 tables:
turf/table
and
obj/table
The code works fine for the turfs, but it doesn't [color] objects.
Turfs and Objs are lit and darkened,
Turfs are colored, Objs are not.
Any ideas of why this could possibly happen?
Both turf/table and obj/table share the same icon and icon_states (for both the object itself *and* the overlays), so, I doubt that's the problem.
If you need any more info, please go ahead and ask for it.
Thanks for reading!
Additionally, your system is rather massively inefficient. You should only be doing anything when the conditions change, not every 2 ticks.