defineProperty("L_N2_speed",globalProperty("sim/cockpit2/engine/indicators/N2_percent[0]")) -- Left N2 speed in %
defineProperty("R_N2_speed",globalProperty("sim/cockpit2/engine/indicators/N2_percent[1]")) -- Right N2 speed in %
defineProperty("fail",globalProperty("sim/operation/failures/rel_engfai0"))
defineProperty("fire",globalProperty("sim/operation/failures/rel_engfir0"))
defineProperty("fail2",globalProperty("sim/operation/failures/rel_engfai1"))
defineProperty("fire2",globalProperty("sim/operation/failures/rel_engfir1"))
defineProperty("frame_rate_period",globalProperty("sim/operation/misc/frame_rate_period"))

local time_passed1 = 0
local time_passed2 = 0


function update()

   if (get(L_N2_speed) > 100.8) then   -- if % greater than 100
      time_passed1 = time_passed1 + get(frame_rate_period)
      if (time_passed1 >= 30) then   -- what happens if % greater than 100 lasts more than half minute (30 seconds)
         set(fail, 6)  -- engine stops running
        
      end
   else
      time_passed1 = 0  -- resets if rpm > 100 lasts less than half minute
   end
   
    if (get(R_N2_speed) > 100.8) then   -- if % greater than 100
      time_passed2 = time_passed2 + get(frame_rate_period)
      if (time_passed2 >= 30) then   -- what happens if % greater than 100 lasts more than half minute (30 seconds)
         set(fail2, 6)  -- engine stops running
         
      end
   else
      time_passed2 = 0  -- resets if rpm > 100 lasts less than half minute
   end

end