void spawnpoint_use()
{
- if(teams_matter)
+ if(teamplay)
if(have_team_spawns > 0)
{
self.team = activator.team;
{
// we request a spawn for a team, and we have team
// spawns, but that team has no spawns?
- if(have_team_spawns[0])
+ if(have_team_spawns_forteam[0])
// try noteam spawns
teamcheck = 0;
else
else
teamcheck = self.team; // MUST be team
}
- else if(have_team_spawns == 0 && have_team_spawns[0])
+ else if(have_team_spawns == 0 && have_team_spawns_forteam[0])
teamcheck = 0; // MUST be noteam
else
teamcheck = -1;
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));
if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
self.weapon_load[j] = cvar(strcat("g_balance_", e.netname, "_reload_ammo"));
}
+ self.weapon_forbidchange = FALSE;
oldself = self;
self = spot;
activator = oldself;
+ string s;
+ s = self.target;
+ self.target = string_null;
SUB_UseTargets();
+ self.target = s;
activator = world;
self = oldself;
WriteCoord(MSG_ENTITY, self.ebouncefactor); // g_balance_grenadelauncher_bouncefactor
WriteCoord(MSG_ENTITY, self.ebouncestop); // g_balance_grenadelauncher_bouncestop
WriteByte(MSG_ENTITY, autocvar_g_balance_nex_secondary); // client has to know if it should zoom or not
- WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_secondary); // client has to know if it should zoom or not
+ WriteByte(MSG_ENTITY, autocvar_g_balance_rifle_secondary); // client has to know if it should zoom or not
WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not
WriteByte(MSG_ENTITY, autocvar_g_balance_minelayer_limit); // minelayer max mines
+ WriteByte(MSG_ENTITY, autocvar_g_balance_hagar_secondary_load_max); // hagar max loadable rockets
WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
return TRUE;
}
{
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);
string ColoredTeamName(float t);
void DecodeLevelParms (void);
//void dom_player_join_team(entity pl);
+void set_dom_state(entity e);
void ClientConnect (void)
{
float t;
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)
{
self.playerid = (playerid_last = playerid_last + 1);
+ if(clienttype(self) == CLIENTTYPE_BOT)
+ PlayerStats_AddPlayer(self);
+
if(autocvar_sv_eventlog)
GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname));
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;
ctf_clientconnect();
}*/
- if(teams_matter || radar_showennemies)
- attach_entcs();
+ attach_entcs();
bot_relinkplayerlist();
else if(autocvar_sv_teamnagger && !(autocvar_bot_vs_human && (c3==-1 && c4==-1)) && !g_ca) // teamnagger is currently bad for ca
send_CSQC_teamnagger();
+ if (g_domination)
+ set_dom_state(self);
+
CheatInitClient();
- PlayerStats_AddPlayer(self);
+ // FIXME: .BUTTON_INFO in PrintWelcomeMessage must be checked at every frame, not just here
+ PrintWelcomeMessage(self);
}
/*
=============
*/
.entity chatbubbleentity;
-.entity teambubbleentity;
void ReadyCount();
void ClientDisconnect (void)
{
if (self.chatbubbleentity)
remove (self.chatbubbleentity);
- if (self.teambubbleentity)
- remove (self.teambubbleentity);
-
if (self.killindicator)
remove (self.killindicator);
}
-void TeamBubbleThink()
-{
- self.nextthink = time;
- if (!self.owner.modelindex || self.owner.teambubbleentity != self)
- {
- if(self.owner) // but why can that ever be world?
- self.owner.teambubbleentity = world;
- remove(self);
- return;
- }
-// setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1'); // bandwidth hog. setattachment does this now
- if (self.owner.BUTTON_CHAT || self.owner.deadflag || self.owner.killindicator)
- self.model = "";
- else
- self.model = self.mdl;
-
-};
-
-float TeamBubble_customizeentityforclient()
-{
- return (self.owner != other && self.owner.team == other.team && other.killcount > -666);
-}
-
-void UpdateTeamBubble()
-{
- if (!self.modelindex || !teams_matter)
- return;
- // spawn a teambubble entity if needed
- if (!self.teambubbleentity && teams_matter)
- {
- self.teambubbleentity = spawn();
- self.teambubbleentity.owner = self;
- self.teambubbleentity.exteriormodeltoclient = self;
- self.teambubbleentity.think = TeamBubbleThink;
- self.teambubbleentity.nextthink = time;
- setmodel(self.teambubbleentity, "models/misc/teambubble.spr"); // precision set below
-// setorigin(self.teambubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
- setorigin(self.teambubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
- setattachment(self.teambubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth
- self.teambubbleentity.mdl = self.teambubbleentity.model;
- self.teambubbleentity.model = self.teambubbleentity.mdl;
- self.teambubbleentity.customizeentityforclient = TeamBubble_customizeentityforclient;
- self.teambubbleentity.effects = EF_LOWPRECISION;
- }
-}
-
// LordHavoc: this hack will be removed when proper _pants/_shirt layers are
// added to the model skins
/*void UpdateColorModHack()
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 "";
self.weapon = spectatee.weapon;
self.nex_charge = spectatee.nex_charge;
self.nex_chargepool_ammo = spectatee.nex_chargepool_ammo;
+ self.hagar_load = spectatee.hagar_load;
self.minelayer_mines = spectatee.minelayer_mines;
self.punchangle = spectatee.punchangle;
self.view_ofs = spectatee.view_ofs;
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
return; // the think tics
}
- if(frametime > 0) // don't do this in cl_movement frames, just in server ticks
- UpdateSelectedPlayer();
-
//don't allow the player to turn around while game is paused!
if(timeoutStatus == 2) {
+ // FIXME turn this into CSQC stuff
self.v_angle = self.lastV_angle;
self.angles = self.lastV_angle;
self.fixangle = TRUE;
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(!zoomstate_set)
- SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_SNIPERRIFLE && autocvar_g_balance_sniperrifle_secondary == 0));
+ SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_NEX) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE && autocvar_g_balance_rifle_secondary == 0));
float oldspectatee_status;
oldspectatee_status = self.spectatee_status;
{
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;
}
if(self.classname == "player") {
CheckRules_Player();
UpdateChatBubble();
- UpdateTeamBubble();
if (self.impulse)
ImpulseCommands();
if (intermission_running)