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));
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) {
if (IS_REAL_CLIENT(this))
PrintWelcomeMessage(this);
+ local const int 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;
}
IntermissionThink(this);
return;
}
+ else if (IS_REAL_CLIENT(this) && !CS(this).autojoin_checked && time >= CS(this).jointime + MIN_SPEC_TIME)
+ {
+ CS(this).autojoin_checked = true;
+ // don't do this in ClientConnect
+ // many things can go wrong if a client is spawned as player on connection
+ 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);
}
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;
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)