Advertisement
Bagura32rus

NEW_T2

Jul 29th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #pragma METAINFO("AnTIRECOIL_NEW", 1, 0, "SHEERIFF")
  2. #define sn 6.32 // Мертвая зона
  3. #define ar 19.0 // Изменение отдачи по вертикали
  4. #define RecoilDelay 115 // Изменение в МС когда начинает рабоать ANTIRECOIL
  5.  
  6. #define RY get_actual(22)
  7. #define RX get_actual(21)
  8.  
  9. main {
  10. if (get_actual(4) && is_active(7) && time_active(4) >= RecoilDelay) AntiRecoil(ar);
  11. }
  12.  
  13. void AntiRecoil (fix32 recoil) {
  14. fix32 modifiedRY;
  15.  
  16. fix32 trueRY = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RY;
  17. fix32 trueRX = (sqrt(RY*RY+RX*RX)-sn)/sqrt(RY*RY+RX*RX)*RX;
  18.  
  19. if (RY > 0.0) modifiedRY = (100.0-sn-recoil)/(100.0-sn)*trueRY + recoil;
  20. if (RY < 0.0) modifiedRY = (100.0-sn+recoil)/(100.0-sn)*trueRY + recoil;
  21.  
  22. fix32 altradius = sqrt(trueRX*trueRX + modifiedRY*modifiedRY);
  23.  
  24. fix32 finalRX = trueRX * (altradius + sn)/altradius;
  25. fix32 finalRY = modifiedRY * (altradius + sn)/altradius;
  26.  
  27. if (RX*RX+RY*RY <= sn*sn) set_val(22,(sn+recoil));
  28.  
  29. if (RX*RX+RY*RY > sn*sn) {
  30. set_val(22,clamp(finalRY, -100f, 100f));
  31. set_val(21,clamp(finalRX, -100f, 100f));
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement