mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 10:29:19 +02:00
light "fix" for multi-unit trains
This commit is contained in:
@@ -16,6 +16,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "lightarray.h"
|
#include "lightarray.h"
|
||||||
#include "dynobj.h"
|
#include "dynobj.h"
|
||||||
|
#include "driver.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
light_array::insert( TDynamicObject const *Owner ) {
|
light_array::insert( TDynamicObject const *Owner ) {
|
||||||
@@ -65,6 +66,16 @@ light_array::update() {
|
|||||||
( ( lightbits & 16 ) ? 1 : 0 );
|
( ( lightbits & 16 ) ? 1 : 0 );
|
||||||
|
|
||||||
light.intensity = 0.15f * light.count; // TODO: intensity can be affected further by dim switch or other factors
|
light.intensity = 0.15f * light.count; // TODO: intensity can be affected further by dim switch or other factors
|
||||||
|
|
||||||
|
// crude catch for unmanned modules which share the light state with the controlled unit.
|
||||||
|
// why don't they get their own light bits btw ._.
|
||||||
|
// TODO, TBD: have separate light bits for each vehicle, so this override isn't necessary
|
||||||
|
if( ( light.owner->Controller == AIdriver )
|
||||||
|
&& ( light.owner->Mechanik == nullptr ) ) {
|
||||||
|
|
||||||
|
light.intensity = 0.0f;
|
||||||
|
light.count = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// with battery off the lights are off
|
// with battery off the lights are off
|
||||||
|
|||||||
Reference in New Issue
Block a user