Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_keyhunt.qc File Reference
Include dependency graph for sv_keyhunt.qc:
This graph shows which files directly or indirectly include this file:

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)
 if (!IS_PLAYER(frag_attacker)||!IS_PLAYER(frag_target)) return
 if (frag_attacker.kh_next !=NULL)
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 ()
bool kh_waypointsprite_visible_for_bot (entity this, entity e)
void kh_WinnerTeam (int winner_team)
void nades_GiveBonus (entity player, float score)
 void (entity this) havocbot_role_kh_carrier

Variables

vector autocvar_g_balance_keyhunt_carrier_damage
vector autocvar_g_balance_keyhunt_carrier_force
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
vector autocvar_g_balance_keyhunt_noncarrier_damage
vector autocvar_g_balance_keyhunt_noncarrier_force
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
float float2int_decimal_fld
entity frag_target = M_ARGV(2, entity)
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 = '25 25 4'
const vector KH_KEY_MIN = '-25 -25 -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
int kh_previous_owner_playerid
entity previous_owner
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 1031 of file sv_keyhunt.qc.

1032{
1033 for (entity head = kh_worldkeylist; head; head = head.kh_worldkeynext)
1034 {
1035 if (head.owner)
1036 {
1037 if (head.owner == this || !kh_waypointsprite_visible_for_bot(this, head.owner))
1038 continue;
1039 if (SAME_TEAM(head, this))
1040 navigation_routerating(this, head.owner, ratingscale_team * 10000, 100000);
1041 else
1042 navigation_routerating(this, head.owner, ratingscale_enemy * 10000, 100000);
1043 }
1044 else
1045 {
1046 if (!kh_waypointsprite_visible_for_bot(this, head))
1047 continue;
1048 navigation_routerating(this, head, ratingscale_dropped * 10000, 100000);
1049 }
1050 }
1051
1052 havocbot_goalrating_items(this, 80000, this.origin, 10000);
1053}
void navigation_routerating(entity this, entity e, float f, float rangebias)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
vector origin
bool kh_waypointsprite_visible_for_bot(entity this, entity e)
entity kh_worldkeylist
Definition sv_keyhunt.qh:24
void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
Definition roles.qc:106
#define SAME_TEAM(a, b)
Definition teams.qh:241

References entity(), havocbot_goalrating_items(), kh_waypointsprite_visible_for_bot(), kh_worldkeylist, navigation_routerating(), origin, and SAME_TEAM.

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

◆ havocbot_role_kh_carrier()

void havocbot_role_kh_carrier ( entity this)

Definition at line 1055 of file sv_keyhunt.qc.

1056{
1057 if(IS_DEAD(this))
1058 return;
1059
1060 if (!(this.kh_next))
1061 {
1062 LOG_TRACE("changing role to freelancer");
1063 this.havocbot_role = havocbot_role_kh_freelancer;
1064 this.havocbot_role_timeout = 0;
1065 return;
1066 }
1067
1069 {
1071
1072 if(kh_Key_AllOwnedByWhichTeam() == this.team)
1073 havocbot_goalrating_kh(this, 10, 0.1, 0.05); // bring home
1074 else
1075 havocbot_goalrating_kh(this, 4, 4, 0.5); // play defensively
1076
1078
1080 }
1081}
void navigation_goalrating_start(entity this)
void navigation_goalrating_timeout_set(entity this)
Definition navigation.qc:20
bool navigation_goalrating_timeout(entity this)
Definition navigation.qc:44
void navigation_goalrating_end(entity this)
float havocbot_role_timeout
Definition api.qh:46
int team
Definition main.qh:188
#define IS_DEAD(s)
Definition player.qh:244
#define LOG_TRACE(...)
Definition log.qh:74
entity kh_next
Definition sv_keyhunt.qc:79
int kh_Key_AllOwnedByWhichTeam()
void havocbot_role_kh_freelancer(entity this)
void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)

References entity(), 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 void().

◆ havocbot_role_kh_defense()

void havocbot_role_kh_defense ( entity this)

Definition at line 1083 of file sv_keyhunt.qc.

1084{
1085 if(IS_DEAD(this))
1086 return;
1087
1088 if (this.kh_next)
1089 {
1090 LOG_TRACE("changing role to carrier");
1091 this.havocbot_role = havocbot_role_kh_carrier;
1092 this.havocbot_role_timeout = 0;
1093 return;
1094 }
1095
1096 if (!this.havocbot_role_timeout)
1097 this.havocbot_role_timeout = time + random() * 10 + 20;
1098 if (time > this.havocbot_role_timeout)
1099 {
1100 LOG_TRACE("changing role to freelancer");
1101 this.havocbot_role = havocbot_role_kh_freelancer;
1102 this.havocbot_role_timeout = 0;
1103 return;
1104 }
1105
1107 {
1108 float key_owner_team;
1110
1111 key_owner_team = kh_Key_AllOwnedByWhichTeam();
1112 if(key_owner_team == this.team)
1113 havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend key carriers
1114 else if(key_owner_team == -1)
1115 havocbot_goalrating_kh(this, 4, 1, 0.05); // play defensively
1116 else
1117 havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK ANYWAY
1118
1120
1122 }
1123}
float time
float random(void)
void havocbot_role_kh_carrier(entity this)

References entity(), 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(), and void().

◆ havocbot_role_kh_freelancer()

void havocbot_role_kh_freelancer ( entity this)

Definition at line 1168 of file sv_keyhunt.qc.

1169{
1170 if(IS_DEAD(this))
1171 return;
1172
1173 if (this.kh_next)
1174 {
1175 LOG_TRACE("changing role to carrier");
1176 this.havocbot_role = havocbot_role_kh_carrier;
1177 this.havocbot_role_timeout = 0;
1178 return;
1179 }
1180
1181 if (!this.havocbot_role_timeout)
1182 this.havocbot_role_timeout = time + random() * 10 + 10;
1183 if (time > this.havocbot_role_timeout)
1184 {
1185 if (random() < 0.5)
1186 {
1187 LOG_TRACE("changing role to offense");
1188 this.havocbot_role = havocbot_role_kh_offense;
1189 }
1190 else
1191 {
1192 LOG_TRACE("changing role to defense");
1193 this.havocbot_role = havocbot_role_kh_defense;
1194 }
1195 this.havocbot_role_timeout = 0;
1196 return;
1197 }
1198
1200 {
1202
1203 int key_owner_team = kh_Key_AllOwnedByWhichTeam();
1204 if(key_owner_team == this.team)
1205 havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend anyway
1206 else if(key_owner_team == -1)
1207 havocbot_goalrating_kh(this, 1, 10, 2); // prefer dropped keys
1208 else
1209 havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK ANYWAY
1210
1212
1214 }
1215}
void havocbot_role_kh_offense(entity this)
void havocbot_role_kh_defense(entity this)

References entity(), 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(), and void().

◆ havocbot_role_kh_offense()

void havocbot_role_kh_offense ( entity this)

Definition at line 1125 of file sv_keyhunt.qc.

1126{
1127 if(IS_DEAD(this))
1128 return;
1129
1130 if (this.kh_next)
1131 {
1132 LOG_TRACE("changing role to carrier");
1133 this.havocbot_role = havocbot_role_kh_carrier;
1134 this.havocbot_role_timeout = 0;
1135 return;
1136 }
1137
1138 if (!this.havocbot_role_timeout)
1139 this.havocbot_role_timeout = time + random() * 10 + 20;
1140 if (time > this.havocbot_role_timeout)
1141 {
1142 LOG_TRACE("changing role to freelancer");
1143 this.havocbot_role = havocbot_role_kh_freelancer;
1144 this.havocbot_role_timeout = 0;
1145 return;
1146 }
1147
1149 {
1150 float key_owner_team;
1151
1153
1154 key_owner_team = kh_Key_AllOwnedByWhichTeam();
1155 if(key_owner_team == this.team)
1156 havocbot_goalrating_kh(this, 10, 0.1, 0.05); // defend anyway
1157 else if(key_owner_team == -1)
1158 havocbot_goalrating_kh(this, 0.1, 1, 2); // play offensively
1159 else
1160 havocbot_goalrating_kh(this, 0.1, 0.1, 5); // ATTACK! EMERGENCY!
1161
1163
1165 }
1166}

References entity(), 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(), and void().

◆ if() [1/2]

if ( ! IS_PLAYERfrag_attacker)||!IS_PLAYER(frag_target)

References frag_target.

◆ if() [2/2]

Definition at line 1229 of file sv_keyhunt.qc.

1230 {
1231 if (frag_target == frag_attacker) // damage done to themselves
1232 {
1235 }
1236 else if (frag_target.kh_next != NULL) // damage done to other key carriers
1237 {
1240 }
1241 else // damage done to noncarriers
1242 {
1245 }
1246 }
#define M_ARGV(x, type)
Definition events.qh:17
#define NULL
Definition post.qh:14
vector
Definition self.qh:96
entity frag_target
Definition sv_ctf.qc:2314
vector autocvar_g_balance_keyhunt_carrier_damage
Definition sv_keyhunt.qc:21
vector autocvar_g_balance_keyhunt_carrier_force
Definition sv_keyhunt.qc:22

References autocvar_g_balance_keyhunt_carrier_damage, autocvar_g_balance_keyhunt_carrier_force, frag_target, M_ARGV, NULL, and vector.

◆ key_reset()

void key_reset ( entity this)

Definition at line 725 of file sv_keyhunt.qc.

726{
727 kh_Key_AssignTo(this, NULL);
728 kh_Key_Remove(this);
729}
void kh_Key_AssignTo(entity key, entity player)
void kh_Key_Remove(entity key)

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

Referenced by kh_Key_Spawn().

◆ kh_AttachedOrigin()

vector kh_AttachedOrigin ( entity e)

Definition at line 213 of file sv_keyhunt.qc.

214{
215 if(e.tag_entity)
216 {
217 makevectors(e.tag_entity.angles);
218 return e.tag_entity.origin + e.origin.x * v_forward - e.origin.y * v_right + e.origin.z * v_up;
219 }
220 else
221 return e.origin;
222}
vector v_up
vector v_right
vector v_forward
#define makevectors
Definition post.qh:21

References entity(), makevectors, v_forward, v_right, v_up, and vector.

Referenced by kh_WinnerTeam().

◆ kh_Controller_SetThink()

void kh_Controller_SetThink ( float t,
kh_Think_t func )

Definition at line 154 of file sv_keyhunt.qc.

155{
157 kh_controller.cnt = ceil(t);
158 if(t == 0)
159 kh_controller.nextthink = time; // force
160}
float ceil(float f)
var kh_Think_t kh_Controller_Thinkfunc
entity kh_controller
Definition sv_keyhunt.qc:76

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

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

◆ kh_Controller_Think()

void kh_Controller_Think ( entity this)

Definition at line 162 of file sv_keyhunt.qc.

163{
164 if(game_stopped)
165 return;
166 if(this.cnt > 0)
167 {
168 if(getthink(this) != kh_WaitForPlayers)
169 --this.cnt;
170 }
171 else if(this.cnt == 0)
172 {
173 --this.cnt;
175 }
176 this.nextthink = time + 1;
177}
float cnt
Definition powerups.qc:24
float game_stopped
Definition stats.qh:81
float nextthink
#define getthink(e)
void kh_WaitForPlayers()

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

Referenced by kh_Initialize().

◆ kh_EnableTrackingDevice()

void kh_EnableTrackingDevice ( )

Definition at line 899 of file sv_keyhunt.qc.

900{
901 Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT);
902 Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT_OTHER);
903
904 kh_tracking_enabled = true;
905}
void Kill_Notification(NOTIF broadcast, entity client, MSG net_type, CPID net_cpid)
Definition all.qc:1464
bool kh_tracking_enabled
Definition sv_keyhunt.qh:32

References kh_tracking_enabled, Kill_Notification(), and NULL.

Referenced by kh_StartRound().

◆ kh_finalize()

void kh_finalize ( )

Definition at line 1003 of file sv_keyhunt.qc.

1004{
1005 // to be called before intermission
1007 delete(kh_controller);
1009}
void kh_FinishRound()

References kh_controller, kh_FinishRound(), and NULL.

◆ kh_FinishRound()

void kh_FinishRound ( )

Definition at line 505 of file sv_keyhunt.qc.

506{
507 // prepare next round
509 entity key;
510
511 kh_no_radar_circles = true;
512 FOR_EACH_KH_KEY(key)
513 kh_Key_Remove(key);
514 kh_no_radar_circles = false;
515
516 Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
518}
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1500
bool kh_no_radar_circles
Definition sv_keyhunt.qc:58
void kh_Controller_SetThink(float t, kh_Think_t func)
float kh_interferemsg_time
Definition sv_keyhunt.qc:78
float autocvar_g_balance_keyhunt_delay_round
Definition sv_keyhunt.qc:14
void kh_StartRound()
#define FOR_EACH_KH_KEY(v)
Definition sv_keyhunt.qh:27

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(), NULL, and Send_Notification().

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

◆ kh_GetMissingTeams()

int kh_GetMissingTeams ( )

Definition at line 856 of file sv_keyhunt.qc.

857{
858 int missing_teams = 0;
859 for(int i = 0; i < AVAILABLE_TEAMS; ++i)
860 {
861 int teem = kh_Team_ByID(i);
862 int players = 0;
864 if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
865 ++players;
866 });
867 if (!players)
868 missing_teams |= BIT(i);
869 }
870 return missing_teams;
871}
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition bits.qh:8
entity players
Definition main.qh:57
#define PHYS_INPUT_BUTTON_CHAT(s)
Definition player.qh:161
#define IS_PLAYER(s)
Definition player.qh:242
#define AVAILABLE_TEAMS
Number of teams that exist currently.
int kh_Team_ByID(int t)
Definition sv_keyhunt.qc:67
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:52

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

Referenced by kh_StartRound(), and kh_WaitForPlayers().

◆ kh_HandleFrags()

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

Definition at line 948 of file sv_keyhunt.qc.

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

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

◆ kh_Initialize()

void kh_Initialize ( )

Definition at line 973 of file sv_keyhunt.qc.

974{
975 // setup variables
977 if(kh_teams < 2)
978 kh_teams = cvar("g_keyhunt_teams"); // read the cvar directly as it gets written earlier in the same frame
979 kh_teams = BITS(bound(2, kh_teams, 4));
980
981 // use a temp entity to avoid linking kh_controller to the world with setmodel
982 entity tmp_ent = spawn();
983 setmodel(tmp_ent, MDL_KH_KEY);
984 kh_key_dropped = tmp_ent.modelindex;
985
986#ifdef KH_PLAYER_USE_CARRIEDMODEL
987 setmodel(tmp_ent, MDL_KH_KEY_CARRIED);
988 kh_key_carried = tmp_ent.modelindex;
989#else
991#endif
992
993 delete(tmp_ent);
994
995 // make a KH entity for controlling the game
999
1000 kh_ScoreRules(kh_teams);
1001}
#define BITS(n)
Definition bits.qh:9
#define setmodel(this, m)
Definition model.qh:26
#define spawn
float bound(float min, float value, float max)
float cvar(string name)
#define new_pure(class)
purely logical entities (not linked to the area grid)
Definition oo.qh:66
#define setthink(e, f)
void kh_ScoreRules(int teams)
Definition sv_keyhunt.qc:90
int autocvar_g_keyhunt_teams_override
Definition sv_keyhunt.qc:35
void kh_Controller_Think(entity this)
int kh_key_dropped
Definition sv_keyhunt.qc:85
int kh_key_carried
Definition sv_keyhunt.qc:85

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

