Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. {
  2. if(readyToShoot == true) {
  3. playsound(x,y,SniperSnd);
  4. shot=true;
  5. justShot=true;
  6. readyToShoot = false;
  7. alarm[0] = reloadTime + 20*owner.zoomed;
  8.  
  9. var hit;
  10. var x1,y1,xm,ym, len;
  11. var hitline;
  12. len=2000;
  13. x1=x;
  14. y1=y;
  15. x2=x+lengthdir_x(len,owner.aimDirection);
  16. y2=y+lengthdir_y(len,owner.aimDirection);
  17.  
  18. while(len>1) {
  19. xm=(x1+x2)/2;
  20. ym=(y1+y2)/2;
  21.  
  22. hitline = false;
  23. with(owner) {
  24. if (collision_line(x1,y1,xm,ym,Generator,true,true)>=0) {
  25. hitline = true;
  26. if instance_nearest(x1,y1,Generator).team == team hitline = false;
  27. }
  28. if(collision_line(x1,y1,xm,ym,Obstacle,true,true)>=0) {
  29. hitline = true;
  30. } else if (collision_line(x1,y1,xm,ym,Character,true,true)>=0) {
  31. hitline = true;
  32. } else if (collision_line(x1,y1,xm,ym,Sentry,true,false)>=0) {
  33. hitline = true;
  34. } else if (collision_line(x1,y1,xm,ym,TeamGate,true,true)>=0) {
  35. hitline = true;
  36. } else if (collision_line(x1,y1,xm,ym,IntelGate,true,true)>=0) {
  37. hitline = true;
  38. } else if (collision_line(x1,y1,xm,ym,ControlPointSetupGate,true,true)>=0) {
  39. if ControlPointSetupGate.solid == true hitline = true;
  40. } else if (collision_line(x1,y1,xm,ym,BulletWall,true,true)>=0) {
  41. hitline = true;
  42. }
  43. }
  44.  
  45. if(hitline) {
  46. x2=xm;
  47. y2=ym;
  48. } else {
  49. x1=xm;
  50. y1=ym;
  51. }
  52. len/=2;
  53. }
  54.  
  55. with(Player) {
  56. if(id != other.ownerPlayer and team != other.owner.team and object != -1) {
  57. if(collision_line(other.x,other.y,other.x2,other.y2,object,true,false)>=0) && object.ubered == 0 {
  58. object.hp -= other.hitDamage;
  59. //new
  60. if (object.lastDamageDealer != other.ownerPlayer && object.lastDamageDealer != object.player){
  61. object.secondToLastDamageDealer = object.lastDamageDealer;
  62. object.alarm[4] = object.alarm[3]
  63. }
  64. object.alarm[3] = ASSIST_TIME;
  65. //end
  66. object.lastDamageDealer = other.ownerPlayer;
  67. object.cloakAlpha = min(object.cloakAlpha + 0.3, 1);
  68.  
  69. //new
  70. if(global.gibLevel > 0){
  71. blood = instance_create(object.x,object.y,Blood);
  72. blood.direction = other.owner.aimDirection-180;
  73. }
  74. if (!other.owner.zoomed)
  75. object.lastDamageSource = WEAPON_RIFLE;
  76. else
  77. object.lastDamageSource = WEAPON_RIFLE_CHARGED;
  78. exit;
  79. }
  80. }
  81. }
  82.  
  83. with(Sentry) {
  84. if(team != other.owner.team) {
  85. if(collision_line(other.x,other.y,other.x2,other.y2,id,false,false)>=0) {
  86. hp -= other.hitDamage;
  87. lastDamageDealer = other.ownerPlayer;
  88. //new
  89. if (!other.owner.zoomed)
  90. lastDamageSource = WEAPON_RIFLE;
  91. else
  92. lastDamageSource = WEAPON_RIFLE_CHARGED;
  93. exit;
  94. }
  95. }
  96. }
  97.  
  98. with(Generator) {
  99. if(team != other.owner.team) {
  100. if(collision_line(other.x,other.y,other.x2,other.y2,id,true,false)>=0) {
  101. hp -= other.hitDamage;
  102. exit;
  103. }
  104. }
  105. }
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement