In addition to the display and music effect updates, there are a couple of other things that need to be refreshed periodically. The default states of the lamps, outside of any running effect, sometimes need to change depending on a complex combination of factors.
For example, consider a feature that needs to be disabled temporarily during any multiball. Instead of using the lamp bit to track whether the feature is enabled, we should use a separate bit flag, and then draw the lamp if the flag is set and the feature is not masked by a multiball.
The lamp_update
event is generated periodically by the system
to give modules a chance to recalculate the states of the lamps.
Currently, it is generated about once per 500ms. Code can request
a faster update by calling effect_update_request
as before.
Likewise, sometimes solenoid-driven devices require a periodic update
as well. Ball scoops that raise from the playfield, like the trap door
on Funhouse, can either be up or down, and the desired state depends on
a number of things. A separate device_update
event is thrown for
the purpose of updating these. It works identically to the lamp_update
function; however, these events are generated more frequently, as they are
more important to be right in a timely manner.
Note that device update is disabled during ball search, so that search handlers can complete control of the devices to try to find the missing pinball.