Prevent divide by 0 runtime, fix supply shuttle

This commit adds a small sanity check to the falloff calculations of
lights, to prevent them from dividing by 0. This may cause undiscovered
strangeness, but strangeness is better than filling the runtime log.

This commit also fixes the supply shuttle, which was not spawning any
ordered items. It did this because it had a very basic contents.len check
which the lighting overlays triggered. The sanity check to not spawn stuff
on top of other stuff is now a for(atom) loop on the turfs, which has
snowflake checks for lights and lighting overlays.
This commit is contained in:
Tigercat2000
2015-05-11 19:37:15 -07:00
parent e8782f90bd
commit 741da037fb
2 changed files with 13 additions and 5 deletions
+4 -4
View File
@@ -120,9 +120,9 @@
#endif
#if LIGHTING_LAMBERTIAN == 1
. = CLAMP01((1 - CLAMP01(sqrt(.) / light_range)) * (1 / (sqrt(. + 1))))
. = CLAMP01((1 - CLAMP01(sqrt(.) / max(1,light_range))) * (1 / (sqrt(. + 1))))
#else
. = 1 - CLAMP01(sqrt(.) / light_range)
. = 1 - CLAMP01(sqrt(.) / max(1,light_range))
#endif
#elif LIGHTING_FALLOFF == 2 // square
@@ -133,9 +133,9 @@
#endif
#if LIGHTING_LAMBERTIAN == 1
. = CLAMP01((1 - CLAMP01(. / light_range)) * (1 / (sqrt(.)**2 + )))
. = CLAMP01((1 - CLAMP01(. / max(1,light_range))) * (1 / (sqrt(.)**2 + )))
#else
. = 1 - CLAMP01(. / light_range)
. = 1 - CLAMP01(. / max(1,light_range))
#endif
#endif