Xonotic
sv_keyhunt.qc File Reference
+ Include dependency graph for sv_keyhunt.qc:

Go to the source code of this file.

Functions

void havocbot_goalrating_kh (entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
 
void havocbot_role_kh_carrier (entity this)
 
void havocbot_role_kh_defense (entity this)
 
void havocbot_role_kh_freelancer (entity this)
 
void havocbot_role_kh_offense (entity this)
 
void key_reset (entity this)
 
vector kh_AttachedOrigin (entity e)
 
void kh_Controller_SetThink (float t, kh_Think_t func)
 
void kh_Controller_Think (entity this)
 
void kh_EnableTrackingDevice ()
 
void kh_finalize ()
 
void kh_FinishRound ()
 
int kh_GetMissingTeams ()
 
float kh_HandleFrags (entity attacker, entity targ, float f)
 
void kh_Initialize ()
 
int kh_Key_AllOwnedByWhichTeam ()
 
void kh_Key_AssignTo (entity key, entity player)
 
void kh_Key_Attach (entity key)
 
void kh_Key_Collect (entity key, entity player)
 
void kh_Key_Damage (entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
 
void kh_Key_Detach (entity key)
 
void kh_Key_DropAll (entity player, float suicide)
 
void kh_Key_DropOne (entity key)
 
void kh_Key_Remove (entity key)
 
void kh_Key_Spawn (entity initial_owner, float _angle, float i)
 
void kh_Key_Think (entity this)
 
void kh_Key_Touch (entity this, entity toucher)
 
bool kh_Key_waypointsprite_visible_for_player (entity this, entity player, entity view)
 
bool kh_KeyCarrier_waypointsprite_visible_for_player (entity this, entity player, entity view)
 
void kh_LoserTeam (int loser_team, entity lostkey)
 
void kh_ScoreRules (int teams)
 
void kh_Scores_Event (entity player, entity key, string what, float frags_player, float frags_owner)
 
void kh_StartRound ()
 
int kh_Team_ByID (int t)
 
void kh_update_state ()
 
void kh_WaitForPlayers ()
 
void kh_WinnerTeam (int winner_team)
 
 MUTATOR_HOOKFUNCTION (kh, ClientDisconnect)
 
 MUTATOR_HOOKFUNCTION (kh, MakePlayerObserver)
 
 MUTATOR_HOOKFUNCTION (kh, PlayerDies)
 
 MUTATOR_HOOKFUNCTION (kh, GiveFragsForKill, CBC_ORDER_FIRST)
 
 MUTATOR_HOOKFUNCTION (kh, MatchEnd)
 
 MUTATOR_HOOKFUNCTION (kh, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
 
 MUTATOR_HOOKFUNCTION (kh, PlayerUseKey)
 
 MUTATOR_HOOKFUNCTION (kh, HavocBot_ChooseRole)
 
 MUTATOR_HOOKFUNCTION (kh, LogDeath_AppendItemCodes)
 
 MUTATOR_HOOKFUNCTION (kh, DropSpecialItems)
 
 MUTATOR_HOOKFUNCTION (kh, reset_map_global)
 
void nades_GiveBonus (entity player, float score)
 
 void (entity this) havocbot_role_kh_carrier
 

Variables

float autocvar_g_balance_keyhunt_damageforcescale
 
float autocvar_g_balance_keyhunt_delay_collect
 
float autocvar_g_balance_keyhunt_delay_damage_return
 
float autocvar_g_balance_keyhunt_delay_return
 
float autocvar_g_balance_keyhunt_delay_round
 
float autocvar_g_balance_keyhunt_delay_tracking
 
float autocvar_g_balance_keyhunt_dropvelocity
 
float autocvar_g_balance_keyhunt_maxdist
 
float autocvar_g_balance_keyhunt_protecttime
 
float autocvar_g_balance_keyhunt_return_when_unreachable
 
int autocvar_g_balance_keyhunt_score_capture
 
int autocvar_g_balance_keyhunt_score_carrierfrag
 
int autocvar_g_balance_keyhunt_score_collect
 
int autocvar_g_balance_keyhunt_score_destroyed
 
int autocvar_g_balance_keyhunt_score_destroyed_ownfactor
 
int autocvar_g_balance_keyhunt_score_push
 
float autocvar_g_balance_keyhunt_throwvelocity
 
int autocvar_g_keyhunt_teams_override
 
entity kh_controller
 
var kh_Think_t kh_Controller_Thinkfunc
 
int kh_dropperteam
 
float kh_droptime
 
int kh_interferemsg_team
 
float kh_interferemsg_time
 
const float KH_KEY_BRIGHTNESS = 2
 
int kh_key_carried
 
int kh_key_dropped
 
const vector KH_KEY_MAX = '10 10 3'
 
const vector KH_KEY_MIN = '-10 -10 -46'
 
const float KH_KEY_WP_ZSHIFT = 20
 
const float KH_KEY_XYDIST = 24
 
const float KH_KEY_XYSPEED = 45
 
const float KH_KEY_ZSHIFT = 22
 
entity kh_next
 
bool kh_no_radar_circles
 
entity kh_prev
 
entity kh_previous_owner
 
int kh_previous_owner_playerid
 
int kh_teams
 
float siren_time
 
const int ST_KH_CAPS = 1
 

Function Documentation

◆ havocbot_goalrating_kh()

void havocbot_goalrating_kh ( entity  this,
float  ratingscale_team,
float  ratingscale_dropped,
float  ratingscale_enemy 
)

Definition at line 1023 of file sv_keyhunt.qc.

References entity(), havocbot_goalrating_items(), kh_tracking_enabled, kh_worldkeylist, MOVE_NOMONSTERS, navigation_routerating(), origin, trace_ent, trace_fraction, and view_ofs.

Referenced by havocbot_role_kh_carrier(), havocbot_role_kh_defense(), havocbot_role_kh_freelancer(), and havocbot_role_kh_offense().

1024 {
1025  entity head;
1026  for (head = kh_worldkeylist; head; head = head.kh_worldkeynext)
1027  {
1028  if(head.owner == this)
1029  continue;
1030  if(!kh_tracking_enabled)
1031  {
1032  // if it's carried by our team we know about it
1033  // otherwise we have to see it to know about it
1034  if(!head.owner || head.team != this.team)
1035  {
1036  traceline(this.origin + this.view_ofs, head.origin, MOVE_NOMONSTERS, this);
1037  if (trace_fraction < 1 && trace_ent != head)
1038  continue; // skip what I can't see
1039  }
1040  }
1041  if(!head.owner)
1042  navigation_routerating(this, head, ratingscale_dropped * 10000, 100000);
1043  else if(head.team == this.team)
1044  navigation_routerating(this, head.owner, ratingscale_team * 10000, 100000);
1045  else
1046  navigation_routerating(this, head.owner, ratingscale_enemy * 10000, 100000);
1047  }
1048 
1049  havocbot_goalrating_items(this, 80000, this.origin, 10000);
1050 }
bool kh_tracking_enabled
Definition: sv_keyhunt.qh:32
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition: roles.qc:106
vector view_ofs
Definition: progsdefs.qc:151
entity() spawn
origin
Definition: ent_cs.qc:114
void navigation_routerating(entity this, entity e, float f, float rangebias)
Definition: navigation.qc:1220
entity kh_worldkeylist
Definition: sv_keyhunt.qh:24
entity trace_ent
Definition: csprogsdefs.qc:40
const float MOVE_NOMONSTERS
Definition: csprogsdefs.qc:253
float trace_fraction
Definition: csprogsdefs.qc:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_role_kh_carrier()

void havocbot_role_kh_carrier ( entity  this)

Definition at line 1052 of file sv_keyhunt.qc.

References havocbot_goalrating_kh(), havocbot_role_kh_freelancer(), havocbot_role_timeout, IS_DEAD, kh_Key_AllOwnedByWhichTeam(), kh_next, LOG_TRACE, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), and team.

Referenced by havocbot_role_kh_defense(), havocbot_role_kh_freelancer(), havocbot_role_kh_offense(), and kh_finalize().

1053 {
1054  if(IS_DEAD(this))
1055  return;
1056 
1057  if (!(this.kh_next))
1058  {
1059  LOG_TRACE("changing role to freelancer");
1060  this.havocbot_role = havocbot_role_kh_freelancer;
1061  this.havocbot_role_timeout = 0;
1062  return;
1063  }
1064 
1066  {
1068 
1069  if(kh_Key_AllOwnedByWhichTeam() == this.team)
1070  havocbot_goalrating_kh(this, 10, 0.1, 0.05); // bring home
1071  else
1072  havocbot_goalrating_kh(this, 4, 4, 0.5); // play defensively
1073 
1075 
1077  }
1078 }
void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
Definition: sv_keyhunt.qc:1023
float havocbot_role_timeout
Definition: api.qh:46
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
int team
Definition: main.qh:157
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
int kh_Key_AllOwnedByWhichTeam()
Definition: sv_keyhunt.qc:774
entity kh_next
Definition: sv_keyhunt.qc:76
#define IS_DEAD(s)
Definition: utils.qh:26
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
#define LOG_TRACE(...)
Definition: log.qh:81
void havocbot_role_kh_freelancer(entity this)
Definition: sv_keyhunt.qc:1165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_role_kh_defense()

void havocbot_role_kh_defense ( entity  this)

Definition at line 1080 of file sv_keyhunt.qc.

References havocbot_goalrating_kh(), havocbot_role_kh_carrier(), havocbot_role_kh_freelancer(), havocbot_role_timeout, IS_DEAD, kh_Key_AllOwnedByWhichTeam(), kh_next, LOG_TRACE, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), random(), team, and time.

Referenced by havocbot_role_kh_freelancer(), kh_finalize(), and MUTATOR_HOOKFUNCTION().

1081 {
1082  if(IS_DEAD(this))
1083  return;
1084 
1085  if (this.kh_next)
1086  {
1087  LOG_TRACE("changing role to carrier");
1088  this.havocbot_role = havocbot_role_kh_carrier;
1089  this.havocbot_role_timeout = 0;
1090  return;
1091  }
1092 
1093  if (!this.havocbot_role_timeout)
1094  this.havocbot_role_timeout = time + random() * 10 + 20;
1095  if (time > this.havocbot_role_timeout)
1096  {
1097  LOG_TRACE("changing role to freelancer");
1098  this.havocbot_role = havocbot_role_kh_freelancer;
1099  this.havocbot_role_timeout = 0;
1100  return;
1101  }
1102 
1104  {
1105  float key_owner_team;
1107 
1108  key_owner_team = kh_Key_AllOwnedByWhichTeam();
1109  if(key_owner_team == this.team)
1110  havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend key carriers
1111  else if(key_owner_team == -1)
1112  havocbot_goalrating_kh(this, 4, 1, 0.05); // play defensively
1113  else
1114  havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK ANYWAY
1115 
1117 
1119  }
1120 }
void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
Definition: sv_keyhunt.qc:1023
float havocbot_role_timeout
Definition: api.qh:46
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
void havocbot_role_kh_carrier(entity this)
Definition: sv_keyhunt.qc:1052
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
int team
Definition: main.qh:157
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
int kh_Key_AllOwnedByWhichTeam()
Definition: sv_keyhunt.qc:774
entity kh_next
Definition: sv_keyhunt.qc:76
#define IS_DEAD(s)
Definition: utils.qh:26
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
#define LOG_TRACE(...)
Definition: log.qh:81
void havocbot_role_kh_freelancer(entity this)
Definition: sv_keyhunt.qc:1165
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_role_kh_freelancer()

void havocbot_role_kh_freelancer ( entity  this)

Definition at line 1165 of file sv_keyhunt.qc.

References havocbot_goalrating_kh(), havocbot_role_kh_carrier(), havocbot_role_kh_defense(), havocbot_role_kh_offense(), havocbot_role_timeout, IS_DEAD, kh_Key_AllOwnedByWhichTeam(), kh_next, LOG_TRACE, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), random(), team, and time.

Referenced by havocbot_role_kh_carrier(), havocbot_role_kh_defense(), havocbot_role_kh_offense(), kh_finalize(), and MUTATOR_HOOKFUNCTION().

1166 {
1167  if(IS_DEAD(this))
1168  return;
1169 
1170  if (this.kh_next)
1171  {
1172  LOG_TRACE("changing role to carrier");
1173  this.havocbot_role = havocbot_role_kh_carrier;
1174  this.havocbot_role_timeout = 0;
1175  return;
1176  }
1177 
1178  if (!this.havocbot_role_timeout)
1179  this.havocbot_role_timeout = time + random() * 10 + 10;
1180  if (time > this.havocbot_role_timeout)
1181  {
1182  if (random() < 0.5)
1183  {
1184  LOG_TRACE("changing role to offense");
1185  this.havocbot_role = havocbot_role_kh_offense;
1186  }
1187  else
1188  {
1189  LOG_TRACE("changing role to defense");
1190  this.havocbot_role = havocbot_role_kh_defense;
1191  }
1192  this.havocbot_role_timeout = 0;
1193  return;
1194  }
1195 
1197  {
1199 
1200  int key_owner_team = kh_Key_AllOwnedByWhichTeam();
1201  if(key_owner_team == this.team)
1202  havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend anyway
1203  else if(key_owner_team == -1)
1204  havocbot_goalrating_kh(this, 1, 10, 2); // prefer dropped keys
1205  else
1206  havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK ANYWAY
1207 
1209 
1211  }
1212 }
void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
Definition: sv_keyhunt.qc:1023
float havocbot_role_timeout
Definition: api.qh:46
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
void havocbot_role_kh_carrier(entity this)
Definition: sv_keyhunt.qc:1052
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
int team
Definition: main.qh:157
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
int kh_Key_AllOwnedByWhichTeam()
Definition: sv_keyhunt.qc:774
entity kh_next
Definition: sv_keyhunt.qc:76
void havocbot_role_kh_offense(entity this)
Definition: sv_keyhunt.qc:1122
#define IS_DEAD(s)
Definition: utils.qh:26
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
void havocbot_role_kh_defense(entity this)
Definition: sv_keyhunt.qc:1080
#define LOG_TRACE(...)
Definition: log.qh:81
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ havocbot_role_kh_offense()

void havocbot_role_kh_offense ( entity  this)

Definition at line 1122 of file sv_keyhunt.qc.

References havocbot_goalrating_kh(), havocbot_role_kh_carrier(), havocbot_role_kh_freelancer(), havocbot_role_timeout, IS_DEAD, kh_Key_AllOwnedByWhichTeam(), kh_next, LOG_TRACE, navigation_goalrating_end(), navigation_goalrating_start(), navigation_goalrating_timeout(), navigation_goalrating_timeout_set(), random(), team, and time.

Referenced by havocbot_role_kh_freelancer(), kh_finalize(), and MUTATOR_HOOKFUNCTION().

1123 {
1124  if(IS_DEAD(this))
1125  return;
1126 
1127  if (this.kh_next)
1128  {
1129  LOG_TRACE("changing role to carrier");
1130  this.havocbot_role = havocbot_role_kh_carrier;
1131  this.havocbot_role_timeout = 0;
1132  return;
1133  }
1134 
1135  if (!this.havocbot_role_timeout)
1136  this.havocbot_role_timeout = time + random() * 10 + 20;
1137  if (time > this.havocbot_role_timeout)
1138  {
1139  LOG_TRACE("changing role to freelancer");
1140  this.havocbot_role = havocbot_role_kh_freelancer;
1141  this.havocbot_role_timeout = 0;
1142  return;
1143  }
1144 
1146  {
1147  float key_owner_team;
1148 
1150 
1151  key_owner_team = kh_Key_AllOwnedByWhichTeam();
1152  if(key_owner_team == this.team)
1153  havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend anyway
1154  else if(key_owner_team == -1)
1155  havocbot_goalrating_kh(this, 0.1, 1, 2); // play offensively
1156  else
1157  havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK! EMERGENCY!
1158 
1160 
1162  }
1163 }
void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
Definition: sv_keyhunt.qc:1023
float havocbot_role_timeout
Definition: api.qh:46
void navigation_goalrating_start(entity this)
Definition: navigation.qc:1830
void havocbot_role_kh_carrier(entity this)
Definition: sv_keyhunt.qc:1052
void navigation_goalrating_end(entity this)
Definition: navigation.qc:1845
int team
Definition: main.qh:157
bool navigation_goalrating_timeout(entity this)
Definition: navigation.qc:43
int kh_Key_AllOwnedByWhichTeam()
Definition: sv_keyhunt.qc:774
entity kh_next
Definition: sv_keyhunt.qc:76
#define IS_DEAD(s)
Definition: utils.qh:26
void navigation_goalrating_timeout_set(entity this)
Definition: navigation.qc:19
#define LOG_TRACE(...)
Definition: log.qh:81
void havocbot_role_kh_freelancer(entity this)
Definition: sv_keyhunt.qc:1165
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key_reset()

void key_reset ( entity  this)

Definition at line 714 of file sv_keyhunt.qc.

References kh_Key_AssignTo(), kh_Key_Remove(), and NULL.

Referenced by kh_Key_Spawn().

715 {
716  kh_Key_AssignTo(this, NULL);
717  kh_Key_Remove(this);
718 }
#define NULL
Definition: post.qh:17
void kh_Key_AssignTo(entity key, entity player)
Definition: sv_keyhunt.qc:304
void kh_Key_Remove(entity key)
Definition: sv_keyhunt.qc:463
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_AttachedOrigin()

vector kh_AttachedOrigin ( entity  e)

Definition at line 205 of file sv_keyhunt.qc.

References makevectors, v_forward, v_right, and v_up.

Referenced by kh_WinnerTeam().

206 {
207  if(e.tag_entity)
208  {
209  makevectors(e.tag_entity.angles);
210  return e.tag_entity.origin + e.origin.x * v_forward - e.origin.y * v_right + e.origin.z * v_up;
211  }
212  else
213  return e.origin;
214 }
vector v_up
Definition: csprogsdefs.qc:31
vector v_right
Definition: csprogsdefs.qc:31
#define makevectors
Definition: post.qh:21
vector v_forward
Definition: csprogsdefs.qc:31
+ Here is the caller graph for this function:

◆ kh_Controller_SetThink()

void kh_Controller_SetThink ( float  t,
kh_Think_t  func 
)

Definition at line 148 of file sv_keyhunt.qc.

References ceil(), kh_controller, kh_Controller_Thinkfunc, kh_WaitForPlayers(), and time.

Referenced by kh_FinishRound(), kh_Initialize(), kh_StartRound(), and kh_WaitForPlayers().

149 {
151  kh_controller.cnt = ceil(t);
152  if(t == 0)
153  kh_controller.nextthink = time; // force
154 }
entity kh_controller
Definition: sv_keyhunt.qc:71
var kh_Think_t kh_Controller_Thinkfunc
Definition: sv_keyhunt.qc:147
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Controller_Think()

void kh_Controller_Think ( entity  this)

Definition at line 156 of file sv_keyhunt.qc.

References cnt, getthink, kh_Controller_Thinkfunc, kh_WaitForPlayers(), nextthink, and time.

Referenced by kh_Initialize().

157 {
158  if(game_stopped)
159  return;
160  if(this.cnt > 0)
161  {
162  if(getthink(this) != kh_WaitForPlayers)
163  this.cnt -= 1;
164  }
165  else if(this.cnt == 0)
166  {
167  this.cnt -= 1;
169  }
170  this.nextthink = time + 1;
171 }
#define getthink(e)
void kh_WaitForPlayers()
Definition: sv_keyhunt.qc:862
float cnt
Definition: powerups.qc:24
float nextthink
Definition: csprogsdefs.qc:121
var kh_Think_t kh_Controller_Thinkfunc
Definition: sv_keyhunt.qc:147
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_EnableTrackingDevice()

void kh_EnableTrackingDevice ( )

Definition at line 903 of file sv_keyhunt.qc.

References kh_tracking_enabled, and NULL.

Referenced by kh_StartRound().

904 {
905  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT);
906  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT_OTHER);
907 
908  kh_tracking_enabled = true;
909 }
bool kh_tracking_enabled
Definition: sv_keyhunt.qh:32
#define NULL
Definition: post.qh:17
+ Here is the caller graph for this function:

◆ kh_finalize()

void kh_finalize ( )

Definition at line 1007 of file sv_keyhunt.qc.

References entity(), havocbot_role_kh_carrier(), havocbot_role_kh_defense(), havocbot_role_kh_freelancer(), havocbot_role_kh_offense(), kh_controller, kh_FinishRound(), NULL, and void().

Referenced by MUTATOR_HOOKFUNCTION().

1008 {
1009  // to be called before intermission
1010  kh_FinishRound();
1011  delete(kh_controller);
1012  kh_controller = NULL;
1013 }
entity kh_controller
Definition: sv_keyhunt.qc:71
#define NULL
Definition: post.qh:17
void kh_FinishRound()
Definition: sv_keyhunt.qc:494
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_FinishRound()

void kh_FinishRound ( )

Definition at line 494 of file sv_keyhunt.qc.

References autocvar_g_balance_keyhunt_delay_round, entity(), FOR_EACH_KH_KEY, kh_Controller_SetThink(), kh_interferemsg_time, kh_Key_Remove(), kh_no_radar_circles, kh_StartRound(), nades_GiveBonus(), and NULL.

Referenced by kh_finalize(), kh_LoserTeam(), and kh_WinnerTeam().

495 {
496  // prepare next round
498  entity key;
499 
500  kh_no_radar_circles = true;
501  FOR_EACH_KH_KEY(key)
502  kh_Key_Remove(key);
503  kh_no_radar_circles = false;
504 
505  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
507 }
float autocvar_g_balance_keyhunt_delay_round
Definition: sv_keyhunt.qc:13
entity() spawn
bool kh_no_radar_circles
Definition: sv_keyhunt.qc:52
void kh_Controller_SetThink(float t, kh_Think_t func)
Definition: sv_keyhunt.qc:148
#define NULL
Definition: post.qh:17
void kh_StartRound()
Definition: sv_keyhunt.qc:911
float kh_interferemsg_time
Definition: sv_keyhunt.qc:75
#define FOR_EACH_KH_KEY(v)
Definition: sv_keyhunt.qh:27
void kh_Key_Remove(entity key)
Definition: sv_keyhunt.qc:463
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_GetMissingTeams()

int kh_GetMissingTeams ( )

Definition at line 845 of file sv_keyhunt.qc.

References BIT, FOREACH_CLIENT, IS_DEAD, IS_PLAYER, kh_Team_ByID(), kh_teams, NumTeams(), PHYS_INPUT_BUTTON_CHAT, and players.

Referenced by kh_StartRound(), and kh_WaitForPlayers().

846 {
847  int missing_teams = 0;
848  for(int i = 0; i < NumTeams(kh_teams); ++i)
849  {
850  int teem = kh_Team_ByID(i);
851  int players = 0;
853  if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
854  ++players;
855  });
856  if (!players)
857  missing_teams |= BIT(i);
858  }
859  return missing_teams;
860 }
#define PHYS_INPUT_BUTTON_CHAT(s)
Definition: player.qh:155
int NumTeams(int teams)
Definition: scores_rules.qc:17
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
int kh_Team_ByID(int t)
Definition: sv_keyhunt.qc:62
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
#define IS_DEAD(s)
Definition: utils.qh:26
entity players
Definition: main.qh:43
int kh_teams
Definition: sv_keyhunt.qc:73
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_HandleFrags()

float kh_HandleFrags ( entity  attacker,
entity  targ,
float  f 
)

Definition at line 949 of file sv_keyhunt.qc.

References autocvar_g_balance_keyhunt_score_carrierfrag, autocvar_g_balance_keyhunt_score_collect, entity(), GameRules_scoring_add, kh_Scores_Event(), and NULL.

Referenced by MUTATOR_HOOKFUNCTION().

950 {
951  if(attacker == targ)
952  return f;
953 
954  if(targ.kh_next)
955  {
956  if(attacker.team == targ.team)
957  {
958  int nk = 0;
959  for(entity k = targ.kh_next; k != NULL; k = k.kh_next)
960  ++nk;
961  kh_Scores_Event(attacker, targ.kh_next, "carrierfrag", -nk * autocvar_g_balance_keyhunt_score_collect, 0);
962  }
963  else
964  {
965  kh_Scores_Event(attacker, targ.kh_next, "carrierfrag", autocvar_g_balance_keyhunt_score_carrierfrag-1, 0);
966  GameRules_scoring_add(attacker, KH_KCKILLS, 1);
967  // the frag gets added later
968  }
969  }
970 
971  return f;
972 }
entity() spawn
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
int autocvar_g_balance_keyhunt_score_carrierfrag
Definition: sv_keyhunt.qc:21
void kh_Scores_Event(entity player, entity key, string what, float frags_player, float frags_owner)
Definition: sv_keyhunt.qc:175
#define NULL
Definition: post.qh:17
int autocvar_g_balance_keyhunt_score_collect
Definition: sv_keyhunt.qc:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Initialize()

void kh_Initialize ( )

Definition at line 974 of file sv_keyhunt.qc.

References autocvar_g_keyhunt_teams_override, BITS, bound(), cvar(), kh_controller, kh_Controller_SetThink(), kh_Controller_Think(), kh_key_carried, kh_key_dropped, kh_ScoreRules(), kh_teams, kh_WaitForPlayers(), new_pure, setmodel, and setthink.

Referenced by REGISTER_MUTATOR().

975 {
976  // setup variables
978  if(kh_teams < 2)
979  kh_teams = cvar("g_keyhunt_teams"); // read the cvar directly as it gets written earlier in the same frame
980  kh_teams = BITS(bound(2, kh_teams, 4));
981 
982  // make a KH entity for controlling the game
986 
987  setmodel(kh_controller, MDL_KH_KEY);
988  kh_key_dropped = kh_controller.modelindex;
989  /*
990  dprint(vtos(kh_controller.mins));
991  dprint(vtos(kh_controller.maxs));
992  dprint("\n");
993  */
994 #ifdef KH_PLAYER_USE_CARRIEDMODEL
995  setmodel(kh_controller, MDL_KH_KEY_CARRIED);
996  kh_key_carried = kh_controller.modelindex;
997 #else
999 #endif
1000 
1001  kh_controller.model = "";
1002  kh_controller.modelindex = 0;
1003 
1005 }
int autocvar_g_keyhunt_teams_override
Definition: sv_keyhunt.qc:29
int kh_key_dropped
Definition: sv_keyhunt.qc:82
void kh_Controller_Think(entity this)
Definition: sv_keyhunt.qc:156
entity kh_controller
Definition: sv_keyhunt.qc:71
void kh_WaitForPlayers()
Definition: sv_keyhunt.qc:862
void kh_Controller_SetThink(float t, kh_Think_t func)
Definition: sv_keyhunt.qc:148
#define setmodel(this, m)
Definition: model.qh:26
void kh_ScoreRules(int teams)
Definition: sv_keyhunt.qc:87
int kh_key_carried
Definition: sv_keyhunt.qc:82
#define new_pure(class)
purely logical entities (.origin doesn&#39;t work)
Definition: oo.qh:62
#define setthink(e, f)
int kh_teams
Definition: sv_keyhunt.qc:73
#define BITS(n)
Definition: bits.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_AllOwnedByWhichTeam()

int kh_Key_AllOwnedByWhichTeam ( )

Definition at line 774 of file sv_keyhunt.qc.

References entity(), FOR_EACH_KH_KEY, kh_teams, and NumTeams().

Referenced by havocbot_role_kh_carrier(), havocbot_role_kh_defense(), havocbot_role_kh_freelancer(), havocbot_role_kh_offense(), kh_Key_AssignTo(), and kh_Key_Think().

775 {
776  entity key;
777  int teem = -1;
778  int keys = NumTeams(kh_teams);
779  FOR_EACH_KH_KEY(key)
780  {
781  if(!key.owner)
782  return -1;
783  if(teem == -1)
784  teem = key.team;
785  else if(teem != key.team)
786  return -1;
787  --keys;
788  }
789  if(keys != 0)
790  return -1;
791  return teem;
792 }
int NumTeams(int teams)
Definition: scores_rules.qc:17
entity() spawn
#define FOR_EACH_KH_KEY(v)
Definition: sv_keyhunt.qh:27
int kh_teams
Definition: sv_keyhunt.qc:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_AssignTo()

void kh_Key_AssignTo ( entity  key,
entity  player 
)

Definition at line 304 of file sv_keyhunt.qc.

References colormapPaletteColor, entity(), FOR_EACH_KH_KEY, FOREACH, kh_interferemsg_team, kh_interferemsg_time, kh_Key_AllOwnedByWhichTeam(), kh_Key_Attach(), kh_Key_Detach(), kh_KeyCarrier_waypointsprite_visible_for_player(), kh_no_radar_circles, kh_update_state(), NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, SPRITERULE_TEAMPLAY, and time.

Referenced by key_reset(), kh_Key_Collect(), kh_Key_DropAll(), kh_Key_DropOne(), kh_Key_Remove(), and kh_Key_Spawn().

305 {
306  if(key.owner == player)
307  return;
308 
309  int ownerteam0 = kh_Key_AllOwnedByWhichTeam();
310 
311  if(key.owner)
312  {
313  kh_Key_Detach(key);
314 
315  // remove from linked list
316  if(key.kh_next)
317  key.kh_next.kh_prev = key.kh_prev;
318  key.kh_prev.kh_next = key.kh_next;
319  key.kh_next = NULL;
320  key.kh_prev = NULL;
321 
322  if(key.owner.kh_next == NULL)
323  {
324  // No longer a key carrier
326  WaypointSprite_Ping(key.owner.waypointsprite_attachedforcarrier);
327  WaypointSprite_DetachCarrier(key.owner);
328  }
329  }
330 
331  key.owner = player;
332 
333  if(player)
334  {
335  // insert into linked list
336  key.kh_next = player.kh_next;
337  key.kh_prev = player;
338  player.kh_next = key;
339  if(key.kh_next)
340  key.kh_next.kh_prev = key;
341 
342  kh_Key_Attach(key);
343 
344  if(key.kh_next == NULL)
345  {
346  // player is now a key carrier
347  entity wp = WaypointSprite_AttachCarrier(WP_Null, player, RADARICON_FLAGCARRIER);
348  wp.colormod = colormapPaletteColor(player.team - 1, 0);
349  player.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_KeyCarrier_waypointsprite_visible_for_player;
350  WaypointSprite_UpdateRule(player.waypointsprite_attachedforcarrier, player.team, SPRITERULE_TEAMPLAY);
351  if(player.team == NUM_TEAM_1)
352  WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierRed, WP_KeyCarrierFriend, WP_KeyCarrierRed);
353  else if(player.team == NUM_TEAM_2)
354  WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierBlue, WP_KeyCarrierFriend, WP_KeyCarrierBlue);
355  else if(player.team == NUM_TEAM_3)
356  WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierYellow, WP_KeyCarrierFriend, WP_KeyCarrierYellow);
357  else if(player.team == NUM_TEAM_4)
358  WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierPink, WP_KeyCarrierFriend, WP_KeyCarrierPink);
360  WaypointSprite_Ping(player.waypointsprite_attachedforcarrier);
361  }
362  }
363 
364  // moved that here, also update if there's no player
365  kh_update_state();
366 
367  key.pusher = NULL;
368 
369  int ownerteam = kh_Key_AllOwnedByWhichTeam();
370  if(ownerteam != ownerteam0)
371  {
372  entity k;
373  if(ownerteam != -1)
374  {
375  kh_interferemsg_time = time + 0.2;
376  kh_interferemsg_team = player.team;
377 
378  // audit all key carrier sprites, update them to "Run here"
379  FOR_EACH_KH_KEY(k)
380  {
381  if (!k.owner) continue;
382  entity first = WP_Null;
383  FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
384  entity third = WP_Null;
385  FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
386  WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFinish, third);
387  }
388  }
389  else
390  {
392 
393  // audit all key carrier sprites, update them to "Key Carrier"
394  FOR_EACH_KH_KEY(k)
395  {
396  if (!k.owner) continue;
397  entity first = WP_Null;
398  FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
399  entity third = WP_Null;
400  FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
401  WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFriend, third);
402  }
403  }
404  }
405 }
const int NUM_TEAM_2
Definition: teams.qh:19
void kh_update_state()
Definition: sv_keyhunt.qc:120
void kh_Key_Attach(entity key)
Definition: sv_keyhunt.qc:216
entity() spawn
bool kh_no_radar_circles
Definition: sv_keyhunt.qc:52
bool kh_KeyCarrier_waypointsprite_visible_for_player(entity this, entity player, entity view)
Definition: sv_keyhunt.qc:100
const int SPRITERULE_TEAMPLAY
int kh_interferemsg_team
Definition: sv_keyhunt.qc:74
int kh_Key_AllOwnedByWhichTeam()
Definition: sv_keyhunt.qc:774
#define NULL
Definition: post.qh:17
const int NUM_TEAM_4
Definition: teams.qh:21
float kh_interferemsg_time
Definition: sv_keyhunt.qc:75
#define FOR_EACH_KH_KEY(v)
Definition: sv_keyhunt.qh:27
const int NUM_TEAM_1
Definition: teams.qh:18
float time
Definition: csprogsdefs.qc:16
void kh_Key_Detach(entity key)
Definition: sv_keyhunt.qc:261
#define FOREACH(list, cond, body)
Definition: iter.qh:19
#define colormapPaletteColor(c, isPants)
Definition: color.qh:5
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Attach()

void kh_Key_Attach ( entity  key)

Definition at line 216 of file sv_keyhunt.qc.

References DAMAGE_NO, entity(), g_items, IL_CONTAINS(), IL_REMOVE(), kh_key_carried, KH_KEY_ZSHIFT, MOVETYPE_NONE, navigation_dynamicgoal_unset(), set_movetype(), setorigin(), SOLID_NOT, and time.

Referenced by kh_Key_AssignTo().

217 {
218 #ifdef KH_PLAYER_USE_ATTACHMENT
219  entity first = key.owner.kh_next;
220  if(key == first)
221  {
222  setattachment(key, key.owner, KH_PLAYER_ATTACHMENT_BONE);
223  if(key.kh_next)
224  {
225  setattachment(key.kh_next, key, "");
226  setorigin(key, key.kh_next.origin - 0.5 * KH_PLAYER_ATTACHMENT_DIST);
227  setorigin(key.kh_next, KH_PLAYER_ATTACHMENT_DIST_ROTATED);
228  key.kh_next.angles = '0 0 0';
229  }
230  else
231  setorigin(key, KH_PLAYER_ATTACHMENT);
232  key.angles = KH_PLAYER_ATTACHMENT_ANGLES;
233  }
234  else
235  {
236  setattachment(key, key.kh_prev, "");
237  if(key.kh_next)
238  setattachment(key.kh_next, key, "");
239  setorigin(key, KH_PLAYER_ATTACHMENT_DIST_ROTATED);
240  setorigin(first, first.origin - 0.5 * KH_PLAYER_ATTACHMENT_DIST);
241  key.angles = '0 0 0';
242  }
243 #else
244  setattachment(key, key.owner, "");
245  setorigin(key, '0 0 1' * KH_KEY_ZSHIFT); // fixing x, y in think
246  key.angles_y -= key.owner.angles.y;
247 #endif
248  key.flags = 0;
249  if(IL_CONTAINS(g_items, key))
250  IL_REMOVE(g_items, key);
251  key.solid = SOLID_NOT;
253  key.team = key.owner.team;
254  key.nextthink = time;
255  key.damageforcescale = 0;
256  key.takedamage = DAMAGE_NO;
257  key.modelindex = kh_key_carried;
259 }
const float SOLID_NOT
Definition: csprogsdefs.qc:244
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
float MOVETYPE_NONE
Definition: progsdefs.qc:246
entity() spawn
const float KH_KEY_ZSHIFT
Definition: sv_keyhunt.qc:42
ERASEABLE bool IL_CONTAINS(IntrusiveList this, entity it)
IntrusiveList g_items
Definition: items.qh:126
int kh_key_carried
Definition: sv_keyhunt.qc:82
void navigation_dynamicgoal_unset(entity this)
Definition: navigation.qc:95
setorigin(ent, v)
float time
Definition: csprogsdefs.qc:16
float DAMAGE_NO
Definition: progsdefs.qc:282
void set_movetype(entity this, int mt)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Collect()

void kh_Key_Collect ( entity  key,
entity  player 
)

Definition at line 423 of file sv_keyhunt.qc.

References APP_TEAM_NUM, ATTEN_NORM, autocvar_g_balance_keyhunt_score_collect, CH_TRIGGER, GameRules_scoring_add, kh_Key_AssignTo(), kh_Scores_Event(), kh_Team_ByID(), NULL, sound, and VOL_BASE.

Referenced by kh_Key_Touch().

424 {
425  sound(player, CH_TRIGGER, SND_KH_COLLECT, VOL_BASE, ATTEN_NORM);
426 
427  if(key.kh_dropperteam != player.team)
428  {
429  kh_Scores_Event(player, key, "collect", autocvar_g_balance_keyhunt_score_collect, 0);
430  GameRules_scoring_add(player, KH_PICKUPS, 1);
431  }
432  key.kh_dropperteam = 0;
433  int realteam = kh_Team_ByID(key.count);
434  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_PICKUP), player.netname);
435 
436  kh_Key_AssignTo(key, player); // this also updates .kh_state
437 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
void kh_Scores_Event(entity player, entity key, string what, float frags_player, float frags_owner)
Definition: sv_keyhunt.qc:175
int kh_Team_ByID(int t)
Definition: sv_keyhunt.qc:62
const int CH_TRIGGER
Definition: sound.qh:12
#define NULL
Definition: post.qh:17
void kh_Key_AssignTo(entity key, entity player)
Definition: sv_keyhunt.qc:304
const float VOL_BASE
Definition: sound.qh:36
const float ATTEN_NORM
Definition: sound.qh:30
int autocvar_g_balance_keyhunt_score_collect
Definition: sv_keyhunt.qc:22
#define sound(e, c, s, v, a)
Definition: sound.qh:52
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Damage()

void kh_Key_Damage ( entity  this,
entity  inflictor,
entity  attacker,
float  damage,
int  deathtype,
.entity  weaponentity,
vector  hitloc,
vector  force 
)

Definition at line 407 of file sv_keyhunt.qc.

References autocvar_g_balance_keyhunt_delay_damage_return, bound(), IS_PLAYER, ITEM_DAMAGE_NEEDKILL, owner, pain_finished, pushltime, team, and time.

Referenced by kh_Key_Spawn().

408 {
409  if(this.owner)
410  return;
411  if(ITEM_DAMAGE_NEEDKILL(deathtype))
412  {
414  return;
415  }
416  if(force == '0 0 0')
417  return;
418  if(time > this.pushltime)
419  if(IS_PLAYER(attacker))
420  this.team = attacker.team;
421 }
int team
Definition: main.qh:157
float pushltime
Definition: jumppads.qh:10
entity owner
Definition: main.qh:73
float autocvar_g_balance_keyhunt_delay_damage_return
Definition: sv_keyhunt.qc:11
#define ITEM_DAMAGE_NEEDKILL(dt)
Definition: items.qh:130
float pain_finished
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Detach()

void kh_Key_Detach ( entity  key)

Definition at line 261 of file sv_keyhunt.qc.

References autocvar_g_balance_keyhunt_damageforcescale, autocvar_g_balance_keyhunt_delay_return, DAMAGE_YES, entity(), FL_ITEM, g_items, IL_CONTAINS(), IL_PUSH(), kh_key_dropped, MOVETYPE_TOSS, navigation_dynamicgoal_set(), NULL, set_movetype(), setorigin(), SOLID_TRIGGER, and time.

Referenced by kh_Key_AssignTo().

262 {
263 #ifdef KH_PLAYER_USE_ATTACHMENT
264  entity first = key.owner.kh_next;
265  if(key == first)
266  {
267  if(key.kh_next)
268  {
269  setattachment(key.kh_next, key.owner, KH_PLAYER_ATTACHMENT_BONE);
270  setorigin(key.kh_next, key.origin + 0.5 * KH_PLAYER_ATTACHMENT_DIST);
271  key.kh_next.angles = KH_PLAYER_ATTACHMENT_ANGLES;
272  }
273  }
274  else
275  {
276  if(key.kh_next)
277  setattachment(key.kh_next, key.kh_prev, "");
278  setorigin(first, first.origin + 0.5 * KH_PLAYER_ATTACHMENT_DIST);
279  }
280  // in any case:
281  setattachment(key, NULL, "");
282  setorigin(key, key.owner.origin + '0 0 1' * (STAT(PL_MIN, key.owner).z - KH_KEY_MIN_z));
283  key.angles = key.owner.angles;
284 #else
285  setorigin(key, key.owner.origin + key.origin.z * '0 0 1');
286  setattachment(key, NULL, "");
287  key.angles_y += key.owner.angles.y;
288 #endif
289  key.flags = FL_ITEM;
290  if(!IL_CONTAINS(g_items, key))
291  IL_PUSH(g_items, key);
292  key.solid = SOLID_TRIGGER;
294  key.pain_finished = time + autocvar_g_balance_keyhunt_delay_return;
295  key.damageforcescale = autocvar_g_balance_keyhunt_damageforcescale;
296  key.takedamage = DAMAGE_YES;
297  // let key.team stay
298  key.modelindex = kh_key_dropped;
299  navigation_dynamicgoal_set(key, key.owner);
300  key.kh_previous_owner = key.owner;
301  key.kh_previous_owner_playerid = key.owner.playerid;
302 }
int kh_key_dropped
Definition: sv_keyhunt.qc:82
float MOVETYPE_TOSS
Definition: progsdefs.qc:252
entity() spawn
void navigation_dynamicgoal_set(entity this, entity dropper)
Definition: navigation.qc:86
float FL_ITEM
Definition: progsdefs.qc:239
ERASEABLE bool IL_CONTAINS(IntrusiveList this, entity it)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
IntrusiveList g_items
Definition: items.qh:126
float autocvar_g_balance_keyhunt_damageforcescale
Definition: sv_keyhunt.qc:9
#define NULL
Definition: post.qh:17
float autocvar_g_balance_keyhunt_delay_return
Definition: sv_keyhunt.qc:12
const float SOLID_TRIGGER
Definition: csprogsdefs.qc:245
setorigin(ent, v)
float time
Definition: csprogsdefs.qc:16
void set_movetype(entity this, int mt)
float DAMAGE_YES
Definition: progsdefs.qc:283
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_DropAll()

void kh_Key_DropAll ( entity  player,
float  suicide 
)

Definition at line 817 of file sv_keyhunt.qc.

References APP_TEAM_NUM, ATTEN_NORM, autocvar_g_balance_keyhunt_dropvelocity, autocvar_g_balance_keyhunt_protecttime, CH_TRIGGER, entity(), GameRules_scoring_add, kh_Key_AssignTo(), kh_Scores_Event(), kh_Team_ByID(), makevectors, NULL, random(), sound, time, v_forward, VOL_BASE, and W_CalculateProjectileVelocity().

Referenced by MUTATOR_HOOKFUNCTION().

818 {
819  if(player.kh_next)
820  {
821  entity mypusher = NULL;
822  if(player.pusher)
823  if(time < player.pushltime)
824  mypusher = player.pusher;
825 
826  entity key;
827  while((key = player.kh_next))
828  {
829  kh_Scores_Event(player, key, "losekey", 0, 0);
830  GameRules_scoring_add(player, KH_LOSSES, 1);
831  int realteam = kh_Team_ByID(key.count);
832  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_LOST), player.netname);
833  kh_Key_AssignTo(key, NULL);
834  makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
835  key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
836  key.pusher = mypusher;
838  if(suicide)
839  key.kh_dropperteam = player.team;
840  }
841  sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM);
842  }
843 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
entity() spawn
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
void kh_Scores_Event(entity player, entity key, string what, float frags_player, float frags_owner)
Definition: sv_keyhunt.qc:175
int kh_Team_ByID(int t)
Definition: sv_keyhunt.qc:62
float autocvar_g_balance_keyhunt_dropvelocity
Definition: sv_keyhunt.qc:16
float autocvar_g_balance_keyhunt_protecttime
Definition: sv_keyhunt.qc:18
const int CH_TRIGGER
Definition: sound.qh:12
#define NULL
Definition: post.qh:17
void kh_Key_AssignTo(entity key, entity player)
Definition: sv_keyhunt.qc:304
const float VOL_BASE
Definition: sound.qh:36
const float ATTEN_NORM
Definition: sound.qh:30
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
Definition: tracing.qc:169
#define sound(e, c, s, v, a)
Definition: sound.qh:52
float time
Definition: csprogsdefs.qc:16
#define makevectors
Definition: post.qh:21
vector v_forward
Definition: csprogsdefs.qc:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_DropOne()

void kh_Key_DropOne ( entity  key)

Definition at line 794 of file sv_keyhunt.qc.

References APP_TEAM_NUM, ATTEN_NORM, autocvar_g_balance_keyhunt_protecttime, autocvar_g_balance_keyhunt_throwvelocity, CH_TRIGGER, entity(), GameRules_scoring_add, kh_Key_AssignTo(), kh_Scores_Event(), kh_Team_ByID(), makevectors, NULL, sound, time, v_forward, VOL_BASE, and W_CalculateProjectileVelocity().

Referenced by MUTATOR_HOOKFUNCTION().

795 {
796  // prevent collecting this one for some time
797  entity player = key.owner;
798 
799  key.kh_droptime = time;
800  key.enemy = player;
801 
802  kh_Scores_Event(player, key, "dropkey", 0, 0);
803  GameRules_scoring_add(player, KH_LOSSES, 1);
804  int realteam = kh_Team_ByID(key.count);
805  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_DROP), player.netname);
806 
807  kh_Key_AssignTo(key, NULL);
808  makevectors(player.v_angle);
809  key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
810  key.pusher = NULL;
812  key.kh_dropperteam = key.team;
813 
814  sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM);
815 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
entity() spawn
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
void kh_Scores_Event(entity player, entity key, string what, float frags_player, float frags_owner)
Definition: sv_keyhunt.qc:175
float autocvar_g_balance_keyhunt_throwvelocity
Definition: sv_keyhunt.qc:26
int kh_Team_ByID(int t)
Definition: sv_keyhunt.qc:62
float autocvar_g_balance_keyhunt_protecttime
Definition: sv_keyhunt.qc:18
const int CH_TRIGGER
Definition: sound.qh:12
#define NULL
Definition: post.qh:17
void kh_Key_AssignTo(entity key, entity player)
Definition: sv_keyhunt.qc:304
const float VOL_BASE
Definition: sound.qh:36
const float ATTEN_NORM
Definition: sound.qh:30
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
Definition: tracing.qc:169
#define sound(e, c, s, v, a)
Definition: sound.qh:52
float time
Definition: csprogsdefs.qc:16
#define makevectors
Definition: post.qh:21
vector v_forward
Definition: csprogsdefs.qc:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Remove()

void kh_Key_Remove ( entity  key)

Definition at line 463 of file sv_keyhunt.qc.

References entity(), kh_Key_AssignTo(), kh_update_state(), kh_worldkeylist, and NULL.

Referenced by key_reset(), and kh_FinishRound().

464 {
465  entity o = key.owner;
466  kh_Key_AssignTo(key, NULL);
467  if(o) // it was attached
468  WaypointSprite_Kill(key.waypointsprite_attachedforcarrier);
469  else // it was dropped
470  WaypointSprite_DetachCarrier(key);
471 
472  // remove key from key list
473  if (kh_worldkeylist == key)
474  kh_worldkeylist = kh_worldkeylist.kh_worldkeynext;
475  else
476  {
477  o = kh_worldkeylist;
478  while (o)
479  {
480  if (o.kh_worldkeynext == key)
481  {
482  o.kh_worldkeynext = o.kh_worldkeynext.kh_worldkeynext;
483  break;
484  }
485  o = o.kh_worldkeynext;
486  }
487  }
488 
489  delete(key);
490 
491  kh_update_state();
492 }
void kh_update_state()
Definition: sv_keyhunt.qc:120
entity() spawn
entity kh_worldkeylist
Definition: sv_keyhunt.qh:24
#define NULL
Definition: post.qh:17
void kh_Key_AssignTo(entity key, entity player)
Definition: sv_keyhunt.qc:304
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Spawn()

void kh_Key_Spawn ( entity  initial_owner,
float  _angle,
float  i 
)

Definition at line 720 of file sv_keyhunt.qc.

References APP_TEAM_NUM, autocvar_g_balance_keyhunt_return_when_unreachable, DAMAGE_YES, DPCONTENTS_BODY, DPCONTENTS_BOTCLIP, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SOLID, entity(), key_reset(), kh_Key_AssignTo(), KH_KEY_BRIGHTNESS, kh_Key_Damage(), kh_key_dropped, KH_KEY_MAX, KH_KEY_MIN, kh_Key_Think(), kh_Key_Touch(), kh_Key_waypointsprite_visible_for_player(), KH_KEY_WP_ZSHIFT, kh_worldkeylist, navigation_dynamicgoal_init(), NULL, NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, NUM_TEAM_4, random(), setthink, Team_ColorRGB(), and time.

Referenced by kh_StartRound().

721 {
722  entity key = new(item_kh_key);
723  key.count = i;
724  settouch(key, kh_Key_Touch);
725  setthink(key, kh_Key_Think);
726  key.nextthink = time;
727  key.cnt = _angle;
728  key.angles = '0 360 0' * random();
729  key.event_damage = kh_Key_Damage;
730  key.takedamage = DAMAGE_YES;
733  key.modelindex = kh_key_dropped;
734  key.model = "key";
735  key.kh_dropperteam = 0;
737  setsize(key, KH_KEY_MIN, KH_KEY_MAX);
738  key.colormod = Team_ColorRGB(initial_owner.team) * KH_KEY_BRIGHTNESS;
739  key.reset = key_reset;
740  navigation_dynamicgoal_init(key, false);
741 
742  switch(initial_owner.team)
743  {
744  case NUM_TEAM_1:
745  key.netname = "^1red key";
746  break;
747  case NUM_TEAM_2:
748  key.netname = "^4blue key";
749  break;
750  case NUM_TEAM_3:
751  key.netname = "^3yellow key";
752  break;
753  case NUM_TEAM_4:
754  key.netname = "^6pink key";
755  break;
756  default:
757  key.netname = "NETGIER key";
758  break;
759  }
760 
761  // link into key list
762  key.kh_worldkeynext = kh_worldkeylist;
763  kh_worldkeylist = key;
764 
765  Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM(initial_owner.team, CENTER_KEYHUNT_START));
766 
767  WaypointSprite_Spawn(WP_KeyDropped, 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, NULL, key.team, key, waypointsprite_attachedforcarrier, false, RADARICON_FLAG);
768  key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player;
769 
770  kh_Key_AssignTo(key, initial_owner);
771 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
const int NUM_TEAM_2
Definition: teams.qh:19
void kh_Key_Touch(entity this, entity toucher)
Definition: sv_keyhunt.qc:439
int kh_key_dropped
Definition: sv_keyhunt.qc:82
const vector KH_KEY_MAX
Definition: sv_keyhunt.qc:49
vector Team_ColorRGB(int teamid)
Definition: teams.qh:76
const float KH_KEY_WP_ZSHIFT
Definition: sv_keyhunt.qc:46
entity() spawn
void navigation_dynamicgoal_init(entity this, bool initially_static)
Definition: navigation.qc:76
float DPCONTENTS_BOTCLIP
float autocvar_g_balance_keyhunt_return_when_unreachable
Definition: sv_keyhunt.qc:15
float DPCONTENTS_PLAYERCLIP
const vector KH_KEY_MIN
Definition: sv_keyhunt.qc:48
entity kh_worldkeylist
Definition: sv_keyhunt.qh:24
void kh_Key_Think(entity this)
Definition: sv_keyhunt.qc:659
bool kh_Key_waypointsprite_visible_for_player(entity this, entity player, entity view)
Definition: sv_keyhunt.qc:109
void key_reset(entity this)
Definition: sv_keyhunt.qc:714
const float KH_KEY_BRIGHTNESS
Definition: sv_keyhunt.qc:50
#define NULL
Definition: post.qh:17
float DPCONTENTS_SOLID
void kh_Key_AssignTo(entity key, entity player)
Definition: sv_keyhunt.qc:304
const int NUM_TEAM_4
Definition: teams.qh:21
float DPCONTENTS_BODY
#define setthink(e, f)
void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition: sv_keyhunt.qc:407
const int NUM_TEAM_1
Definition: teams.qh:18
float time
Definition: csprogsdefs.qc:16
const int NUM_TEAM_3
Definition: teams.qh:20
float DAMAGE_YES
Definition: progsdefs.qc:283
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Think()

void kh_Key_Think ( entity  this)

Definition at line 659 of file sv_keyhunt.qc.

References APP_TEAM_NUM, ATTEN_NORM, autocvar_g_balance_keyhunt_maxdist, CH_TRIGGER, cnt, entity(), FOR_EACH_KH_KEY, FOREACH_CLIENT, IS_PLAYER, kh_interferemsg_team, kh_interferemsg_time, kh_Key_AllOwnedByWhichTeam(), KH_KEY_XYDIST, KH_KEY_XYSPEED, kh_LoserTeam(), kh_WinnerTeam(), LABEL, makevectors, nextthink, origin, owner, pain_finished, setorigin(), siren_time, sound, team, time, v_forward, vdist, vector(), and VOL_BASE.

Referenced by kh_Key_Spawn().

660 {
661  if(game_stopped)
662  return;
663 
664  if(this.owner)
665  {
666 #ifndef KH_PLAYER_USE_ATTACHMENT
667  makevectors('0 1 0' * (this.cnt + (time % 360) * KH_KEY_XYSPEED));
668  setorigin(this, v_forward * KH_KEY_XYDIST + '0 0 1' * this.origin.z);
669 #endif
670  }
671 
672  // if in nodrop or time over, end the round
673  if(!this.owner)
674  if(time > this.pain_finished)
675  kh_LoserTeam(this.team, this);
676 
677  if(this.owner)
678  if(kh_Key_AllOwnedByWhichTeam() != -1)
679  {
680  if(this.siren_time < time)
681  {
682  sound(this.owner, CH_TRIGGER, SND_KH_ALARM, VOL_BASE, ATTEN_NORM); // play a simple alarm
683  this.siren_time = time + 2.5; // repeat every 2.5 seconds
684  }
685 
686  entity key;
687  vector p = this.owner.origin;
688  FOR_EACH_KH_KEY(key)
689  if(vdist(key.owner.origin - p, >, autocvar_g_balance_keyhunt_maxdist))
690  goto not_winning;
691  kh_WinnerTeam(this.team);
692 LABEL(not_winning)
693  }
694 
696  {
699  if(it.team == kh_interferemsg_team)
700  {
701  if(it.kh_next)
702  Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET);
703  else
704  Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
705  }
706  else
707  Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
708  });
709  }
710 
711  this.nextthink = time + 0.05;
712 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
const float KH_KEY_XYDIST
Definition: sv_keyhunt.qc:43
void kh_WinnerTeam(int winner_team)
Definition: sv_keyhunt.qc:511
int team
Definition: main.qh:157
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
origin
Definition: ent_cs.qc:114
entity owner
Definition: main.qh:73
int kh_interferemsg_team
Definition: sv_keyhunt.qc:74
float autocvar_g_balance_keyhunt_maxdist
Definition: sv_keyhunt.qc:17
float cnt
Definition: powerups.qc:24
const int CH_TRIGGER
Definition: sound.qh:12
int kh_Key_AllOwnedByWhichTeam()
Definition: sv_keyhunt.qc:774
const float KH_KEY_XYSPEED
Definition: sv_keyhunt.qc:44
const float VOL_BASE
Definition: sound.qh:36
const float ATTEN_NORM
Definition: sound.qh:30
float nextthink
Definition: csprogsdefs.qc:121
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float kh_interferemsg_time
Definition: sv_keyhunt.qc:75
float pain_finished
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition: vector.qh:8
float siren_time
Definition: sv_keyhunt.qc:59
#define FOR_EACH_KH_KEY(v)
Definition: sv_keyhunt.qh:27
#define LABEL(id)
Definition: compiler.qh:36
setorigin(ent, v)
#define sound(e, c, s, v, a)
Definition: sound.qh:52
float time
Definition: csprogsdefs.qc:16
#define makevectors
Definition: post.qh:21
#define IS_PLAYER(v)
Definition: utils.qh:9
void kh_LoserTeam(int loser_team, entity lostkey)
Definition: sv_keyhunt.qc:573
vector v_forward
Definition: csprogsdefs.qc:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_Touch()

void kh_Key_Touch ( entity  this,
entity  toucher 
)

Definition at line 439 of file sv_keyhunt.qc.

References autocvar_g_balance_keyhunt_delay_collect, autocvar_g_balance_keyhunt_delay_damage_return, bound(), enemy, IS_DEAD, IS_PLAYER, ITEM_TOUCH_NEEDKILL, kh_droptime, kh_Key_Collect(), owner, pain_finished, and time.

Referenced by kh_Key_Spawn().

440 {
441  if(game_stopped)
442  return;
443 
444  if(this.owner) // already carried
445  return;
446 
447  if(ITEM_TOUCH_NEEDKILL())
448  {
450  return;
451  }
452 
453  if (!IS_PLAYER(toucher))
454  return;
455  if(IS_DEAD(toucher))
456  return;
457  if(toucher == this.enemy)
459  return; // you just dropped it!
460  kh_Key_Collect(this, toucher);
461 }
float autocvar_g_balance_keyhunt_delay_collect
Definition: sv_keyhunt.qc:10
float kh_droptime
Definition: sv_keyhunt.qc:77
entity owner
Definition: main.qh:73
float autocvar_g_balance_keyhunt_delay_damage_return
Definition: sv_keyhunt.qc:11
entity enemy
Definition: sv_ctf.qh:143
void kh_Key_Collect(entity key, entity player)
Definition: sv_keyhunt.qc:423
#define IS_DEAD(s)
Definition: utils.qh:26
#define ITEM_TOUCH_NEEDKILL()
Definition: items.qh:129
float pain_finished
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Key_waypointsprite_visible_for_player()

bool kh_Key_waypointsprite_visible_for_player ( entity  this,
entity  player,
entity  view 
)

Definition at line 109 of file sv_keyhunt.qc.

References kh_tracking_enabled, and owner.

Referenced by kh_Key_Spawn().

110 {
112  return false;
113  if(!this.owner)
114  return true;
115  if(!this.owner.owner)
116  return true;
117  return false; // draw only when key is not owned
118 }
bool kh_tracking_enabled
Definition: sv_keyhunt.qh:32
entity owner
Definition: main.qh:73
+ Here is the caller graph for this function:

◆ kh_KeyCarrier_waypointsprite_visible_for_player()

bool kh_KeyCarrier_waypointsprite_visible_for_player ( entity  this,
entity  player,
entity  view 
)

Definition at line 100 of file sv_keyhunt.qc.

References DIFF_TEAM, IS_PLAYER, and kh_tracking_enabled.

Referenced by kh_Key_AssignTo().

101 {
102  if(!IS_PLAYER(view) || DIFF_TEAM(this, view))
104  return false;
105 
106  return true;
107 }
bool kh_tracking_enabled
Definition: sv_keyhunt.qh:32
#define DIFF_TEAM(a, b)
Definition: teams.qh:240
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the caller graph for this function:

◆ kh_LoserTeam()

void kh_LoserTeam ( int  loser_team,
entity  lostkey 
)

Definition at line 573 of file sv_keyhunt.qc.

References APP_TEAM_NUM, autocvar_g_balance_keyhunt_score_destroyed, autocvar_g_balance_keyhunt_score_destroyed_ownfactor, autocvar_g_balance_keyhunt_score_push, DistributeEvenly_Get(), DistributeEvenly_Init(), entity(), FOR_EACH_KH_KEY, FOREACH_CLIENT, GameRules_scoring_add, IS_PLAYER, kh_FinishRound(), kh_Scores_Event(), kh_Team_ByID(), kh_teams, NULL, NumTeams(), players, and SND.

Referenced by kh_Key_Think().

574 {
575  float f;
576  entity attacker = NULL;
577  if(lostkey.pusher)
578  if(lostkey.pusher.team != loser_team)
579  if(IS_PLAYER(lostkey.pusher))
580  attacker = lostkey.pusher;
581 
582  if(attacker)
583  {
584  if(lostkey.kh_previous_owner)
585  kh_Scores_Event(lostkey.kh_previous_owner, NULL, "pushed", 0, -autocvar_g_balance_keyhunt_score_push);
586  // don't actually GIVE him the -nn points, just log
588  GameRules_scoring_add(attacker, KH_PUSHES, 1);
589  //centerprint(attacker, "Your push is the best!"); // does this really need to exist?
590  }
591  else
592  {
593  int players = 0;
595 
596  FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, { ++players; });
597 
598  entity key;
599  int keys = 0;
600  FOR_EACH_KH_KEY(key)
601  if(key.owner && key.team != loser_team)
602  ++keys;
603 
604  if(lostkey.kh_previous_owner)
605  kh_Scores_Event(lostkey.kh_previous_owner, NULL, "destroyed", 0, -autocvar_g_balance_keyhunt_score_destroyed);
606  // don't actually GIVE him the -nn points, just log
607 
608  if(lostkey.kh_previous_owner.playerid == lostkey.kh_previous_owner_playerid)
609  GameRules_scoring_add(lostkey.kh_previous_owner, KH_DESTROYS, 1);
610 
612 
613  FOR_EACH_KH_KEY(key)
614  if(key.owner && key.team != loser_team)
615  {
616  f = DistributeEvenly_Get(of);
617  kh_Scores_Event(key.owner, NULL, "destroyed_holdingkey", f, 0);
618  }
619 
620  int fragsleft = DistributeEvenly_Get(players);
621 
622  // Now distribute these among all other teams...
623  int j = NumTeams(kh_teams) - 1;
624  for(int i = 0; i < NumTeams(kh_teams); ++i)
625  {
626  int thisteam = kh_Team_ByID(i);
627  if(thisteam == loser_team) // bad boy, no cookie - this WILL happen
628  continue;
629 
630  players = 0;
631  FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, { ++players; });
632 
633  DistributeEvenly_Init(fragsleft, j);
634  fragsleft = DistributeEvenly_Get(j - 1);
636 
637  FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, {
638  f = DistributeEvenly_Get(1);
639  kh_Scores_Event(it, NULL, "destroyed", f, 0);
640  });
641 
642  --j;
643  }
644  }
645 
646  int realteam = kh_Team_ByID(lostkey.count);
647  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(loser_team, CENTER_ROUND_TEAM_LOSS));
648  if(attacker)
649  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_PUSHED), attacker.netname, lostkey.kh_previous_owner.netname);
650  else
651  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_DESTROYED), lostkey.kh_previous_owner.netname);
652 
653  play2all(SND(KH_DESTROY));
654  te_tarexplosion(lostkey.origin);
655 
656  kh_FinishRound();
657 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
#define SND(id)
Definition: all.qh:35
int NumTeams(int teams)
Definition: scores_rules.qc:17
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
#define GameRules_scoring_add(client, fld, value)
Definition: sv_rules.qh:78
void kh_Scores_Event(entity player, entity key, string what, float frags_player, float frags_owner)
Definition: sv_keyhunt.qc:175
ERASEABLE float DistributeEvenly_Get(float weight)
Definition: random.qc:54
int kh_Team_ByID(int t)
Definition: sv_keyhunt.qc:62
int autocvar_g_balance_keyhunt_score_destroyed
Definition: sv_keyhunt.qc:23
#define NULL
Definition: post.qh:17
void kh_FinishRound()
Definition: sv_keyhunt.qc:494
int autocvar_g_balance_keyhunt_score_push
Definition: sv_keyhunt.qc:25
entity players
Definition: main.qh:43
ERASEABLE void DistributeEvenly_Init(float amount, float totalweight)
Definition: random.qc:42
#define FOR_EACH_KH_KEY(v)
Definition: sv_keyhunt.qh:27
int kh_teams
Definition: sv_keyhunt.qc:73
#define IS_PLAYER(v)
Definition: utils.qh:9
int autocvar_g_balance_keyhunt_score_destroyed_ownfactor
Definition: sv_keyhunt.qc:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_ScoreRules()

void kh_ScoreRules ( int  teams)

Definition at line 87 of file sv_keyhunt.qc.

References GameRules_scoring, SFL_LOWER_IS_BETTER, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_SECONDARY, and ST_KH_CAPS.

Referenced by kh_Initialize().

88 {
90  field_team(ST_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
91  field(SP_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
92  field(SP_KH_PUSHES, "pushes", 0);
93  field(SP_KH_DESTROYS, "destroyed", SFL_LOWER_IS_BETTER);
94  field(SP_KH_PICKUPS, "pickups", 0);
95  field(SP_KH_KCKILLS, "kckills", 0);
96  field(SP_KH_LOSSES, "losses", SFL_LOWER_IS_BETTER);
97  });
98 }
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition: sv_rules.qh:53
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit)
Definition: scores.qh:126
const int SFL_SORT_PRIO_PRIMARY
Definition: scores.qh:127
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition: scores.qh:98
entity teams
Definition: main.qh:44
const int ST_KH_CAPS
Definition: sv_keyhunt.qc:86
+ Here is the caller graph for this function:

◆ kh_Scores_Event()

void kh_Scores_Event ( entity  player,
entity  key,
string  what,
float  frags_player,
float  frags_owner 
)

Definition at line 175 of file sv_keyhunt.qc.

References autocvar_sv_eventlog, ftos(), GameLogEcho(), strcat(), and UpdateFrags().

Referenced by kh_HandleFrags(), kh_Key_Collect(), kh_Key_DropAll(), kh_Key_DropOne(), kh_LoserTeam(), and kh_WinnerTeam().

176 {
177  string s;
178  if(game_stopped)
179  return;
180 
181  if(frags_player)
182  UpdateFrags(player, frags_player);
183 
184  if(key && key.owner && frags_owner)
185  UpdateFrags(key.owner, frags_owner);
186 
187  if(!autocvar_sv_eventlog) //output extra info to the console or text file
188  return;
189 
190  s = strcat(":keyhunt:", what, ":", ftos(player.playerid), ":", ftos(frags_player));
191 
192  if(key && key.owner)
193  s = strcat(s, ":", ftos(key.owner.playerid));
194  else
195  s = strcat(s, ":0");
196 
197  s = strcat(s, ":", ftos(frags_owner), ":");
198 
199  if(key)
200  s = strcat(s, key.netname);
201 
202  GameLogEcho(s);
203 }
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
void UpdateFrags(entity player, int f)
Definition: damage.qc:44
void GameLogEcho(string s)
Definition: gamelog.qc:12
bool autocvar_sv_eventlog
Definition: gamelog.qh:3
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_StartRound()

void kh_StartRound ( )

Definition at line 911 of file sv_keyhunt.qc.

References autocvar_g_balance_keyhunt_delay_tracking, entity(), FOREACH_CLIENT, IS_DEAD, IS_PLAYER, kh_Controller_SetThink(), kh_EnableTrackingDevice(), kh_GetMissingTeams(), kh_Key_Spawn(), kh_Team_ByID(), kh_teams, kh_tracking_enabled, kh_WaitForPlayers(), NULL, NumTeams(), PHYS_INPUT_BUTTON_CHAT, players, and time.

Referenced by kh_FinishRound(), and kh_WaitForPlayers().

912 {
913  if(time < game_starttime)
914  {
915  kh_Controller_SetThink(game_starttime - time + 0.1, kh_WaitForPlayers);
916  return;
917  }
918 
919  if(kh_GetMissingTeams())
920  {
922  return;
923  }
924 
925  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT);
926  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT_OTHER);
927 
928  for(int i = 0; i < NumTeams(kh_teams); ++i)
929  {
930  int teem = kh_Team_ByID(i);
931  int players = 0;
932  entity my_player = NULL;
934  if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
935  {
936  ++players;
937  if(random() * players <= 1)
938  my_player = it;
939  }
940  });
941  kh_Key_Spawn(my_player, 360 * i / NumTeams(kh_teams), i);
942  }
943 
944  kh_tracking_enabled = false;
945  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_SCAN, autocvar_g_balance_keyhunt_delay_tracking);
947 }
#define PHYS_INPUT_BUTTON_CHAT(s)
Definition: player.qh:155
void kh_Key_Spawn(entity initial_owner, float _angle, float i)
Definition: sv_keyhunt.qc:720
bool kh_tracking_enabled
Definition: sv_keyhunt.qh:32
int NumTeams(int teams)
Definition: scores_rules.qc:17
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
void kh_WaitForPlayers()
Definition: sv_keyhunt.qc:862
void kh_Controller_SetThink(float t, kh_Think_t func)
Definition: sv_keyhunt.qc:148
float autocvar_g_balance_keyhunt_delay_tracking
Definition: sv_keyhunt.qc:14
int kh_Team_ByID(int t)
Definition: sv_keyhunt.qc:62
int kh_GetMissingTeams()
Definition: sv_keyhunt.qc:845
#define NULL
Definition: post.qh:17
#define IS_DEAD(s)
Definition: utils.qh:26
entity players
Definition: main.qh:43
int kh_teams
Definition: sv_keyhunt.qc:73
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
void kh_EnableTrackingDevice()
Definition: sv_keyhunt.qc:903
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_Team_ByID()

int kh_Team_ByID ( int  t)

Definition at line 62 of file sv_keyhunt.qc.

References NUM_TEAM_1, NUM_TEAM_2, NUM_TEAM_3, and NUM_TEAM_4.

Referenced by kh_GetMissingTeams(), kh_Key_Collect(), kh_Key_DropAll(), kh_Key_DropOne(), kh_LoserTeam(), and kh_StartRound().

63 {
64  if(t == 0) return NUM_TEAM_1;
65  if(t == 1) return NUM_TEAM_2;
66  if(t == 2) return NUM_TEAM_3;
67  if(t == 3) return NUM_TEAM_4;
68  return 0;
69 }
const int NUM_TEAM_2
Definition: teams.qh:19
const int NUM_TEAM_4
Definition: teams.qh:21
const int NUM_TEAM_1
Definition: teams.qh:18
const int NUM_TEAM_3
Definition: teams.qh:20
+ Here is the caller graph for this function:

◆ kh_update_state()

void kh_update_state ( )

Definition at line 120 of file sv_keyhunt.qc.

References entity(), FOR_EACH_KH_KEY, and FOREACH_CLIENT.

Referenced by kh_Key_AssignTo(), and kh_Key_Remove().

121 {
122  entity key;
123  int f;
124  int s = 0;
125  FOR_EACH_KH_KEY(key)
126  {
127  if(key.owner)
128  f = key.team;
129  else
130  f = 30;
131  s |= (32 ** key.count) * f;
132  }
133 
134  FOREACH_CLIENT(true, { STAT(OBJECTIVE_STATUS, it) = s; });
135 
136  FOR_EACH_KH_KEY(key)
137  {
138  if(key.owner)
139  STAT(OBJECTIVE_STATUS, key.owner) |= (32 ** key.count) * 31;
140  }
141  //print(ftos((nextent(NULL)).kh_state), "\n");
142 }
entity() spawn
#define FOREACH_CLIENT(cond, body)
Definition: utils.qh:49
#define FOR_EACH_KH_KEY(v)
Definition: sv_keyhunt.qh:27
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_WaitForPlayers()

void kh_WaitForPlayers ( )

Definition at line 862 of file sv_keyhunt.qc.

References autocvar_g_balance_keyhunt_delay_round, kh_Controller_SetThink(), kh_GetMissingTeams(), kh_StartRound(), NULL, player_count, and time.

Referenced by kh_Controller_SetThink(), kh_Controller_Think(), kh_Initialize(), kh_StartRound(), and MUTATOR_HOOKFUNCTION().

863 {
864  static int prev_missing_teams_mask;
865  if(time < game_starttime)
866  {
867  if (prev_missing_teams_mask > 0)
868  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS);
869  prev_missing_teams_mask = -1;
870  kh_Controller_SetThink(game_starttime - time + 0.1, kh_WaitForPlayers);
871  return;
872  }
873 
874  int missing_teams_mask = kh_GetMissingTeams();
875  if(!missing_teams_mask)
876  {
877  if(prev_missing_teams_mask > 0)
878  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS);
879  prev_missing_teams_mask = -1;
880  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
882  }
883  else
884  {
885  if(player_count == 0)
886  {
887  if(prev_missing_teams_mask > 0)
888  Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_MISSING_TEAMS);
889  prev_missing_teams_mask = -1;
890  }
891  else
892  {
893  if(prev_missing_teams_mask != missing_teams_mask)
894  {
895  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask);
896  prev_missing_teams_mask = missing_teams_mask;
897  }
898  }
900  }
901 }
float autocvar_g_balance_keyhunt_delay_round
Definition: sv_keyhunt.qc:13
int player_count
Definition: api.qh:103
void kh_WaitForPlayers()
Definition: sv_keyhunt.qc:862
void kh_Controller_SetThink(float t, kh_Think_t func)
Definition: sv_keyhunt.qc:148
int kh_GetMissingTeams()
Definition: sv_keyhunt.qc:845
#define NULL
Definition: post.qh:17
void kh_StartRound()
Definition: sv_keyhunt.qc:911
float time
Definition: csprogsdefs.qc:16
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ kh_WinnerTeam()

void kh_WinnerTeam ( int  winner_team)

Definition at line 511 of file sv_keyhunt.qc.

References APP_TEAM_NUM, autocvar_g_balance_keyhunt_score_capture, DistributeEvenly_Get(), DistributeEvenly_Init(), entity(), FOR_EACH_KH_KEY, GameRules_scoring_add_team, kh_AttachedOrigin(), kh_FinishRound(), kh_Scores_Event(), kh_teams, nades_GiveBonus(), NULL, NumTeams(), SND, strcat(), Team_ColorRGB(), and vector().

Referenced by kh_Key_Think().

512 {
513  // all key carriers get some points
514  entity key;
517  // twice the score for 3 team games, three times the score for 4 team games!
518  // note: for a win by destroying the key, this should NOT be applied
519  FOR_EACH_KH_KEY(key)
520  {
521  float f = DistributeEvenly_Get(1);
522  kh_Scores_Event(key.owner, key, "capture", f, 0);
523  GameRules_scoring_add_team(key.owner, KH_CAPS, 1);
524  nades_GiveBonus(key.owner, autocvar_g_nades_bonus_score_high);
525  }
526 
527  bool first = true;
528  string keyowner = "";
529  FOR_EACH_KH_KEY(key)
530  if(key.owner.kh_next == key)
531  {
532  if(!first)
533  keyowner = strcat(keyowner, ", ");
534  keyowner = key.owner.netname;
535  first = false;
536  }
537 
538  Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
539  Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_KEYHUNT_CAPTURE), keyowner);
540 
541  first = true;
542  vector firstorigin = '0 0 0', lastorigin = '0 0 0', midpoint = '0 0 0';
543  FOR_EACH_KH_KEY(key)
544  {
545  vector thisorigin = kh_AttachedOrigin(key);
546  //dprint("Key origin: ", vtos(thisorigin), "\n");
547  midpoint += thisorigin;
548 
549  if(!first)
550  {
551  // TODO: this effect has been replaced due to a possible crash it causes
552  // see https://gitlab.com/xonotic/darkplaces/issues/123
553  //te_lightning2(NULL, lastorigin, thisorigin);
554  Send_Effect(EFFECT_TR_NEXUIZPLASMA, lastorigin, thisorigin, 1);
555  }
556  lastorigin = thisorigin;
557  if(first)
558  firstorigin = thisorigin;
559  first = false;
560  }
561  if(NumTeams(kh_teams) > 2)
562  {
563  //te_lightning2(NULL, lastorigin, firstorigin); // TODO see above
564  Send_Effect(EFFECT_TR_NEXUIZPLASMA, lastorigin, firstorigin, 1);
565  }
566  midpoint = midpoint * (1 / NumTeams(kh_teams));
567  te_customflash(midpoint, 1000, 1, Team_ColorRGB(winner_team) * 0.5 + '0.5 0.5 0.5'); // make the color >=0.5 in each component
568 
569  play2all(SND(KH_CAPTURE));
570  kh_FinishRound();
571 }
#define APP_TEAM_NUM(num, prefix)
Definition: all.qh:85
#define SND(id)
Definition: all.qh:35
int NumTeams(int teams)
Definition: scores_rules.qc:17
vector Team_ColorRGB(int teamid)
Definition: teams.qh:76
entity() spawn
void kh_Scores_Event(entity player, entity key, string what, float frags_player, float frags_owner)
Definition: sv_keyhunt.qc:175
int autocvar_g_balance_keyhunt_score_capture
Definition: sv_keyhunt.qc:20
vector kh_AttachedOrigin(entity e)
Definition: sv_keyhunt.qc:205
ERASEABLE float DistributeEvenly_Get(float weight)
Definition: random.qc:54
void nades_GiveBonus(entity player, float score)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define GameRules_scoring_add_team(client, fld, value)
Definition: sv_rules.qh:80
#define NULL
Definition: post.qh:17
void kh_FinishRound()
Definition: sv_keyhunt.qc:494
vector(float skel, float bonenum) _skel_get_boneabs_hidden
ERASEABLE void DistributeEvenly_Init(float amount, float totalweight)
Definition: random.qc:42
#define FOR_EACH_KH_KEY(v)
Definition: sv_keyhunt.qh:27
int kh_teams
Definition: sv_keyhunt.qc:73
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MUTATOR_HOOKFUNCTION() [1/11]

MUTATOR_HOOKFUNCTION ( kh  ,
ClientDisconnect   
)

Definition at line 1217 of file sv_keyhunt.qc.

References entity(), kh_Key_DropAll(), and M_ARGV.

1218 {
1219  entity player = M_ARGV(0, entity);
1220 
1221  kh_Key_DropAll(player, true);
1222 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
void kh_Key_DropAll(entity player, float suicide)
Definition: sv_keyhunt.qc:817
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [2/11]

MUTATOR_HOOKFUNCTION ( kh  ,
MakePlayerObserver   
)

Definition at line 1224 of file sv_keyhunt.qc.

References entity(), kh_Key_DropAll(), and M_ARGV.

1225 {
1226  entity player = M_ARGV(0, entity);
1227 
1228  kh_Key_DropAll(player, true);
1229 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
void kh_Key_DropAll(entity player, float suicide)
Definition: sv_keyhunt.qc:817
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [3/11]

MUTATOR_HOOKFUNCTION ( kh  ,
PlayerDies   
)

Definition at line 1231 of file sv_keyhunt.qc.

References entity(), IS_PLAYER, kh_Key_DropAll(), and M_ARGV.

1232 {
1233  entity frag_attacker = M_ARGV(1, entity);
1234  entity frag_target = M_ARGV(2, entity);
1235 
1236  if(frag_target == frag_attacker)
1237  kh_Key_DropAll(frag_target, true);
1238  else if(IS_PLAYER(frag_attacker))
1239  kh_Key_DropAll(frag_target, false);
1240  else
1241  kh_Key_DropAll(frag_target, true);
1242 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
void kh_Key_DropAll(entity player, float suicide)
Definition: sv_keyhunt.qc:817
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [4/11]

MUTATOR_HOOKFUNCTION ( kh  ,
GiveFragsForKill  ,
CBC_ORDER_FIRST   
)

Definition at line 1244 of file sv_keyhunt.qc.

References entity(), kh_HandleFrags(), and M_ARGV.

1245 {
1246  entity frag_attacker = M_ARGV(0, entity);
1247  entity frag_target = M_ARGV(1, entity);
1248  float frag_score = M_ARGV(2, float);
1249  M_ARGV(2, float) = kh_HandleFrags(frag_attacker, frag_target, frag_score);
1250 }
entity() spawn
float kh_HandleFrags(entity attacker, entity targ, float f)
Definition: sv_keyhunt.qc:949
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [5/11]

MUTATOR_HOOKFUNCTION ( kh  ,
MatchEnd   
)

Definition at line 1252 of file sv_keyhunt.qc.

References kh_finalize().

1253 {
1254  kh_finalize();
1255 }
void kh_finalize()
Definition: sv_keyhunt.qc:1007
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [6/11]

MUTATOR_HOOKFUNCTION ( kh  ,
TeamBalance_CheckAllowedTeams  ,
CBC_ORDER_EXCLUSIVE   
)

Definition at line 1257 of file sv_keyhunt.qc.

References kh_teams, and M_ARGV.

1258 {
1259  M_ARGV(0, float) = kh_teams;
1260  return true;
1261 }
#define M_ARGV(x, type)
Definition: events.qh:17
int kh_teams
Definition: sv_keyhunt.qc:73

◆ MUTATOR_HOOKFUNCTION() [7/11]

MUTATOR_HOOKFUNCTION ( kh  ,
PlayerUseKey   
)

Definition at line 1263 of file sv_keyhunt.qc.

References entity(), kh_Key_DropOne(), M_ARGV, and MUTATOR_RETURNVALUE.

1264 {
1265  entity player = M_ARGV(0, entity);
1266 
1267  if(MUTATOR_RETURNVALUE == 0)
1268  {
1269  entity k = player.kh_next;
1270  if(k)
1271  {
1272  kh_Key_DropOne(k);
1273  return true;
1274  }
1275  }
1276 }
void kh_Key_DropOne(entity key)
Definition: sv_keyhunt.qc:794
entity() spawn
#define MUTATOR_RETURNVALUE
Definition: base.qh:303
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [8/11]

MUTATOR_HOOKFUNCTION ( kh  ,
HavocBot_ChooseRole   
)

Definition at line 1278 of file sv_keyhunt.qc.

References entity(), havocbot_role_kh_defense(), havocbot_role_kh_freelancer(), havocbot_role_kh_offense(), IS_DEAD, M_ARGV, and random().

1279 {
1280  entity bot = M_ARGV(0, entity);
1281 
1282  if(IS_DEAD(bot))
1283  return true;
1284 
1285  float r = random() * 3;
1286  if (r < 1)
1287  bot.havocbot_role = havocbot_role_kh_offense;
1288  else if (r < 2)
1289  bot.havocbot_role = havocbot_role_kh_defense;
1290  else
1291  bot.havocbot_role = havocbot_role_kh_freelancer;
1292 
1293  return true;
1294 }
entity() spawn
void havocbot_role_kh_offense(entity this)
Definition: sv_keyhunt.qc:1122
#define M_ARGV(x, type)
Definition: events.qh:17
#define IS_DEAD(s)
Definition: utils.qh:26
void havocbot_role_kh_defense(entity this)
Definition: sv_keyhunt.qc:1080
void havocbot_role_kh_freelancer(entity this)
Definition: sv_keyhunt.qc:1165
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [9/11]

MUTATOR_HOOKFUNCTION ( kh  ,
LogDeath_AppendItemCodes   
)

Definition at line 1296 of file sv_keyhunt.qc.

References entity(), M_ARGV, and strcat().

1297 {
1298  entity player = M_ARGV(0, entity);
1299  if(player.kh_next)
1300  M_ARGV(1, string) = strcat(M_ARGV(1, string), "K"); // item codes
1301 }
entity() spawn
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
#define M_ARGV(x, type)
Definition: events.qh:17
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [10/11]

MUTATOR_HOOKFUNCTION ( kh  ,
DropSpecialItems   
)

Definition at line 1303 of file sv_keyhunt.qc.

References entity(), kh_Key_DropAll(), and M_ARGV.

1304 {
1305  entity frag_target = M_ARGV(0, entity);
1306 
1307  kh_Key_DropAll(frag_target, false);
1308 }
entity() spawn
#define M_ARGV(x, type)
Definition: events.qh:17
void kh_Key_DropAll(entity player, float suicide)
Definition: sv_keyhunt.qc:817
+ Here is the call graph for this function:

◆ MUTATOR_HOOKFUNCTION() [11/11]

MUTATOR_HOOKFUNCTION ( kh  ,
reset_map_global   
)

Definition at line 1310 of file sv_keyhunt.qc.

References kh_WaitForPlayers().

1311 {
1312  kh_WaitForPlayers(); // takes care of killing the "missing teams" message
1313 }
void kh_WaitForPlayers()
Definition: sv_keyhunt.qc:862
+ Here is the call graph for this function:

◆ nades_GiveBonus()

void nades_GiveBonus ( entity  player,
float  score 
)

Referenced by kh_FinishRound(), and kh_WinnerTeam().

+ Here is the caller graph for this function:

◆ void()

void ( entity  this)

Referenced by kh_finalize().

+ Here is the caller graph for this function:

Variable Documentation

◆ autocvar_g_balance_keyhunt_damageforcescale

float autocvar_g_balance_keyhunt_damageforcescale

Definition at line 9 of file sv_keyhunt.qc.

Referenced by kh_Key_Detach().

◆ autocvar_g_balance_keyhunt_delay_collect

float autocvar_g_balance_keyhunt_delay_collect

Definition at line 10 of file sv_keyhunt.qc.

Referenced by kh_Key_Touch().

◆ autocvar_g_balance_keyhunt_delay_damage_return

float autocvar_g_balance_keyhunt_delay_damage_return

Definition at line 11 of file sv_keyhunt.qc.

Referenced by kh_Key_Damage(), and kh_Key_Touch().

◆ autocvar_g_balance_keyhunt_delay_return

float autocvar_g_balance_keyhunt_delay_return

Definition at line 12 of file sv_keyhunt.qc.

Referenced by kh_Key_Detach().

◆ autocvar_g_balance_keyhunt_delay_round

float autocvar_g_balance_keyhunt_delay_round

Definition at line 13 of file sv_keyhunt.qc.

Referenced by kh_FinishRound(), and kh_WaitForPlayers().

◆ autocvar_g_balance_keyhunt_delay_tracking

float autocvar_g_balance_keyhunt_delay_tracking

Definition at line 14 of file sv_keyhunt.qc.

Referenced by kh_StartRound().

◆ autocvar_g_balance_keyhunt_dropvelocity

float autocvar_g_balance_keyhunt_dropvelocity

Definition at line 16 of file sv_keyhunt.qc.

Referenced by kh_Key_DropAll().

◆ autocvar_g_balance_keyhunt_maxdist

float autocvar_g_balance_keyhunt_maxdist

Definition at line 17 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ autocvar_g_balance_keyhunt_protecttime

float autocvar_g_balance_keyhunt_protecttime

Definition at line 18 of file sv_keyhunt.qc.

Referenced by kh_Key_DropAll(), and kh_Key_DropOne().

◆ autocvar_g_balance_keyhunt_return_when_unreachable

float autocvar_g_balance_keyhunt_return_when_unreachable

Definition at line 15 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ autocvar_g_balance_keyhunt_score_capture

int autocvar_g_balance_keyhunt_score_capture

Definition at line 20 of file sv_keyhunt.qc.

Referenced by kh_WinnerTeam().

◆ autocvar_g_balance_keyhunt_score_carrierfrag

int autocvar_g_balance_keyhunt_score_carrierfrag

Definition at line 21 of file sv_keyhunt.qc.

Referenced by kh_HandleFrags().

◆ autocvar_g_balance_keyhunt_score_collect

int autocvar_g_balance_keyhunt_score_collect

Definition at line 22 of file sv_keyhunt.qc.

Referenced by kh_HandleFrags(), and kh_Key_Collect().

◆ autocvar_g_balance_keyhunt_score_destroyed

int autocvar_g_balance_keyhunt_score_destroyed

Definition at line 23 of file sv_keyhunt.qc.

Referenced by kh_LoserTeam().

◆ autocvar_g_balance_keyhunt_score_destroyed_ownfactor

int autocvar_g_balance_keyhunt_score_destroyed_ownfactor

Definition at line 24 of file sv_keyhunt.qc.

Referenced by kh_LoserTeam().

◆ autocvar_g_balance_keyhunt_score_push

int autocvar_g_balance_keyhunt_score_push

Definition at line 25 of file sv_keyhunt.qc.

Referenced by kh_LoserTeam().

◆ autocvar_g_balance_keyhunt_throwvelocity

float autocvar_g_balance_keyhunt_throwvelocity

Definition at line 26 of file sv_keyhunt.qc.

Referenced by kh_Key_DropOne().

◆ autocvar_g_keyhunt_teams_override

int autocvar_g_keyhunt_teams_override

Definition at line 29 of file sv_keyhunt.qc.

Referenced by kh_Initialize().

◆ kh_controller

entity kh_controller

Definition at line 71 of file sv_keyhunt.qc.

Referenced by kh_Controller_SetThink(), kh_finalize(), and kh_Initialize().

◆ kh_Controller_Thinkfunc

var kh_Think_t kh_Controller_Thinkfunc

Definition at line 147 of file sv_keyhunt.qc.

Referenced by kh_Controller_SetThink(), and kh_Controller_Think().

◆ kh_dropperteam

int kh_dropperteam

Definition at line 78 of file sv_keyhunt.qc.

◆ kh_droptime

float kh_droptime

Definition at line 77 of file sv_keyhunt.qc.

Referenced by kh_Key_Touch().

◆ kh_interferemsg_team

int kh_interferemsg_team

Definition at line 74 of file sv_keyhunt.qc.

Referenced by kh_Key_AssignTo(), and kh_Key_Think().

◆ kh_interferemsg_time

float kh_interferemsg_time

Definition at line 75 of file sv_keyhunt.qc.

Referenced by kh_FinishRound(), kh_Key_AssignTo(), and kh_Key_Think().

◆ KH_KEY_BRIGHTNESS

const float KH_KEY_BRIGHTNESS = 2

Definition at line 50 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ kh_key_carried

int kh_key_carried

Definition at line 82 of file sv_keyhunt.qc.

Referenced by kh_Initialize(), and kh_Key_Attach().

◆ kh_key_dropped

int kh_key_dropped

Definition at line 82 of file sv_keyhunt.qc.

Referenced by kh_Initialize(), kh_Key_Detach(), and kh_Key_Spawn().

◆ KH_KEY_MAX

const vector KH_KEY_MAX = '10 10 3'

Definition at line 49 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ KH_KEY_MIN

const vector KH_KEY_MIN = '-10 -10 -46'

Definition at line 48 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ KH_KEY_WP_ZSHIFT

const float KH_KEY_WP_ZSHIFT = 20

Definition at line 46 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ KH_KEY_XYDIST

const float KH_KEY_XYDIST = 24

Definition at line 43 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ KH_KEY_XYSPEED

const float KH_KEY_XYSPEED = 45

Definition at line 44 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ KH_KEY_ZSHIFT

const float KH_KEY_ZSHIFT = 22

Definition at line 42 of file sv_keyhunt.qc.

Referenced by kh_Key_Attach().

◆ kh_next

◆ kh_no_radar_circles

bool kh_no_radar_circles

Definition at line 52 of file sv_keyhunt.qc.

Referenced by kh_FinishRound(), and kh_Key_AssignTo().

◆ kh_prev

entity kh_prev

Definition at line 76 of file sv_keyhunt.qc.

◆ kh_previous_owner

entity kh_previous_owner

Definition at line 79 of file sv_keyhunt.qc.

◆ kh_previous_owner_playerid

int kh_previous_owner_playerid

Definition at line 80 of file sv_keyhunt.qc.

◆ kh_teams

◆ siren_time

float siren_time

Definition at line 59 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ ST_KH_CAPS

const int ST_KH_CAPS = 1

Definition at line 86 of file sv_keyhunt.qc.

Referenced by kh_ScoreRules().