Xonotic
|
#include "scores.qh"
#include <common/mapinfo.qh>
#include <common/mutators/base.qh>
#include <common/net_linked.qh>
#include <common/playerstats.qh>
#include <common/scores.qh>
#include <common/state.qh>
#include <common/stats.qh>
#include <common/teams.qh>
#include <common/weapons/_all.qh>
#include <server/client.qh>
#include <server/command/common.qh>
#include <server/intermission.qh>
#include <server/mutators/_mod.qh>
#include <server/round_handler.qh>
#include <server/world.qh>
Go to the source code of this file.
Functions | |
string | GetPlayerScoreString (entity pl, float shortString) |
Returns score strings for eventlog etc. More... | |
string | GetScoreLogLabel (string label, float fl) |
string | GetTeamScoreString (float tm, float shortString) |
float | PlayerScore_Add (entity player, PlayerScoreField scorefield, float score) |
Adds a score to the player's scores. More... | |
void | PlayerScore_Attach (entity player) |
Attaches a PlayerScore entity to a player. More... | |
float | PlayerScore_Clear (entity player) |
Initialize the score of this player if needed. More... | |
float | PlayerScore_Compare (entity t1, entity t2, bool strict) |
void | PlayerScore_Detach (entity player) |
Detaches a PlayerScore entity from the player. More... | |
void | PlayerScore_PlayerStats (entity p) |
bool | PlayerScore_SendEntity (entity this, entity to, float sendflags) |
float | PlayerScore_Set (entity player, PlayerScoreField scorefield, float score) |
Sets the player's score to the score parameter. More... | |
entity | PlayerScore_Sort (.float field, int teams, bool strict, bool nospectators) |
Sorts the players and stores their place in the given field, starting with. More... | |
void | PlayerScore_TeamStats () |
float | PlayerTeamScore_Add (entity player, PlayerScoreField pscorefield, float tscorefield, float score) |
Adds a score to both the player and the team. More... | |
float | PlayerTeamScore_Compare (entity p1, entity p2, float teams, bool strict) |
void | Score_ClearAll () |
Clear ALL scores (for ready-restart). More... | |
void | Score_NicePrint (entity to) |
Prints the scores to the console of a player. More... | |
string | Score_NicePrint_ItemColor (float vflags) |
void | Score_NicePrint_Player (entity to, entity p, float w) |
void | Score_NicePrint_Spectator (entity to, entity p) |
void | Score_NicePrint_Spectators (entity to) |
void | Score_NicePrint_Team (entity to, float t, float w) |
vector | ScoreField_Compare (entity t1, entity t2,.float field, float fieldflags, vector previous, bool strict) |
void | ScoreInfo_Init (int teams) |
bool | ScoreInfo_SendEntity (entity this, entity to, int sf) |
void | ScoreInfo_SetLabel_PlayerScore (PlayerScoreField i, string label, float scoreflags) |
Set the label of a player score item, as well as the scoring flags. More... | |
void | ScoreInfo_SetLabel_TeamScore (float i, string label, float scoreflags) |
Set the label of a team score item, as well as the scoring flags. More... | |
float | TeamScore_Add (entity player, float scorefield, float score) |
Adds a score to the player's team's scores. More... | |
float | TeamScore_AddToTeam (int t, float scorefield, float score) |
Adds a score to the given team. More... | |
float | TeamScore_Compare (entity t1, entity t2, bool strict) |
float | TeamScore_GetCompareValue (float t) |
Returns a value indicating the team score (and higher is better). More... | |
bool | TeamScore_SendEntity (entity this, entity to, float sendflags) |
void | TeamScore_Spawn (float t, string name) |
void | WinningConditionHelper (entity this) |
Sets the following results for the current scores entities. More... | |
Variables | |
const float | NAMEWIDTH = 22 |
float | score_dummyfield |
entity | scorekeeper |
float | scores_flags_primary |
var float | scores_primary |
const float | SCORESWIDTH = 58 |
entity | teamscorekeepers [16] |
float | teamscores_entities_count |
float | teamscores_flags_primary |
var float | teamscores_primary |
Returns score strings for eventlog etc.
When called with NULL, or 0, as argument, they return the labels in the same order. The strings are comma separated; labels that end with !! designate primary, labels that end with ! designate high priority. Labels get an appended < if the scores are better if smaller (e.g. deaths). High priorities always come first. Example label string: score!!,kills,deaths<,suicides< If shortString is set, only the sort keys are returned.
Definition at line 586 of file scores.qc.
References CS(), entity(), FOREACH, ftos(), GetScoreLogLabel(), scorekeeper, scores_flags, scores_label, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, strcat(), strlen(), and substring().
Referenced by DumpStats(), and WinningConditionHelper().
Definition at line 575 of file scores.qc.
References SFL_LOWER_IS_BETTER, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, and strcat().
Referenced by GetPlayerScoreString(), and GetTeamScoreString().
Definition at line 648 of file scores.qc.
References entity(), ftos(), GetScoreLogLabel(), MAX_TEAMSCORE, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, strcat(), strlen(), substring(), teamscorekeepers, teamscores_flags, and teamscores_label.
Referenced by DumpStats(), and WinningConditionHelper().
float PlayerScore_Add | ( | entity | player, |
PlayerScoreField | scorefield, | ||
float | score | ||
) |
Adds a score to the player's scores.
NEVER call this if PlayerScore_Attach has not been called yet! Means: FIXME make players unable to join the game when not called ClientConnect yet. Returns the new score.
Definition at line 336 of file scores.qc.
References BIT, CS(), entity(), LOG_WARN, M_ARGV, MUTATOR_CALLHOOK, scores_initialized, scores_label, strcat(), and warmup_stage.
Referenced by _GameRules_scoring_add(), _GameRules_scoring_add_float2int(), and PlayerTeamScore_Add().
Attaches a PlayerScore entity to a player.
Use that in ClientConnect. Remember to detach it in ClientDisconnect!
Definition at line 318 of file scores.qc.
References CS(), entity(), error(), new_pure, PlayerScore_SendEntity(), and scorekeeper.
Referenced by ClientState_attach(), and PlayerState_detach().
Initialize the score of this player if needed.
Does nothing in teamplay. Use that when a spectator becomes a player. Returns whether clearing has been performed
Definition at line 267 of file scores.qc.
References BIT, CS(), entity(), FOREACH, MUTATOR_CALLHOOK, scores_label, and teamscores_entities_count.
Referenced by PutPlayerInServer(), and SetPlayerTeam().
Definition at line 399 of file scores.qc.
References FOREACH, result, ScoreField_Compare(), scores, scores_flags, and vector().
Referenced by PlayerTeamScore_Compare(), and WinningConditionHelper().
Detaches a PlayerScore entity from the player.
Use that in ClientDisconnect.
Definition at line 328 of file scores.qc.
References CS(), error(), NULL, and scorekeeper.
Referenced by ClientState_attach(), and ClientState_detach().
Definition at line 939 of file scores.qc.
References CS(), entity(), FOREACH, scores_label, and strcat().
Definition at line 239 of file scores.qc.
References etof(), FOREACH, owner, scores, WriteByte(), WriteChar(), and WriteShort().
Referenced by PlayerScore_Attach().
float PlayerScore_Set | ( | entity | player, |
PlayerScoreField | scorefield, | ||
float | score | ||
) |
Sets the player's score to the score parameter.
NEVER call this if PlayerScore_Attach has not been called yet! Means: FIXME make players unable to join the game when not called ClientConnect yet. Returns the new (or old if unchanged) score.
Definition at line 368 of file scores.qc.
References BIT, CS(), entity(), LOG_WARN, scores_initialized, and scores_label.
Referenced by NET_HANDLE().
Sorts the players and stores their place in the given field, starting with.
Definition at line 724 of file scores.qc.
References CS(), entity(), FOREACH_CLIENT, FRAGS_SPECTATOR, NULL, PlayerTeamScore_Compare(), and scorekeeper.
Referenced by MUTATOR_HOOKFUNCTION(), and Score_NicePrint().
void PlayerScore_TeamStats | ( | ) |
Definition at line 949 of file scores.qc.
References entity(), MAX_TEAMSCORE, strcat(), teamscorekeepers, and teamscores_label.
float PlayerTeamScore_Add | ( | entity | player, |
PlayerScoreField | pscorefield, | ||
float | tscorefield, | ||
float | score | ||
) |
Adds a score to both the player and the team.
Returns the team score if possible, otherwise the player score.
Definition at line 390 of file scores.qc.
References PlayerScore_Add(), TeamScore_Add(), and teamscores_entities_count.
Referenced by _GameRules_scoring_add_team().
Definition at line 704 of file scores.qc.
References CS(), entity(), PlayerScore_Compare(), scorekeeper, TeamScore_Compare(), teamscorekeepers, and teamscores_entities_count.
Referenced by PlayerScore_Sort().
void Score_ClearAll | ( | ) |
Clear ALL scores (for ready-restart).
Definition at line 288 of file scores.qc.
References BIT, CS(), entity(), FOREACH, FOREACH_CLIENTSLOT, MAX_TEAMSCORE, scores_label, teamscorekeepers, and teamscores_label.
Referenced by reset_map().
Prints the scores to the console of a player.
Definition at line 903 of file scores.qc.
References bound(), entity(), floor(), FOREACH, FOREACH_CLIENT, IS_PLAYER, PlayerScore_Sort(), score_dummyfield, Score_NicePrint_Player(), Score_NicePrint_Spectator(), Score_NicePrint_Spectators(), Score_NicePrint_Team(), scores_label, SCORESWIDTH, and teamscores_entities_count.
Referenced by CommonCommand_teamstatus(), and MUTATOR_HOOKFUNCTION().
Definition at line 810 of file scores.qc.
References SFL_SORT_PRIO_PRIMARY, and SFL_SORT_PRIO_SECONDARY.
Referenced by Score_NicePrint_Player(), and Score_NicePrint_Team().
Definition at line 857 of file scores.qc.
References CS(), entity(), FOREACH, NAMEWIDTH, print_to(), Score_NicePrint_ItemColor(), scores_flags, scores_label, strcat(), strlen(), and substring().
Referenced by Score_NicePrint().
Definition at line 897 of file scores.qc.
References print_to(), and strcat().
Referenced by Score_NicePrint().
Definition at line 892 of file scores.qc.
References print_to().
Referenced by Score_NicePrint().
Definition at line 820 of file scores.qc.
References entity(), FOREACH, max(), MAX_TEAMSCORE, NAMEWIDTH, print_to(), s2, Score_NicePrint_ItemColor(), scores_flags, scores_label, strcat(), substring(), Team_ColoredFullName, teamscorekeepers, teamscores_flags, and teamscores_label.
Referenced by Score_NicePrint().
vector ScoreField_Compare | ( | entity | t1, |
entity | t2, | ||
.float | field, | ||
float | fieldflags, | ||
vector | previous, | ||
bool | strict | ||
) |
Definition at line 27 of file scores.qc.
References SFL_LOWER_IS_BETTER, SFL_SORT_PRIO_MASK, and SFL_ZERO_IS_WORST.
Referenced by PlayerScore_Compare(), and TeamScore_Compare().
Definition at line 214 of file scores.qc.
References BIT, new_pure, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, ScoreInfo_SendEntity(), scores_initialized, and TeamScore_Spawn().
Referenced by ScoreRules_basics_end().
Definition at line 197 of file scores.qc.
References FOREACH, MapInfo_LoadedGametype, MAX_TEAMSCORE, scores_flags, scores_label, teamscores_flags, teamscores_label, WriteByte(), WriteRegistered, and WriteString().
Referenced by ScoreInfo_Init().
void ScoreInfo_SetLabel_PlayerScore | ( | PlayerScoreField | i, |
string | label, | ||
float | scoreflags | ||
) |
Set the label of a player score item, as well as the scoring flags.
Definition at line 165 of file scores.qc.
References scores, scores_flags, scores_flags_primary, scores_label, scores_primary, SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, and strcat().
Referenced by _GameRules_scoring_field(), and ScoreRules_basics().
Set the label of a team score item, as well as the scoring flags.
Definition at line 181 of file scores.qc.
References SFL_SORT_PRIO_MASK, SFL_SORT_PRIO_PRIMARY, strcat(), teamscores, teamscores_flags, teamscores_flags_primary, teamscores_label, and teamscores_primary.
Referenced by _GameRules_scoring_field_team(), and ScoreRules_basics().
Adds a score to the player's team's scores.
NEVER call this if team has not been set yet! Returns the new score.
Definition at line 137 of file scores.qc.
References TeamScore_AddToTeam().
Referenced by PlayerTeamScore_Add().
Adds a score to the given team.
NEVER call this if team has not been set yet! Returns the new score.
Definition at line 108 of file scores.qc.
References BIT, entity(), error(), scores_initialized, teamscorekeepers, and teamscores_label.
Referenced by CA_CheckWinner(), ctf_Handle_Return(), Domination_CheckWinner(), dompointthink(), freezetag_CheckWinner(), GoalTouch(), MUTATOR_HOOKFUNCTION(), Onslaught_CheckWinner(), TeamScore_Add(), WinningCondition_Assault(), and WinningCondition_RanOutOfSpawns().
Definition at line 142 of file scores.qc.
References MAX_TEAMSCORE, result, ScoreField_Compare(), teamscores, teamscores_flags, and vector().
Referenced by PlayerTeamScore_Compare(), and WinningConditionHelper().
Returns a value indicating the team score (and higher is better).
Definition at line 783 of file scores.qc.
References entity(), error(), SFL_LOWER_IS_BETTER, SFL_ZERO_IS_WORST, teamscorekeepers, and teamscores_flags_primary.
Referenced by WinningCondition_Scores().
Definition at line 64 of file scores.qc.
References assert, BIT, eprint(), MAX_TEAMSCORE, team, teamscores, WriteByte(), WriteChar(), and WriteShort().
Referenced by TeamScore_Spawn().
Definition at line 97 of file scores.qc.
References entity(), name, new_pure, TeamScore_SendEntity(), teamscorekeepers, and teamscores_entities_count.
Referenced by ScoreInfo_Init().
Sets the following results for the current scores entities.
Definition at line 415 of file scores.qc.
References autocvar_g_full_getstatus_responses, autocvar_g_xonoticversion, CS(), cvar_purechanges_count, entity(), FOREACH_CLIENT, ftos(), GetGametype(), GetPlayerScoreString(), GetTeamScoreString(), INGAME_JOINED, IS_PLAYER, IS_REAL_CLIENT, modname, nJoinAllowed(), NULL, player_count, PlayerScore_Compare(), scores_flags_primary, serverflags, SFL_LOWER_IS_BETTER, SFL_ZERO_IS_WORST, strcat(), strcpy, sv_termsofservice_url_escaped, TeamScore_Compare(), teamscorekeepers, teamscores_entities_count, teamscores_flags_primary, WinningConditionHelper_equality, WinningConditionHelper_lowerisbetter, WinningConditionHelper_second, WinningConditionHelper_secondscore, WinningConditionHelper_secondteam, WinningConditionHelper_topscore, WinningConditionHelper_winner, WinningConditionHelper_winnerteam, WinningConditionHelper_zeroisworst, and worldstatus.
Referenced by spawnfunc(), WinningCondition_Assault(), WinningCondition_Invasion(), WinningCondition_LMS(), and WinningCondition_Scores().
const float NAMEWIDTH = 22 |
Definition at line 807 of file scores.qc.
Referenced by Score_NicePrint_Player(), and Score_NicePrint_Team().
float score_dummyfield |
Definition at line 902 of file scores.qc.
Referenced by Score_NicePrint().
entity scorekeeper |
Definition at line 19 of file scores.qc.
Referenced by GetPlayerScoreString(), PlayerScore_Attach(), PlayerScore_Detach(), PlayerScore_Sort(), and PlayerTeamScore_Compare().
float scores_flags_primary |
Definition at line 24 of file scores.qc.
Referenced by ScoreInfo_SetLabel_PlayerScore(), and WinningConditionHelper().
var float scores_primary |
Definition at line 22 of file scores.qc.
Referenced by ScoreInfo_SetLabel_PlayerScore().
const float SCORESWIDTH = 58 |
Definition at line 808 of file scores.qc.
Referenced by Score_NicePrint().
entity teamscorekeepers[16] |
Definition at line 20 of file scores.qc.
Referenced by GetTeamScoreString(), PlayerScore_TeamStats(), PlayerTeamScore_Compare(), Score_ClearAll(), Score_NicePrint_Team(), TeamScore_AddToTeam(), TeamScore_GetCompareValue(), TeamScore_Spawn(), and WinningConditionHelper().
float teamscores_entities_count |
Definition at line 21 of file scores.qc.
Referenced by PlayerScore_Clear(), PlayerTeamScore_Add(), PlayerTeamScore_Compare(), Score_NicePrint(), TeamScore_Spawn(), and WinningConditionHelper().
float teamscores_flags_primary |
Definition at line 25 of file scores.qc.
Referenced by ScoreInfo_SetLabel_TeamScore(), TeamScore_GetCompareValue(), and WinningConditionHelper().
var float teamscores_primary |
Definition at line 23 of file scores.qc.
Referenced by ScoreInfo_SetLabel_TeamScore().