yogstation13 / yogstation-classic

Yogstation13's classic code source.
http://www.yogstation.net
GNU Affero General Public License v3.0
11 stars 37 forks source link

Fixes light bulbs not updating the lighting #1202

Closed X-TheDark closed 8 years ago

X-TheDark commented 8 years ago

Refer to issues #883 , #910 , #1198 .

Intent of your Pull Request

Light bulbs now properly update lighting. Cause of issue: When lightbulb is removed from fixture, the "light" (light datum) datum's variable radius is set to 4 in SetLuminosity (since that's the LIGHTING_MIN_RADIUS)

radius = max(LIGHTING_MIN_RADIUS, new_luminosity)

and since the brightness of the light bulb fixture is 4, it doesn't pass the light.radius != brightness part of

if(!light || light.radius != brightness)

In fact, I'm not sure what this check is set to accomplish, exactly, as update() is only called when you do something to the light fixture (turn it on/off, take out/put in lightbulb) therefore I just removed the check entirely, as there's no reason for this check to be done, really (!light part is covered in SetLuminosity proc already and I have no idea why you need the light.radius != brightness check since both of those are hardcoded values (sort of)).

Changelog

:cl: X-TheDark bugfix: Light bulb fixtures now properly update the surrounding tile brightness when their state is changed (put in lightbulb/turn fixture on). /:cl:

ShadowDeath6 commented 8 years ago

Hero

oisin100 commented 8 years ago

change = changed

X-TheDark commented 8 years ago

Whoops. Fix'd.

Also, it's funny how much I commented, deliberated and explained a one-line change...guess I'd really like to know why this check was there in the first place.

oisin100 commented 8 years ago

Also, it's funny how much I commented, deliberated and explained a one-line change...guess I'd really like to know why this check was there in the first place.

Its a simple answer, BLAME TACO.