Referenced by REGISTER_MUTATOR().

◆ kh_Key_AllOwnedByWhichTeam()

int kh_Key_AllOwnedByWhichTeam ( )

Definition at line 785 of file sv_keyhunt.qc.

786{
787 entity key;
788 int teem = -1;
789 int keys = AVAILABLE_TEAMS;
790 FOR_EACH_KH_KEY(key)
791 {
792 if(!key.owner)
793 return -1;
794 if(teem == -1)
795 teem = key.team;
796 else if(teem != key.team)
797 return -1;
798 --keys;
799 }
800 if(keys != 0)
801 return -1;
802 return teem;
803}

References AVAILABLE_TEAMS, entity(), and FOR_EACH_KH_KEY.

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().

◆ kh_Key_AssignTo()

void kh_Key_AssignTo ( entity key,
entity player )

Definition at line 313 of file sv_keyhunt.qc.

314{
315 if(key.owner == player)
316 return;
317
318 int ownerteam0 = kh_Key_AllOwnedByWhichTeam();
319
320 if(key.owner)
321 {
322 kh_Key_Detach(key);
323
324 // remove from linked list
325 if(key.kh_next)
326 key.kh_next.kh_prev = key.kh_prev;
327 key.kh_prev.kh_next = key.kh_next;
328 key.kh_next = NULL;
329 key.kh_prev = NULL;
330
331 if(key.owner.kh_next == NULL)
332 {
333 // No longer a key carrier
335 WaypointSprite_Ping(key.owner.waypointsprite_attachedforcarrier);
337 }
338 }
339
340 key.owner = player;
341
342 if(player)
343 {
344 // insert into linked list
345 key.kh_next = player.kh_next;
346 key.kh_prev = player;
347 player.kh_next = key;
348 if(key.kh_next)
349 key.kh_next.kh_prev = key;
350
351 kh_Key_Attach(key);
352
353 if(key.kh_next == NULL)
354 {
355 // player is now a key carrier
356 entity wp = WaypointSprite_AttachCarrier(WP_Null, player, RADARICON_FLAGCARRIER);
357 wp.colormod = colormapPaletteColor(player.team - 1, 0);
358 player.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_KeyCarrier_waypointsprite_visible_for_player;
359 WaypointSprite_UpdateRule(player.waypointsprite_attachedforcarrier, player.team, SPRITERULE_TEAMPLAY);
360 if(player.team == NUM_TEAM_1)
361 WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierRed, WP_KeyCarrierFriend, WP_KeyCarrierRed);
362 else if(player.team == NUM_TEAM_2)
363 WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierBlue, WP_KeyCarrierFriend, WP_KeyCarrierBlue);
364 else if(player.team == NUM_TEAM_3)
365 WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierYellow, WP_KeyCarrierFriend, WP_KeyCarrierYellow);
366 else if(player.team == NUM_TEAM_4)
367 WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, WP_KeyCarrierPink, WP_KeyCarrierFriend, WP_KeyCarrierPink);
369 WaypointSprite_Ping(player.waypointsprite_attachedforcarrier);
370 }
371 }
372
373 // moved that here, also update if there's no player
375
376 key.pusher = NULL;
377
378 int ownerteam = kh_Key_AllOwnedByWhichTeam();
379 if(ownerteam != ownerteam0)
380 {
381 entity k;
382 if(ownerteam != -1)
383 {
385 kh_interferemsg_team = player.team;
386
387 // audit all key carrier sprites, update them to "Run here"
389 {
390 if (!k.owner) continue;
391 entity first = WP_Null;
392 FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
393 entity third = WP_Null;
394 FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
395 WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFinish, third);
396 }
397 }
398 else
399 {
401
402 // audit all key carrier sprites, update them to "Key Carrier"
404 {
405 if (!k.owner) continue;
406 entity first = WP_Null;
407 FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model1, { first = it; break; });
408 entity third = WP_Null;
409 FOREACH(Waypoints, it.netname == k.owner.waypointsprite_attachedforcarrier.model3, { third = it; break; });
410 WaypointSprite_UpdateSprites(k.owner.waypointsprite_attachedforcarrier, first, WP_KeyCarrierFriend, third);
411 }
412 }
413 }
414}
#define colormapPaletteColor(c, isPants)
Definition color.qh:5
#define FOREACH(list, cond, body)
Definition iter.qh:19
int kh_interferemsg_team
Definition sv_keyhunt.qc:77
void kh_Key_Detach(entity key)
bool kh_KeyCarrier_waypointsprite_visible_for_player(entity this, entity player, entity view)
void kh_Key_Attach(entity key)
void kh_update_state()
const int NUM_TEAM_2
Definition teams.qh:14
const int NUM_TEAM_4
Definition teams.qh:16
const int NUM_TEAM_3
Definition teams.qh:15
const int NUM_TEAM_1
Definition teams.qh:13
void WaypointSprite_UpdateSprites(entity e, entity _m1, entity _m2, entity _m3)
void WaypointSprite_Ping(entity e)
entity WaypointSprite_AttachCarrier(entity spr, entity carrier, entity icon)
void WaypointSprite_DetachCarrier(entity carrier)
void WaypointSprite_UpdateRule(entity e, float t, float r)
const int SPRITERULE_TEAMPLAY

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, time, WaypointSprite_AttachCarrier(), WaypointSprite_DetachCarrier(), WaypointSprite_Ping(), WaypointSprite_UpdateRule(), and WaypointSprite_UpdateSprites().

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

◆ kh_Key_Attach()

void kh_Key_Attach ( entity key)

Definition at line 224 of file sv_keyhunt.qc.

225{
226 key.solid = SOLID_NOT; // before setorigin to prevent area grid linking
227#ifdef KH_PLAYER_USE_ATTACHMENT
228 entity first = key.owner.kh_next;
229 if(key == first)
230 {
231 setattachment(key, key.owner, KH_PLAYER_ATTACHMENT_BONE);
232 if(key.kh_next)
233 {
234 setattachment(key.kh_next, key, "");
235 setorigin(key, key.kh_next.origin - 0.5 * KH_PLAYER_ATTACHMENT_DIST);
236 setorigin(key.kh_next, KH_PLAYER_ATTACHMENT_DIST_ROTATED);
237 key.kh_next.angles = '0 0 0';
238 }
239 else
240 setorigin(key, KH_PLAYER_ATTACHMENT);
241 key.angles = KH_PLAYER_ATTACHMENT_ANGLES;
242 }
243 else
244 {
245 setattachment(key, key.kh_prev, "");
246 if(key.kh_next)
247 setattachment(key.kh_next, key, "");
248 setorigin(key, KH_PLAYER_ATTACHMENT_DIST_ROTATED);
249 setorigin(first, first.origin - 0.5 * KH_PLAYER_ATTACHMENT_DIST);
250 key.angles = '0 0 0';
251 }
252#else
253 setattachment(key, key.owner, "");
254 setorigin(key, '0 0 1' * KH_KEY_ZSHIFT); // fixing x, y in think
255 key.angles_y -= key.owner.angles.y;
256#endif
257 key.flags = 0;
258 if(IL_CONTAINS(g_items, key))
259 IL_REMOVE(g_items, key);
261 key.team = key.owner.team;
262 key.nextthink = time;
263 key.damageforcescale = 0;
264 key.takedamage = DAMAGE_NO;
265 key.modelindex = kh_key_carried;
267}
void navigation_dynamicgoal_unset(entity this)
Definition navigation.qc:96
const float SOLID_NOT
ERASEABLE void IL_REMOVE(IntrusiveList this, entity it)
Remove any element, anywhere in the list.
ERASEABLE bool IL_CONTAINS(IntrusiveList this, entity it)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NONE
Definition movetypes.qh:129
IntrusiveList g_items
Definition items.qh:119
const int DAMAGE_NO
Definition subs.qh:79
const float KH_KEY_ZSHIFT
Definition sv_keyhunt.qc:48

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

Referenced by kh_Key_AssignTo().

◆ kh_Key_Collect()

void kh_Key_Collect ( entity key,
entity player )

Definition at line 432 of file sv_keyhunt.qc.

433{
434 sound(player, CH_TRIGGER, SND_KH_COLLECT, VOL_BASE, ATTEN_NORM);
435
436 if(key.kh_dropperteam != player.team)
437 {
439 GameRules_scoring_add(player, KH_PICKUPS, 1);
440 }
441 key.kh_dropperteam = 0;
442 int realteam = kh_Team_ByID(key.count);
443 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_PICKUP), player.netname);
444
445 kh_Key_AssignTo(key, player); // this also updates .kh_state
446}
#define APP_TEAM_NUM(num, prefix)
Definition all.qh:88
const int CH_TRIGGER
Definition sound.qh:12
const float VOL_BASE
Definition sound.qh:36
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52

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

Referenced by kh_Key_Touch().

◆ 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 416 of file sv_keyhunt.qc.

417{
418 if(this.owner)
419 return;
420 if(ITEM_DAMAGE_NEEDKILL(deathtype))
421 {
423 return;
424 }
425 if(force == '0 0 0')
426 return;
427 if(time > this.pushltime)
428 if(IS_PLAYER(attacker))
429 this.team = attacker.team;
430}
float pain_finished
entity owner
Definition main.qh:87
float pushltime
Definition jumppads.qh:21
#define ITEM_DAMAGE_NEEDKILL(dt)
Definition items.qh:123
float autocvar_g_balance_keyhunt_delay_damage_return
Definition sv_keyhunt.qc:12

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

Referenced by kh_Key_Spawn().

◆ kh_Key_Detach()

void kh_Key_Detach ( entity key)

Definition at line 269 of file sv_keyhunt.qc.

270{
271 key.solid = SOLID_TRIGGER; // before setorigin to ensure area grid linking
272#ifdef KH_PLAYER_USE_ATTACHMENT
273 entity first = key.owner.kh_next;
274 if(key == first)
275 {
276 if(key.kh_next)
277 {
278 setattachment(key.kh_next, key.owner, KH_PLAYER_ATTACHMENT_BONE);
279 setorigin(key.kh_next, key.origin + 0.5 * KH_PLAYER_ATTACHMENT_DIST);
280 key.kh_next.angles = KH_PLAYER_ATTACHMENT_ANGLES;
281 }
282 }
283 else
284 {
285 if(key.kh_next)
286 setattachment(key.kh_next, key.kh_prev, "");
287 setorigin(first, first.origin + 0.5 * KH_PLAYER_ATTACHMENT_DIST);
288 }
289 // in any case:
290 setattachment(key, NULL, "");
291 setorigin(key, key.owner.origin + '0 0 1' * (STAT(PL_MIN, key.owner).z - KH_KEY_MIN_z));
292 key.angles = key.owner.angles;
293#else
294 setorigin(key, key.owner.origin + key.origin.z * '0 0 1');
295 setattachment(key, NULL, "");
296 key.angles_y += key.owner.angles.y;
297#endif
298 key.flags = FL_ITEM;
299 if(!IL_CONTAINS(g_items, key))
300 IL_PUSH(g_items, key);
302 nudgeoutofsolid_OrFallback(key); // a key has a bigger bbox than a player
303 key.pain_finished = time + autocvar_g_balance_keyhunt_delay_return;
304 key.damageforcescale = autocvar_g_balance_keyhunt_damageforcescale;
305 key.takedamage = DAMAGE_YES;
306 // let key.team stay
307 key.modelindex = kh_key_dropped;
308 navigation_dynamicgoal_set(key, key.owner);
309 key.previous_owner = key.owner;
310 key.kh_previous_owner_playerid = key.owner.playerid;
311}
void navigation_dynamicgoal_set(entity this, entity dropper)
Definition navigation.qc:87
const int FL_ITEM
Definition constants.qh:77
const float SOLID_TRIGGER
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
#define STAT(...)
Definition stats.qh:94
const int MOVETYPE_TOSS
Definition movetypes.qh:135
const int DAMAGE_YES
Definition subs.qh:80
float autocvar_g_balance_keyhunt_delay_return
Definition sv_keyhunt.qc:13
float autocvar_g_balance_keyhunt_damageforcescale
Definition sv_keyhunt.qc:10

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(), SOLID_TRIGGER, STAT, and time.

Referenced by kh_Key_AssignTo().

◆ kh_Key_DropAll()

void kh_Key_DropAll ( entity player,
float suicide )

Definition at line 828 of file sv_keyhunt.qc.

829{
830 if(player.kh_next)
831 {
832 entity mypusher = NULL;
833 if(player.pusher)
834 if(time < player.pushltime)
835 mypusher = player.pusher;
836
837 entity key;
838 while((key = player.kh_next))
839 {
840 kh_Scores_Event(player, key, "losekey", 0, 0);
841 GameRules_scoring_add(player, KH_LOSSES, 1);
842 int realteam = kh_Team_ByID(key.count);
843 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_LOST), player.netname);
844 kh_Key_AssignTo(key, NULL);
845 makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
846 key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
847 key.pusher = mypusher;
849 if(suicide)
850 key.kh_dropperteam = player.team;
851 }
852 sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM);
853 }
854}
float autocvar_g_balance_keyhunt_protecttime
Definition sv_keyhunt.qc:19
float autocvar_g_balance_keyhunt_dropvelocity
Definition sv_keyhunt.qc:17
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
Definition tracing.qc:174

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(), Send_Notification(), sound, time, v_forward, VOL_BASE, and W_CalculateProjectileVelocity().

◆ kh_Key_DropOne()

void kh_Key_DropOne ( entity key)

Definition at line 805 of file sv_keyhunt.qc.

806{
807 // prevent collecting this one for some time
808 entity player = key.owner;
809
810 key.kh_droptime = time;
811 key.enemy = player;
812
813 kh_Scores_Event(player, key, "dropkey", 0, 0);
814 GameRules_scoring_add(player, KH_LOSSES, 1);
815 int realteam = kh_Team_ByID(key.count);
816 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_DROP), player.netname);
817
818 kh_Key_AssignTo(key, NULL);
819 makevectors(player.v_angle);
820 key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_throwvelocity * v_forward, false);
821 key.pusher = NULL;
823 key.kh_dropperteam = key.team;
824
825 sound(player, CH_TRIGGER, SND_KH_DROP, VOL_BASE, ATTEN_NORM);
826}
float autocvar_g_balance_keyhunt_throwvelocity
Definition sv_keyhunt.qc:32

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, Send_Notification(), sound, time, v_forward, VOL_BASE, and W_CalculateProjectileVelocity().

◆ kh_Key_Remove()

void kh_Key_Remove ( entity key)

Definition at line 474 of file sv_keyhunt.qc.

475{
476 entity o = key.owner;
477 kh_Key_AssignTo(key, NULL);
478 if(o) // it was attached
479 WaypointSprite_Kill(key.waypointsprite_attachedforcarrier);
480 else // it was dropped
482
483 // remove key from key list
484 if (kh_worldkeylist == key)
485 kh_worldkeylist = kh_worldkeylist.kh_worldkeynext;
486 else
487 {
488 o = kh_worldkeylist;
489 while (o)
490 {
491 if (o.kh_worldkeynext == key)
492 {
493 o.kh_worldkeynext = o.kh_worldkeynext.kh_worldkeynext;
494 break;
495 }
496 o = o.kh_worldkeynext;
497 }
498 }
499
500 delete(key);
501
503}
void WaypointSprite_Kill(entity wp)

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

Referenced by key_reset(), and kh_FinishRound().

◆ kh_Key_Spawn()

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

Definition at line 731 of file sv_keyhunt.qc.

732{
733 entity key = new(item_kh_key);
734 key.count = i;
737 key.nextthink = time;
738 key.cnt = _angle;
739 key.angles = '0 360 0' * random();
740 key.event_damage = kh_Key_Damage;
741 key.takedamage = DAMAGE_YES;
744 key.modelindex = kh_key_dropped;
745 key.model = "key";
746 key.kh_dropperteam = 0;
748 setsize(key, KH_KEY_MIN, KH_KEY_MAX);
749 key.colormod = Team_ColorRGB(initial_owner.team) * KH_KEY_BRIGHTNESS;
750 key.reset = key_reset;
751 navigation_dynamicgoal_init(key, false);
752
753 switch(initial_owner.team)
754 {
755 case NUM_TEAM_1:
756 key.netname = "^1red key";
757 break;
758 case NUM_TEAM_2:
759 key.netname = "^4blue key";
760 break;
761 case NUM_TEAM_3:
762 key.netname = "^3yellow key";
763 break;
764 case NUM_TEAM_4:
765 key.netname = "^6pink key";
766 break;
767 default:
768 key.netname = "NETGIER key";
769 break;
770 }
771
772 // link into key list
773 key.kh_worldkeynext = kh_worldkeylist;
774 kh_worldkeylist = key;
775
776 Send_Notification(NOTIF_ONE, initial_owner, MSG_CENTER, APP_TEAM_NUM(initial_owner.team, CENTER_KEYHUNT_START));
777
778 WaypointSprite_Spawn(WP_KeyDropped, 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, NULL, key.team, key, waypointsprite_attachedforcarrier, false, RADARICON_FLAG);
779 key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player;
780
781 kh_Key_AssignTo(key, initial_owner);
782}
void navigation_dynamicgoal_init(entity this, bool initially_static)
Definition navigation.qc:77
float DPCONTENTS_BOTCLIP
float DPCONTENTS_SOLID
float DPCONTENTS_BODY
float DPCONTENTS_PLAYERCLIP
#define settouch(e, f)
Definition self.qh:77
void key_reset(entity this)
void kh_Key_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
bool kh_Key_waypointsprite_visible_for_player(entity this, entity player, entity view)
void kh_Key_Think(entity this)
const float KH_KEY_BRIGHTNESS
Definition sv_keyhunt.qc:56
const vector KH_KEY_MAX
Definition sv_keyhunt.qc:55
float autocvar_g_balance_keyhunt_return_when_unreachable
Definition sv_keyhunt.qc:16
const float KH_KEY_WP_ZSHIFT
Definition sv_keyhunt.qc:52
void kh_Key_Touch(entity this, entity toucher)
const vector KH_KEY_MIN
Definition sv_keyhunt.qc:54
vector Team_ColorRGB(int teamid)
Definition teams.qh:76
entity WaypointSprite_Spawn(entity spr, float _lifetime, float maxdistance, entity ref, vector ofs, entity showto, float t, entity own,.entity ownfield, float hideable, entity icon)
entity waypointsprite_attachedforcarrier

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(), Send_Notification(), setthink, settouch, Team_ColorRGB(), time, waypointsprite_attachedforcarrier, and WaypointSprite_Spawn().

Referenced by kh_StartRound().

◆ kh_Key_Think()

void kh_Key_Think ( entity this)

Definition at line 670 of file sv_keyhunt.qc.

671{
672 if(game_stopped)
673 return;
674
675 if(this.owner)
676 {
677#ifndef KH_PLAYER_USE_ATTACHMENT
678 makevectors('0 1 0' * (this.cnt + (time % 360) * KH_KEY_XYSPEED));
679 setorigin(this, v_forward * KH_KEY_XYDIST + '0 0 1' * this.origin.z);
680#endif
681 }
682
683 // if in nodrop or time over, end the round
684 if(!this.owner)
685 if(time > this.pain_finished)
686 kh_LoserTeam(this.team, this);
687
688 if(this.owner)
690 {
691 if(this.siren_time < time)
692 {
693 sound(this.owner, CH_TRIGGER, SND_KH_ALARM, VOL_BASE, ATTEN_NORM); // play a simple alarm
694 this.siren_time = time + 2.5; // repeat every 2.5 seconds
695 }
696
697 entity key;
698 vector p = this.owner.origin;
699 FOR_EACH_KH_KEY(key)
700 if(vdist(key.owner.origin - p, >, autocvar_g_balance_keyhunt_maxdist))
701 goto not_winning;
702 kh_WinnerTeam(this.team);
703LABEL(not_winning)
704 }
705
707 {
710 if(it.team == kh_interferemsg_team)
711 {
712 if(it.kh_next)
713 Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_MEET);
714 else
715 Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_KEYHUNT_HELP);
716 }
717 else
718 Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(kh_interferemsg_team, CENTER_KEYHUNT_INTERFERE));
719 });
720 }
721
722 this.nextthink = time + 0.05;
723}
#define LABEL(id)
Definition compiler.qh:34
void kh_LoserTeam(int loser_team, entity lostkey)
const float KH_KEY_XYSPEED
Definition sv_keyhunt.qc:50
float siren_time
Definition sv_keyhunt.qc:65
float autocvar_g_balance_keyhunt_maxdist
Definition sv_keyhunt.qc:18
void kh_WinnerTeam(int winner_team)
const float KH_KEY_XYDIST
Definition sv_keyhunt.qc:49
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt().
Definition vector.qh:8

References APP_TEAM_NUM, ATTEN_NORM, autocvar_g_balance_keyhunt_maxdist, CH_TRIGGER, cnt, entity(), FOR_EACH_KH_KEY, FOREACH_CLIENT, game_stopped, 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, Send_Notification(), siren_time, sound, team, time, v_forward, vdist, vector, and VOL_BASE.

Referenced by kh_Key_Spawn().

◆ kh_Key_Touch()

void kh_Key_Touch ( entity this,
entity toucher )

Definition at line 448 of file sv_keyhunt.qc.

449{
450 if(game_stopped)
451 return;
452
453 if(this.owner) // already carried
454 return;
455
457 {
459 return;
460 }
461
462 if (!IS_PLAYER(toucher))
463 return;
464 if(IS_DEAD(toucher))
465 return;
467 return;
468 if(toucher == this.enemy)
470 return; // you just dropped it!
471 kh_Key_Collect(this, toucher);
472}
entity entity toucher
Definition self.qh:76
#define IS_INDEPENDENT_PLAYER(e)
Definition client.qh:312
#define ITEM_TOUCH_NEEDKILL()
Definition items.qh:122
entity enemy
Definition sv_ctf.qh:152
float autocvar_g_balance_keyhunt_delay_collect
Definition sv_keyhunt.qc:11
float kh_droptime
Definition sv_keyhunt.qc:80
void kh_Key_Collect(entity key, entity player)

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

