X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fcl_client.qc;h=26393d79c6b07280ae05f8fd463fe7952857ddb7;hp=4c7d5c57564d8f7b674c610629e45faac08ab7b7;hb=024719975962a1b3ca98ab2f73a8d89d66b1ce21;hpb=7ba1f46ba161d21ffd81e032f35c49b9da9f4d63 diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 4c7d5c5756..26393d79c6 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -6,22 +6,6 @@ void send_CSQC_teamnagger() { WriteByte(MSG_BROADCAST, TE_CSQC_TEAMNAGGER); } -void Announce(string snd) { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_ANNOUNCE); - WriteString(MSG_BROADCAST, snd); -} - -void AnnounceTo(entity e, string snd) { - if (clienttype(e) == CLIENTTYPE_REAL) - { - msg_entity = e; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_ANNOUNCE); - WriteString(MSG_ONE, snd); - } -} - float ClientData_Send(entity to, float sf) { if(to != self.owner) @@ -422,13 +406,9 @@ void PutObserverInServer (void) if not(g_ca) // don't reset teams when moving a ca player to the spectators self.team = -1; // move this as it is needed to log the player spectating in eventlog - if(self.killcount != -666) { - if(g_lms) { - if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0 && self.lms_spectate_warning != 2) - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_LMS_NOLIVES, self.netname); - else - Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_LMS_FORFEIT, self.netname); - } else { Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, self.netname); } + if(self.killcount != -666) + { + Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_SPECTATE, self.netname); if(self.just_joined == FALSE) { LogTeamchange(self.playerid, -1, 4); @@ -519,14 +499,6 @@ void PutObserverInServer (void) Spawnqueue_Insert(self); } } - else if(g_lms) - { - // Only if the player cannot play at all - if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666) - self.frags = FRAGS_SPECTATOR; - else - self.frags = FRAGS_LMS_LOSER; - } else if(g_ca) { if(self.caplayer) @@ -627,21 +599,6 @@ void FixPlayermodel() setcolor(self, stof(autocvar_sv_defaultplayercolors)); } -void PlayerTouchExplode(entity p1, entity p2) -{ - vector org; - org = (p1.origin + p2.origin) * 0.5; - org_z += (p1.mins_z + p2.mins_z) * 0.5; - - te_explosion(org); - - entity e; - e = spawn(); - setorigin(e, org); - RadiusDamage(e, world, g_touchexplode_damage, g_touchexplode_edgedamage, g_touchexplode_radius, world, g_touchexplode_force, DEATH_TOUCHEXPLODE, world); - remove(e); -} - /* ============= PutClientInServer @@ -668,16 +625,11 @@ void PutClientInServer (void) // reset player keys self.itemkeys = 0; - // player is dead and becomes observer - // FIXME fix LMS scoring for new system - if(g_lms) - { - if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0) - self.classname = "observer"; - } - if((g_arena && !self.spawned) || (g_ca && !allowed_to_spawn)) self.classname = "observer"; + + if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0) + self.classname = "observer"; if(gameover) self.classname = "observer"; @@ -1147,7 +1099,7 @@ void KillIndicator_Think() if(clienttype(self.owner) == CLIENTTYPE_REAL) { if(self.cnt <= 10) - AnnounceTo(self.owner, strcat(ftos(self.cnt), "")); + { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(self.cnt)); } } self.nextthink = time + 1; self.cnt -= 1; @@ -1433,7 +1385,7 @@ void ClientConnect (void) JoinBestTeam(self, FALSE, FALSE); // if the team number is valid, keep it - if((autocvar_sv_spectate == 1 && !g_lms) || autocvar_g_campaign || self.team_forced < 0) { + if(autocvar_g_campaign || self.team_forced < 0) { self.classname = "observer"; } else { if(teamplay) @@ -1525,17 +1477,14 @@ void ClientConnect (void) if(clienttype(self) == CLIENTTYPE_REAL) { - if(autocvar_g_bugrigs || WEPSET_EQ_AW(g_weaponarena_weapons, WEP_TUBA)) - stuffcmd(self, "cl_cmd settemp chase_active 1\n"); - } - - if(g_lms) - { - if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0) + if(!autocvar_g_campaign) { - PlayerScore_Add(self, SP_LMS_RANK, 666); - self.frags = FRAGS_SPECTATOR; + self.motd_actived_time = -1; + Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage()); } + + if(autocvar_g_bugrigs || WEPSET_EQ_AW(g_weaponarena_weapons, WEP_TUBA)) + stuffcmd(self, "cl_cmd settemp chase_active 1\n"); } if(!sv_foginterval && world.fog != "") @@ -1574,9 +1523,6 @@ void ClientConnect (void) CheatInitClient(); - if(!autocvar_g_campaign) - Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage()); - CSQCMODEL_AUTOINIT(); self.model_randomizer = random(); @@ -2016,7 +1962,7 @@ void player_regen (void) limita = limita * limit_mod; //limitf = limitf * limit_mod; - if(g_lms && g_ca) + if(g_lms || g_ca) rot_mod = 0; if (!g_minstagib && !g_ca && (!g_lms || autocvar_g_lms_regenerate)) @@ -2285,7 +2231,7 @@ void ShowRespawnCountdown() { self.respawn_countdown = number - 1; if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds - AnnounceTo(self, strcat(ftos(number), "")); + Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(number)); } } } @@ -2303,11 +2249,9 @@ void LeaveSpectatorMode() if(autocvar_g_campaign) { campaign_bots_may_start = 1; } - else - { Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD); } Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_PREVENT_JOIN); - + PutClientInServer(); if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_PLAY, self.netname); } @@ -2317,7 +2261,7 @@ void LeaveSpectatorMode() else { // Player may not join because g_maxplayers is set - Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_PREVENT_JOIN); + Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT); } } @@ -2374,22 +2318,24 @@ void checkSpectatorBlock() { } } -.float motd_actived_time; // used for both motd and campaign_message void PrintWelcomeMessage() { - if (self.motd_actived_time == 0) { // is there already a message showing? + if(self.motd_actived_time == 0) + { if (autocvar_g_campaign) { if ((self.classname == "player" && self.BUTTON_INFO) || (self.classname != "player")) { self.motd_actived_time = time; Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message); } } else { - if ((time - self.jointime > autocvar_welcome_message_time) && self.BUTTON_INFO) { + if (self.BUTTON_INFO) { self.motd_actived_time = time; Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage()); } } - } else { // showing MOTD or campaign message + } + else if(self.motd_actived_time > 0) // showing MOTD or campaign message + { if (autocvar_g_campaign) { if (self.BUTTON_INFO) self.motd_actived_time = time; @@ -2398,16 +2344,25 @@ void PrintWelcomeMessage() Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD); } } else { - if ((time - self.jointime) > autocvar_welcome_message_time) { - if (self.BUTTON_INFO) - self.motd_actived_time = time; - else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released - self.motd_actived_time = 0; - Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD); - } + if (self.BUTTON_INFO) + self.motd_actived_time = time; + else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released + self.motd_actived_time = 0; + Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD); } } } + else //if(self.motd_actived_time < 0) // just connected, motd is active + { + if(self.BUTTON_INFO) // BUTTON_INFO hides initial MOTD + self.motd_actived_time = -2; // wait until BUTTON_INFO gets released + else if(self.motd_actived_time == -2 || IS_PLAYER(self) || time - self.jointime > autocvar_welcome_message_time) + { + // instanctly hide MOTD + self.motd_actived_time = 0; + Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD); + } + } } void ObserverThink() @@ -2438,8 +2393,6 @@ void ObserverThink() } } } - - PrintWelcomeMessage(); } void SpectatorThink() @@ -2478,7 +2431,6 @@ void SpectatorThink() PutObserverInServer(); } - PrintWelcomeMessage(); self.flags |= FL_CLIENT | FL_NOTARGET; } @@ -2497,8 +2449,6 @@ void PlayerUseKey() MUTATOR_CALLHOOK(PlayerUseKey); } -.float touchexplode_time; - /* ============= PlayerPreThink @@ -2599,11 +2549,10 @@ void PlayerPreThink (void) self.usekeypressed = self.BUTTON_USE; } - PrintWelcomeMessage(); + if(clienttype(self) == CLIENTTYPE_REAL) + PrintWelcomeMessage(); if(self.classname == "player") { -// if(self.netname == "Wazat") -// bprint(self.classname, "\n"); CheckRules_Player(); @@ -2662,7 +2611,7 @@ void PlayerPreThink (void) if(frametime) player_anim(); button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE); - force_respawn = (g_lms || g_ca || g_cts || autocvar_g_forced_respawn); + force_respawn = (g_ca || g_cts || autocvar_g_forced_respawn); if (self.deadflag == DEAD_DYING) { if(force_respawn) @@ -2697,55 +2646,6 @@ void PlayerPreThink (void) return; } - // FIXME from now on self.deadflag is always 0 (and self.health is never < 1) - // so (self.deadflag == DEAD_NO) is always true in the code below - - if(g_touchexplode) - if(time > self.touchexplode_time) - if(self.classname == "player") - if(self.deadflag == DEAD_NO) - if not(IS_INDEPENDENT_PLAYER(self)) - FOR_EACH_PLAYER(other) if(self != other) - { - if(time > other.touchexplode_time) - if(other.deadflag == DEAD_NO) - if not(IS_INDEPENDENT_PLAYER(other)) - if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax)) - { - PlayerTouchExplode(self, other); - self.touchexplode_time = other.touchexplode_time = time + 0.2; - } - } - - if(g_lms && !self.deadflag && autocvar_g_lms_campcheck_interval) - { - vector dist; - - // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement) - dist = self.prevorigin - self.origin; - dist_z = 0; - self.lms_traveled_distance += fabs(vlen(dist)); - - if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime)) - { - self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2; - self.lms_traveled_distance = 0; - } - - if(time > self.lms_nextcheck) - { - //sprint(self, "distance: ", ftos(self.lms_traveled_distance), "\n"); - if(self.lms_traveled_distance < autocvar_g_lms_campcheck_distance) - { - Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_CAMPCHECK); - // FIXME KadaverJack: gibbing player here causes playermodel to bounce around, instead of eye.md3 - // I wasn't able to find out WHY that happens, so I put a workaround in place that shall prevent players from being gibbed :( - Damage(self, self, self, bound(0, autocvar_g_lms_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0'); - } - self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval; - self.lms_traveled_distance = 0; - } - } self.prevorigin = self.origin; @@ -2956,7 +2856,7 @@ void PlayerPostThink (void) else if(timeleft <= 10) { if(timeleft != self.idlekick_lasttimeleft) - AnnounceTo(self, ftos(timeleft)); + Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(timeleft)); self.idlekick_lasttimeleft = timeleft; } }