Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Update ( deltaUpdateTimeFromGame )
- deltaTime = math.abs(os.clock() - casMinuly)
- casMinuly = os.clock()
- if math.abs(deltaTime-deltaUpdateTimeFromGame) > 1 then
- deltaTime = deltaUpdateTimeFromGame
- end
- --OBE1-------------------------------------------------------------------------------
- gBrzdicOBE1 = Call("GetControlValue", "OBE1", 0)
- trainBrakeDirectValue = Call("GetControlValue", "TrainBrakeControlNonHUD", 0)
- koef = 0.75
- doplnuj = false
- if not gZasahVZ then
- if gAutomatika == 0 then
- if gBrzdicOBE1 < 0.1 then --svih
- koef = 0.5
- doplnuj = true
- elseif gBrzdicOBE1 < 0.2 then --prebiti
- koef = 0.3
- doplnuj = true
- elseif gBrzdicOBE1 < 0.3 then --zaver
- koef = 0
- elseif gBrzdicOBE1 < 0.4 then --odbrzdeni
- koef = 0.15
- doplnuj = true
- elseif gBrzdicOBE1 < 0.55 then --jizda
- koef = 0
- elseif gBrzdicOBE1 < 0.7 then --brzdeni
- koef = 0.1
- end
- elseif ((gBrzdicOBE1 > 0.53) or (gBrzdicOBE1 <= 0.54 and gOverSpeedActivated == false)) then
- if gBrzdicOBE1 < 0.1 then --svih
- koef = 0.5
- doplnuj = true
- elseif gBrzdicOBE1 < 0.2 then --prebiti
- koef = 0.3
- doplnuj = true
- elseif gBrzdicOBE1 < 0.3 then --zaver
- koef = 0
- elseif gBrzdicOBE1 < 0.4 then --odbrzdeni
- koef = 0.15
- doplnuj = true
- elseif gBrzdicOBE1 < 0.55 then --jizda
- koef = 0
- elseif gBrzdicOBE1 < 0.7 then --brzdeni
- koef = 0.1
- end
- end
- end
- if doplnuj then
- trainBrakeDirectValue = math.max(trainBrakeDirectValue - (deltaTime * koef * math.sqrt(trainBrakeDirectValue)) / math.max((Call("GetConsistLength")-17)/100, 1),0)
- else
- trainBrakeDirectValue = math.min(trainBrakeDirectValue + (deltaTime * koef * math.sqrt(1-trainBrakeDirectValue)) / math.max((Call("GetConsistLength")-17)/100, 1),1)
- end
- Call("SetControlValue", "TrainBrakeControlNonHUD", 0, trainBrakeDirectValue)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement