X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qc;h=b6d6e25e8dd9e3347387eaaacbada358d69d5feb;hb=866e651a9a86250d2aa36350bb756344463b6f57;hp=5b7509e484d5fecec7e6f49a852de6ea218e39e9;hpb=b1317ceb61ee2690d3d892945c1c0926c181db2b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 5b7509e48..b6d6e25e8 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -51,7 +52,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -641,7 +643,8 @@ void PutPlayerInServer(entity this) this.respawn_flags = 0; this.respawn_time = 0; STAT(RESPAWN_TIME, this) = 0; - this.scale = ((q3compat && autocvar_sv_q3compat_changehitbox) ? 0.9 : autocvar_sv_player_scale); + // DP model scaling uses 1/16 accuracy and 13/16 is closest to 56/69 + this.scale = ((q3compat && autocvar_sv_q3compat_changehitbox) ? 0.8125 : autocvar_sv_player_scale); this.fade_time = 0; this.pain_finished = 0; this.pushltime = 0; @@ -1185,10 +1188,21 @@ void ClientConnect(entity this) Handicap_Initialize(this); + // playban + if (PlayerInList(this, autocvar_g_playban_list)) + TRANSMUTE(Observer, this); + + if (PlayerInList(this, autocvar_g_chatban_list)) // chatban + CS(this).muted = true; + MUTATOR_CALLHOOK(ClientConnect, this); if (player_count == 1) + { + if (autocvar_sv_autopause && server_is_dedicated) + setpause(0); localcmd("\nsv_hook_firstjoin\n"); + } } /* ============= @@ -1204,6 +1218,20 @@ void ClientDisconnect(entity this) { assert(IS_CLIENT(this), return); + /* from "ignore" command */ + strfree(this.ignore_list); + FOREACH_CLIENT(IS_REAL_CLIENT(it) && it.ignore_list, + { + if(it.crypto_idfp && it.crypto_idfp != "") + continue; + string mylist = ignore_removefromlist(it, this); + if(it.ignore_list) + strunzone(it.ignore_list); + + it.ignore_list = strzone(mylist); + }); + /* from "ignore" command */ + PlayerStats_GameReport_FinalizePlayer(this); if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE); if (CS(this).active_minigame) part_minigame(this); @@ -2021,6 +2049,17 @@ int nJoinAllowed(entity this, entity ignore) if(this && (Player_GetForcedTeamIndex(this) == TEAM_FORCE_SPECTATOR)) return 0; // forced spectators can never join + static float msg_time = 0; + if(this && !INGAME(this) && ignore && PlayerInList(this, autocvar_g_playban_list)) + { + if(time > msg_time) + { + Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PLAYBAN); + msg_time = time + 0.5; + } + return 0; + } + // TODO simplify this int totalClients = 0; int currentlyPlaying = 0; @@ -2039,7 +2078,6 @@ int nJoinAllowed(entity this, entity ignore) else if(player_limit > 0 && currentlyPlaying < player_limit) free_slots = min(maxclients - totalClients, player_limit - currentlyPlaying); - static float msg_time = 0; if(this && !INGAME(this) && ignore && !free_slots && time > msg_time) { Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT, player_limit); @@ -2060,6 +2098,32 @@ bool joinAllowed(entity this) return true; } +void show_entnum(entity this) +{ + // waypoint editor implements a similar feature for waypoints + if (waypointeditor_enabled) + return; + + if (wasfreed(this.wp_aimed)) + this.wp_aimed = NULL; + + WarpZone_crosshair_trace_plusvisibletriggers(this); + entity ent = NULL; + if (trace_ent) + { + ent = trace_ent; + if (ent != this.wp_aimed) + { + string str = sprintf( + "^7ent #%d\n^8 netname: ^3%s\n^8 classname: ^5%s\n^8 origin: ^2'%s'", + etof(ent), ent.netname, ent.classname, vtos(ent.origin)); + debug_text_3d((ent.absmin + ent.absmax) * 0.5, str, 0, 7, '0 0 0'); + } + } + if (this.wp_aimed != ent) + this.wp_aimed = ent; +} + .string shootfromfixedorigin; .bool dualwielding_prev; bool PlayerThink(entity this) @@ -2081,6 +2145,8 @@ bool PlayerThink(entity this) if (frametime) player_powerups(this); + if (frametime && autocvar_sv_show_entnum) show_entnum(this); + if (IS_DEAD(this)) { if (this.personal && g_race_qualifying) { if (time > this.respawn_time) { @@ -2225,11 +2291,18 @@ void ObserverOrSpectatorThink(entity this) } } + if (frametime && autocvar_sv_show_entnum) show_entnum(this); + if (IS_BOT_CLIENT(this) && !CS(this).autojoin_checked) { CS(this).autojoin_checked = true; TRANSMUTE(Player, this); PutClientInServer(this); + + .entity weaponentity = weaponentities[0]; + if(this.(weaponentity).m_weapon == WEP_Null) + W_NextWeapon(this, 0, weaponentity); + return; } @@ -2283,6 +2356,7 @@ void ObserverOrSpectatorThink(entity this) if ((is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) || (!is_spec && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this)))) { this.flags |= FL_JUMPRELEASED; + // primary attack pressed if(this.flags & FL_SPAWNING) { this.flags &= ~FL_SPAWNING;