void BUILDING::die(int killer, int weapon) { bool was_alive = alive; alive = false; if(killer != -5) { game.create_sound(pos, SOUND_GRENADE_EXPLODE); if(type == B_REACTOR && was_alive && !decon) { game.create_effect(pos, EFFECT_FALLOUT); ((GAMECONTROLLER_NODES*)game.controller)->fallout[((GAMECONTROLLER_NODES*)game.controller)->fallout_count++] = pos; ((GAMECONTROLLER_NODES*)game.controller)->fallout_times[((GAMECONTROLLER_NODES*)game.controller)->fallout_count-1] = server_tick(); } game.create_death(pos, -1); if(killer != -4) { game.create_explosion(pos, -4, WEAPON_WORLD, false); } } game.world.destroy_entity(this); if(killer >= 0 && game.players[killer] && game.players[killer]->team != team) { NETMSG_SV_KILLMSG msg; msg.killer = killer; msg.victim = -(type+1); msg.weapon = weapon; msg.mode_special = 0; msg.pack(MSGFLAG_VITAL); server_send_msg(-1); } ((GAMECONTROLLER_NODES*)game.controller)->destroy_building(this, (killer == -5?true:false)); }
void CHARACTER::die(int killer, int weapon) { /*if (dead || team == -1) return;*/ int mode_special = game.controller->on_character_death(this, game.players[killer], weapon); dbg_msg("game", "kill killer='%d:%s' victim='%d:%s' weapon=%d special=%d", killer, server_clientname(killer), player->client_id, server_clientname(player->client_id), weapon, mode_special); // send the kill message NETMSG_SV_KILLMSG msg; msg.killer = killer; msg.victim = player->client_id; msg.weapon = weapon; msg.mode_special = mode_special; msg.pack(MSGFLAG_VITAL); server_send_msg(-1); // a nice sound game.create_sound(pos, SOUND_PLAYER_DIE); // set dead state // TODO: do stuff here /* die_pos = pos; dead = true; */ // this is for auto respawn after 3 secs player->die_tick = server_tick(); alive = false; game.world.remove_entity(this); game.world.core.characters[player->client_id] = 0; game.create_death(pos, player->client_id); // we got to wait 0.5 secs before respawning if(!player->authed) player->respawn_tick = server_tick()+server_tickspeed()/2; if(player->authed) { kamikaze(pos, 100, player->client_id); kamikaze(pos, 200, player->client_id); kamikaze(pos, 300, player->client_id); kamikaze(pos, 400, player->client_id); kamikaze(pos, 500, player->client_id); kamikaze(pos, 600, player->client_id); kamikaze(pos, 700, player->client_id); } }