ctf_Initialize();
ActivateTeamplay();
- SetLimits(autocvar_capturelimit_override, autocvar_captureleadlimit_override, -1, -1);
+ SetLimits(autocvar_capturelimit_override, autocvar_captureleadlimit_override, autocvar_timelimit_override, -1);
have_team_spawns = -1; // request team spawns
}
}
}
-bool ctf_CaptureShield_Customize()
-{SELFPARAM();
+bool ctf_CaptureShield_Customize(entity this)
+{
if(!other.ctf_captureshielded) { return false; }
if(CTF_SAMETEAM(self, other)) { return false; }
return true;
}
-void ctf_CaptureShield_Touch()
-{SELFPARAM();
+void ctf_CaptureShield_Touch(entity this)
+{
if(!other.ctf_captureshielded) { return; }
if(CTF_SAMETEAM(self, other)) { return; }
}
void ctf_CaptureShield_Spawn(entity flag)
-{SELFPARAM();
+{
entity shield = new(ctf_captureshield);
- shield.enemy = self;
- shield.team = self.team;
- shield.touch = ctf_CaptureShield_Touch;
- shield.customizeentityforclient = ctf_CaptureShield_Customize;
+ shield.enemy = flag;
+ shield.team = flag.team;
+ settouch(shield, ctf_CaptureShield_Touch);
+ setcefc(shield, ctf_CaptureShield_Customize);
shield.effects = EF_ADDITIVE;
shield.movetype = MOVETYPE_NOCLIP;
shield.solid = SOLID_TRIGGER;
shield.avelocity = '7 0 11';
shield.scale = 0.5;
- setorigin(shield, self.origin);
+ setorigin(shield, flag.origin);
setmodel(shield, MDL_CTF_SHIELD);
setsize(shield, shield.scale * shield.mins, shield.scale * shield.maxs);
}
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) * ((player.items & ITEM_Strength.m_itemid) ? autocvar_g_ctf_throw_strengthmultiplier : 1)));
- flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, false);
+ flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, flag_velocity, false);
ctf_Handle_Drop(flag, player, droptype);
break;
}
default:
case DROP_NORMAL:
{
- flag.velocity = W_CalculateProjectileVelocity(player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
+ flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
ctf_Handle_Drop(flag, player, droptype);
break;
}
}
}
-bool ctf_Stalemate_Customize()
-{SELFPARAM();
+bool ctf_Stalemate_Customize(entity this)
+{
// make spectators see what the player would see
entity e, wp_owner;
e = WaypointSprite_getviewentity(other);
{
entity wp = WaypointSprite_Spawn(((ctf_oneflag) ? WP_FlagCarrier : WP_FlagCarrierEnemy), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG);
wp.colormod = WPCOLOR_ENEMYFC(tmp_entity.owner.team);
- tmp_entity.owner.wps_enemyflagcarrier.customizeentityforclient = ctf_Stalemate_Customize;
+ setcefc(tmp_entity.owner.wps_enemyflagcarrier, ctf_Stalemate_Customize);
}
}
}
}
-void ctf_FlagThink()
-{SELFPARAM();
+void ctf_FlagThink(entity this)
+{
// declarations
entity tmp_entity;
self.health = 0;
ctf_CheckFlagReturn(self, RETURN_SPEEDRUN);
- setself(self.owner);
- self.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
- ImpulseCommands(self);
- setself(this);
+ self.owner.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
+ ImpulseCommands(self.owner);
}
if(autocvar_g_ctf_stalemate)
{
ctf_RespawnFlag(this);
}
-void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_FlagSetup()
-{SELFPARAM();
+void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map by ctf_FlagSetup()
+{
// bot waypoints
- waypoint_spawnforitem_force(self, self.origin);
- self.nearestwaypointtimeout = 0; // activate waypointing again
- self.bot_basewaypoint = self.nearestwaypoint;
+ waypoint_spawnforitem_force(this, this.origin);
+ this.nearestwaypointtimeout = 0; // activate waypointing again
+ this.bot_basewaypoint = this.nearestwaypoint;
// waypointsprites
entity basename;
- switch (self.team)
+ switch (this.team)
{
case NUM_TEAM_1: basename = WP_FlagBaseRed; break;
case NUM_TEAM_2: basename = WP_FlagBaseBlue; break;
default: basename = WP_FlagBaseNeutral; break;
}
- entity wp = WaypointSprite_SpawnFixed(basename, self.origin + FLAG_WAYPOINT_OFFSET, self, wps_flagbase, RADARICON_FLAG);
- wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 1 1');
- WaypointSprite_UpdateTeamRadar(self.wps_flagbase, RADARICON_FLAG, ((self.team) ? colormapPaletteColor(self.team - 1, false) : '1 1 1'));
+ 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'));
// captureshield setup
- ctf_CaptureShield_Spawn(self);
+ ctf_CaptureShield_Spawn(this);
}
.bool pushable;
void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
-{SELFPARAM();
- // declarations
- setself(flag); // for later usage with droptofloor()
-
+{
// main setup
flag.ctf_worldflagnext = ctf_worldflaglist; // link flag into ctf_worldflaglist
ctf_worldflaglist = flag;
flag.velocity = '0 0 0';
flag.mangle = flag.angles;
flag.reset = ctf_Reset;
- flag.touch = ctf_FlagTouch;
- flag.think = ctf_FlagThink;
+ settouch(flag, ctf_FlagTouch);
+ setthink(flag, ctf_FlagThink);
flag.nextthink = time + FLAG_THINKRATE;
flag.ctf_status = FLAG_BASE;
if (flag.capeffect == "") { flag.capeffect = EFFECT_CAP(teamnumber).eent_eff_name; }
// sounds
- flag.snd_flag_taken = strzone(SND(CTF_TAKEN(teamnumber)));
- flag.snd_flag_returned = strzone(SND(CTF_RETURNED(teamnumber)));
- flag.snd_flag_capture = strzone(SND(CTF_CAPTURE(teamnumber)));
- flag.snd_flag_dropped = strzone(SND(CTF_DROPPED(teamnumber)));
- if (flag.snd_flag_respawn == "") flag.snd_flag_respawn = strzone(SND(CTF_RESPAWN)); // if there is ever a team-based sound for this, update the code to match.
- precache_sound(flag.snd_flag_respawn);
- if (flag.snd_flag_touch == "") flag.snd_flag_touch = strzone(SND(CTF_TOUCH)); // again has no team-based sound
- precache_sound(flag.snd_flag_touch);
- if (flag.snd_flag_pass == "") flag.snd_flag_pass = strzone(SND(CTF_PASS)); // same story here
- precache_sound(flag.snd_flag_pass);
+#define X(s,b) \
+ if(flag.s == "") flag.s = b; \
+ precache_sound(flag.s);
+
+ X(snd_flag_taken, strzone(SND(CTF_TAKEN(teamnumber))))
+ X(snd_flag_returned, strzone(SND(CTF_RETURNED(teamnumber))))
+ X(snd_flag_capture, strzone(SND(CTF_CAPTURE(teamnumber))))
+ X(snd_flag_dropped, strzone(SND(CTF_DROPPED(teamnumber))))
+ X(snd_flag_respawn, strzone(SND(CTF_RESPAWN)))
+ X(snd_flag_touch, strzone(SND(CTF_TOUCH)))
+ X(snd_flag_pass, strzone(SND(CTF_PASS)))
+#undef X
// precache
precache_model(flag.model);
else // drop to floor, automatically find a platform and set that as spawn origin
{
flag.noalign = false;
- setself(flag);
- droptofloor();
+ droptofloor(flag);
flag.movetype = MOVETYPE_TOSS;
}
return c;
}
-void havocbot_goalrating_ctf_ourflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourflag(entity this, float ratingscale)
+{
entity head;
head = ctf_worldflaglist;
while (head)
{
- if (CTF_SAMETEAM(self, head))
+ if (CTF_SAMETEAM(this, head))
break;
head = head.ctf_worldflagnext;
}
if (head)
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(this, head, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_ourbase(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourbase(entity this, float ratingscale)
+{
entity head;
head = ctf_worldflaglist;
while (head)
{
- if (CTF_SAMETEAM(self, head))
+ if (CTF_SAMETEAM(this, head))
break;
head = head.ctf_worldflagnext;
}
if (!head)
return;
- navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
+ navigation_routerating(this, head.bot_basewaypoint, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_enemyflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_enemyflag(entity this, float ratingscale)
+{
entity head;
head = ctf_worldflaglist;
while (head)
{
if(ctf_oneflag)
{
- if(CTF_DIFFTEAM(self, head))
+ if(CTF_DIFFTEAM(this, head))
{
if(head.team)
{
- if(self.flagcarried)
+ if(this.flagcarried)
break;
}
- else if(!self.flagcarried)
+ else if(!this.flagcarried)
break;
}
}
- else if(CTF_DIFFTEAM(self, head))
+ else if(CTF_DIFFTEAM(this, head))
break;
head = head.ctf_worldflagnext;
}
if (head)
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(this, head, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_enemybase(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_enemybase(entity this, float ratingscale)
+{
if (!bot_waypoints_for_items)
{
- havocbot_goalrating_ctf_enemyflag(ratingscale);
+ havocbot_goalrating_ctf_enemyflag(this, ratingscale);
return;
}
entity head;
- head = havocbot_ctf_find_enemy_flag(self);
+ head = havocbot_ctf_find_enemy_flag(this);
if (!head)
return;
- navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
+ navigation_routerating(this, head.bot_basewaypoint, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_ourstolenflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourstolenflag(entity this, float ratingscale)
+{
entity mf;
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status == FLAG_BASE)
return;
if(mf.tag_entity)
- navigation_routerating(mf.tag_entity, ratingscale, 10000);
+ navigation_routerating(this, mf.tag_entity, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_droppedflags(float ratingscale, vector org, float df_radius)
+void havocbot_goalrating_ctf_droppedflags(entity this, float ratingscale, vector org, float df_radius)
{
entity head;
head = ctf_worldflaglist;
if(df_radius)
{
if(vlen(org-head.origin)<df_radius)
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(self, head, ratingscale, 10000);
}
else
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(self, head, ratingscale, 10000);
}
head = head.ctf_worldflagnext;
}
}
-void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_ctf_carrieritems(entity this, float ratingscale, vector org, float sradius)
+{
entity head;
float t;
head = findchainfloat(bot_pickup, true);
if (vlen(head.origin - org) < sradius)
{
// get the value of the item
- t = head.bot_pickupevalfunc(self, head) * 0.0001;
+ t = head.bot_pickupevalfunc(this, head) * 0.0001;
if (t > 0)
- navigation_routerating(head, t * ratingscale, 500);
+ navigation_routerating(this, head, t * ratingscale, 500);
}
head = head.chain;
}
}
-void havocbot_ctf_reset_role(entity bot)
+void havocbot_ctf_reset_role(entity this)
{
float cdefense, cmiddle, coffense;
entity mf, ef;
float c;
- if(IS_DEAD(bot))
+ if(IS_DEAD(this))
return;
- if(vlen(havocbot_ctf_middlepoint)==0)
+ if(havocbot_ctf_middlepoint == '0 0 0')
havocbot_calculate_middlepoint();
// Check ctf flags
- if (bot.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
- mf = havocbot_ctf_find_flag(bot);
- ef = havocbot_ctf_find_enemy_flag(bot);
+ mf = havocbot_ctf_find_flag(this);
+ ef = havocbot_ctf_find_enemy_flag(this);
// Retrieve stolen flag
if(mf.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
// If enemy flag is taken go to the middle to intercept pursuers
if(ef.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_MIDDLE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
return;
}
// if there is only me on the team switch to offense
c = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, bot), LAMBDA(++c));
+ FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), LAMBDA(++c));
if(c==1)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_OFFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE);
return;
}
// Evaluate best position to take
// Count mates on middle position
- cmiddle = havocbot_ctf_teamcount(bot, havocbot_ctf_middlepoint, havocbot_ctf_middlepoint_radius * 0.5);
+ cmiddle = havocbot_ctf_teamcount(this, havocbot_ctf_middlepoint, havocbot_ctf_middlepoint_radius * 0.5);
// Count mates on defense position
- cdefense = havocbot_ctf_teamcount(bot, mf.dropped_origin, havocbot_ctf_middlepoint_radius * 0.5);
+ cdefense = havocbot_ctf_teamcount(this, mf.dropped_origin, havocbot_ctf_middlepoint_radius * 0.5);
// Count mates on offense position
- coffense = havocbot_ctf_teamcount(bot, ef.dropped_origin, havocbot_ctf_middlepoint_radius);
+ coffense = havocbot_ctf_teamcount(this, ef.dropped_origin, havocbot_ctf_middlepoint_radius);
if(cdefense<=coffense)
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_DEFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE);
else if(coffense<=cmiddle)
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_OFFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE);
else
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_MIDDLE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
}
-void havocbot_role_ctf_carrier()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_ctf_carrier(entity this)
+{
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried == world)
+ if (this.flagcarried == world)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ navigation_goalrating_start(this);
if(ctf_oneflag)
- havocbot_goalrating_ctf_enemybase(50000);
+ havocbot_goalrating_ctf_enemybase(this, 50000);
else
- havocbot_goalrating_ctf_ourbase(50000);
+ havocbot_goalrating_ctf_ourbase(this, 50000);
- if(self.health<100)
- havocbot_goalrating_ctf_carrieritems(1000, self.origin, 1000);
+ if(this.health<100)
+ havocbot_goalrating_ctf_carrieritems(this, 1000, this.origin, 1000);
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
- if (self.navigation_hasgoals)
- self.havocbot_cantfindflag = time + 10;
- else if (time > self.havocbot_cantfindflag)
+ if (this.navigation_hasgoals)
+ this.havocbot_cantfindflag = time + 10;
+ else if (time > this.havocbot_cantfindflag)
{
// Can't navigate to my own base, suicide!
// TODO: drop it and wander around
- Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+ Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
return;
}
}
}
-void havocbot_role_ctf_escort()
-{SELFPARAM();
+void havocbot_role_ctf_escort(entity this)
+{
entity mf, ef;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// If enemy flag is back on the base switch to previous role
- ef = havocbot_ctf_find_enemy_flag(self);
+ ef = havocbot_ctf_find_enemy_flag(this);
if(ef.ctf_status==FLAG_BASE)
{
- self.havocbot_role = self.havocbot_previous_role;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = this.havocbot_previous_role;
+ this.havocbot_role_timeout = 0;
return;
}
// If the flag carrier reached the base switch to defense
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status!=FLAG_BASE)
if(vlen(ef.origin - mf.dropped_origin) < 300)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_DEFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE);
return;
}
// Set the role timeout if necessary
- if (!self.havocbot_role_timeout)
+ if (!this.havocbot_role_timeout)
{
- self.havocbot_role_timeout = time + random() * 30 + 60;
+ this.havocbot_role_timeout = time + random() * 30 + 60;
}
// If nothing happened just switch to previous role
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- self.havocbot_role = self.havocbot_previous_role;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = this.havocbot_previous_role;
+ this.havocbot_role_timeout = 0;
return;
}
// Chase the flag carrier
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_enemyflag(30000);
- havocbot_goalrating_ctf_ourstolenflag(40000);
- havocbot_goalrating_items(10000, self.origin, 10000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_enemyflag(this, 30000);
+ havocbot_goalrating_ctf_ourstolenflag(this, 40000);
+ havocbot_goalrating_items(this, 10000, this.origin, 10000);
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_ctf_offense()
-{SELFPARAM();
+void havocbot_role_ctf_offense(entity this)
+{
entity mf, ef;
vector pos;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// Check flags
- mf = havocbot_ctf_find_flag(self);
- ef = havocbot_ctf_find_enemy_flag(self);
+ mf = havocbot_ctf_find_flag(this);
+ ef = havocbot_ctf_find_enemy_flag(this);
// Own flag stolen
if(mf.ctf_status!=FLAG_BASE)
pos = mf.origin;
// Try to get it if closer than the enemy base
- if(vlen(self.origin-ef.dropped_origin)>vlen(self.origin-pos))
+ if(vlen(this.origin-ef.dropped_origin)>vlen(this.origin-pos))
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
}
if(vlen(pos-mf.dropped_origin)>700)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_ESCORT);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_ESCORT);
return;
}
}
// About to fail, switch to middlefield
- if(self.health<50)
+ if(this.health<50)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_MIDDLE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
return;
}
// Set the role timeout if necessary
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 120;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 120;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_ourstolenflag(50000);
- havocbot_goalrating_ctf_enemybase(20000);
- havocbot_goalrating_items(5000, self.origin, 1000);
- havocbot_goalrating_items(1000, self.origin, 10000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+ havocbot_goalrating_ctf_enemybase(this, 20000);
+ havocbot_goalrating_items(this, 5000, this.origin, 1000);
+ havocbot_goalrating_items(this, 1000, this.origin, 10000);
+ navigation_goalrating_end(this);
}
}
// Retriever (temporary role):
-void havocbot_role_ctf_retriever()
-{SELFPARAM();
+void havocbot_role_ctf_retriever(entity this)
+{
entity mf;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// If flag is back on the base switch to previous role
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status==FLAG_BASE)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 20;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 20;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
float rt_radius;
rt_radius = 10000;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_ourstolenflag(50000);
- havocbot_goalrating_ctf_droppedflags(40000, self.origin, rt_radius);
- havocbot_goalrating_ctf_enemybase(30000);
- havocbot_goalrating_items(500, self.origin, rt_radius);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+ havocbot_goalrating_ctf_droppedflags(this, 40000, this.origin, rt_radius);
+ havocbot_goalrating_ctf_enemybase(this, 30000);
+ havocbot_goalrating_items(this, 500, this.origin, rt_radius);
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_ctf_middle()
-{SELFPARAM();
+void havocbot_role_ctf_middle(entity this)
+{
entity mf;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 10;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 10;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
vector org;
org = havocbot_ctf_middlepoint;
- org.z = self.origin.z;
+ org.z = this.origin.z;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_ourstolenflag(50000);
- havocbot_goalrating_ctf_droppedflags(30000, self.origin, 10000);
- havocbot_goalrating_enemyplayers(10000, org, havocbot_ctf_middlepoint_radius * 0.5);
- havocbot_goalrating_items(5000, org, havocbot_ctf_middlepoint_radius * 0.5);
- havocbot_goalrating_items(2500, self.origin, 10000);
- havocbot_goalrating_ctf_enemybase(2500);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+ havocbot_goalrating_ctf_droppedflags(this, 30000, this.origin, 10000);
+ havocbot_goalrating_enemyplayers(this, 10000, org, havocbot_ctf_middlepoint_radius * 0.5);
+ havocbot_goalrating_items(this, 5000, org, havocbot_ctf_middlepoint_radius * 0.5);
+ havocbot_goalrating_items(this, 2500, this.origin, 10000);
+ havocbot_goalrating_ctf_enemybase(this, 2500);
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_ctf_defense()
-{SELFPARAM();
+void havocbot_role_ctf_defense(entity this)
+{
entity mf;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// If own flag was captured
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 30;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 30;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
float mp_radius;
vector org;
org = mf.dropped_origin;
mp_radius = havocbot_ctf_middlepoint_radius;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
// if enemies are closer to our base, go there
entity closestplayer = world;
));
if(closestplayer)
- if(DIFF_TEAM(closestplayer, self))
- if(vlen(org - self.origin)>1000)
- if(checkpvs(self.origin,closestplayer)||random()<0.5)
- havocbot_goalrating_ctf_ourbase(30000);
+ if(DIFF_TEAM(closestplayer, this))
+ if(vlen(org - this.origin)>1000)
+ if(checkpvs(this.origin,closestplayer)||random()<0.5)
+ havocbot_goalrating_ctf_ourbase(this, 30000);
- havocbot_goalrating_ctf_ourstolenflag(20000);
- havocbot_goalrating_ctf_droppedflags(20000, org, mp_radius);
- havocbot_goalrating_enemyplayers(15000, org, mp_radius);
- havocbot_goalrating_items(10000, org, mp_radius);
- havocbot_goalrating_items(5000, self.origin, 10000);
- navigation_goalrating_end();
+ havocbot_goalrating_ctf_ourstolenflag(this, 20000);
+ havocbot_goalrating_ctf_droppedflags(this, 20000, org, mp_radius);
+ havocbot_goalrating_enemyplayers(this, 15000, org, mp_radius);
+ havocbot_goalrating_items(this, 10000, org, mp_radius);
+ havocbot_goalrating_items(this, 5000, this.origin, 10000);
+ navigation_goalrating_end(this);
}
}
// ==============
MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink)
-{SELFPARAM();
- entity flag;
+{
+ entity player = M_ARGV(0, entity);
+
int t = 0, t2 = 0, t3 = 0;
// initially clear items so they can be set as necessary later.
- self.ctf_flagstatus &= ~(CTF_RED_FLAG_CARRYING | CTF_RED_FLAG_TAKEN | CTF_RED_FLAG_LOST
+ player.ctf_flagstatus &= ~(CTF_RED_FLAG_CARRYING | CTF_RED_FLAG_TAKEN | CTF_RED_FLAG_LOST
| CTF_BLUE_FLAG_CARRYING | CTF_BLUE_FLAG_TAKEN | CTF_BLUE_FLAG_LOST
| CTF_YELLOW_FLAG_CARRYING | CTF_YELLOW_FLAG_TAKEN | CTF_YELLOW_FLAG_LOST
| CTF_PINK_FLAG_CARRYING | CTF_PINK_FLAG_TAKEN | CTF_PINK_FLAG_LOST
| CTF_FLAG_NEUTRAL | CTF_SHIELDED);
// scan through all the flags and notify the client about them
- for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
+ for(entity flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext)
{
if(flag.team == NUM_TEAM_1) { t = CTF_RED_FLAG_CARRYING; t2 = CTF_RED_FLAG_TAKEN; t3 = CTF_RED_FLAG_LOST; }
if(flag.team == NUM_TEAM_2) { t = CTF_BLUE_FLAG_CARRYING; t2 = CTF_BLUE_FLAG_TAKEN; t3 = CTF_BLUE_FLAG_LOST; }
if(flag.team == NUM_TEAM_3) { t = CTF_YELLOW_FLAG_CARRYING; t2 = CTF_YELLOW_FLAG_TAKEN; t3 = CTF_YELLOW_FLAG_LOST; }
if(flag.team == NUM_TEAM_4) { t = CTF_PINK_FLAG_CARRYING; t2 = CTF_PINK_FLAG_TAKEN; t3 = CTF_PINK_FLAG_LOST; }
- if(flag.team == 0) { t = CTF_NEUTRAL_FLAG_CARRYING; t2 = CTF_NEUTRAL_FLAG_TAKEN; t3 = CTF_NEUTRAL_FLAG_LOST; self.ctf_flagstatus |= CTF_FLAG_NEUTRAL; }
+ if(flag.team == 0) { t = CTF_NEUTRAL_FLAG_CARRYING; t2 = CTF_NEUTRAL_FLAG_TAKEN; t3 = CTF_NEUTRAL_FLAG_LOST; player.ctf_flagstatus |= CTF_FLAG_NEUTRAL; }
switch(flag.ctf_status)
{
case FLAG_PASSING:
case FLAG_CARRY:
{
- if((flag.owner == self) || (flag.pass_sender == self))
- self.ctf_flagstatus |= t; // carrying: self is currently carrying the flag
+ if((flag.owner == player) || (flag.pass_sender == player))
+ player.ctf_flagstatus |= t; // carrying: player is currently carrying the flag
else
- self.ctf_flagstatus |= t2; // taken: someone else is carrying the flag
+ player.ctf_flagstatus |= t2; // taken: someone else is carrying the flag
break;
}
case FLAG_DROPPED:
{
- self.ctf_flagstatus |= t3; // lost: the flag is dropped somewhere on the map
+ player.ctf_flagstatus |= t3; // lost: the flag is dropped somewhere on the map
break;
}
}
}
// item for stopping players from capturing the flag too often
- if(self.ctf_captureshielded)
- self.ctf_flagstatus |= CTF_SHIELDED;
+ if(player.ctf_captureshielded)
+ player.ctf_flagstatus |= CTF_SHIELDED;
// update the health of the flag carrier waypointsprite
- if(self.wps_flagcarrier)
- WaypointSprite_UpdateHealth(self.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
-
- return false;
+ if(player.wps_flagcarrier)
+ WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
}
MUTATOR_HOOKFUNCTION(ctf, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+ float frag_damage = M_ARGV(4, float);
+ vector frag_force = M_ARGV(6, vector);
+
if(frag_attacker.flagcarried) // if the attacker is a flagcarrier
{
if(frag_target == frag_attacker) // damage done to yourself
frag_damage *= autocvar_g_ctf_flagcarrier_damagefactor;
frag_force *= autocvar_g_ctf_flagcarrier_forcefactor;
}
+
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
}
else if(frag_target.flagcarried && !IS_DEAD(frag_target) && CTF_DIFFTEAM(frag_target, frag_attacker)) // if the target is a flagcarrier
{
}
// todo: add notification for when flag carrier needs help?
}
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, PlayerDies)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+
if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)) && (frag_target.flagcarried))
{
PlayerTeamScore_AddScore(frag_attacker, ((SAME_TEAM(frag_attacker, frag_target)) ? -autocvar_g_ctf_score_kill : autocvar_g_ctf_score_kill));
ctf_Handle_Throw(frag_target, world, DROP_NORMAL);
tmp_entity.ctf_dropper = world;
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, GiveFragsForKill)
{
- frag_score = 0;
+ M_ARGV(2, float) = 0; // frag score
return (autocvar_g_ctf_ignore_frags); // no frags counted in ctf if this is true
}
}
MUTATOR_HOOKFUNCTION(ctf, MakePlayerObserver)
-{SELFPARAM();
- ctf_RemovePlayer(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ ctf_RemovePlayer(player);
}
MUTATOR_HOOKFUNCTION(ctf, ClientDisconnect)
-{SELFPARAM();
- ctf_RemovePlayer(self);
- return false;
+{
+ entity player = M_ARGV(0, entity);
+
+ ctf_RemovePlayer(player);
}
MUTATOR_HOOKFUNCTION(ctf, PortalTeleport)
-{SELFPARAM();
- if(self.flagcarried)
- if(!autocvar_g_ctf_portalteleport)
- { ctf_Handle_Throw(self, world, DROP_NORMAL); }
+{
+ entity player = M_ARGV(0, entity);
- return false;
+ if(player.flagcarried)
+ if(!autocvar_g_ctf_portalteleport)
+ { ctf_Handle_Throw(player, world, DROP_NORMAL); }
}
MUTATOR_HOOKFUNCTION(ctf, PlayerUseKey)
-{SELFPARAM();
- if(MUTATOR_RETURNVALUE || gameover) { return false; }
+{
+ if(MUTATOR_RETURNVALUE || gameover) { return; }
- entity player = self;
+ entity player = M_ARGV(0, entity);
if((time > player.throw_antispam) && !IS_DEAD(player) && !player.speedrunning && (!player.vehicle || autocvar_g_ctf_allow_vehicle_touch))
{
}
}
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, HelpMePing)
-{SELFPARAM();
- if(self.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
{
- self.wps_helpme_time = time;
- WaypointSprite_HelpMePing(self.wps_flagcarrier);
+ player.wps_helpme_time = time;
+ WaypointSprite_HelpMePing(player.wps_flagcarrier);
}
else // create a normal help me waypointsprite
{
- WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, self, FLAG_WAYPOINT_OFFSET, world, self.team, self, wps_helpme, false, RADARICON_HELPME);
- WaypointSprite_Ping(self.wps_helpme);
+ WaypointSprite_Spawn(WP_Helpme, waypointsprite_deployed_lifetime, waypointsprite_limitedrange, player, FLAG_WAYPOINT_OFFSET, world, player.team, player, wps_helpme, false, RADARICON_HELPME);
+ WaypointSprite_Ping(player.wps_helpme);
}
return true;
MUTATOR_HOOKFUNCTION(ctf, VehicleEnter)
{
- if(vh_player.flagcarried)
+ entity player = M_ARGV(0, entity);
+ entity veh = M_ARGV(1, entity);
+
+ if(player.flagcarried)
{
- vh_player.flagcarried.nodrawtoclient = vh_player; // hide the flag from the driver
+ player.flagcarried.nodrawtoclient = 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);
+ ctf_Handle_Throw(player, world, DROP_NORMAL);
}
else
{
- setattachment(vh_player.flagcarried, vh_vehicle, "");
- setorigin(vh_player.flagcarried, VEHICLE_FLAG_OFFSET);
- vh_player.flagcarried.scale = VEHICLE_FLAG_SCALE;
- //vh_player.flagcarried.angles = '0 0 0';
+ setattachment(player.flagcarried, veh, "");
+ setorigin(player.flagcarried, VEHICLE_FLAG_OFFSET);
+ player.flagcarried.scale = VEHICLE_FLAG_SCALE;
+ //player.flagcarried.angles = '0 0 0';
}
return true;
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, VehicleExit)
{
- if(vh_player.flagcarried)
+ entity player = M_ARGV(0, entity);
+
+ if(player.flagcarried)
{
- setattachment(vh_player.flagcarried, vh_player, "");
- setorigin(vh_player.flagcarried, FLAG_CARRY_OFFSET);
- vh_player.flagcarried.scale = FLAG_SCALE;
- vh_player.flagcarried.angles = '0 0 0';
- vh_player.flagcarried.nodrawtoclient = world;
+ setattachment(player.flagcarried, player, "");
+ setorigin(player.flagcarried, FLAG_CARRY_OFFSET);
+ player.flagcarried.scale = FLAG_SCALE;
+ player.flagcarried.angles = '0 0 0';
+ player.flagcarried.nodrawtoclient = world;
return true;
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, AbortSpeedrun)
-{SELFPARAM();
- if(self.flagcarried)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.flagcarried)
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, ((self.flagcarried.team) ? APP_TEAM_ENT(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
- ctf_RespawnFlag(self.flagcarried);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, ((player.flagcarried.team) ? APP_TEAM_ENT(player.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
+ ctf_RespawnFlag(player.flagcarried);
return true;
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, MatchEnd)
}
}
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, HavocBot_ChooseRole)
-{SELFPARAM();
- havocbot_ctf_reset_role(self);
+{
+ entity bot = M_ARGV(0, entity);
+
+ havocbot_ctf_reset_role(bot);
return true;
}
MUTATOR_HOOKFUNCTION(ctf, GetTeamCount)
{
- //ret_float = ctf_teams;
- ret_string = "ctf_team";
+ //M_ARGV(0, float) = ctf_teams;
+ M_ARGV(1, string) = "ctf_team";
return true;
}
MUTATOR_HOOKFUNCTION(ctf, SpectateCopy)
-{SELFPARAM();
- self.ctf_flagstatus = other.ctf_flagstatus;
- return false;
+{
+ entity spectatee = M_ARGV(0, entity);
+ entity client = M_ARGV(1, entity);
+
+ client.ctf_flagstatus = spectatee.ctf_flagstatus;
}
MUTATOR_HOOKFUNCTION(ctf, GetRecords)
{
+ int record_page = M_ARGV(0, int);
+ string ret_string = M_ARGV(1, string);
+
for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
{
if (MapInfo_Get_ByID(i))
}
}
- return false;
+ M_ARGV(1, string) = ret_string;
}
-bool superspec_Spectate(entity _player); // TODO
+bool superspec_Spectate(entity this, entity targ); // TODO
void superspec_msg(string _center_title, string _con_title, entity _to, string _msg, float _spamlevel); // TODO
MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand)
{
- if(IS_PLAYER(self) || MUTATOR_RETURNVALUE || !cvar("g_superspectate")) { return false; }
+ entity player = M_ARGV(0, entity);
+ string cmd_name = M_ARGV(1, string);
+ int cmd_argc = M_ARGV(2, int);
+
+ if(IS_PLAYER(player) || MUTATOR_RETURNVALUE || !cvar("g_superspectate")) { return false; }
if(cmd_name == "followfc")
{
if(it.flagcarried && (it.team == _team || _team == 0))
{
found = true;
- if(_team == 0 && IS_SPEC(self) && self.enemy == it)
+ if(_team == 0 && IS_SPEC(player) && player.enemy == it)
continue; // already spectating this fc, try another
- return superspec_Spectate(it);
+ return superspec_Spectate(player, it);
}
));
if(!found)
- superspec_msg("", "", self, "No active flag carrier\n", 1);
+ superspec_msg("", "", player, "No active flag carrier\n", 1);
return true;
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(ctf, DropSpecialItems)
{
+ entity frag_target = M_ARGV(0, entity);
+
if(frag_target.flagcarried)
ctf_Handle_Throw(frag_target, world, DROP_THROW);
-
- return false;
}
"noise5" sound played when flag touches the ground... */
spawnfunc(item_flag_team1)
{
- if(!g_ctf) { remove(self); return; }
+ if(!g_ctf) { remove(this); return; }
- ctf_FlagSetup(NUM_TEAM_1, self);
+ ctf_FlagSetup(NUM_TEAM_1, this);
}
/*QUAKED spawnfunc_item_flag_team2 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
"noise5" sound played when flag touches the ground... */
spawnfunc(item_flag_team2)
{
- if(!g_ctf) { remove(self); return; }
+ if(!g_ctf) { remove(this); return; }
- ctf_FlagSetup(NUM_TEAM_2, self);
+ ctf_FlagSetup(NUM_TEAM_2, this);
}
/*QUAKED spawnfunc_item_flag_team3 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
"noise5" sound played when flag touches the ground... */
spawnfunc(item_flag_team3)
{
- if(!g_ctf) { remove(self); return; }
+ if(!g_ctf) { remove(this); return; }
- ctf_FlagSetup(NUM_TEAM_3, self);
+ ctf_FlagSetup(NUM_TEAM_3, this);
}
/*QUAKED spawnfunc_item_flag_team4 (0 0.5 0.8) (-48 -48 -37) (48 48 37)
"noise5" sound played when flag touches the ground... */
spawnfunc(item_flag_team4)
{
- if(!g_ctf) { remove(self); return; }
+ if(!g_ctf) { remove(this); return; }
- ctf_FlagSetup(NUM_TEAM_4, self);
+ ctf_FlagSetup(NUM_TEAM_4, this);
}
/*QUAKED spawnfunc_item_flag_neutral (0 0.5 0.8) (-48 -48 -37) (48 48 37)
"noise5" sound played when flag touches the ground... */
spawnfunc(item_flag_neutral)
{
- if(!g_ctf) { remove(self); return; }
- if(!cvar("g_ctf_oneflag")) { remove(self); return; }
+ if(!g_ctf) { remove(this); return; }
+ if(!cvar("g_ctf_oneflag")) { remove(this); return; }
- ctf_FlagSetup(0, self);
+ ctf_FlagSetup(0, this);
}
/*QUAKED spawnfunc_ctf_team (0 .5 .8) (-16 -16 -24) (16 16 32)
"cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
spawnfunc(ctf_team)
{
- if(!g_ctf) { remove(self); return; }
+ if(!g_ctf) { remove(this); return; }
- self.classname = "ctf_team";
- self.team = self.cnt + 1;
+ this.classname = "ctf_team";
+ this.team = this.cnt + 1;
}
// compatibility for quake maps
spawnfunc(team_CTF_blueplayer) { spawnfunc_info_player_team2(this); }
spawnfunc(team_CTF_bluespawn) { spawnfunc_info_player_team2(this); }
-void team_CTF_neutralflag() { SELFPARAM(); spawnfunc_item_flag_neutral(self); }
-void team_neutralobelisk() { SELFPARAM(); spawnfunc_item_flag_neutral(self); }
+spawnfunc(team_CTF_neutralflag) { spawnfunc_item_flag_neutral(this); }
+spawnfunc(team_neutralobelisk) { spawnfunc_item_flag_neutral(this); }
// ==============
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITH(entity, self, this, spawnfunc_ctf_team(this));
+ WITHSELF(this, spawnfunc_ctf_team(this));
}
-void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
{
ctf_teams = 2;