ka_RespawnBall();
}
-void ka_SpawnBall() // loads various values for the ball
+void ka_SpawnBall() // loads various values for the ball, runs only once at start of match
{
if(!g_keepaway) { return; }
setmodel(e, e.model);
setsize(e, '-16 -16 -20', '16 16 20'); // 20 20 20 was too big, player is only 16 16 24... gotta cheat with the Z (20) axis so that the particle isn't cut off
e.classname = "keepawayball";
- e.damageforcescale = cvar("g_keepawayball_damageforcescale");
+ e.damageforcescale = autocvar_g_keepawayball_damageforcescale;
e.takedamage = DAMAGE_YES;
- e.glow_color = cvar("g_keepawayball_trail_color");
+ e.glow_color = autocvar_g_keepawayball_trail_color;
e.glow_trail = TRUE;
e.movetype = MOVETYPE_BOUNCE;
e.touch = ka_TouchEvent;
self.angles = '0 0 0';
self.solid = SOLID_TRIGGER;
self.think = ka_RespawnBall;
- self.nextthink = time + cvar("g_keepawayball_respawntime");
+ self.nextthink = time + autocvar_g_keepawayball_respawntime;
pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
self.owner = other;
other.ballcarried = self;
setattachment(self, other, "");
- setorigin(self, '3 0 20');
+ setorigin(self, '3 0 20'); // wtf why is this not '0 0 0' ?
// make the ball invisible/unable to do anything
self.velocity = '0 0 0';
self.takedamage = DAMAGE_NO;
// apply effects to player
- other.glow_color = cvar("g_keepawayball_trail_color");
+ other.glow_color = autocvar_g_keepawayball_trail_color;
other.glow_trail = TRUE;
other.effects |= EF_DIMLIGHT;
- other.alpha = cvar("g_keepaway_ballcarrier_alpha");
- other.exteriorweaponentity.alpha = cvar("g_keepaway_ballcarrier_alpha");
+ other.alpha = autocvar_g_keepaway_ballcarrier_alpha;
+ other.exteriorweaponentity.alpha = autocvar_g_keepaway_ballcarrier_alpha;
// messages and sounds
Send_KillNotification(other.netname, "", "", KA_PICKUPBALL, MSG_KA);
ball.solid = SOLID_TRIGGER; // is this needed?
ball.wait = time + 1;
ball.think = ka_RespawnBall;
- ball.nextthink = time + cvar("g_keepawayball_respawntime");
+ ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.touch = ka_TouchEvent;
ball.takedamage = DAMAGE_YES;
ball.effects &~= EF_NODRAW;
ball.owner = world;
// reset the player effects
+ plyr.glow_trail = FALSE;
plyr.effects &~= EF_DIMLIGHT;
plyr.alpha = default_player_alpha;
plyr.exteriorweaponentity.alpha = default_weapon_alpha;
- plyr.glow_trail = FALSE;
// messages and sounds
Send_KillNotification(plyr.netname, "", "", KA_DROPBALL, MSG_KA);
float ka_ballcarrier_waypointsprite_visible_for_player(entity e) // runs on waypoints which are attached to ballcarriers, updates once per frame
{
if(e.ballcarried)
- {
if(other.classname == "spectator")
return FALSE; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
- else if(g_minstagib && (e.items & IT_STRENGTH))
- return FALSE; // if the ballcarrier has invisibility, don't draw the waypoint as this is the function of invisibility in keepaway
- }
+
+ // TODO: Make the ballcarrier lack a waypointsprite whenever they have the invisibility powerup
return TRUE;
}
{
if(frag_target.ballcarried) { // add to amount of times killing carrier
PlayerScore_Add(frag_attacker, SP_KEEPAWAY_CARRIERKILLS, 1);
- if(cvar("g_keepaway_bckillscore")) // add bckills to the score
+ if(autocvar_g_keepaway_bckillscore) // add bckills to the score
PlayerScore_Add(frag_attacker, SP_KEEPAWAY_SCORE, 1);
}
else if(!frag_attacker.ballcarried)
- if(cvar("g_keepaway_noncarrier_warn"))
+ if(autocvar_g_keepaway_noncarrier_warn)
centerprint_atprio(frag_attacker, (CENTERPRIO_SPAM + 5), "Killing people while you don't have the ball gives no points!");
if(frag_attacker.ballcarried) // add to amount of kills while ballcarrier
{
if(frag_target == frag_attacker) // damage done to yourself
{
- frag_damage *= cvar("g_keepaway_ballcarrier_selfdamage");
- frag_force *= cvar("g_keepaway_ballcarrier_selfforce");
+ frag_damage *= autocvar_g_keepaway_ballcarrier_selfdamage;
+ frag_force *= autocvar_g_keepaway_ballcarrier_selfforce;
}
else // damage done to noncarriers
{
- frag_damage *= cvar("g_keepaway_ballcarrier_damage");
- frag_force *= cvar("g_keepaway_ballcarrier_force");
+ frag_damage *= autocvar_g_keepaway_ballcarrier_damage;
+ frag_force *= autocvar_g_keepaway_ballcarrier_force;
}
}
else if not(frag_target.ballcarried) // if the target is a noncarrier
{
if(frag_target == frag_attacker) // damage done to yourself
{
- frag_damage *= cvar("g_keepaway_noncarrier_selfdamage");
- frag_force *= cvar("g_keepaway_noncarrier_selfforce");
+ frag_damage *= autocvar_g_keepaway_noncarrier_selfdamage;
+ frag_force *= autocvar_g_keepaway_noncarrier_selfforce;
}
else // damage done to other noncarriers
{
- frag_damage *= cvar("g_keepaway_noncarrier_damage");
- frag_force *= cvar("g_keepaway_noncarrier_force");
+ frag_damage *= autocvar_g_keepaway_noncarrier_damage;
+ frag_force *= autocvar_g_keepaway_noncarrier_force;
}
}
return 0;
MUTATOR_HOOKFUNCTION(ka_PlayerPowerups)
{
+ // right now this hook doesn't make much sense (It's actually useless this way except for minstagib invisibility alpha)
+ // but in the future it's 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()
+
+ // also note that this structure makes no sense (Rather there is a better way to do it) the way it's currently applied
+ // again just bare with me as this is for a future feature.
+
if(self.ballcarried)
{
- // if the player has the ball, force ballcarrier alpha upon them
- self.alpha = cvar("g_keepaway_ballcarrier_alpha");
- self.exteriorweaponentity.alpha = cvar("g_keepaway_ballcarrier_alpha");
+ // force the default ballcarrier alpha on the player if they have the ball
+ self.alpha = autocvar_g_keepaway_ballcarrier_alpha;
+ self.exteriorweaponentity.alpha = autocvar_g_keepaway_ballcarrier_alpha;
- // if we're in minstagib and a ballcarrier has just picked up invisibility,
- // notify all the other players that the ballcarrier no longer has a waypoint
if(g_minstagib)
{
if(olditems & IT_STRENGTH)
- {
- if(time > self.strength_finished)
- { // this only runs ONCE right after the player loses invisibility
- bprint(self.netname, "^7 isn't invisible from radar anymore.\n");
- }
- }
- else
- {
- if(time < self.strength_finished)
- { // this only runs ONCE right after the player gains invisibility
- bprint(self.netname, "^7 has picked up invisibility and can no longer be seen on radar!\n");
- }
+ { // if the player has the ball and they also have the invisibility powerup, apply alpha accordingly
+ self.alpha = g_minstagib_invis_alpha;
+ self.exteriorweaponentity.alpha = g_minstagib_invis_alpha;
}
}
}
}
return 0;
-}
\ No newline at end of file
+}