set g_keepawayball_trail_color 254 "particle trail color from player/ball"
set g_keepawayball_damageforcescale 2 "scale of force which is applied to the ball by weapons/explosions/etc"
set g_keepawayball_respawntime 10 "if no one picks up the ball, how long to wait until the ball respawns"
+set g_keepawayball_tracking 1 "\"0\" = don't show a waypoint on the ball/ballcarrier, \"1\" = always show a waypoint, \"2\" = only show a waypoint if the ball is dropped"
// ==========
set g_balance_keyhunt_delay_damage_return 5 "time a key takes to automatically destroy itself if it falls into lava/slime/trigger hurt"
set g_balance_keyhunt_delay_return 60 "time a key takes to destroy itself if dropped"
set g_balance_keyhunt_delay_round 5
-set g_balance_keyhunt_delay_tracking 10
+set g_balance_keyhunt_delay_tracking 10 "time after which waypoints show on keys and key carriers, if negative they don't show"
set g_balance_keyhunt_delay_fadeout 2
set g_balance_keyhunt_delay_collect 1.5
set g_balance_keyhunt_maxdist 150
set g_tkaball_trail_color 254 "particle trail color from player/ball"
set g_tkaball_damageforcescale 2 "scale of force which is applied to the ball by weapons/explosions/etc"
set g_tkaball_respawntime 10 "if no one picks up the ball, how long to wait until the ball respawns"
+set g_tkaball_tracking 1 "\"0\" = don't show a waypoint on the ball/ballcarrier, \"1\" = always show a waypoint, \"2\" = only show a waypoint if the ball is dropped"
// ==========
// survival
// team waypoints
//if(CTF_SAMETEAM(wp_owner.flagcarried, wp_owner)) { return false; }
- if(SAME_TEAM(wp_owner, e)) { return false; }
- if(!IS_PLAYER(e)) { return false; }
+ if(SAME_TEAM(wp_owner, e) || !IS_PLAYER(e))
+ return false;
+ if(IS_INVISIBLE(wp_owner))
+ return false; // hide the waypointsprite if the owner is invisible
return true;
}
int autocvar_g_keepawayball_effects;
float autocvar_g_keepawayball_respawntime;
int autocvar_g_keepawayball_trail_color;
+int autocvar_g_keepawayball_tracking;
bool ka_ballcarrier_waypointsprite_visible_for_player(entity this, entity player, entity view) // runs on waypoints which are attached to ballcarriers, updates once per frame
{
- if(view.ballcarried)
- if(IS_SPEC(player))
- return false; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
-
- // TODO: Make the ballcarrier lack a waypointsprite whenever they have the invisibility powerup
+ if(view.ballcarried && IS_SPEC(player))
+ return false; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
+ if(IS_SPEC(player) || warmup_stage)
+ return true;
+ if(IS_INVISIBLE(this.owner))
+ return false; // hide the waypointsprite if the owner is invisible
- return true;
+ return autocvar_g_keepawayball_tracking == 1;
}
void ka_EventLog(string mode, entity actor) // use an alias for easy changing and quick editing later
Send_Effect(EFFECT_KA_BALL_RESPAWN, oldballorigin, '0 0 0', 1);
Send_Effect(EFFECT_KA_BALL_RESPAWN, this.origin, '0 0 0', 1);
- WaypointSprite_Spawn(WP_KaBall, 0, 0, this, '0 0 64', NULL, this.team, this, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
- WaypointSprite_Ping(this.waypointsprite_attachedforcarrier);
+ if(autocvar_g_keepawayball_tracking || warmup_stage)
+ {
+ WaypointSprite_Spawn(WP_KaBall, 0, 0, this, '0 0 64', NULL, this.team, this, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
+ WaypointSprite_Ping(this.waypointsprite_attachedforcarrier);
+ }
sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
}
sound(NULL, CH_TRIGGER, SND_KA_DROPPED, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
// waypoints
- WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
- WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
- WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
+ if(autocvar_g_keepawayball_tracking || warmup_stage)
+ {
+ WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
+ WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
+ WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
+ }
ka_PlayerReset(player);
}
}
entity kh_controller;
-//bool kh_tracking_enabled;
int kh_teams;
int kh_interferemsg_team;
float kh_interferemsg_time;
bool kh_KeyCarrier_waypointsprite_visible_for_player(entity this, entity player, entity view) // runs all the time
{
- if(!IS_PLAYER(view) || DIFF_TEAM(this, view))
- if(!kh_tracking_enabled)
- return false;
+ if(view.kh_next && IS_SPEC(player))
+ return false; // we don't want spectators of key carriers to see the attached waypoint on the top of their screen
+ if(IS_SPEC(player) || warmup_stage || SAME_TEAM(player, this.owner))
+ return true;
+ if(IS_INVISIBLE(this.owner))
+ return false; // hide the waypointsprite if the owner is invisible
- return true;
+ return kh_tracking_enabled;
}
bool kh_Key_waypointsprite_visible_for_player(entity this, entity player, entity view)
{
+ if(IS_SPEC(player) || warmup_stage)
+ return true;
if(!kh_tracking_enabled)
return false;
- if(!this.owner)
- return true;
- if(!this.owner.owner)
- return true;
- return false; // draw only when key is not owned
+
+ return !this.owner || !this.owner.owner; // draw only when key is not owned
}
void kh_update_state()
}
kh_tracking_enabled = false;
- Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_SCAN, autocvar_g_balance_keyhunt_delay_tracking);
- kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, kh_EnableTrackingDevice);
+ if(autocvar_g_balance_keyhunt_delay_tracking >= 0)
+ {
+ Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_KEYHUNT_SCAN, autocvar_g_balance_keyhunt_delay_tracking);
+ kh_Controller_SetThink(autocvar_g_balance_keyhunt_delay_tracking, kh_EnableTrackingDevice);
+ }
}
float kh_HandleFrags(entity attacker, entity targ, float f) // adds to the player score
int autocvar_g_tkaball_effects;
float autocvar_g_tkaball_respawntime;
int autocvar_g_tkaball_trail_color;
+int autocvar_g_tkaball_tracking;
bool tka_ballcarrier_waypointsprite_visible_for_player(entity this, entity player, entity view) // runs on waypoints which are attached to ballcarriers, updates once per frame
{
- if(view.ballcarried)
- if(IS_SPEC(player))
- return false; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
-
- // TODO: Make the ballcarrier lack a waypointsprite whenever they have the invisibility powerup
+ if(view.ballcarried && IS_SPEC(player))
+ return false; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
+ if(IS_SPEC(player) || warmup_stage || SAME_TEAM(player, this.owner))
+ return true;
+ if(IS_INVISIBLE(this.owner))
+ return false; // hide the waypointsprite if the owner is invisible
- return true;
+ return autocvar_g_tkaball_tracking == 1;
}
void tka_EventLog(string mode, entity actor) // use an alias for easy changing and quick editing later
Send_Effect(EFFECT_KA_BALL_RESPAWN, oldballorigin, '0 0 0', 1);
Send_Effect(EFFECT_KA_BALL_RESPAWN, this.origin, '0 0 0', 1);
- WaypointSprite_Spawn(WP_KaBall, 0, 0, this, '0 0 64', NULL, this.team, this, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
- WaypointSprite_Ping(this.waypointsprite_attachedforcarrier);
+ if(autocvar_g_tkaball_tracking || warmup_stage)
+ {
+ WaypointSprite_Spawn(WP_KaBall, 0, 0, this, '0 0 64', NULL, this.team, this, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
+ WaypointSprite_Ping(this.waypointsprite_attachedforcarrier);
+ }
sound(this, CH_TRIGGER, SND_KA_RESPAWN, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
}
sound(NULL, CH_TRIGGER, SND_KA_DROPPED, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
// waypoints
- WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
- WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
- WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
+ if(autocvar_g_tkaball_tracking || warmup_stage)
+ {
+ WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
+ WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
+ WaypointSprite_Ping(ball.waypointsprite_attachedforcarrier);
+ }
tka_PlayerReset(player);
}
#define IS_MOVABLE(v) ((IS_PLAYER(v) || IS_MONSTER(v)) && !STAT(FROZEN, v))
#define IS_DEAD(s) ((s).deadflag != DEAD_NO)
+#define IS_INVISIBLE(v) (v.alpha <= 0.25 || StatusEffects_active(STATUSEFFECT_Invisibility, v) || MUTATOR_IS_ENABLED(cloaked))
#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))