X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qc;h=3fd9113bdd18e73adc32d4e7bfdbfc42235af2fe;hp=238e07fb0f33d8febf4482dda7811e9581e1295d;hb=d01c567581179df7cc68bcdc8dce58efad911bc4;hpb=baeda00e5b0205e304ff26f3d618bffd31302b18 diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 238e07fb0f..3fd9113bdd 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1219,16 +1219,7 @@ void ClientConnect(entity this) JoinBestTeam(this, false); // if the team number is valid, keep it this.playerid = playerid_save; - if (autocvar_sv_spectate || autocvar_g_campaign || this.team_forced < 0) { - TRANSMUTE(Observer, this); - } else { - if (!teamplay || autocvar_g_balance_teams) { - TRANSMUTE(Player, this); - campaign_bots_may_start = true; - } else { - TRANSMUTE(Observer, this); // do it anyway - } - } + TRANSMUTE(Observer, this); PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid)); @@ -2246,43 +2237,6 @@ bool PlayerThink(entity this) return false; } - bool have_hook = false; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - if(this.(weaponentity).hook.state) - { - have_hook = true; - break; - } - } - bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this); - if (have_hook) { - do_crouch = false; - } else if (this.waterlevel >= WATERLEVEL_SWIMMING) { - do_crouch = false; - } else if (this.vehicle) { - do_crouch = false; - } else if (STAT(FROZEN, this)) { - do_crouch = false; - } - - if (do_crouch) { - if (!this.crouch) { - this.crouch = true; - this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this); - setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this)); - // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway - } - } else if (this.crouch) { - tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this); - if (!trace_startsolid) { - this.crouch = false; - this.view_ofs = STAT(PL_VIEW_OFS, this); - setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this)); - } - } - FixPlayermodel(this); if (this.shootfromfixedorigin != autocvar_g_shootfromfixedorigin) { @@ -2609,7 +2563,10 @@ void PlayerPreThink (entity this) if (IS_REAL_CLIENT(this)) PrintWelcomeMessage(this); + #define MIN_SPEC_TIME 1 if (IS_PLAYER(this)) { + if (IS_REAL_CLIENT(this) && time < CS(this).jointime + MIN_SPEC_TIME) + error("Client can't be spawned as player on connection!"); if(!PlayerThink(this)) return; } @@ -2618,6 +2575,22 @@ void PlayerPreThink (entity this) IntermissionThink(this); return; } + else if (IS_REAL_CLIENT(this) && time < CS(this).jointime + MIN_SPEC_TIME + 1) + { + // don't do this in ClientConnect + // many things can go wrong if a client is spawned as player on connection + if (time > CS(this).jointime + MIN_SPEC_TIME) + { + if (MUTATOR_CALLHOOK(AutoJoinOnConnection, this) + || (!(autocvar_sv_spectate || autocvar_g_campaign || this.team_forced < 0) + && (!teamplay || autocvar_g_balance_teams))) + { + campaign_bots_may_start = true; + Join(this); + return; + } + } + } else if (IS_OBSERVER(this)) { ObserverThink(this); } @@ -2805,11 +2778,14 @@ void PM_UpdateButtons(entity this, entity store) store.impulse = this.impulse; this.impulse = 0; - store.button0 = this.button0; - store.button2 = this.button2; - store.button3 = this.button3; + bool typing = this.buttonchat; + + store.button0 = (typing) ? 0 : this.button0; + //button1?! + store.button2 = (typing) ? 0 : this.button2; + store.button3 = (typing) ? 0 : this.button3; store.button4 = this.button4; - store.button5 = this.button5; + store.button5 = (typing) ? 0 : this.button5; store.button6 = this.button6; store.button7 = this.button7; store.button8 = this.button8; @@ -2835,7 +2811,7 @@ void PM_UpdateButtons(entity this, entity store) store.ping_movementloss = this.ping_movementloss; store.v_angle = this.v_angle; - store.movement = this.movement; + store.movement = (typing) ? '0 0 0' : this.movement; } NET_HANDLE(fpsreport, bool)