- Add engine_max_temp and engine_is_hot fields to heat_data structure
- Add EngineMaxTemperature field extraction from .fiz files
- Add engine overheat check comparing Ts with engine_max_temp
- Add four new overheat lamp indicators:
- i-oil_overheat
- i-water_overheat
- i-wateraux_overheat
- i-engine_overheat
- Add lamp update logic to turn on/off based on is_hot flags
- Add lamp initialization in clear_cab_controls()
This implements issue #77 - overheat lamps for diesel engines.
The lamps will turn on when:
- Oil temperature exceeds OilMaxTemperature
- Water temperature exceeds WaterMaxTemperature
- Auxiliary water temperature exceeds WaterAuxMaxTemperature
- Engine temperature exceeds EngineMaxTemperature
Each check includes 8-degree hysteresis to prevent rapid on/off cycling.
- Fixed phase shift when the light is specified as a negative value.
- This fixes railroad crossing lights!!!
- Improved light transition times to make them even more realistic.
- Simplified the overall code.
We could have done away with it just because the memcell values are always the last parameter. However, this might not always be the case in the future. Also, it's better for consistency reasons.
- Fixed the `api.memcell_update` and `api.memcell_update_n` functions to accept the `memcell_values` structure instead of three separate values.
- Additionally, also fixed the error message for when the memcell is not found.
An undocumented change from the previous commit:
- When the Lua script is not able to find an object, the message is now printed to `errors.txt`, not just to `log.txt`.
- Lua bindings are no longer using FFI in favor of the "classic" Lua C API.
- This makes it work properly on native Linux builds.
- Changed the Lua API slightly:
- Removed the `api.event_preparefunc()` function because it is no longer necessary. Instead, you can pass any function you want without preparing it first.
- Added an `api.event_exists()` function. Takes a single `name` argument.
- Any `api.find_*()` functions return `nil` instead of an userdata representing a null pointer when the requested object is not found.