return -1;
}
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, PlayerDies)
{
+ entity frag_attacker = M_ARGV(1, entity);
+ entity frag_target = M_ARGV(2, entity);
+
if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)))
{
if(frag_target.ballcarried) { // add to amount of times killing carrier
}
if(frag_target.ballcarried) { ka_DropEvent(frag_target); } // a player with the ball has died, drop it
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, GiveFragsForKill)
{
- frag_score = 0; // no frags counted in keepaway
- return 1; // you deceptive little bugger ;3 This needs to be true in order for this function to even count.
+ M_ARGV(2, float) = 0; // no frags counted in keepaway
+ return true; // you deceptive little bugger ;3 This needs to be true in order for this function to even count.
}
MUTATOR_HOOKFUNCTION(ka, PlayerPreThink)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
// clear the item used for the ball in keepaway
- self.items &= ~IT_KEY1;
+ player.items &= ~IT_KEY1;
// if the player has the ball, make sure they have the item for it (Used for HUD primarily)
- if(self.ballcarried)
- self.items |= IT_KEY1;
-
- return 0;
+ if(player.ballcarried)
+ player.items |= IT_KEY1;
}
MUTATOR_HOOKFUNCTION(ka, PlayerUseKey)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
if(MUTATOR_RETURNVALUE == 0)
- if(self.ballcarried)
+ if(player.ballcarried)
{
- ka_DropEvent(self);
- return 1;
+ ka_DropEvent(player);
+ return true;
}
- return 0;
}
MUTATOR_HOOKFUNCTION(ka, 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.ballcarried) // if the attacker is a ballcarrier
{
if(frag_target == frag_attacker) // damage done to yourself
frag_force *= autocvar_g_keepaway_noncarrier_force;
}
}
- return 0;
+
+ M_ARGV(4, float) = frag_damage;
+ M_ARGV(6, vector) = frag_force;
+
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, ClientDisconnect)
-{SELFPARAM();
- if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
- return 0;
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ballcarried) { ka_DropEvent(player); } // a player with the ball has left the match, drop it
}
MUTATOR_HOOKFUNCTION(ka, MakePlayerObserver)
-{SELFPARAM();
- if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
- return 0;
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ballcarried) { ka_DropEvent(player); } // a player with the ball has left the match, drop it
+ return false;
}
MUTATOR_HOOKFUNCTION(ka, PlayerPowerups)
-{SELFPARAM();
+{
+ entity player = M_ARGV(0, entity);
+
// In the future this hook is supposed to allow me to do some extra stuff with waypointsprites and invisibility powerup
// So bare with me until I can fix a certain bug with ka_ballcarrier_waypointsprite_visible_for_player()
- self.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
-
- if(self.ballcarried)
- self.effects |= autocvar_g_keepaway_ballcarrier_effects;
+ player.effects &= ~autocvar_g_keepaway_ballcarrier_effects;
- return 0;
+ if(player.ballcarried)
+ player.effects |= autocvar_g_keepaway_ballcarrier_effects;
}
.float stat_sv_airspeedlimit_nonqw;
.float stat_sv_maxspeed;
MUTATOR_HOOKFUNCTION(ka, PlayerPhysics)
-{SELFPARAM();
- if(self.ballcarried)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ballcarried)
{
- self.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
- self.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
+ player.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
+ player.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
}
- return false;
}
MUTATOR_HOOKFUNCTION(ka, BotShouldAttack)
-{SELFPARAM();
+{
+ entity bot = M_ARGV(0, entity);
+ entity targ = M_ARGV(1, entity);
+
// if neither player has ball then don't attack unless the ball is on the ground
- if(!checkentity.ballcarried && !self.ballcarried && ka_ball.owner)
+ if(!targ.ballcarried && !bot.ballcarried && ka_ball.owner)
return true;
return false;
}
MUTATOR_HOOKFUNCTION(ka, HavocBot_ChooseRole)
-{SELFPARAM();
- if (self.ballcarried)
- self.havocbot_role = havocbot_role_ka_carrier;
+{
+ entity bot = M_ARGV(0, entity);
+
+ if (bot.ballcarried)
+ bot.havocbot_role = havocbot_role_ka_carrier;
else
- self.havocbot_role = havocbot_role_ka_collector;
+ bot.havocbot_role = havocbot_role_ka_collector;
return true;
}
MUTATOR_HOOKFUNCTION(ka, DropSpecialItems)
{
+ entity frag_target = M_ARGV(0, entity);
+
if(frag_target.ballcarried)
ka_DropEvent(frag_target);