Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Notify all clients of a "building destruction" event.
- *
- * argument0: The owner of the destroyed building
- * argument1: The player who inflicted the fatal damage (or -1 for owner detonation)
- * argument2: The healer of the destroyer (or -1 for none)
- * argument3: The source of the fatal damage
- */
- var owner, killer, healer, damageSource;
- owner = argument0;
- killer = argument1;
- healer = argument2;
- damageSource = argument3;
- writebyte(DESTROY_SENTRY, global.eventBuffer);
- writebyte(ds_list_find_index(global.players, owner), global.eventBuffer);
- if(killer != -1) {
- writebyte(ds_list_find_index(global.players, killer), global.eventBuffer);
- } else {
- writebyte(255, global.eventBuffer);
- }
- if(healer != -1) {
- writebyte(ds_list_find_index(global.players, healer), global.eventBuffer);
- } else {
- writebyte(255, global.eventBuffer);
- }
- writebyte(damageSource, global.eventBuffer);
- /**
- * Perform the "building destroyed" event, i.e. change the appropriate scores,
- * destroy the building object to spawn metal and so on.
- *
- * argument0: The player whose building died
- * argument1: The player who inflicted the fatal damage (or -1 for self)
- * argument2: The healer who assisted the destruction (or -1 for no assist)
- * argument3: The source of the fatal damage
- */
- var owner, killer, assistant, damageSource;
- owner = argument0;
- killer = argument1;
- healer = argument2;
- damageSource = argument3;
- //*************************************
- //* Scoring and Kill log
- //*************************************
- //victim.deaths += 1;
- if(killer != -1 && killer != owner) {
- killer.stats[DESTRUCTION] +=1;
- killer.roundStats[DESTRUCTION] +=1;
- killer.stats[POINTS] += 1;
- killer.roundStats[POINTS] += 1;
- recordDestructionInLog(owner, killer, healer, damageSource);
- }
- //*************************************
- //* Scrapped
- //*************************************
- with(owner.sentry) {
- if built==1 {
- with(currentWeapon) {
- instance_destroy();
- }
- }
- if global.myself == owner {
- if !instance_exists(NoticeO) instance_create(0,0,NoticeO);
- with NoticeO notice = NOTICE_AUTOGUNSCRAPPED;
- }
- // Allow the mines stickied to this autogun to drop to the floor
- with(Mine) {
- if(place_meeting(x,y,other.id)) {
- stickied = false;
- }
- }
- ownerPlayer.sentry=-1;
- instance_create(x,y,Explosion)
- playsound(x,y,ExplosionSnd);
- sentrygibs=instance_create(x,y,SentryGibs);
- sentrygibs.image_speed=0;
- if team == TEAM_RED sentrygibs.image_index=0;
- else sentrygibs.image_index=1;
- }
- //end
- with(owner.sentry) {
- instance_destroy();
- }
- ClientBeginStep
- case DESTROY_SENTRY:
- //receiveCompleteMessage(global.serverSocket,1,0);
- //player = ds_list_find_value(global.players, readbyte(0));
- //new
- receiveCompleteMessage(global.serverSocket,4,0);
- playerID = readbyte(0);
- otherPlayerID = readbyte(0);
- assistantPlayerID = readbyte(0);
- causeOfDeath = readbyte(0);
- player = ds_list_find_value(global.players, playerID);
- if(otherPlayerID == 255) {
- doEventDestruction(player, -1, -1, causeOfDeath);
- } else {
- otherPlayer = ds_list_find_value(global.players, otherPlayerID);
- if (assistantPlayerID == 255) {
- doEventDestruction(player, otherPlayer, -1, causeOfDeath);
- } else {
- assistantPlayer = ds_list_find_value(global.players, assistantPlayerID);
- doEventDestruction(player, otherPlayer, assistantPlayer, causeOfDeath);
- }
- }
- //end new
- //if player.sentry != -1 with player.sentry instance_destroy();
- break;
- GameServerBeginStep
- case DESTROY_SENTRY:
- if(player.sentry != -1) {
- with(player.sentry) {
- //new
- sendEventDestruction(ownerPlayer, ownerPlayer, -1, -1);
- doEventDestruction(ownerPlayer, ownerPlayer, -1, -1);
- //end new
- instance_destroy();
- }
- }
- player.sentry = -1;
- processedUntil = getpos(1, receiveBuffer);
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement