Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Notify all clients of a "building destruction" event.
  3.  *
  4.  * argument0: The owner of the destroyed building
  5.  * argument1: The player who inflicted the fatal damage (or -1 for owner detonation)
  6.  * argument2: The healer of the destroyer (or -1 for none)
  7.  * argument3: The source of the fatal damage
  8.  */
  9. var owner, killer, healer, damageSource;
  10. owner = argument0;
  11. killer = argument1;
  12. healer = argument2;
  13. damageSource = argument3;
  14.  
  15. writebyte(DESTROY_SENTRY, global.eventBuffer);
  16. writebyte(ds_list_find_index(global.players, owner), global.eventBuffer);
  17. if(killer != -1) {
  18.     writebyte(ds_list_find_index(global.players, killer), global.eventBuffer);
  19. } else {
  20.     writebyte(255, global.eventBuffer);
  21. }
  22. if(healer != -1) {
  23.     writebyte(ds_list_find_index(global.players, healer), global.eventBuffer);
  24. } else {
  25.     writebyte(255, global.eventBuffer);
  26. }  
  27. writebyte(damageSource, global.eventBuffer);
  28.  
  29. /**
  30.  * Perform the "building destroyed" event, i.e. change the appropriate scores,
  31.  * destroy the building object to spawn metal and so on.
  32.  *
  33.  * argument0: The player whose building died
  34.  * argument1: The player who inflicted the fatal damage (or -1 for self)
  35.  * argument2: The healer who assisted the destruction (or -1 for no assist)
  36.  * argument3: The source of the fatal damage
  37.  */
  38. var owner, killer, assistant, damageSource;
  39. owner = argument0;
  40. killer = argument1;
  41. healer = argument2;
  42. damageSource = argument3;
  43.  
  44. //*************************************
  45. //*      Scoring and Kill log
  46. //*************************************
  47.  
  48. //victim.deaths += 1;
  49. if(killer != -1 && killer != owner) {
  50.     killer.stats[DESTRUCTION] +=1;
  51.     killer.roundStats[DESTRUCTION] +=1;
  52.     killer.stats[POINTS] += 1;
  53.     killer.roundStats[POINTS] += 1;
  54.     recordDestructionInLog(owner, killer, healer, damageSource);
  55. }
  56. //*************************************
  57. //*         Scrapped
  58. //*************************************
  59. with(owner.sentry) {
  60.     if built==1 {
  61.         with(currentWeapon) {
  62.             instance_destroy();
  63.         }
  64.     }
  65.     if global.myself == owner {
  66.         if !instance_exists(NoticeO) instance_create(0,0,NoticeO);
  67.         with NoticeO notice = NOTICE_AUTOGUNSCRAPPED;
  68.     }
  69.  
  70.     // Allow the mines stickied to this autogun to drop to the floor
  71.     with(Mine) {
  72.         if(place_meeting(x,y,other.id)) {
  73.             stickied = false;
  74.         }
  75.     }
  76.  
  77.     ownerPlayer.sentry=-1;
  78.     instance_create(x,y,Explosion)
  79.     playsound(x,y,ExplosionSnd);
  80.     sentrygibs=instance_create(x,y,SentryGibs);
  81.     sentrygibs.image_speed=0;
  82.     if team == TEAM_RED sentrygibs.image_index=0;
  83.     else sentrygibs.image_index=1;
  84. }
  85. //end
  86.  
  87. with(owner.sentry) {      
  88.     instance_destroy();
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement