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)
28 if(autocvar_g_campcheck_interval)
32 // calculate player movement (in 2 dimensions only, so jumping on one spot doesn't count as movement)
33 dist = self.prevorigin - self.origin;
35 self.campcheck_traveled_distance += fabs(vlen(dist));
37 if((autocvar_g_campaign && !campaign_bots_may_start) || (time < game_starttime) || (round_handler_IsActive() && !round_handler_IsRoundStarted()))
39 self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
40 self.campcheck_traveled_distance = 0;
43 if(time > self.campcheck_nextcheck)
45 if(self.campcheck_traveled_distance < autocvar_g_campcheck_distance)
47 Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_CAMPCHECK);
49 Damage(self.vehicle, self, self, autocvar_g_campcheck_damage * 2, DEATH_CAMP, self.vehicle.origin, '0 0 0');
51 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');
53 self.campcheck_nextcheck = time + autocvar_g_campcheck_interval;
54 self.campcheck_traveled_distance = 0;
61 MUTATOR_HOOKFUNCTION(campcheck_PlayerSpawn)
63 self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
64 self.campcheck_traveled_distance = 0;
69 MUTATOR_HOOKFUNCTION(campcheck_BuildMutatorsString)
71 ret_string = strcat(ret_string, ":CampCheck");
75 MUTATOR_DEFINITION(mutator_campcheck)
77 MUTATOR_HOOK(PlayerDies, campcheck_PlayerDies, CBC_ORDER_ANY);
78 MUTATOR_HOOK(PlayerDamage_Calculate, campcheck_PlayerDamage, CBC_ORDER_ANY);
79 MUTATOR_HOOK(PlayerPreThink, campcheck_PlayerThink, CBC_ORDER_ANY);
80 MUTATOR_HOOK(PlayerSpawn, campcheck_PlayerSpawn, CBC_ORDER_ANY);
81 MUTATOR_HOOK(BuildMutatorsString, campcheck_BuildMutatorsString, CBC_ORDER_ANY);