set g_ctf_flag_take_damage 0
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_pickup_verbosename 1 "show the name of the person who picked up the flag too"
+set g_ctf_flag_return_when_unreachable 1 "automatically return the flag if it falls into lava/slime/trigger hurt"
set g_ctf_shield_max_ratio 0 "shield at most this percentage of a team from the enemy flag (try: 0.4 for 40%)"
set g_ctf_shield_min_negscore 20 "shield the player from the flag if he's got this negative amount of points or less"
string autocvar_g_ctf_flag_red_model;
float autocvar_g_ctf_flag_red_skin;
float autocvar_g_ctf_flag_returntime;
+float autocvar_g_ctf_flag_return_when_unreachable;
float autocvar_g_ctf_flag_take_damage;
float autocvar_g_ctf_flagcarrier_selfdamage;
float autocvar_g_ctf_flagcarrier_selfforce;
.float watersound_finished;
.float iscreature;
.float damagedbycontents;
+.float damagedbytriggers;
.vector oldvelocity;
.float pauseregen_finished;
Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
}
}
+ else if(other.damagedbytriggers)
+ {
+ if(other.takedamage)
+ {
+ EXACTTRIGGER_TOUCH;
+ Damage(other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+ }
+ }
else
{
if (!other.owner)
{
- if (other.items & IT_KEY1 || other.items & IT_KEY2) // reset flag
- {
- EXACTTRIGGER_TOUCH;
- other.pain_finished = min(other.pain_finished, time + 2);
- }
- else if (other.classname == "rune") // reset runes
+ if (other.classname == "rune") // reset runes
{
EXACTTRIGGER_TOUCH;
other.nextthink = min(other.nextthink, time + 1);
void ctf_FlagDamage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
+ if(deathtype == DEATH_HURTTRIGGER || deathtype == DEATH_SLIME || deathtype == DEATH_LAVA)
+ {
+ // automatically kill the flag and return it
+ self.health = 0;
+ ctf_CheckFlagReturn(self);
+ }
+
if(autocvar_g_ctf_flag_take_damage)
{
self.health = self.health - damage;
{
if(gameover) { return; }
if(!self) { return; }
- if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
- || ((trace_dpstartcontents | trace_dphitcontents) & (DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_NODROP)))
- { // The flag fell off the map or into lava/slime, respawn it since players can't get to it
- bprint("The ", self.netname, " fell somewhere it couldn't be reached and has returned to base\n");
- sound (self, CH_TRIGGER, self.snd_flag_respawn, VOL_BASE, ATTN_NONE);
- ctf_EventLog("returned", self.team, world);
- ctf_RespawnFlag(self);
- return;
- }
if(other.deadflag != DEAD_NO) { return; }
if(other.classname != "player")
{ // The flag just touched an object, most likely the world
flag.max_flag_health = ((autocvar_g_ctf_flag_take_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100);
flag.health = flag.max_flag_health;
flag.event_damage = ctf_FlagDamage;
+ flag.damagedbytriggers = autocvar_g_ctf_flag_return_when_unreachable;
+ flag.damagedbycontents = autocvar_g_ctf_flag_return_when_unreachable;
flag.velocity = '0 0 0';
flag.mangle = flag.angles;
flag.reset = ctf_Reset;