#include "../../common/effects.qh"
+#include "../../common/movetypes/movetypes.qh"
void ctf_FakeTimeLimit(entity e, float t)
{
makevectors(passer_angle);
// find the closest point on the enemy to the center of the attack
- float ang; // angle between shotdir and h
float h; // hypotenuse, which is the distance between attacker to head
float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
h = vlen(head_center - passer_center);
- ang = acos(dotproduct(normalize(head_center - passer_center), v_forward));
- a = h * cos(ang);
+ a = h * (normalize(head_center - passer_center) * v_forward);
vector nearest_on_line = (passer_center + a * v_forward);
float distance_from_line = vlen(nearest_to_passer - nearest_on_line);
{
makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0'));
- flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward)));
+ flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & IT_STRENGTH) ? autocvar_g_ctf_throw_strengthmultiplier : 1)));
flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, false);
ctf_Handle_Drop(flag, player, droptype);
break;
void ctf_FlagDamage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
+ self.velocity = self.velocity;
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
if(autocvar_g_ctf_flag_return_damage_delay)
}
}
-void ctf_FlagThink()
+void ctf_FlagUpdate()
{
// declarations
entity tmp_entity;
- self.nextthink = time + FLAG_THINKRATE; // only 5 fps, more is unnecessary.
-
// captureshield
if(self == ctf_worldflaglist) // only for the first flag
FOR_EACH_CLIENT(tmp_entity)
}
}
+void ctf_FlagThink()
+{
+ self.nextthink = time + FLAG_THINKRATE;
+
+ ctf_FlagUpdate();
+
+ /*if(time >= self.ctf_thinkrate)
+ {
+ self.ctf_thinkrate = time + FLAG_THINKRATE;
+ ctf_FlagUpdate();
+ }*/
+
+ //Movetype_Physics_NoMatchServer();
+ //Movetype_Physics_MatchTicrate(sys_frametime, 0);
+}
+
void ctf_FlagTouch()
{
if(gameover) { return; }
// captureshield setup
ctf_CaptureShield_Spawn(self);
+
+ //self.move_origin = self.origin;
+ //self.angles = self.angles;
+ //self.velocity = self.velocity;
}
void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
{
if(vh_player.flagcarried)
{
+ vh_player.flagcarried.nodrawtoclient = vh_player; // hide the flag from the driver
+
if(!autocvar_g_ctf_allow_vehicle_carry && !autocvar_g_ctf_allow_vehicle_touch)
{
ctf_Handle_Throw(vh_player, world, DROP_NORMAL);
if(vh_player.flagcarried)
{
setattachment(vh_player.flagcarried, vh_player, "");
- setorigin(vh_player.flagcarried, FLAG_CARRY_OFFSET);
+ setorigin(vh_player.flagcarried, VEHICLE_FLAG_OFFSET);
vh_player.flagcarried.scale = FLAG_SCALE;
vh_player.flagcarried.angles = '0 0 0';
+ vh_player.flagcarried.nodrawtoclient = world;
return true;
}
void spawnfunc_team_CTF_redspawn() { spawnfunc_info_player_team1(); }
void spawnfunc_team_CTF_bluespawn() { spawnfunc_info_player_team2(); }
+void team_CTF_neutralflag() { spawnfunc_item_flag_neutral(); }
+void team_neutralobelisk() { spawnfunc_item_flag_neutral(); }
+
// ==============
// Initialization