set g_lms_lives_override -1
set g_lms_extra_lives 0
set g_lms_regenerate 0
-set g_lms_campcheck_interval 10
-set g_lms_campcheck_damage 100
-set g_lms_campcheck_distance 1800
set g_lms_last_join 3 "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives"
set g_lms_join_anytime 1 "if true, new players can join, but get same amount of lives as the worst player"
set g_riflearena_rifle_secondary_animtime 0.15
set g_riflearena_rifle_secondary_refire 0.15
set g_riflearena_rifle_secondary_damage 40
+
+
+// ============
+// camp check
+// ============
+set g_campcheck 0 "damages campers every few seconds"
+set g_campcheck_interval 10
+set g_campcheck_damage 100
+set g_campcheck_distance 1800
MSG_CENTER_NOTIF(1, CENTER_COUNTDOWN_ROUNDSTOP, 0, 0, "", CPID_ROUND, "2 0", _("^F4Round cannot start"), "") \
MSG_CENTER_NOTIF(1, CENTER_ROUND_TIED, 0, 0, "", CPID_ROUND, "0 0", _("^BGRound tied"), "") \
MSG_CENTER_NOTIF(1, CENTER_ROUND_OVER, 0, 0, "", CPID_ROUND, "0 0", _("^BGRound over, there's no winner"), "") \
+ MSG_CENTER_NOTIF(1, CENTER_CAMPCHECK, 0, 0, "", CPID_CAMPCHECK, "0 0", _("^F2Don't camp!"), "") \
MSG_CENTER_NOTIF(1, CENTER_CTF_CAPTURESHIELD_FREE, 0, 0, "", CPID_CTF_CAPSHIELD, "0 0", _("^BGYou are now free.\n^BGFeel free to ^F2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \
MSG_CENTER_NOTIF(1, CENTER_CTF_CAPTURESHIELD_SHIELDED, 0, 0, "", CPID_CTF_CAPSHIELD, "0 0", _("^BGYou are now ^F1shielded^BG from the flag\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \
MULTITEAM_CENTER(1, CENTER_CTF_CAPTURE_, 2, 0, 0, "", CPID_CTF_LOWPRIO, "0 0", _("^BGYou captured the ^TC^TT^BG flag!"), "") \
MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_WAIT, 0, 4, "missing_teams", CPID_KEYHUNT_OTHER, "0 0", _("^BGWaiting for players to join...\nNeed active players for: %s"), "") \
MSG_CENTER_NOTIF(1, CENTER_MISSING_TEAMS, 0, 4, "missing_teams", CPID_MISSING_TEAMS, "-1 0", _("^BGWaiting for players to join...\nNeed active players for: %s"), "") \
MSG_CENTER_NOTIF(1, CENTER_MISSING_PLAYERS, 0, 1, "f1", CPID_MISSING_PLAYERS, "-1 0", _("^BGWaiting for %s player(s) to join..."), "") \
- MSG_CENTER_NOTIF(1, CENTER_LMS_CAMPCHECK, 0, 0, "", CPID_LMS_CAMP, "0 0", _("^F2Don't camp!"), "") \
MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO, 0, 0, "", CPID_MINSTA_FINDAMMO, "1 9", _("^F4^COUNT^BG left to find some ammo!"), "") \
MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO_FIRST, 0, 0, "", CPID_MINSTA_FINDAMMO, "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("^BGGet some ammo! ^F4^COUNT^BG left!")) \
MSG_CENTER_NOTIF(1, CENTER_MINSTA_LIVES_REMAINING, 0, 1, "f1", NO_CPID, "0 0", _("^F2Extra lives remaining: ^K1%s"), "") \
#define autocvar_g_keyhunt_point_limit cvar("g_keyhunt_point_limit")
float autocvar_g_keyhunt_teams;
float autocvar_g_keyhunt_teams_override;
-float autocvar_g_lms_campcheck_damage;
-float autocvar_g_lms_campcheck_distance;
float autocvar_g_lms_extra_lives;
-float autocvar_g_lms_campcheck_interval;
float autocvar_g_lms_join_anytime;
float autocvar_g_lms_last_join;
#define autocvar_g_lms_lives_override cvar("g_lms_lives_override")
float autocvar_g_nades_nade_radius;
float autocvar_g_nades_nade_force;
float autocvar_g_nades_nade_newton_style;
+float autocvar_g_campcheck_damage;
+float autocvar_g_campcheck_distance;
+float autocvar_g_campcheck_interval;
CHECK_MUTATOR_ADD("g_nades", mutator_nades, 1);
CHECK_MUTATOR_ADD("g_sandbox", sandbox, 1);
CHECK_MUTATOR_ADD("g_riflearena", mutator_riflearena, !cvar("g_minstagib"));
+ CHECK_MUTATOR_ADD("g_campcheck", mutator_campcheck, 1);
#undef CHECK_MUTATOR_ADD
return FALSE;
}
-MUTATOR_HOOKFUNCTION(lms_PlayerSpawn)
-{
- self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
- self.lms_traveled_distance = 0;
-
- return FALSE;
-}
-
MUTATOR_HOOKFUNCTION(lms_PlayerDies)
{
self.respawn_flags |= RESPAWN_FORCE;
if(self.deadflag == DEAD_DYING)
self.deadflag = DEAD_RESPAWNING;
- if not(self.deadflag)
- if(autocvar_g_lms_campcheck_interval)
- {
- vector dist;
-
- // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
- dist = self.prevorigin - self.origin;
- dist_z = 0;
- self.lms_traveled_distance += fabs(vlen(dist));
-
- if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime))
- {
- self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
- self.lms_traveled_distance = 0;
- }
-
- if(time > self.lms_nextcheck)
- {
- if(self.lms_traveled_distance < autocvar_g_lms_campcheck_distance)
- {
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_CAMPCHECK);
- if(self.vehicle)
- Damage(self.vehicle, self, self, autocvar_g_lms_campcheck_damage * 2, DEATH_CAMP, self.vehicle.origin, '0 0 0');
- else
- Damage(self, self, self, bound(0, autocvar_g_lms_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0');
- }
- self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval;
- self.lms_traveled_distance = 0;
- }
- }
-
- return FALSE;
-}
-
-MUTATOR_HOOKFUNCTION(lms_PlayerDamage)
-{
- if(IS_PLAYER(frag_target))
- if(IS_PLAYER(frag_attacker))
- if(frag_attacker != frag_target)
- {
- frag_target.lms_traveled_distance = autocvar_g_lms_campcheck_distance;
- frag_attacker.lms_traveled_distance = autocvar_g_lms_campcheck_distance;
- }
-
return FALSE;
}
MUTATOR_HOOK(reset_map_global, lms_ResetMap, CBC_ORDER_ANY);
MUTATOR_HOOK(reset_map_players, lms_ResetPlayers, CBC_ORDER_ANY);
MUTATOR_HOOK(PutClientInServer, lms_PlayerPreSpawn, CBC_ORDER_ANY);
- MUTATOR_HOOK(PlayerSpawn, lms_PlayerSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerDies, lms_PlayerDies, CBC_ORDER_ANY);
MUTATOR_HOOK(MakePlayerObserver, lms_RemovePlayer, CBC_ORDER_ANY);
MUTATOR_HOOK(ClientConnect, lms_ClientConnect, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerPreThink, lms_PlayerThink, CBC_ORDER_ANY);
- MUTATOR_HOOK(PlayerDamage_Calculate, lms_PlayerDamage, CBC_ORDER_ANY);
MUTATOR_HOOK(ForbidThrowCurrentWeapon, lms_ForbidThrowing, CBC_ORDER_ANY);
MUTATOR_HOOK(GiveFragsForKill, lms_GiveFragsForKill, CBC_ORDER_ANY);
MUTATOR_HOOK(SetStartItems, lms_SetStartItems, CBC_ORDER_ANY);
// lives related defs
float lms_lowest_lives;
float lms_next_place;
-float LMS_NewPlayerLives();
-
-// camp check
-.float lms_nextcheck;
-.float lms_traveled_distance;
\ No newline at end of file
+float LMS_NewPlayerLives();
\ No newline at end of file
--- /dev/null
+.float campcheck_nextcheck;
+.float campcheck_traveled_distance;
+
+MUTATOR_HOOKFUNCTION(campcheck_PlayerDies)
+{
+ Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_CAMPCHECK);
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(campcheck_PlayerDamage)
+{
+ if(IS_PLAYER(frag_target))
+ if(IS_PLAYER(frag_attacker))
+ if(frag_attacker != frag_target)
+ {
+ frag_target.campcheck_traveled_distance = autocvar_g_campcheck_distance;
+ frag_attacker.campcheck_traveled_distance = autocvar_g_campcheck_distance;
+ }
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(campcheck_PlayerThink)
+{
+ if(IS_PLAYER(self))
+ if(self.deadflag == DEAD_NO)
+ if(autocvar_g_campcheck_interval)
+ {
+ vector dist;
+
+ // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
+ dist = self.prevorigin - self.origin;
+ dist_z = 0;
+ self.campcheck_traveled_distance += fabs(vlen(dist));
+
+ if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
+ {
+ self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
+ self.campcheck_traveled_distance = 0;
+ }
+
+ if(time > self.campcheck_nextcheck)
+ {
+ if(self.campcheck_traveled_distance < autocvar_g_campcheck_distance)
+ {
+ Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_CAMPCHECK);
+ if(self.vehicle)
+ Damage(self.vehicle, self, self, autocvar_g_campcheck_damage * 2, DEATH_CAMP, self.vehicle.origin, '0 0 0');
+ else
+ Damage(self, self, self, bound(0, autocvar_g_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0');
+ }
+ self.campcheck_nextcheck = time + autocvar_g_campcheck_interval;
+ self.campcheck_traveled_distance = 0;
+ }
+ }
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(campcheck_PlayerSpawn)
+{
+ self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
+ self.campcheck_traveled_distance = 0;
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(campcheck_BuildMutatorsString)
+{
+ ret_string = strcat(ret_string, ":CampCheck");
+ return FALSE;
+}
+
+MUTATOR_DEFINITION(mutator_campcheck)
+{
+ MUTATOR_HOOK(PlayerDies, campcheck_PlayerDies, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerDamage_Calculate, campcheck_PlayerDamage, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerPreThink, campcheck_PlayerThink, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerSpawn, campcheck_PlayerSpawn, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsString, campcheck_BuildMutatorsString, CBC_ORDER_ANY);
+
+ return FALSE;
+}
MUTATOR_DECLARATION(mutator_melee_only);
MUTATOR_DECLARATION(mutator_nades);
MUTATOR_DECLARATION(mutator_riflearena);
+MUTATOR_DECLARATION(mutator_campcheck);
MUTATOR_DECLARATION(sandbox);
mutators/mutator_melee_only.qc
mutators/mutator_nades.qc
mutators/mutator_riflearena.qc
+mutators/mutator_campcheck.qc
../warpzonelib/anglestransform.qc
../warpzonelib/mathlib.qc