unorthodox-paradox / omsi_2_csb_ai_enhancements

AI enhancements for CSB vehicles
1 stars 0 forks source link

AI exterior lighting not actualized at prolonged stops and running engine #82

Closed unorthodox-paradox closed 4 years ago

unorthodox-paradox commented 4 years ago

Symptoms

At prolonged stops, if the AI decides not to turn off, or subsequently re-ignite, the engine, due to environmental adversity, it will beyond that point in time fail to actualize its exterior lighting any further -- both due to improving and due to worsening conditions alike --, until either a) conditions allow the engine to once again be turned off, or b) departure time arrives.

Identified causes and resolution progress

The cause lies here (lights_ai.osc:lights_ai_engine_dependent_lighting_context_evaluate_and_translate):

(L.L.lights_ai_sun_alt) l1 >= l2 || (L.L.Envir_Brightness) l3 >= &&
    (L.L.lights_ai_precip_type) 0 =
    (L.L.lights_ai_precip_type) 1 = l4 -1 = (L.L.lights_ai_env_wetness) l4 <= || && ||
    (L.L.lights_ai_precip_type) 2 = l5 -1 = (L.L.lights_ai_env_wetness) l5 <= || && || &&
    l1 91 = ! &&
{if}
    -1 (S.L.lights_ai_ext_lighting_env_perception_target)
    0 (S.L.lights_ai_ext_lighting_target)
{else}
    (L.L.ai_pre_cockpit_engine_target) (L.L.ai_pre_cockpit_transmission_target) ! &&
    {if}
        -1 (S.L.lights_ai_ext_lighting_env_perception_target)
        (L.L.lights_ai_ext_lighting_env_perception) 4 =
        {if}
            2
        {else}
            1
        {endif}
        (L.L.lights_ai_ext_lighting) min (S.L.lights_ai_ext_lighting_target)
    {endif}
{endif}

Specifically, when the first if (temporarily-off context) doesn't hold, then we only query the current state of exterior lights and bound it (to prevent headlight usage while stopped), effectively disregarding target state. That else-if should be corrected to evaluate exterior lighting target perception and preferences instead.

Some further things to take into account:

User-level workarounds

None available.