set g_ctf_flag_return_carried_radius 100 "allow flags to be returned by carrier if base is within this radius"
set g_ctf_flag_return_time 30 "automatically return the flag to base after this amount of time"
set g_ctf_flag_return_dropped 100 "automatically return the flag to base if dropped within this distance from base (in qu)"
-set g_ctf_flag_return_damage 0 "allow the flag to be damaged, reducing time needed to automatically return to base"
+set g_ctf_flag_return_damage 0 "allow the flag to be damaged when dropped, reducing time needed to automatically return to base; initial health is defined by g_ctf_flag_health"
set g_ctf_flag_return_damage_delay 0 "how much time the flag takes to automatically return to base if it falls into lava/slime/trigger hurt"
set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
set g_ctf_flag_waypoint 1 "show a waypoint at the flag for easy discovery and directions"
set g_ctf_portalteleport 0 "allow flag carriers to go through portals made in portal gun without dropping the flag"
set g_ctf_reverse 0 "if enabled, you score by bringing your own flag to an enemy's flag in their base"
set g_ctf_flag_collect_delay 1
-set g_ctf_flag_health 0
+set g_ctf_flag_health 0 "secondary setting of g_ctf_flag_return_damage that defines initial health of the flag when dropped. Is set to 0 initial health defaults to 100"
set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players"
set g_ctf_flag_dropped_floatinwater 200 "move upwards while in water at this velocity"
set g_ctf_throw 1 "throwing allows circumventing carrierkill score, so enable this with care!"
bool autocvar_g_ctf_flag_dropped_waypoint;
bool autocvar_g_ctf_flag_dropped_floatinwater;
bool autocvar_g_ctf_flag_glowtrails;
-int autocvar_g_ctf_flag_health;
+float autocvar_g_ctf_flag_health;
bool autocvar_g_ctf_flag_return;
bool autocvar_g_ctf_flag_return_carrying;
float autocvar_g_ctf_flag_return_carried_radius;
set_movetype(flag, MOVETYPE_TOSS);
flag.takedamage = DAMAGE_YES;
flag.angles = '0 0 0';
+
+ flag.max_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health > 0) ? autocvar_g_ctf_flag_health : 100);
SetResourceExplicit(flag, RES_HEALTH, flag.max_health);
+
flag.ctf_droptime = time;
flag.ctf_landtime = 0;
flag.ctf_dropper = player;
flag.solid = SOLID_TRIGGER;
flag.takedamage = DAMAGE_NO;
flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale;
- flag.max_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100);
+
+ flag.max_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health > 0) ? autocvar_g_ctf_flag_health : 100);
SetResourceExplicit(flag, RES_HEALTH, flag.max_health);
+
flag.event_damage = ctf_FlagDamage;
flag.pushable = true;
flag.teleportable = TELEPORT_NORMAL;