Referenced by kh_Key_Spawn().

◆ kh_Key_waypointsprite_visible_for_player()

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

Definition at line 115 of file sv_keyhunt.qc.

116{
117 // always show the dropped key waypoint while in warmup or spectating
118 if(this.owner && !this.owner.owner && (IS_SPEC(player) || warmup_stage))
119 return true;
121 return false;
122
123 return !this.owner || !this.owner.owner; // draw only when key is not owned
124}
bool warmup_stage
Definition main.qh:120
#define IS_SPEC(v)
Definition utils.qh:10

References entity(), IS_SPEC, kh_tracking_enabled, owner, and warmup_stage.

Referenced by kh_Key_Spawn().

◆ kh_KeyCarrier_waypointsprite_visible_for_player()

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

Definition at line 103 of file sv_keyhunt.qc.

104{
105 if(view.kh_next && IS_SPEC(player))
106 return false; // we don't want spectators of key carriers to see the attached waypoint on the top of their screen
107 if(IS_SPEC(player) || warmup_stage || SAME_TEAM(player, this.owner))
108 return true;
109 if(IS_INVISIBLE(this.owner))
110 return false; // hide the waypointsprite if the owner is invisible
111
112 return kh_tracking_enabled;
113}
#define IS_INVISIBLE(v)
Definition utils.qh:29

References entity(), IS_INVISIBLE, IS_SPEC, kh_tracking_enabled, owner, SAME_TEAM, and warmup_stage.

Referenced by kh_Key_AssignTo().

◆ kh_LoserTeam()

void kh_LoserTeam ( int loser_team,
entity lostkey )

Definition at line 584 of file sv_keyhunt.qc.

585{
586 float f;
587 entity attacker = NULL;
588 if(lostkey.pusher)
589 if(lostkey.pusher.team != loser_team)
590 if(IS_PLAYER(lostkey.pusher))
591 attacker = lostkey.pusher;
592
593 if(attacker)
594 {
595 if(lostkey.previous_owner)
596 kh_Scores_Event(lostkey.previous_owner, NULL, "pushed", 0, -autocvar_g_balance_keyhunt_score_push);
597 // don't actually GIVE them the -nn points, just log
599 GameRules_scoring_add(attacker, KH_PUSHES, 1);
600 //centerprint(attacker, "Your push is the best!"); // does this really need to exist?
601 }
602 else
603 {
604 int players = 0;
606
607 FOREACH_CLIENT(IS_PLAYER(it) && it.team != loser_team, { ++players; });
608
609 entity key;
610 int keys = 0;
611 FOR_EACH_KH_KEY(key)
612 if(key.owner && key.team != loser_team)
613 ++keys;
614
615 if(lostkey.previous_owner)
616 kh_Scores_Event(lostkey.previous_owner, NULL, "destroyed", 0, -autocvar_g_balance_keyhunt_score_destroyed);
617 // don't actually GIVE them the -nn points, just log
618
619 if(lostkey.previous_owner.playerid == lostkey.kh_previous_owner_playerid)
620 GameRules_scoring_add(lostkey.previous_owner, KH_DESTRUCTIONS, 1);
621
623
624 FOR_EACH_KH_KEY(key)
625 if(key.owner && key.team != loser_team)
626 {
627 f = DistributeEvenly_Get(of);
628 kh_Scores_Event(key.owner, NULL, "destroyed_holdingkey", f, 0);
629 }
630
631 int fragsleft = DistributeEvenly_Get(players);
632
633 // Now distribute these among all other teams...
634 int j = AVAILABLE_TEAMS - 1;
635 for(int i = 0; i < AVAILABLE_TEAMS; ++i)
636 {
637 int thisteam = kh_Team_ByID(i);
638 if(thisteam == loser_team) // bad boy, no cookie - this WILL happen
639 continue;
640
641 players = 0;
642 FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, { ++players; });
643
644 DistributeEvenly_Init(fragsleft, j);
645 fragsleft = DistributeEvenly_Get(j - 1);
647
648 FOREACH_CLIENT(IS_PLAYER(it) && it.team == thisteam, {
649 f = DistributeEvenly_Get(1);
650 kh_Scores_Event(it, NULL, "destroyed", f, 0);
651 });
652
653 --j;
654 }
655 }
656
657 int realteam = kh_Team_ByID(lostkey.count);
658 Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(loser_team, CENTER_ROUND_TEAM_LOSS));
659 if(attacker)
660 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_PUSHED), attacker.netname, lostkey.previous_owner.netname);
661 else
662 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_DESTROYED), lostkey.previous_owner.netname);
663
664 play2all(SND(KH_DESTROY));
665 te_tarexplosion(lostkey.origin);
666
668}
ERASEABLE void DistributeEvenly_Init(float amount, float totalweight)
Definition random.qc:42
ERASEABLE float DistributeEvenly_Get(float weight)
Definition random.qc:52
void play2all(string samp)
Definition all.qc:142
#define SND(id)
Definition all.qh:35
int autocvar_g_balance_keyhunt_score_destroyed
Definition sv_keyhunt.qc:29
int autocvar_g_balance_keyhunt_score_push
Definition sv_keyhunt.qc:31
int autocvar_g_balance_keyhunt_score_destroyed_ownfactor
Definition sv_keyhunt.qc:30

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

Referenced by kh_Key_Think().

◆ kh_ScoreRules()

void kh_ScoreRules ( int teams)

Definition at line 90 of file sv_keyhunt.qc.

91{
93 field_team(ST_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
94 field(SP_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
95 field(SP_KH_PUSHES, "pushes", 0);
96 field(SP_KH_DESTRUCTIONS, "destructions", SFL_LOWER_IS_BETTER);
97 field(SP_KH_PICKUPS, "pickups", 0);
98 field(SP_KH_KCKILLS, "kckills", 0);
99 field(SP_KH_LOSSES, "losses", SFL_LOWER_IS_BETTER);
100 });
101}
entity teams
Definition main.qh:58
const int SFL_LOWER_IS_BETTER
Lower scores are better (e.g.
Definition scores.qh:102
const int SFL_SORT_PRIO_SECONDARY
Scoring priority (NOTE: PRIMARY is used for fraglimit) NOTE: SFL_SORT_PRIO_SECONDARY value must be lo...
Definition scores.qh:133
const int SFL_SORT_PRIO_PRIMARY
Definition scores.qh:134
const int ST_KH_CAPS
Definition sv_keyhunt.qc:89
#define GameRules_scoring(teams, spprio, stprio, fields)
Definition sv_rules.qh:58

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

Referenced by kh_Initialize().

◆ kh_Scores_Event()

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

Definition at line 183 of file sv_keyhunt.qc.

184{
185 string s;
186 if(game_stopped)
187 return;
188
189 if(frags_player)
190 GameRules_scoring_add_team_float2int(player, SCORE, frags_player, float2int_decimal_fld, 1);
191
192 if(key && key.owner && frags_owner)
193 GameRules_scoring_add_team_float2int(key.owner, SCORE, frags_owner, float2int_decimal_fld, 1);
194
195 if(!autocvar_sv_eventlog) //output extra info to the console or text file
196 return;
197
198 s = strcat(":keyhunt:", what, ":", ftos(player.playerid), ":", ftos(frags_player));
199
200 if(key && key.owner)
201 s = strcat(s, ":", ftos(key.owner.playerid));
202 else
203 s = strcat(s, ":0");
204
205 s = strcat(s, ":", ftos(frags_owner), ":");
206
207 if(key)
208 s = strcat(s, key.netname);
209
210 GameLogEcho(s);
211}
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3
string ftos(float f)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
float float2int_decimal_fld
#define GameRules_scoring_add_team_float2int(client, fld, value, float_field, score_factor)
Definition sv_rules.qh:87

References autocvar_sv_eventlog, entity(), float2int_decimal_fld, ftos(), game_stopped, GameLogEcho(), GameRules_scoring_add_team_float2int, and strcat().

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

◆ kh_StartRound()

void kh_StartRound ( )

Definition at line 907 of file sv_keyhunt.qc.

908{
909 if(time < game_starttime)
910 {
912 return;
913 }
914
916 {
918 return;
919 }
920
921 Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT);
922 Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_KEYHUNT_OTHER);
923
924 for(int i = 0; i < AVAILABLE_TEAMS; ++i)
925 {
926 int teem = kh_Team_ByID(i);
927 int players = 0;
928 entity my_player = NULL;
930 if(!IS_DEAD(it) && !PHYS_INPUT_BUTTON_CHAT(it) && it.team == teem)
931 {
932 ++players;
933 if(random() * players <= 1)
934 my_player = it;
935 }
936 });
937 kh_Key_Spawn(my_player, 360 * i / AVAILABLE_TEAMS, i);
938 }
939
940 kh_tracking_enabled = false;
942 {
943 Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_SCAN, autocvar_g_balance_keyhunt_delay_tracking);
945 }
946}
float game_starttime
Definition stats.qh:82
void kh_EnableTrackingDevice()
int kh_GetMissingTeams()
void kh_Key_Spawn(entity initial_owner, float _angle, float i)
float autocvar_g_balance_keyhunt_delay_tracking
Definition sv_keyhunt.qc:15

References autocvar_g_balance_keyhunt_delay_tracking, AVAILABLE_TEAMS, entity(), FOREACH_CLIENT, game_starttime, IS_DEAD, IS_PLAYER, kh_Controller_SetThink(), kh_EnableTrackingDevice(), kh_GetMissingTeams(), kh_Key_Spawn(), kh_Team_ByID(), kh_tracking_enabled, kh_WaitForPlayers(), Kill_Notification(), NULL, PHYS_INPUT_BUTTON_CHAT, players, random(), Send_Notification(), and time.

Referenced by kh_FinishRound(), and kh_WaitForPlayers().

◆ kh_Team_ByID()

int kh_Team_ByID ( int t)

Definition at line 67 of file sv_keyhunt.qc.

68{
69 if(t == 0) return NUM_TEAM_1;
70 if(t == 1) return NUM_TEAM_2;
71 if(t == 2) return NUM_TEAM_3;
72 if(t == 3) return NUM_TEAM_4;
73 return 0;
74}

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().

◆ kh_update_state()

void kh_update_state ( )

Definition at line 126 of file sv_keyhunt.qc.

127{
128 entity key;
129 int f;
130 int s = 0;
131 FOR_EACH_KH_KEY(key)
132 {
133 if(key.owner)
134 f = key.team;
135 else
136 f = 30;
137 s |= (32 ** key.count) * f;
138 }
139
140 FOREACH_CLIENT(true, { STAT(OBJECTIVE_STATUS, it) = s; });
141
142 FOR_EACH_KH_KEY(key)
143 {
144 if(key.owner)
145 STAT(OBJECTIVE_STATUS, key.owner) |= (32 ** key.count) * 31;
146 }
147 //print(ftos((nextent(NULL)).kh_state), "\n");
148}

References entity(), FOR_EACH_KH_KEY, FOREACH_CLIENT, and STAT.

Referenced by kh_Key_AssignTo(), and kh_Key_Remove().

◆ kh_WaitForPlayers()

void kh_WaitForPlayers ( )

Definition at line 873 of file sv_keyhunt.qc.

874{
875 static int prev_missing_teams_mask;
877 if(time < game_starttime)
878 {
880 return;
881 }
882
884 {
885 Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_ROUNDSTART, autocvar_g_balance_keyhunt_delay_round);
887 }
888 else
889 {
890 if(player_count != 0)
891 {
892 if(prev_missing_teams_mask != missing_teams_mask)
893 prev_missing_teams_mask = missing_teams_mask;
894 }
896 }
897}
int player_count
Definition api.qh:103
int missing_teams_mask
Definition stats.qh:85

References autocvar_g_balance_keyhunt_delay_round, game_starttime, kh_Controller_SetThink(), kh_GetMissingTeams(), kh_StartRound(), kh_WaitForPlayers(), missing_teams_mask, NULL, player_count, Send_Notification(), and time.

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

◆ kh_waypointsprite_visible_for_bot()

bool kh_waypointsprite_visible_for_bot ( entity this,
entity e )

Definition at line 1019 of file sv_keyhunt.qc.

1020{
1021 entity key_wp = e.waypointsprite_attachedforcarrier;
1022 if (!key_wp)
1023 if (!key_wp.waypointsprite_visible_for_player(key_wp, this, WaypointSprite_getviewentity(this)))
1024 { // has no waypoint, or waypoint not visible
1025 if (!checkpvs(this.origin + this.view_ofs, e)) // key cannot be seen
1026 return false;
1027 }
1028 return true;
1029}
float checkpvs(vector viewpos, entity viewee)
vector view_ofs
Definition progsdefs.qc:151
entity WaypointSprite_getviewentity(entity e)

References checkpvs(), entity(), origin, view_ofs, and WaypointSprite_getviewentity().

Referenced by havocbot_goalrating_kh().

◆ kh_WinnerTeam()

void kh_WinnerTeam ( int winner_team)

Definition at line 522 of file sv_keyhunt.qc.

523{
524 // all key carriers get some points
525 entity key;
528 // twice the score for 3 team games, three times the score for 4 team games!
529 // note: for a win by destroying the key, this should NOT be applied
530 FOR_EACH_KH_KEY(key)
531 {
532 float f = DistributeEvenly_Get(1);
533 kh_Scores_Event(key.owner, key, "capture", f, 0);
534 GameRules_scoring_add_team(key.owner, KH_CAPS, 1);
536 }
537
538 bool first = true;
539 string keyowner = "";
540 FOR_EACH_KH_KEY(key)
541 if(key.owner.kh_next == key)
542 {
543 if(!first)
544 keyowner = strcat(keyowner, ", ");
545 keyowner = key.owner.netname;
546 first = false;
547 }
548
549 Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, APP_TEAM_NUM(winner_team, CENTER_ROUND_TEAM_WIN));
550 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(winner_team, INFO_KEYHUNT_CAPTURE), keyowner);
551
552 first = true;
553 vector firstorigin = '0 0 0', lastorigin = '0 0 0', midpoint = '0 0 0';
554 FOR_EACH_KH_KEY(key)
555 {
556 vector thisorigin = kh_AttachedOrigin(key);
557 //dprint("Key origin: ", vtos(thisorigin), "\n");
558 midpoint += thisorigin;
559
560 if(!first)
561 {
562 // TODO: this effect has been replaced due to a possible crash it causes
563 // see https://gitlab.com/xonotic/darkplaces/issues/123
564 //te_lightning2(NULL, lastorigin, thisorigin);
565 Send_Effect(EFFECT_TR_NEXUIZPLASMA, lastorigin, thisorigin, 1);
566 }
567 lastorigin = thisorigin;
568 if(first)
569 firstorigin = thisorigin;
570 first = false;
571 }
572 if(AVAILABLE_TEAMS > 2)
573 {
574 //te_lightning2(NULL, lastorigin, firstorigin); // TODO see above
575 Send_Effect(EFFECT_TR_NEXUIZPLASMA, lastorigin, firstorigin, 1);
576 }
577 midpoint = midpoint * (1 / AVAILABLE_TEAMS);
578 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
579
580 play2all(SND(KH_CAPTURE));
582}
void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
Definition all.qc:120
void nades_GiveBonus(entity player, float score)
Definition sv_nades.qc:445
vector kh_AttachedOrigin(entity e)
int autocvar_g_balance_keyhunt_score_capture
Definition sv_keyhunt.qc:26
int autocvar_g_nades_bonus_score_high
Definition sv_nades.qh:38
#define GameRules_scoring_add_team(client, fld, value)
Definition sv_rules.qh:89

References APP_TEAM_NUM, autocvar_g_balance_keyhunt_score_capture, autocvar_g_nades_bonus_score_high, AVAILABLE_TEAMS, DistributeEvenly_Get(), DistributeEvenly_Init(), entity(), FOR_EACH_KH_KEY, GameRules_scoring_add_team, kh_AttachedOrigin(), kh_FinishRound(), kh_Scores_Event(), nades_GiveBonus(), NULL, play2all(), Send_Effect(), Send_Notification(), SND, strcat(), Team_ColorRGB(), and vector.

Referenced by kh_Key_Think().

◆ nades_GiveBonus()

void nades_GiveBonus ( entity player,
float score )

Definition at line 445 of file sv_nades.qc.

446{
448 && IS_REAL_CLIENT(player) && IS_PLAYER(player) && STAT(NADE_BONUS, player) < autocvar_g_nades_bonus_max
449 && !IS_DEAD(player) && !STAT(FROZEN, player))
450 {
451 if (STAT(NADE_BONUS_SCORE, player) < 1)
452 STAT(NADE_BONUS_SCORE, player) += score / autocvar_g_nades_bonus_score_max;
453
454 if (STAT(NADE_BONUS_SCORE, player) >= 1)
455 {
456 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS);
457 play2(player, SND(NADE_BONUS));
458 ++STAT(NADE_BONUS, player);
459 --STAT(NADE_BONUS_SCORE, player);
460 }
461 }
462}
void play2(entity e, string filename)
Definition all.qc:116
bool autocvar_g_nades
Definition sv_nades.qh:5
bool autocvar_g_nades_bonus
Definition sv_nades.qh:27
int autocvar_g_nades_bonus_max
Definition sv_nades.qh:32
int autocvar_g_nades_bonus_score_max
Definition sv_nades.qh:33
#define IS_REAL_CLIENT(v)
Definition utils.qh:17

Referenced by kh_WinnerTeam().

◆ void()

Variable Documentation

◆ autocvar_g_balance_keyhunt_carrier_damage

vector autocvar_g_balance_keyhunt_carrier_damage

Definition at line 21 of file sv_keyhunt.qc.

Referenced by if().

◆ autocvar_g_balance_keyhunt_carrier_force

vector autocvar_g_balance_keyhunt_carrier_force

Definition at line 22 of file sv_keyhunt.qc.

Referenced by if().

◆ autocvar_g_balance_keyhunt_damageforcescale

float autocvar_g_balance_keyhunt_damageforcescale

Definition at line 10 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 11 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 12 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 13 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 14 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 15 of file sv_keyhunt.qc.

Referenced by kh_StartRound().

◆ autocvar_g_balance_keyhunt_dropvelocity

float autocvar_g_balance_keyhunt_dropvelocity

Definition at line 17 of file sv_keyhunt.qc.

Referenced by kh_Key_DropAll().

◆ autocvar_g_balance_keyhunt_maxdist

float autocvar_g_balance_keyhunt_maxdist

Definition at line 18 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ autocvar_g_balance_keyhunt_noncarrier_damage

vector autocvar_g_balance_keyhunt_noncarrier_damage

Definition at line 23 of file sv_keyhunt.qc.

◆ autocvar_g_balance_keyhunt_noncarrier_force

vector autocvar_g_balance_keyhunt_noncarrier_force

Definition at line 24 of file sv_keyhunt.qc.

◆ autocvar_g_balance_keyhunt_protecttime

float autocvar_g_balance_keyhunt_protecttime

Definition at line 19 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 16 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 26 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 27 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 28 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 29 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 30 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 31 of file sv_keyhunt.qc.

Referenced by kh_LoserTeam().

◆ autocvar_g_balance_keyhunt_throwvelocity

float autocvar_g_balance_keyhunt_throwvelocity

Definition at line 32 of file sv_keyhunt.qc.

Referenced by kh_Key_DropOne().

◆ autocvar_g_keyhunt_teams_override

int autocvar_g_keyhunt_teams_override

Definition at line 35 of file sv_keyhunt.qc.

Referenced by kh_Initialize().

◆ float2int_decimal_fld

float float2int_decimal_fld

Definition at line 182 of file sv_keyhunt.qc.

◆ frag_target

entity frag_target = M_ARGV(2, entity)

Definition at line 1223 of file sv_keyhunt.qc.

◆ kh_controller

entity kh_controller

Definition at line 76 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 153 of file sv_keyhunt.qc.

Referenced by kh_Controller_SetThink(), and kh_Controller_Think().

◆ kh_dropperteam

int kh_dropperteam

Definition at line 81 of file sv_keyhunt.qc.

◆ kh_droptime

float kh_droptime

Definition at line 80 of file sv_keyhunt.qc.

Referenced by kh_Key_Touch().

◆ kh_interferemsg_team

int kh_interferemsg_team

Definition at line 77 of file sv_keyhunt.qc.

Referenced by kh_Key_AssignTo(), and kh_Key_Think().

◆ kh_interferemsg_time

float kh_interferemsg_time

Definition at line 78 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 56 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ kh_key_carried

int kh_key_carried

Definition at line 85 of file sv_keyhunt.qc.

Referenced by kh_Initialize(), and kh_Key_Attach().

◆ kh_key_dropped

int kh_key_dropped

Definition at line 85 of file sv_keyhunt.qc.

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

◆ KH_KEY_MAX

const vector KH_KEY_MAX = '25 25 4'

Definition at line 55 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ KH_KEY_MIN

const vector KH_KEY_MIN = '-25 -25 -46'

Definition at line 54 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ KH_KEY_WP_ZSHIFT

const float KH_KEY_WP_ZSHIFT = 20

Definition at line 52 of file sv_keyhunt.qc.

Referenced by kh_Key_Spawn().

◆ KH_KEY_XYDIST

const float KH_KEY_XYDIST = 24

Definition at line 49 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ KH_KEY_XYSPEED

const float KH_KEY_XYSPEED = 45

Definition at line 50 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ KH_KEY_ZSHIFT

const float KH_KEY_ZSHIFT = 22

Definition at line 48 of file sv_keyhunt.qc.

Referenced by kh_Key_Attach().

◆ kh_next

◆ kh_no_radar_circles

bool kh_no_radar_circles

Definition at line 58 of file sv_keyhunt.qc.

Referenced by kh_FinishRound(), and kh_Key_AssignTo().

◆ kh_prev

entity kh_prev

Definition at line 79 of file sv_keyhunt.qc.

◆ kh_previous_owner_playerid

int kh_previous_owner_playerid

Definition at line 83 of file sv_keyhunt.qc.

◆ previous_owner

entity previous_owner

Definition at line 82 of file sv_keyhunt.qc.

◆ siren_time

float siren_time

Definition at line 65 of file sv_keyhunt.qc.

Referenced by kh_Key_Think().

◆ ST_KH_CAPS

const int ST_KH_CAPS = 1

Definition at line 89 of file sv_keyhunt.qc.

Referenced by kh_ScoreRules().