Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
63
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. }
  90.  
  91. ClientBeginStep
  92. case DESTROY_SENTRY:
  93.                   //receiveCompleteMessage(global.serverSocket,1,0);
  94.                   //player = ds_list_find_value(global.players, readbyte(0));
  95.                   //new
  96.                   receiveCompleteMessage(global.serverSocket,4,0);
  97.                   playerID = readbyte(0);
  98.                   otherPlayerID = readbyte(0);
  99.                   assistantPlayerID = readbyte(0);
  100.                   causeOfDeath = readbyte(0);
  101.                  
  102.                   player = ds_list_find_value(global.players, playerID);
  103.                   if(otherPlayerID == 255) {
  104.                       doEventDestruction(player, -1, -1, causeOfDeath);
  105.                   } else {
  106.                       otherPlayer = ds_list_find_value(global.players, otherPlayerID);
  107.                       if (assistantPlayerID == 255) {
  108.                          doEventDestruction(player, otherPlayer, -1, causeOfDeath);
  109.                       } else {
  110.                          assistantPlayer = ds_list_find_value(global.players, assistantPlayerID);
  111.                          doEventDestruction(player, otherPlayer, assistantPlayer, causeOfDeath);
  112.                       }
  113.                   }  
  114.                  
  115.                   //end new
  116.                   //if player.sentry != -1 with player.sentry instance_destroy();
  117.                   break;
  118. GameServerBeginStep
  119. case DESTROY_SENTRY:
  120.                     if(player.sentry != -1) {
  121.                         with(player.sentry) {
  122.                         //new
  123.                             sendEventDestruction(ownerPlayer, ownerPlayer, -1, -1);
  124.                             doEventDestruction(ownerPlayer, ownerPlayer, -1, -1);
  125.                         //end new
  126.                             instance_destroy();
  127.                         }
  128.                     }
  129.                     player.sentry = -1;                        
  130.                     processedUntil = getpos(1, receiveBuffer);
  131.                     break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement