#include "sv_ctf.qh"
#include <common/effects/all.qh>
+#include <common/mapobjects/teleporters.qh>
+#include <common/mapobjects/triggers.qh>
#include <common/vehicles/all.qh>
+#include <server/command/vote.qh>
+#include <server/client.qh>
+#include <server/gamelog.qh>
+#include <server/intermission.qh>
+#include <server/damage.qh>
+#include <server/world.qh>
+#include <server/items/items.qh>
+#include <server/race.qh>
#include <server/teamplay.qh>
#include <lib/warpzone/common.qh>
float autocvar_g_ctf_flag_return_damage;
float autocvar_g_ctf_flag_return_damage_delay;
float autocvar_g_ctf_flag_return_dropped;
+bool autocvar_g_ctf_flag_waypoint = true;
+float autocvar_g_ctf_flag_waypoint_maxdistance;
float autocvar_g_ctf_flagcarrier_auto_helpme_damage;
float autocvar_g_ctf_flagcarrier_auto_helpme_time;
float autocvar_g_ctf_flagcarrier_selfdamagefactor;
if(!flag) { return; }
if((droptype == DROP_PASS) && !receiver) { return; }
- if(flag.speedrunning) { ctf_RespawnFlag(flag); return; }
+ if(flag.speedrunning)
+ {
+ // ensure old waypoints are removed before resetting the flag
+ WaypointSprite_Kill(player.wps_flagcarrier);
+
+ if(player.wps_enemyflagcarrier)
+ WaypointSprite_Kill(player.wps_enemyflagcarrier);
+
+ if(player.wps_flagreturn)
+ WaypointSprite_Kill(player.wps_flagreturn);
+ ctf_RespawnFlag(flag);
+ return;
+ }
// reset the flag
setattachment(flag, NULL, "");
ctf_CaptureShield_Update(player, 0); // shield player from picking up flag
}
+#if 0
void shockwave_spawn(string m, vector org, float sz, float t1, float t2)
{
return modeleffect_spawn(m, 0, 0, org, '0 0 0', '0 0 0', '0 0 0', 0, sz, 1, t1, t2);
}
+#endif
// ==============
// Event Handlers
// effects
Send_Effect_(flag.capeffect, flag.origin, '0 0 0', 1);
- //shockwave_spawn("models/ctf/shockwavetransring.md3", flag.origin - '0 0 15', -0.8, 0, 1);
+#if 0
+ shockwave_spawn("models/ctf/shockwavetransring.md3", flag.origin - '0 0 15', -0.8, 0, 1);
+#endif
// other
if(capturetype == CAPTURE_NORMAL)
.float last_respawn;
void ctf_RespawnFlag(entity flag)
{
+ flag.watertype = CONTENT_EMPTY; // TODO: it is unclear why this workaround is needed, likely many other potential breakage points!!
// check for flag respawn being called twice in a row
if(flag.last_respawn > time - 0.5)
{ backtrace("flag respawn called twice quickly! please notify Samual about this..."); }
default: basename = WP_FlagBaseNeutral; break;
}
- entity wp = WaypointSprite_SpawnFixed(basename, this.origin + FLAG_WAYPOINT_OFFSET, this, wps_flagbase, RADARICON_FLAG);
- wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 1 1');
- WaypointSprite_UpdateTeamRadar(this.wps_flagbase, RADARICON_FLAG, ((this.team) ? colormapPaletteColor(this.team - 1, false) : '1 1 1'));
- setcefc(wp, ctf_FlagBase_Customize);
+ if(autocvar_g_ctf_flag_waypoint)
+ {
+ entity wp = WaypointSprite_SpawnFixed(basename, this.origin + FLAG_WAYPOINT_OFFSET, this, wps_flagbase, RADARICON_FLAG);
+ wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 1 1');
+ wp.fade_rate = autocvar_g_ctf_flag_waypoint_maxdistance;
+ WaypointSprite_UpdateTeamRadar(this.wps_flagbase, RADARICON_FLAG, ((this.team) ? colormapPaletteColor(this.team - 1, false) : '1 1 1'));
+ setcefc(wp, ctf_FlagBase_Customize);
+ }
// captureshield setup
ctf_CaptureShield_Spawn(this);
WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResource(player, RES_HEALTH), GetResource(player, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
}
-MUTATOR_HOOKFUNCTION(ctf, Damage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
+MUTATOR_HOOKFUNCTION(ctf, Damage_Calculate) // for changing damage and force values that are applied to players in damage.qc
{
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
if(head != player && SAME_TEAM(head, player))
if(!head.speedrunning && !head.vehicle)
{
- // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
+ // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in damage.qc)
vector head_center = WarpZone_UnTransformOrigin(head, CENTER_OR_VIEWOFS(head));
vector passer_center = CENTER_OR_VIEWOFS(player);