void spawnpoint_use()
{
- if(teams_matter)
+ if(teamplay)
if(have_team_spawns > 0)
{
self.team = activator.team;
DropAllRunes(self);
MUTATOR_CALLHOOK(MakePlayerObserver);
+ if (g_minstagib)
+ minstagib_stop_countdown();
+
Portal_ClearAll(self);
if(self.alivetime)
if(autocvar_sv_defaultcharacter == 1) {
defaultskin = 0;
- if(teams_matter)
+ if(teamplay)
{
string s;
s = Team_ColorNameLowerCase(self.team);
if(chmdl || oldskin != self.skinindex)
self.species = player_getspecies(); // model or skin has changed
- if(!teams_matter)
+ if(!teamplay)
if(strlen(autocvar_sv_defaultplayercolors))
if(self.clientcolors != stof(autocvar_sv_defaultplayercolors))
setcolor(self, stof(autocvar_sv_defaultplayercolors));
oldself = self;
self = spot;
activator = oldself;
+ string s;
+ s = self.target;
+ self.target = string_null;
SUB_UseTargets();
+ self.target = s;
activator = world;
self = oldself;
{
if(self.cnt <= 10)
AnnounceTo(self.owner, strcat(ftos(self.cnt), ""));
+ // TODO: Send_CSQC_Centerprint_Generic only once
if(self.owner.killindicator_teamchange)
{
if(self.owner.killindicator_teamchange == -1)
- centerprint(self.owner, strcat("Changing team in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_TEAMCHANGE, "Changing team in %d seconds", 1, self.cnt);
else if(self.owner.killindicator_teamchange == -2)
- centerprint(self.owner, strcat("Spectating in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_TEAMCHANGE, "Spectating in %d seconds", 1, self.cnt);
else
- centerprint(self.owner, strcat("Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_TEAMCHANGE, strcat("Changing to ", ColoredTeamName(self.owner.killindicator_teamchange), " in %d seconds"), 1, self.cnt);
}
else
- centerprint(self.owner, strcat("^1Suicide in ", ftos(self.cnt), " seconds"));
+ Send_CSQC_Centerprint_Generic(self.owner, CPID_KILL, "^1Suicide in %d seconds", 1, self.cnt);
}
self.nextthink = time + 1;
self.cnt -= 1;
void DoTeamChange(float destteam)
{
float t, c0;
- if(!teams_matter)
+ if(!teamplay)
{
if(destteam >= 0)
SetPlayerColors(self, destteam);
else
self.team_forced = 0;
- if(!teams_matter)
+ if(!teamplay)
if(self.team_forced > 0)
self.team_forced = 0;
if((autocvar_sv_spectate == 1 && !g_lms) || autocvar_g_campaign || self.team_forced < 0) {
self.classname = "observer";
} else {
- if(teams_matter)
+ if(teamplay)
{
if(autocvar_g_balance_teams || autocvar_g_balance_teams_force)
{
bprint("\n");
- self.welcomemessage_time = 0;
-
stuffcmd(self, strcat(clientstuff, "\n"));
stuffcmd(self, strcat("exec maps/", mapname, ".cfg\n"));
stuffcmd(self, "cl_particles_reloadeffects\n");
GetCvars(0);
// notify about available teams
- if(teams_matter)
+ if(teamplay)
{
CheckAllowedTeams(self);
t = 0; if(c1 >= 0) t |= 1; if(c2 >= 0) t |= 2; if(c3 >= 0) t |= 4; if(c4 >= 0) t |= 8;
set_dom_state(self);
CheatInitClient();
+
+ // FIXME: .BUTTON_INFO in PrintWelcomeMessage must be checked at every frame, not just here
+ PrintWelcomeMessage(self);
}
/*
local float c;
c = self.clientcolors & 15;
// LordHavoc: only bothering to support white, green, red, yellow, blue
- if (!teams_matter) self.colormod = '0 0 0';
+ if (!teamplay) self.colormod = '0 0 0';
else if (c == 0) self.colormod = '1.00 1.00 1.00';
else if (c == 3) self.colormod = '0.10 1.73 0.10';
else if (c == 4) self.colormod = '1.73 0.10 0.10';
else {
retStr = strcat("Timeout ends in ", ftos(remainingTimeoutTime), " seconds!\n");
//don't show messages like "Timeout ends in 0 seconds"...
- if (remainingTimeoutTime > 0)
+ if ((remainingTimeoutTime) > 0)
return retStr;
else
return "";
void LeaveSpectatorMode()
{
if(nJoinAllowed(1)) {
- if(!teams_matter || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) {
+ if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) {
self.classname = "player";
if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force)
bprint ("^4", self.netname, "^4 is playing now\n");
if(!autocvar_g_campaign)
- centerprint(self,""); // clear MOTD
+ Send_CSQC_Centerprint_Generic(self, CPID_MOTD, "", 1, 0); // clear MOTD
return;
} else {
}
}
}
- PrintWelcomeMessage(self);
}
void SpectatorThink()
}
}
- PrintWelcomeMessage(self);
self.flags |= FL_CLIENT | FL_NOTARGET;
}
+float ctf_usekey();
+void PlayerUseKey()
+{
+ if(self.classname != "player")
+ return;
+
+ // a use key was pressed; call handlers
+ if(ctf_usekey())
+ return;
+
+ MUTATOR_CALLHOOK(PlayerUseKey);
+}
+
.float touchexplode_time;
/*
Called every frame for each client before the physics are run
=============
*/
+.float usekeypressed;
void() ctf_setstatus;
void() nexball_setstatus;
.float items_added;
MUTATOR_CALLHOOK(PlayerPreThink);
+ if(self.BUTTON_USE && !self.usekeypressed)
+ PlayerUseKey();
+ self.usekeypressed = self.BUTTON_USE;
+
if(self.classname == "player") {
// if(self.netname == "Wazat")
// bprint(self.classname, "\n");
CheckRules_Player();
- PrintWelcomeMessage(self);
-
if (intermission_running)
{
IntermissionThink (); // otherwise a button could be missed between
player_powerups();
}
+ if (g_minstagib)
+ minstagib_ammocheck();
+
if (self.deadflag != DEAD_NO)
{
float button_pressed, force_respawn;
}
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(frametime)
player_anim();
- if (g_minstagib)
- minstagib_ammocheck();
-
if(g_ctf)
ctf_setstatus();
{
if(timeleft != self.idlekick_lasttimeleft)
{
- centerprint_atprio(self, CENTERPRIO_IDLEKICK, strcat("^3Stop idling!\n^3Disconnecting in ", ftos(timeleft), "..."));
+ // TODO: send this msg only once
+ Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in %d seconds...", 1, timeleft);
AnnounceTo(self, strcat(ftos(timeleft), ""));
}
}
else
{
- centerprint_expire(self, CENTERPRIO_IDLEKICK);
+ Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "", 1, timeleft);
}
self.idlekick_lasttimeleft = timeleft;
}