1 .float campcheck_nextcheck;
2 .float campcheck_traveled_distance;
4 MUTATOR_HOOKFUNCTION(campcheck_PlayerDies)
6 Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_CAMPCHECK);
11 MUTATOR_HOOKFUNCTION(campcheck_PlayerDamage)
13 if(IS_PLAYER(frag_target))
14 if(IS_PLAYER(frag_attacker))
15 if(frag_attacker != frag_target)
17 frag_target.campcheck_traveled_distance = autocvar_g_campcheck_distance;
18 frag_attacker.campcheck_traveled_distance = autocvar_g_campcheck_distance;
24 MUTATOR_HOOKFUNCTION(campcheck_PlayerThink)
27 if(self.deadflag == DEAD_NO)
29 if(autocvar_g_campcheck_interval)
33 // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
34 dist = self.prevorigin - self.origin;
36 self.campcheck_traveled_distance += fabs(vlen(dist));
38 if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
40 self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
41 self.campcheck_traveled_distance = 0;
44 if(time > self.campcheck_nextcheck)
46 if(self.campcheck_traveled_distance < autocvar_g_campcheck_distance)
48 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_CAMPCHECK);
50 Damage(self.vehicle, self, self, autocvar_g_campcheck_damage * 2, DEATH_CAMP, self.vehicle.origin, '0 0 0');
52 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');
54 self.campcheck_nextcheck = time + autocvar_g_campcheck_interval;
55 self.campcheck_traveled_distance = 0;
62 MUTATOR_HOOKFUNCTION(campcheck_PlayerSpawn)
64 self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
65 self.campcheck_traveled_distance = 0;
70 MUTATOR_HOOKFUNCTION(campcheck_BuildMutatorsString)
72 ret_string = strcat(ret_string, ":CampCheck");
76 MUTATOR_DEFINITION(mutator_campcheck)
78 MUTATOR_HOOK(PlayerDies, campcheck_PlayerDies, CBC_ORDER_ANY);
79 MUTATOR_HOOK(PlayerDamage_Calculate, campcheck_PlayerDamage, CBC_ORDER_ANY);
80 MUTATOR_HOOK(PlayerPreThink, campcheck_PlayerThink, CBC_ORDER_ANY);
81 MUTATOR_HOOK(PlayerSpawn, campcheck_PlayerSpawn, CBC_ORDER_ANY);
82 MUTATOR_HOOK(BuildMutatorsString, campcheck_BuildMutatorsString, CBC_ORDER_ANY);