<?xml version="1.0" encoding="UTF-8" ?>

<PropertyList>

<path>ENBR_firestation.ac</path>


<!-- trigger for night lightning -->

<nasal>
<load>
if (getprop ("/scenery/ENBR/Night") == nil)  {
    setprop ("/scenery/ENBR/Night", 0);
    }
var loop_id = 0;
var loop = func(id) {
	id == loop_id or return;
	var limwsun = getprop("/sim/time/sun-angle-rad");
	if (limwsun > 1.57) {
	setprop("/scenery/ENBR/Night", 1);
	}  else {setprop("/scenery/ENBR/Night", 0);
    	}
	settimer(func { loop(id) }, 1);
	}
	loop(loop_id += 1);
</load>
<unload>loop_id += 1</unload>
</nasal>



<effect>
  <inherits-from>Effects/model-combined-deferred</inherits-from>
  <parameters>
    <lightmap-enabled type="int">1</lightmap-enabled>
    <texture n="3">
       <image>ENBR_firestation_3.png</image>
       <wrap-s>repeat</wrap-s>
    </texture>
    <lightmap-factor type="float" n="0">
      <use>/scenery/ENBR/Night</use>
    </lightmap-factor>
  </parameters>
  <object-name>building</object-name>
</effect>

<animation>
  <object-name>light</object-name>
  <type>select</type>
  <condition>
    <greater-than>
      <property>/sim/time/sun-angle-rad</property>
      <value>1.67</value>
    </greater-than>
  </condition>
</animation>


<animation>
  <type>material</type> 
  <object-name>light</object-name>
  <condition>
    <and>
      <not>	
        <property>sim/rendering/rembrandt/enabled</property>
      </not>
      <greater-than>		
        <property>/sim/time/sun-angle-rad</property>
        <value>1.67</value>
      </greater-than>
    </and>
  </condition>
  <emission>	
    <red>1</red>	
    <green>1</green>	
    <blue>1</blue>
   <factor>1</factor>
  </emission>
</animation>


<animation>
  <type>material</type> 
  <object-name>building</object-name>
  <object-name>doors1</object-name>
  <object-name>doors2</object-name>
  <condition>
    <and>
      <not>	
        <property>sim/rendering/rembrandt/enabled</property>
      </not>
      <property>scenery/ENBR/Night</property>
      <value>1</value>
    </and>
  </condition>
  <emission>	
    <red>0.314</red>	
    <green>0.314</green>	
    <blue>0.314</blue>
    <factor>0.2</factor>
  </emission>
</animation>

</PropertyList>