Guest User

E2 SetAng Steering

a guest
Mar 18th, 2017
8,349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @name Setang steering
  2. @inputs A D CHASSIS:entity
  3. @outputs TURN
  4. @persist SLAVE:entity [TURN_RATE TURN_ANGLE TURN] B C
  5. @model models/sprops/rectangles/size_2_5/rect_18x18x3.mdl
  6.  
  7. if (dupefinished()) {reset()}
  8.  
  9. B = round(toUnit("km/h",CHASSIS:vel():length()))
  10.  
  11.  
  12. if(B >= 20) {
  13. TURN_ANGLE = 25
  14. }
  15. else
  16. {
  17. TURN_ANGLE = 45
  18. }
  19.  
  20. if (first()) {
  21. interval(85)
  22.  
  23. TURN_RATE = 10
  24.  
  25.  
  26. SLAVE = entity()
  27. } elseif (clk()) {
  28. interval(85)
  29.  
  30. if (!SLAVE:isPlayerHolding()) {
  31. TURN += clamp((A-D)*TURN_ANGLE - TURN, -TURN_RATE, TURN_RATE)
  32. SLAVE:setAng( CHASSIS:toWorld(ang(0, TURN, -TURN/9)) )
  33. SLAVE:propFreeze(1)
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment