void DropOwner()
{SELFPARAM();
entity ownr;
- ownr = self.owner;
- DropBall(self, ownr.origin, ownr.velocity);
+ ownr = this.owner;
+ DropBall(this, ownr.origin, ownr.velocity);
makevectors(ownr.v_angle.y * '0 1 0');
ownr.velocity += ('0 0 0.75' - v_forward) * 1000;
UNSET_ONGROUND(ownr);
void InitBall()
{SELFPARAM();
if(gameover) return;
- UNSET_ONGROUND(self);
- self.movetype = MOVETYPE_BOUNCE;
- if(self.classname == "nexball_basketball")
- self.touch = basketball_touch;
- else if(self.classname == "nexball_football")
- self.touch = football_touch;
- self.cnt = 0;
- self.think = ResetBall;
- self.nextthink = time + autocvar_g_nexball_delay_idle + 3;
- self.teamtime = 0;
- self.pusher = world;
- self.team = false;
- _sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM);
- WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+ UNSET_ONGROUND(this);
+ this.movetype = MOVETYPE_BOUNCE;
+ if(this.classname == "nexball_basketball")
+ this.touch = basketball_touch;
+ else if(this.classname == "nexball_football")
+ this.touch = football_touch;
+ this.cnt = 0;
+ this.think = ResetBall;
+ this.nextthink = time + autocvar_g_nexball_delay_idle + 3;
+ this.teamtime = 0;
+ this.pusher = world;
+ this.team = false;
+ _sound(this, CH_TRIGGER, this.noise1, VOL_BASE, ATTEN_NORM);
+ WaypointSprite_Ping(this.waypointsprite_attachedforcarrier);
LogNB("init", world);
}
void ResetBall()
{SELFPARAM();
- if(self.cnt < 2) // step 1
+ if(this.cnt < 2) // step 1
{
- if(time == self.teamtime)
- bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n");
+ if(time == this.teamtime)
+ bprint("The ", Team_ColoredFullName(this.team), " held the ball for too long.\n");
- self.touch = func_null;
- self.movetype = MOVETYPE_NOCLIP;
- self.velocity = '0 0 0'; // just in case?
- if(!self.cnt)
+ this.touch = func_null;
+ this.movetype = MOVETYPE_NOCLIP;
+ this.velocity = '0 0 0'; // just in case?
+ if(!this.cnt)
LogNB("resetidle", world);
- self.cnt = 2;
- self.nextthink = time;
+ this.cnt = 2;
+ this.nextthink = time;
}
- else if(self.cnt < 4) // step 2 and 3
+ else if(this.cnt < 4) // step 2 and 3
{
-// dprint("Step ", ftos(self.cnt), ": Calculated velocity: ", vtos(self.spawnorigin - self.origin), ", time: ", ftos(time), "\n");
- self.velocity = (self.spawnorigin - self.origin) * (self.cnt - 1); // 1 or 0.5 second movement
- self.nextthink = time + 0.5;
- self.cnt += 1;
+// dprint("Step ", ftos(this.cnt), ": Calculated velocity: ", vtos(this.spawnorigin - this.origin), ", time: ", ftos(time), "\n");
+ this.velocity = (this.spawnorigin - this.origin) * (this.cnt - 1); // 1 or 0.5 second movement
+ this.nextthink = time + 0.5;
+ this.cnt += 1;
}
else // step 4
{
// dprint("Step 4: time: ", ftos(time), "\n");
- if(vlen(self.origin - self.spawnorigin) > 10) // should not happen anymore
+ if(vlen(this.origin - this.spawnorigin) > 10) // should not happen anymore
LOG_TRACE("The ball moved too far away from its spawn origin.\nOffset: ",
- vtos(self.origin - self.spawnorigin), " Velocity: ", vtos(self.velocity), "\n");
- self.velocity = '0 0 0';
- setorigin(self, self.spawnorigin); // make sure it's positioned correctly anyway
- self.movetype = MOVETYPE_NONE;
- self.think = InitBall;
- self.nextthink = max(time, game_starttime) + autocvar_g_nexball_delay_start;
+ vtos(this.origin - this.spawnorigin), " Velocity: ", vtos(this.velocity), "\n");
+ this.velocity = '0 0 0';
+ setorigin(this, this.spawnorigin); // make sure it's positioned correctly anyway
+ this.movetype = MOVETYPE_NONE;
+ this.think = InitBall;
+ this.nextthink = max(time, game_starttime) + autocvar_g_nexball_delay_start;
}
}
void W_Nexball_Think()
{SELFPARAM();
//dprint("W_Nexball_Think\n");
- //vector new_dir = steerlib_arrive(self.enemy.origin, 2500);
- vector new_dir = normalize(self.enemy.origin + '0 0 50' - self.origin);
- vector old_dir = normalize(self.velocity);
- float _speed = vlen(self.velocity);
+ //vector new_dir = steerlib_arrive(this.enemy.origin, 2500);
+ vector new_dir = normalize(this.enemy.origin + '0 0 50' - this.origin);
+ vector old_dir = normalize(this.velocity);
+ float _speed = vlen(this.velocity);
vector new_vel = normalize(old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
//vector new_vel = (new_dir * autocvar_g_nexball_safepass_turnrate
- self.velocity = new_vel;
+ this.velocity = new_vel;
- self.nextthink = time;
+ this.nextthink = time;
}
void W_Nexball_Touch()
// TODO check if the two sides have moved (currently they won't move anyway)
float cc = 0, cc1 = 0, cc2 = 0;
- if(self.goalentity.islinked || self.goalentity.iscaptured) { cc1 = (self.goalentity.team - 1) * 0x01; }
- if(self.enemy.islinked || self.enemy.iscaptured) { cc2 = (self.enemy.team - 1) * 0x10; }
+ if(this.goalentity.islinked || this.goalentity.iscaptured) { cc1 = (this.goalentity.team - 1) * 0x01; }
+ if(this.enemy.islinked || this.enemy.iscaptured) { cc2 = (this.enemy.team - 1) * 0x10; }
cc = cc1 + cc2;
- if(cc != self.clientcolors)
+ if(cc != this.clientcolors)
{
- self.clientcolors = cc;
- self.SendFlags |= 4;
+ this.clientcolors = cc;
+ this.SendFlags |= 4;
}
- self.nextthink = time;
+ this.nextthink = time;
}
void ons_DelayedLinkSetup(entity this)
{
- self.goalentity = find(world, targetname, self.target);
- self.enemy = find(world, targetname, self.target2);
- if(!self.goalentity) { objerror("can not find target\n"); }
- if(!self.enemy) { objerror("can not find target2\n"); }
+ this.goalentity = find(world, targetname, this.target);
+ this.enemy = find(world, targetname, this.target2);
+ if(!this.goalentity) { objerror("can not find target\n"); }
+ if(!this.enemy) { objerror("can not find target2\n"); }
- LOG_DEBUG(strcat(etos(self.goalentity), " linked with ", etos(self.enemy), "\n"));
- self.SendFlags |= 3;
- self.think = ons_Link_CheckUpdate;
- self.nextthink = time;
+ LOG_DEBUG(strcat(etos(this.goalentity), " linked with ", etos(this.enemy), "\n"));
+ this.SendFlags |= 3;
+ this.think = ons_Link_CheckUpdate;
+ this.nextthink = time;
}
void ons_ControlPoint_Icon_Think()
{SELFPARAM();
- self.nextthink = time + ONS_CP_THINKRATE;
+ this.nextthink = time + ONS_CP_THINKRATE;
if(autocvar_g_onslaught_cp_proxydecap)
{
int _friendly_count = 0;
FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
- if(vdist(it.origin - self.origin, <, autocvar_g_onslaught_cp_proxydecap_distance))
+ if(vdist(it.origin - this.origin, <, autocvar_g_onslaught_cp_proxydecap_distance))
{
- if(SAME_TEAM(it, self))
+ if(SAME_TEAM(it, this))
++_friendly_count;
else
++_enemy_count;
_friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
_enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
- self.health = bound(0, self.health + (_friendly_count - _enemy_count), self.max_health);
- self.SendFlags |= CPSF_STATUS;
- if(self.health <= 0)
+ this.health = bound(0, this.health + (_friendly_count - _enemy_count), this.max_health);
+ this.SendFlags |= CPSF_STATUS;
+ if(this.health <= 0)
{
- ons_ControlPoint_Icon_Damage(self, self, self, 1, 0, self.origin, '0 0 0');
+ ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, this.origin, '0 0 0');
return;
}
}
- if (time > self.pain_finished + 5)
+ if (time > this.pain_finished + 5)
{
- if(self.health < self.max_health)
+ if(this.health < this.max_health)
{
- self.health = self.health + self.count;
- if (self.health >= self.max_health)
- self.health = self.max_health;
- WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
+ this.health = this.health + this.count;
+ if (this.health >= this.max_health)
+ this.health = this.max_health;
+ WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
}
}
- if(self.owner.islinked != self.owner.waslinked)
+ if(this.owner.islinked != this.owner.waslinked)
{
// unteam the spawnpoint if needed
- int t = self.owner.team;
- if(!self.owner.islinked)
- self.owner.team = 0;
+ int t = this.owner.team;
+ if(!this.owner.islinked)
+ this.owner.team = 0;
- SUB_UseTargets(self.owner, self, NULL);
+ SUB_UseTargets(this.owner, this, NULL);
- self.owner.team = t;
+ this.owner.team = t;
- self.owner.waslinked = self.owner.islinked;
+ this.owner.waslinked = this.owner.islinked;
}
// damaged fx
- if(random() < 0.6 - self.health / self.max_health)
+ if(random() < 0.6 - this.health / this.max_health)
{
- Send_Effect(EFFECT_ELECTRIC_SPARKS, self.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
+ Send_Effect(EFFECT_ELECTRIC_SPARKS, this.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
if(random() > 0.8)
- sound(self, CH_PAIN, SND_ONS_SPARK1, VOL_BASE, ATTEN_NORM);
+ sound(this, CH_PAIN, SND_ONS_SPARK1, VOL_BASE, ATTEN_NORM);
else if (random() > 0.5)
- sound(self, CH_PAIN, SND_ONS_SPARK2, VOL_BASE, ATTEN_NORM);
+ sound(this, CH_PAIN, SND_ONS_SPARK2, VOL_BASE, ATTEN_NORM);
}
}
{SELFPARAM();
int a;
- self.nextthink = time + ONS_CP_THINKRATE;
+ this.nextthink = time + ONS_CP_THINKRATE;
// only do this if there is power
- a = ons_ControlPoint_CanBeLinked(self.owner, self.owner.team);
+ a = ons_ControlPoint_CanBeLinked(this.owner, this.owner.team);
if(!a)
return;
- self.health = self.health + self.count;
+ this.health = this.health + this.count;
- self.SendFlags |= CPSF_STATUS;
+ this.SendFlags |= CPSF_STATUS;
- if (self.health >= self.max_health)
+ if (this.health >= this.max_health)
{
- self.health = self.max_health;
- self.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
- self.think = ons_ControlPoint_Icon_Think;
- sound(self, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM);
- self.owner.iscaptured = true;
- self.solid = SOLID_BBOX;
+ this.health = this.max_health;
+ this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
+ this.think = ons_ControlPoint_Icon_Think;
+ sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM);
+ this.owner.iscaptured = true;
+ this.solid = SOLID_BBOX;
- Send_Effect(EFFECT_CAP(self.owner.team), self.owner.origin, '0 0 0', 1);
+ Send_Effect(EFFECT_CAP(this.owner.team), this.owner.origin, '0 0 0', 1);
- WaypointSprite_UpdateMaxHealth(self.owner.sprite, self.max_health);
- WaypointSprite_UpdateHealth(self.owner.sprite, self.health);
+ WaypointSprite_UpdateMaxHealth(this.owner.sprite, this.max_health);
+ WaypointSprite_UpdateHealth(this.owner.sprite, this.health);
- if(IS_PLAYER(self.owner.ons_toucher))
+ if(IS_PLAYER(this.owner.ons_toucher))
{
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, self.owner.ons_toucher.netname, self.owner.message);
- Send_Notification(NOTIF_ALL_EXCEPT, self.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(self.owner.ons_toucher.team, CENTER_ONS_CAPTURE), self.owner.message);
- Send_Notification(NOTIF_ONE, self.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, self.owner.message);
- PlayerScore_Add(self.owner.ons_toucher, SP_ONS_CAPS, 1);
- PlayerTeamScore_AddScore(self.owner.ons_toucher, 10);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message);
+ Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE), this.owner.message);
+ Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message);
+ PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1);
+ PlayerTeamScore_AddScore(this.owner.ons_toucher, 10);
}
- self.owner.ons_toucher = world;
+ this.owner.ons_toucher = world;
onslaught_updatelinks();
// Use targets now (somebody make sure this is in the right place..)
- SUB_UseTargets(self.owner, self, NULL);
+ SUB_UseTargets(this.owner, this, NULL);
- self.SendFlags |= CPSF_SETUP;
+ this.SendFlags |= CPSF_SETUP;
}
- if(self.owner.model != MDL_ONS_CP_PAD2.model_str())
- setmodel_fixsize(self.owner, MDL_ONS_CP_PAD2);
+ if(this.owner.model != MDL_ONS_CP_PAD2.model_str())
+ setmodel_fixsize(this.owner, MDL_ONS_CP_PAD2);
- if(random() < 0.9 - self.health / self.max_health)
- Send_Effect(EFFECT_RAGE, self.origin + 10 * randomvec(), '0 0 -1', 1);
+ if(random() < 0.9 - this.health / this.max_health)
+ Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1);
}
void onslaught_controlpoint_icon_link(entity e, void() spawnproc);
void ons_GeneratorThink()
{SELFPARAM();
- self.nextthink = time + GEN_THINKRATE;
+ this.nextthink = time + GEN_THINKRATE;
if (!gameover)
{
- if(!self.isshielded && self.wait < time)
+ if(!this.isshielded && this.wait < time)
{
- self.wait = time + 5;
+ this.wait = time + 5;
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
- if(SAME_TEAM(it, self))
+ if(SAME_TEAM(it, this))
{
Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_ONS_NOTSHIELDED_TEAM);
soundto(MSG_ONE, it, CHAN_AUTO, SND(KH_ALARM), VOL_BASE, ATTEN_NONE); // FIXME: unique sound?
}
else
- Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(self.team, CENTER_ONS_NOTSHIELDED));
+ Send_Notification(NOTIF_ONE, it, MSG_CENTER, APP_TEAM_NUM(this.team, CENTER_ONS_NOTSHIELDED));
});
}
}
void pong_ball_think()
{SELFPARAM();
float think_speed = autocvar_sys_ticrate;
- self.nextthink = time + think_speed;
+ this.nextthink = time + think_speed;
- self.origin_x += self.velocity_x * think_speed;
- self.origin_y += self.velocity_y * think_speed;
- self.SendFlags |= MINIG_SF_UPDATE;
+ this.origin_x += this.velocity_x * think_speed;
+ this.origin_y += this.velocity_y * think_speed;
+ this.SendFlags |= MINIG_SF_UPDATE;
int i;
for ( i = 1; i <= PONG_MAX_PLAYERS; i++ )
- if ( pong_paddle_hit(self, i) )
+ if ( pong_paddle_hit(this, i) )
{
- pong_paddle_bounce(self,i);
- self.team = i;
- self.SendFlags |= PONG_SF_BALLTEAM;
+ pong_paddle_bounce(this,i);
+ this.team = i;
+ this.SendFlags |= PONG_SF_BALLTEAM;
return;
}
- if ( self.origin_y <= self.pong_length )
+ if ( this.origin_y <= this.pong_length )
{
- if ( !pong_goal(self,3) )
+ if ( !pong_goal(this,3) )
{
- self.origin_y = self.pong_length;
- self.velocity_y *= -1;
+ this.origin_y = this.pong_length;
+ this.velocity_y *= -1;
}
}
- else if ( self.origin_y >= 1-self.pong_length )
+ else if ( this.origin_y >= 1-this.pong_length )
{
- if ( !pong_goal(self,4) )
+ if ( !pong_goal(this,4) )
{
- self.origin_y = 1-self.pong_length;
- self.velocity_y *= -1;
+ this.origin_y = 1-this.pong_length;
+ this.velocity_y *= -1;
}
}
- if ( self.origin_x <= self.pong_length )
+ if ( this.origin_x <= this.pong_length )
{
- if ( !pong_goal(self,2) )
+ if ( !pong_goal(this,2) )
{
- self.origin_x = self.pong_length;
- self.velocity_x *= -1;
+ this.origin_x = this.pong_length;
+ this.velocity_x *= -1;
}
}
- else if ( self.origin_x >= 1-self.pong_length )
+ else if ( this.origin_x >= 1-this.pong_length )
{
- if ( !pong_goal(self,1) )
+ if ( !pong_goal(this,1) )
{
- self.origin_x = 1-self.pong_length;
- self.velocity_x *= -1;
+ this.origin_x = 1-this.pong_length;
+ this.velocity_x *= -1;
}
}
void pong_ai_think()
{SELFPARAM();
float think_speed = autocvar_sv_minigames_pong_ai_thinkspeed;
- self.nextthink = time + think_speed;
+ this.nextthink = time + think_speed;
float distance;
float next_distance;
float min_distance = 1;
entity ball = world;
entity mayball = world;
- while ( ( mayball = findentity(mayball,owner,self.owner) ) )
+ while ( ( mayball = findentity(mayball,owner,this.owner) ) )
if ( mayball.classname == "pong_ball" )
{
- distance = vlen(mayball.origin-self.pong_ai_paddle.origin);
- next_distance = vlen(mayball.origin+mayball.velocity-self.pong_ai_paddle.origin);
+ distance = vlen(mayball.origin-this.pong_ai_paddle.origin);
+ next_distance = vlen(mayball.origin+mayball.velocity-this.pong_ai_paddle.origin);
if ( distance < min_distance && ( distance < 0.5 || next_distance < distance ) )
{
min_distance = distance;
}
float target = 0.5;
- float self_pos;
+ float my_pos;
- if ( self.team <= 2 )
+ if ( this.team <= 2 )
{
if ( ball )
target = ball.origin_y + ball.velocity_y*think_speed;
- self_pos = self.pong_ai_paddle.origin_y;
+ my_pos = this.pong_ai_paddle.origin_y;
}
else
{
if ( ball )
target = ball.origin_x + ball.velocity_x*think_speed;
- self_pos = self.pong_ai_paddle.origin_x;
+ my_pos = this.pong_ai_paddle.origin_x;
}
- distance = self.pong_length/2 * autocvar_sv_minigames_pong_ai_tolerance
+ distance = this.pong_length/2 * autocvar_sv_minigames_pong_ai_tolerance
+ autocvar_sv_minigames_pong_paddle_speed * think_speed;
- if (target < self_pos - distance)
- self.pong_keys = PONG_KEY_DECREASE;
- else if (target > self_pos + distance)
- self.pong_keys = PONG_KEY_INCREASE;
+ if (target < my_pos - distance)
+ this.pong_keys = PONG_KEY_DECREASE;
+ else if (target > my_pos + distance)
+ this.pong_keys = PONG_KEY_INCREASE;
else
- self.pong_keys = 0;
+ this.pong_keys = 0;
}
entity pong_ai_spawn(entity paddle)
void pong_paddle_think()
{SELFPARAM();
float think_speed = autocvar_sys_ticrate;
- self.nextthink = time + think_speed;
+ this.nextthink = time + think_speed;
- if ( self.realowner.minigame_players.pong_keys == PONG_KEY_INCREASE ||
- self.realowner.minigame_players.pong_keys == PONG_KEY_DECREASE )
+ if ( this.realowner.minigame_players.pong_keys == PONG_KEY_INCREASE ||
+ this.realowner.minigame_players.pong_keys == PONG_KEY_DECREASE )
{
float movement = autocvar_sv_minigames_pong_paddle_speed * think_speed;
- float halflen = self.pong_length/2;
+ float halflen = this.pong_length/2;
- if ( self.realowner.minigame_players.pong_keys == PONG_KEY_DECREASE )
+ if ( this.realowner.minigame_players.pong_keys == PONG_KEY_DECREASE )
movement *= -1;
- if ( self.team > 2 )
- self.origin_x = bound(halflen, self.origin_x+movement, 1-halflen);
+ if ( this.team > 2 )
+ this.origin_x = bound(halflen, this.origin_x+movement, 1-halflen);
else
- self.origin_y = bound(halflen, self.origin_y+movement, 1-halflen);
+ this.origin_y = bound(halflen, this.origin_y+movement, 1-halflen);
- self.SendFlags |= MINIG_SF_UPDATE;
+ this.SendFlags |= MINIG_SF_UPDATE;
}
}
void snake_head_think()
{
SELFPARAM();
- entity minigame = self.owner;
+ entity minigame = this.owner;
if(minigame.minigame_flags & SNAKE_TURN_MOVE)
- snake_move_head(minigame, self);
+ snake_move_head(minigame, this);
snake_check_winner(minigame);
- self.nextthink = time + self.snake_delay;
+ this.nextthink = time + this.snake_delay;
}
void minigame_setup_snake(entity minigame, int pteam)
// copied from W_Seeker_Think
void M_Mage_Attack_Spike_Think()
{SELFPARAM();
- if (time > self.ltime || (self.enemy && self.enemy.health <= 0) || self.owner.health <= 0) {
- self.projectiledeathtype |= HITTYPE_SPLASH;
- M_Mage_Attack_Spike_Explode(self);
+ if (time > this.ltime || (this.enemy && this.enemy.health <= 0) || this.owner.health <= 0) {
+ this.projectiledeathtype |= HITTYPE_SPLASH;
+ M_Mage_Attack_Spike_Explode(this);
}
- float spd = vlen(self.velocity);
+ float spd = vlen(this.velocity);
spd = bound(
spd - (autocvar_g_monster_mage_attack_spike_decel) * frametime,
(autocvar_g_monster_mage_attack_spike_speed_max),
spd + (autocvar_g_monster_mage_attack_spike_accel) * frametime
);
- if (self.enemy != world)
- if (self.enemy.takedamage != DAMAGE_AIM || IS_DEAD(self.enemy))
- self.enemy = world;
+ if (this.enemy != world)
+ if (this.enemy.takedamage != DAMAGE_AIM || IS_DEAD(this.enemy))
+ this.enemy = world;
- if (self.enemy != world)
+ if (this.enemy != world)
{
- entity e = self.enemy;
+ entity e = this.enemy;
vector eorg = 0.5 * (e.absmin + e.absmax);
float turnrate = (autocvar_g_monster_mage_attack_spike_turnrate); // how fast to turn
- vector desireddir = normalize(eorg - self.origin);
- vector olddir = normalize(self.velocity); // get my current direction
+ vector desireddir = normalize(eorg - this.origin);
+ vector olddir = normalize(this.velocity); // get my current direction
// Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
- if ((autocvar_g_monster_mage_attack_spike_smart) && vdist(eorg - self.origin, >, autocvar_g_monster_mage_attack_spike_smart_mindist))
+ if ((autocvar_g_monster_mage_attack_spike_smart) && vdist(eorg - this.origin, >, autocvar_g_monster_mage_attack_spike_smart_mindist))
{
- // Is it a better idea (shorter distance) to trace to the target itself?
- if ( vlen2(self.origin + olddir * self.wait) < vlen2(eorg - self.origin))
- traceline(self.origin, self.origin + olddir * self.wait, false, self);
+ // Is it a better idea (shorter distance) to trace to the target itthis?
+ if ( vlen2(this.origin + olddir * this.wait) < vlen2(eorg - this.origin))
+ traceline(this.origin, this.origin + olddir * this.wait, false, this);
else
- traceline(self.origin, eorg, false, self);
+ traceline(this.origin, eorg, false, this);
// Setup adaptive tracelength
- self.wait = bound((autocvar_g_monster_mage_attack_spike_smart_trace_min), vlen(self.origin - trace_endpos), self.wait = (autocvar_g_monster_mage_attack_spike_smart_trace_max));
+ this.wait = bound((autocvar_g_monster_mage_attack_spike_smart_trace_min), vlen(this.origin - trace_endpos), this.wait = (autocvar_g_monster_mage_attack_spike_smart_trace_max));
// Calc how important it is that we turn and add this to the desierd (enemy) dir.
desireddir = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
}
vector newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
- self.velocity = newdir * spd; // make me fly in the new direction at my flight speed
+ this.velocity = newdir * spd; // make me fly in the new direction at my flight speed
}
///////////////
- //self.angles = vectoangles(self.velocity); // turn model in the new flight direction
- self.nextthink = time;// + 0.05; // csqc projectiles
- UpdateCSQCProjectile(self);
+ //this.angles = vectoangles(this.velocity); // turn model in the new flight direction
+ this.nextthink = time;// + 0.05; // csqc projectiles
+ UpdateCSQCProjectile(this);
}
void M_Mage_Attack_Spike(entity this, vector dir)
#include <common/effects/qc/all.qh>
-void M_Shambler_Attack_Lightning_Explode()
-{SELFPARAM();
+void M_Shambler_Attack_Lightning_Explode(entity this)
+{
entity head;
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
- Send_Effect(EFFECT_ELECTRO_IMPACT, self.origin, '0 0 0', 1);
+ sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
+ Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
- self.event_damage = func_null;
- self.takedamage = DAMAGE_NO;
- self.movetype = MOVETYPE_NONE;
- self.velocity = '0 0 0';
+ this.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
+ this.movetype = MOVETYPE_NONE;
+ this.velocity = '0 0 0';
- if(self.movetype == MOVETYPE_NONE)
- self.velocity = self.oldvelocity;
+ if(this.movetype == MOVETYPE_NONE)
+ this.velocity = this.oldvelocity;
- RadiusDamage (self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), world, world, (autocvar_g_monster_shambler_attack_lightning_force), self.projectiledeathtype, other);
+ RadiusDamage (this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), world, world, (autocvar_g_monster_shambler_attack_lightning_force), this.projectiledeathtype, other);
- for(head = findradius(self.origin, (autocvar_g_monster_shambler_attack_lightning_radius_zap)); head; head = head.chain) if(head != self.realowner) if(head.takedamage)
+ for(head = findradius(this.origin, (autocvar_g_monster_shambler_attack_lightning_radius_zap)); head; head = head.chain) if(head != this.realowner) if(head.takedamage)
{
- te_csqc_lightningarc(self.origin, head.origin);
- Damage(head, self, self.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(self), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
+ te_csqc_lightningarc(this.origin, head.origin);
+ Damage(head, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
}
- self.think = SUB_Remove_self;
- self.nextthink = time + 0.2;
+ this.think = SUB_Remove_self;
+ this.nextthink = time + 0.2;
}
void M_Shambler_Attack_Lightning_Explode_use(entity this, entity actor, entity trigger)
{
- WITHSELF(this, M_Shambler_Attack_Lightning_Explode());
+ M_Shambler_Attack_Lightning_Explode(this);
}
void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
void M_Shambler_Attack_Lightning_Think()
{SELFPARAM();
- self.nextthink = time;
- if (time > self.cnt)
+ this.nextthink = time;
+ if (time > this.cnt)
{
other = world;
- M_Shambler_Attack_Lightning_Explode();
+ M_Shambler_Attack_Lightning_Explode(this);
return;
}
}
void M_Wyvern_Attack_Fireball_Explode()
{
SELFPARAM();
- Send_Effect(EFFECT_FIREBALL_EXPLODE, self.origin, '0 0 0', 1);
+ Send_Effect(EFFECT_FIREBALL_EXPLODE, this.origin, '0 0 0', 1);
- entity own = self.realowner;
+ entity own = this.realowner;
- RadiusDamage(self, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, world, world, autocvar_g_monster_wyvern_attack_fireball_radius, self.projectiledeathtype, world);
+ RadiusDamage(this, own, autocvar_g_monster_wyvern_attack_fireball_damage, autocvar_g_monster_wyvern_attack_fireball_edgedamage, autocvar_g_monster_wyvern_attack_fireball_force, world, world, autocvar_g_monster_wyvern_attack_fireball_radius, this.projectiledeathtype, world);
FOREACH_ENTITY_FLOAT(takedamage, DAMAGE_AIM,
{
- if(vdist(it.origin - self.origin, <=, autocvar_g_monster_wyvern_attack_fireball_radius))
- Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, self.projectiledeathtype);
+ if(vdist(it.origin - this.origin, <=, autocvar_g_monster_wyvern_attack_fireball_radius))
+ Fire_AddDamage(it, own, 5 * MONSTER_SKILLMOD(own), autocvar_g_monster_wyvern_attack_fireball_damagetime, this.projectiledeathtype);
});
- remove(self);
+ remove(this);
}
void M_Wyvern_Attack_Fireball_Touch()
void Monster_Delay_Action_self()
{
SELFPARAM();
- Monster_Delay_Action(self);
+ Monster_Delay_Action(this);
}
void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func)
e.buff_waypoint.waypointsprite_visible_for_player = buff_Waypoint_visible_for_player;
}
-void buff_SetCooldown(float cd)
-{SELFPARAM();
+void buff_SetCooldown(entity this, float cd)
+{
cd = max(0, cd);
- if(!self.buff_waypoint)
- buff_Waypoint_Spawn(self);
+ if(!this.buff_waypoint)
+ buff_Waypoint_Spawn(this);
- WaypointSprite_UpdateBuildFinished(self.buff_waypoint, time + cd);
- self.buff_activetime = cd;
- self.buff_active = !cd;
+ WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + cd);
+ this.buff_activetime = cd;
+ this.buff_active = !cd;
}
void buff_Respawn(entity this)
void buff_Think()
{SELFPARAM();
- if(self.buffs != self.oldbuffs)
+ if(this.buffs != this.oldbuffs)
{
- entity buff = buff_FirstFromFlags(self.buffs);
- self.color = buff.m_color;
- self.glowmod = buff_GlowColor(buff);
- self.skin = buff.m_skin;
+ entity buff = buff_FirstFromFlags(this.buffs);
+ this.color = buff.m_color;
+ this.glowmod = buff_GlowColor(buff);
+ this.skin = buff.m_skin;
- setmodel(self, MDL_BUFF);
+ setmodel(this, MDL_BUFF);
- if(self.buff_waypoint)
+ if(this.buff_waypoint)
{
- //WaypointSprite_Disown(self.buff_waypoint, 1);
- WaypointSprite_Kill(self.buff_waypoint);
- buff_Waypoint_Spawn(self);
- if(self.buff_activetime)
- WaypointSprite_UpdateBuildFinished(self.buff_waypoint, time + self.buff_activetime - frametime);
+ //WaypointSprite_Disown(this.buff_waypoint, 1);
+ WaypointSprite_Kill(this.buff_waypoint);
+ buff_Waypoint_Spawn(this);
+ if(this.buff_activetime)
+ WaypointSprite_UpdateBuildFinished(this.buff_waypoint, time + this.buff_activetime - frametime);
}
- self.oldbuffs = self.buffs;
+ this.oldbuffs = this.buffs;
}
if(!gameover)
if((round_handler_IsActive() && !round_handler_IsRoundStarted()) || time >= game_starttime)
- if(!self.buff_activetime_updated)
+ if(!this.buff_activetime_updated)
{
- buff_SetCooldown(self.buff_activetime);
- self.buff_activetime_updated = true;
+ buff_SetCooldown(this, this.buff_activetime);
+ this.buff_activetime_updated = true;
}
- if(!self.buff_active && !self.buff_activetime)
- if(!self.owner || STAT(FROZEN, self.owner) || IS_DEAD(self.owner) || !self.owner.iscreature || !(self.owner.buffs & self.buffs))
+ if(!this.buff_active && !this.buff_activetime)
+ if(!this.owner || STAT(FROZEN, this.owner) || IS_DEAD(this.owner) || !this.owner.iscreature || !(this.owner.buffs & this.buffs))
{
- buff_SetCooldown(autocvar_g_buffs_cooldown_respawn + frametime);
- self.owner = world;
+ buff_SetCooldown(this, autocvar_g_buffs_cooldown_respawn + frametime);
+ this.owner = world;
if(autocvar_g_buffs_randomize)
- buff_NewType(self, self.buffs);
+ buff_NewType(this, this.buffs);
- if(autocvar_g_buffs_random_location || (self.spawnflags & 64))
- buff_Respawn(self);
+ if(autocvar_g_buffs_random_location || (this.spawnflags & 64))
+ buff_Respawn(this);
}
- if(self.buff_activetime)
+ if(this.buff_activetime)
if(!gameover)
if((round_handler_IsActive() && !round_handler_IsRoundStarted()) || time >= game_starttime)
{
- self.buff_activetime = max(0, self.buff_activetime - frametime);
+ this.buff_activetime = max(0, this.buff_activetime - frametime);
- if(!self.buff_activetime)
+ if(!this.buff_activetime)
{
- self.buff_active = true;
- sound(self, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTN_NORM);
- Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
+ this.buff_active = true;
+ sound(this, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTN_NORM);
+ Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
}
}
- if(self.buff_active)
+ if(this.buff_active)
{
- if(self.team && !self.buff_waypoint)
- buff_Waypoint_Spawn(self);
+ if(this.team && !this.buff_waypoint)
+ buff_Waypoint_Spawn(this);
- if(self.lifetime)
- if(time >= self.lifetime)
- buff_Respawn(self);
+ if(this.lifetime)
+ if(time >= this.lifetime)
+ buff_Respawn(this);
}
- self.nextthink = time;
- //self.angles_y = time * 110.1;
+ this.nextthink = time;
+ //this.angles_y = time * 110.1;
}
-void buff_Waypoint_Reset()
-{SELFPARAM();
- WaypointSprite_Kill(self.buff_waypoint);
+void buff_Waypoint_Reset(entity this)
+{
+ WaypointSprite_Kill(this.buff_waypoint);
- if(self.buff_activetime) { buff_Waypoint_Spawn(self); }
+ if(this.buff_activetime) { buff_Waypoint_Spawn(this); }
}
void buff_Reset(entity this)
if(autocvar_g_buffs_randomize)
buff_NewType(this, this.buffs);
this.owner = world;
- buff_SetCooldown(autocvar_g_buffs_cooldown_activate);
- buff_Waypoint_Reset();
+ buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate);
+ buff_Waypoint_Reset(this);
this.buff_activetime_updated = false;
if(autocvar_g_buffs_random_location || (this.spawnflags & 64))
float buff_Customize()
{SELFPARAM();
entity player = WaypointSprite_getviewentity(other);
- if(!self.buff_active || (self.team && DIFF_TEAM(player, self)))
+ if(!this.buff_active || (this.team && DIFF_TEAM(player, this)))
{
- self.alpha = 0.3;
- if(self.effects & EF_FULLBRIGHT) { self.effects &= ~(EF_FULLBRIGHT); }
- self.pflags = 0;
+ this.alpha = 0.3;
+ if(this.effects & EF_FULLBRIGHT) { this.effects &= ~(EF_FULLBRIGHT); }
+ this.pflags = 0;
}
else
{
- self.alpha = 1;
- if(!(self.effects & EF_FULLBRIGHT)) { self.effects |= EF_FULLBRIGHT; }
- self.light_lev = 220 + 36 * sin(time);
- self.pflags = PFLAGS_FULLDYNAMIC;
+ this.alpha = 1;
+ if(!(this.effects & EF_FULLBRIGHT)) { this.effects |= EF_FULLBRIGHT; }
+ this.light_lev = 220 + 36 * sin(time);
+ this.pflags = PFLAGS_FULLDYNAMIC;
}
return true;
}
-void buff_Init(entity ent)
-{SELFPARAM();
- if(!cvar("g_buffs")) { remove(ent); return; }
-
- if(!teamplay && ent.team) { ent.team = 0; }
-
- entity buff = buff_FirstFromFlags(self.buffs);
-
- setself(ent);
- if(!self.buffs || buff_Available(buff))
- buff_NewType(self, 0);
-
- self.classname = "item_buff";
- self.solid = SOLID_TRIGGER;
- self.flags = FL_ITEM;
- self.think = buff_Think;
- self.touch = buff_Touch;
- self.reset = buff_Reset;
- self.nextthink = time + 0.1;
- self.gravity = 1;
- self.movetype = MOVETYPE_TOSS;
- self.scale = 1;
- self.skin = buff.m_skin;
- self.effects = EF_FULLBRIGHT | EF_STARDUST | EF_NOSHADOW;
- self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
- self.customizeentityforclient = buff_Customize;
- //self.gravity = 100;
- self.color = buff.m_color;
- self.glowmod = buff_GlowColor(self);
- buff_SetCooldown(autocvar_g_buffs_cooldown_activate + game_starttime);
- self.buff_active = !self.buff_activetime;
- self.pflags = PFLAGS_FULLDYNAMIC;
-
- if(self.spawnflags & 1)
- self.noalign = true;
-
- if(self.noalign)
- self.movetype = MOVETYPE_NONE; // reset by random location
-
- setmodel(self, MDL_BUFF);
- setsize(self, BUFF_MIN, BUFF_MAX);
-
- if(cvar("g_buffs_random_location") || (self.spawnflags & 64))
- buff_Respawn(self);
+void buff_Init(entity this)
+{
+ if(!cvar("g_buffs")) { remove(this); return; }
+
+ if(!teamplay && this.team) { this.team = 0; }
- setself(this);
+ entity buff = buff_FirstFromFlags(this.buffs);
+
+ if(!this.buffs || buff_Available(buff))
+ buff_NewType(this, 0);
+
+ this.classname = "item_buff";
+ this.solid = SOLID_TRIGGER;
+ this.flags = FL_ITEM;
+ this.think = buff_Think;
+ this.touch = buff_Touch;
+ this.reset = buff_Reset;
+ this.nextthink = time + 0.1;
+ this.gravity = 1;
+ this.movetype = MOVETYPE_TOSS;
+ this.scale = 1;
+ this.skin = buff.m_skin;
+ this.effects = EF_FULLBRIGHT | EF_STARDUST | EF_NOSHADOW;
+ this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
+ this.customizeentityforclient = buff_Customize;
+ //this.gravity = 100;
+ this.color = buff.m_color;
+ this.glowmod = buff_GlowColor(this);
+ buff_SetCooldown(this, autocvar_g_buffs_cooldown_activate + game_starttime);
+ this.buff_active = !this.buff_activetime;
+ this.pflags = PFLAGS_FULLDYNAMIC;
+
+ if(this.spawnflags & 1)
+ this.noalign = true;
+
+ if(this.noalign)
+ this.movetype = MOVETYPE_NONE; // reset by random location
+
+ setmodel(this, MDL_BUFF);
+ setsize(this, BUFF_MIN, BUFF_MAX);
+
+ if(cvar("g_buffs_random_location") || (this.spawnflags & 64))
+ buff_Respawn(this);
}
void buff_Init_Compat(entity ent, entity replacement)
void buff_Vengeance_DelayedDamage()
{SELFPARAM();
- if(self.enemy)
- Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF.m_id, self.enemy.origin, '0 0 0');
+ if(this.enemy)
+ Damage(this.enemy, this.owner, this.owner, this.dmg, DEATH_BUFF.m_id, this.enemy.origin, '0 0 0');
- remove(self);
+ remove(this);
return;
}
void instagib_invisibility()
{SELFPARAM();
- self.strength_finished = autocvar_g_balance_powerup_strength_time;
+ this.strength_finished = autocvar_g_balance_powerup_strength_time;
StartItem(this, ITEM_Invisibility);
}
void instagib_speed()
{SELFPARAM();
- self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+ this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
StartItem(this, ITEM_Speed);
}
Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_INSTAGIB_FINDAMMO);
e.instagib_needammo = false;
}
-void instagib_ammocheck()
-{SELFPARAM();
- if(time < self.instagib_nextthink)
+void instagib_ammocheck(entity this)
+{
+ if(time < this.instagib_nextthink)
return;
- if(!IS_PLAYER(self))
+ if(!IS_PLAYER(this))
return; // not a player
- if(IS_DEAD(self) || gameover)
- instagib_stop_countdown(self);
- else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO) || (self.flags & FL_GODMODE))
- instagib_stop_countdown(self);
+ if(IS_DEAD(this) || gameover)
+ instagib_stop_countdown(this);
+ else if (this.ammo_cells > 0 || (this.items & IT_UNLIMITED_WEAPON_AMMO) || (this.flags & FL_GODMODE))
+ instagib_stop_countdown(this);
else if(autocvar_g_rm && autocvar_g_rm_laser)
{
- if(!self.instagib_needammo)
+ if(!this.instagib_needammo)
{
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
- self.instagib_needammo = true;
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_INSTAGIB_DOWNGRADE);
+ this.instagib_needammo = true;
}
}
else
{
- self.instagib_needammo = true;
- if (self.health <= 5)
+ this.instagib_needammo = true;
+ if (this.health <= 5)
{
- Damage(self, self, self, 5, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED);
+ Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_INSTAGIB_TERMINATED);
}
- else if (self.health <= 10)
+ else if (this.health <= 10)
{
- Damage(self, self, self, 5, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1);
+ Damage(this, this, this, 5, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_1);
}
- else if (self.health <= 20)
+ else if (this.health <= 20)
{
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_2);
}
- else if (self.health <= 30)
+ else if (this.health <= 30)
{
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_3);
}
- else if (self.health <= 40)
+ else if (this.health <= 40)
{
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_4);
}
- else if (self.health <= 50)
+ else if (this.health <= 50)
{
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_5);
}
- else if (self.health <= 60)
+ else if (this.health <= 60)
{
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_6);
}
- else if (self.health <= 70)
+ else if (this.health <= 70)
{
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_7);
}
- else if (self.health <= 80)
+ else if (this.health <= 80)
{
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_8);
}
- else if (self.health <= 90)
+ else if (this.health <= 90)
{
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO);
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
- Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_INSTAGIB_FINDAMMO);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, ANNCE_NUM_9);
}
else
{
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO);
- Damage(self, self, self, 10, DEATH_NOAMMO.m_id, self.origin, '0 0 0');
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_MULTI, MULTI_INSTAGIB_FINDAMMO);
+ Damage(this, this, this, 10, DEATH_NOAMMO.m_id, this.origin, '0 0 0');
}
}
- self.instagib_nextthink = time + 1;
+ this.instagib_nextthink = time + 1;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, MatchEnd)
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPreThink)
-{
- instagib_ammocheck();
+{SELFPARAM();
+ instagib_ammocheck(self);
return false;
}
void nade_timer_think()
{SELFPARAM();
- self.skin = 8 - (self.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
- self.nextthink = time;
- if(!self.owner || wasfreed(self.owner))
- remove(self);
+ this.skin = 8 - (this.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
+ this.nextthink = time;
+ if(!this.owner || wasfreed(this.owner))
+ remove(this);
}
void nade_burn_spawn(entity _nade)
CSQCProjectile(_nade, true, Nades_from(_nade.nade_type).m_projectile[false], true);
}
-void napalm_damage(float dist, float damage, float edgedamage, float burntime)
-{SELFPARAM();
+void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
+{
entity e;
float d;
vector p;
return;
RandomSelection_Init();
- for(e = WarpZone_FindRadius(self.origin, dist, true); e; e = e.chain)
+ for(e = WarpZone_FindRadius(this.origin, dist, true); e; e = e.chain)
if(e.takedamage == DAMAGE_AIM)
- if(self.realowner != e || autocvar_g_nades_napalm_selfdamage)
- if(!IS_PLAYER(e) || !self.realowner || DIFF_TEAM(e, self))
+ if(this.realowner != e || autocvar_g_nades_napalm_selfdamage)
+ if(!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this))
if(!STAT(FROZEN, e))
{
p = e.origin;
p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
- d = vlen(WarpZone_UnTransformOrigin(e, self.origin) - p);
+ d = vlen(WarpZone_UnTransformOrigin(e, this.origin) - p);
if(d < dist)
{
e.fireball_impactvec = p;
}
if(RandomSelection_chosen_ent)
{
- d = vlen(WarpZone_UnTransformOrigin(RandomSelection_chosen_ent, self.origin) - RandomSelection_chosen_ent.fireball_impactvec);
+ d = vlen(WarpZone_UnTransformOrigin(RandomSelection_chosen_ent, this.origin) - RandomSelection_chosen_ent.fireball_impactvec);
d = damage + (edgedamage - damage) * (d / dist);
- Fire_AddDamage(RandomSelection_chosen_ent, self.realowner, d * burntime, burntime, self.projectiledeathtype | HITTYPE_BOUNCE);
- //trailparticles(self, particleeffectnum(EFFECT_FIREBALL_LASER), self.origin, RandomSelection_chosen_ent.fireball_impactvec);
- Send_Effect(EFFECT_FIREBALL_LASER, self.origin, RandomSelection_chosen_ent.fireball_impactvec - self.origin, 1);
+ Fire_AddDamage(RandomSelection_chosen_ent, this.realowner, d * burntime, burntime, this.projectiledeathtype | HITTYPE_BOUNCE);
+ //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec);
+ Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1);
}
}
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
{
- remove(self);
+ remove(this);
return;
}
- if(time > self.pushltime)
+ if(time > this.pushltime)
{
- remove(self);
+ remove(this);
return;
}
- vector midpoint = ((self.absmin + self.absmax) * 0.5);
+ vector midpoint = ((this.absmin + this.absmax) * 0.5);
if(pointcontents(midpoint) == CONTENT_WATER)
{
- self.velocity = self.velocity * 0.5;
+ this.velocity = this.velocity * 0.5;
if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
- { self.velocity_z = 200; }
+ { this.velocity_z = 200; }
}
- self.angles = vectoangles(self.velocity);
+ this.angles = vectoangles(this.velocity);
- napalm_damage(autocvar_g_nades_napalm_ball_radius,autocvar_g_nades_napalm_ball_damage,
+ napalm_damage(this, autocvar_g_nades_napalm_ball_radius,autocvar_g_nades_napalm_ball_damage,
autocvar_g_nades_napalm_ball_damage,autocvar_g_nades_napalm_burntime);
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
}
-void nade_napalm_ball()
-{SELFPARAM();
+void nade_napalm_ball(entity this)
+{
entity proj;
vector kick;
- spamsound(self, CH_SHOTS, SND(FIREBALL_FIRE), VOL_BASE, ATTEN_NORM);
+ spamsound(this, CH_SHOTS, SND(FIREBALL_FIRE), VOL_BASE, ATTEN_NORM);
proj = new(grenade);
- proj.owner = self.owner;
- proj.realowner = self.realowner;
- proj.team = self.owner.team;
+ proj.owner = this.owner;
+ proj.realowner = this.realowner;
+ proj.team = this.owner.team;
proj.bot_dodge = true;
proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
proj.movetype = MOVETYPE_BOUNCE;
setmodel(proj, MDL_Null);
proj.scale = 1;//0.5;
setsize(proj, '-4 -4 -4', '4 4 4');
- setorigin(proj, self.origin);
+ setorigin(proj, this.origin);
proj.think = napalm_ball_think;
proj.nextthink = time;
proj.damageforcescale = autocvar_g_nades_napalm_ball_damageforcescale;
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
{
- remove(self);
+ remove(this);
return;
}
- if(time >= self.ltime)
+ if(time >= this.ltime)
{
- remove(self);
+ remove(this);
return;
}
- vector midpoint = ((self.absmin + self.absmax) * 0.5);
+ vector midpoint = ((this.absmin + this.absmax) * 0.5);
if(pointcontents(midpoint) == CONTENT_WATER)
{
- self.velocity = self.velocity * 0.5;
+ this.velocity = this.velocity * 0.5;
if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
- { self.velocity_z = 200; }
+ { this.velocity_z = 200; }
- UpdateCSQCProjectile(self);
+ UpdateCSQCProjectile(this);
}
- napalm_damage(autocvar_g_nades_napalm_fountain_radius, autocvar_g_nades_napalm_fountain_damage,
+ napalm_damage(this, autocvar_g_nades_napalm_fountain_radius, autocvar_g_nades_napalm_fountain_damage,
autocvar_g_nades_napalm_fountain_edgedamage, autocvar_g_nades_napalm_burntime);
- self.nextthink = time + 0.1;
- if(time >= self.nade_special_time)
+ this.nextthink = time + 0.1;
+ if(time >= this.nade_special_time)
{
- self.nade_special_time = time + autocvar_g_nades_napalm_fountain_delay;
- nade_napalm_ball();
+ this.nade_special_time = time + autocvar_g_nades_napalm_fountain_delay;
+ nade_napalm_ball(this);
}
}
-void nade_napalm_boom()
-{SELFPARAM();
+void nade_napalm_boom(entity this)
+{
entity fountain;
int c;
for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
- nade_napalm_ball();
+ nade_napalm_ball(this);
fountain = spawn();
nade_ice_freeze(self, e, current_freeze_time);
}
-void nade_ice_boom()
-{SELFPARAM();
+void nade_ice_boom(entity this)
+{
entity fountain;
fountain = spawn();
- fountain.owner = self.owner;
- fountain.realowner = self.realowner;
- fountain.origin = self.origin;
+ fountain.owner = this.owner;
+ fountain.realowner = this.realowner;
+ fountain.origin = this.origin;
setorigin(fountain, fountain.origin);
fountain.think = nade_ice_think;
fountain.nextthink = time;
fountain.ltime = time + autocvar_g_nades_ice_freeze_time;
fountain.pushltime = fountain.wait = fountain.ltime;
- fountain.team = self.team;
+ fountain.team = this.team;
fountain.movetype = MOVETYPE_TOSS;
fountain.projectiledeathtype = DEATH_NADE_ICE.m_id;
fountain.bot_dodge = false;
setsize(fountain, '-16 -16 -16', '16 16 16');
fountain.nade_special_time = time+0.3;
- fountain.angles = self.angles;
+ fountain.angles = this.angles;
if ( autocvar_g_nades_ice_explode )
{
entity timer = new(nade_timer);
setmodel(timer, MDL_NADE_TIMER);
setattachment(timer, fountain, "");
- timer.colormap = self.colormap;
- timer.glowmod = self.glowmod;
+ timer.colormap = this.colormap;
+ timer.glowmod = this.glowmod;
timer.think = nade_timer_think;
timer.nextthink = time;
timer.wait = fountain.ltime;
setmodel(fountain, MDL_Null);
}
-void nade_translocate_boom()
-{SELFPARAM();
- if(self.realowner.vehicle)
+void nade_translocate_boom(entity this)
+{
+ if(this.realowner.vehicle)
return;
- vector locout = self.origin + '0 0 1' * (1 - self.realowner.mins.z - 24);
- tracebox(locout, self.realowner.mins, self.realowner.maxs, locout, MOVE_NOMONSTERS, self.realowner);
+ vector locout = this.origin + '0 0 1' * (1 - this.realowner.mins.z - 24);
+ tracebox(locout, this.realowner.mins, this.realowner.maxs, locout, MOVE_NOMONSTERS, this.realowner);
locout = trace_endpos;
- makevectors(self.realowner.angles);
+ makevectors(this.realowner.angles);
- MUTATOR_CALLHOOK(PortalTeleport, self.realowner);
+ MUTATOR_CALLHOOK(PortalTeleport, this.realowner);
- TeleportPlayer(self, self.realowner, locout, self.realowner.angles, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
+ TeleportPlayer(this, this.realowner, locout, this.realowner.angles, v_forward * vlen(this.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
}
-void nade_spawn_boom()
-{SELFPARAM();
+void nade_spawn_boom(entity this)
+{
entity spawnloc = spawn();
- setorigin(spawnloc, self.origin);
- setsize(spawnloc, self.realowner.mins, self.realowner.maxs);
+ setorigin(spawnloc, this.origin);
+ setsize(spawnloc, this.realowner.mins, this.realowner.maxs);
spawnloc.movetype = MOVETYPE_NONE;
spawnloc.solid = SOLID_NOT;
- spawnloc.drawonlytoclient = self.realowner;
+ spawnloc.drawonlytoclient = this.realowner;
spawnloc.effects = EF_STARDUST;
spawnloc.cnt = autocvar_g_nades_spawn_count;
- if(self.realowner.nade_spawnloc)
+ if(this.realowner.nade_spawnloc)
{
- remove(self.realowner.nade_spawnloc);
- self.realowner.nade_spawnloc = world;
+ remove(this.realowner.nade_spawnloc);
+ this.realowner.nade_spawnloc = world;
}
- self.realowner.nade_spawnloc = spawnloc;
+ this.realowner.nade_spawnloc = spawnloc;
}
void nade_heal_think()
}
}
-void nade_heal_boom()
-{SELFPARAM();
+void nade_heal_boom(entity this)
+{
entity healer;
healer = spawn();
- healer.owner = self.owner;
- healer.realowner = self.realowner;
- setorigin(healer, self.origin);
+ healer.owner = this.owner;
+ healer.realowner = this.realowner;
+ setorigin(healer, this.origin);
healer.healer_lifetime = autocvar_g_nades_heal_time; // save the cvar
healer.ltime = time + healer.healer_lifetime;
- healer.team = self.realowner.team;
+ healer.team = this.realowner.team;
healer.bot_dodge = false;
healer.solid = SOLID_TRIGGER;
healer.touch = nade_heal_touch;
healer.SendFlags |= 1;
}
-void nade_monster_boom()
-{SELFPARAM();
- entity e = spawnmonster(self.pokenade_type, 0, self.realowner, self.realowner, self.origin, false, false, 1);
+void nade_monster_boom(entity this)
+{
+ entity e = spawnmonster(this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
if(autocvar_g_nades_pokenade_monster_lifetime > 0)
e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
entity expef = NULL;
bool nade_blast = true;
- switch ( Nades_from(self.nade_type) )
+ switch ( Nades_from(this.nade_type) )
{
case NADE_TYPE_NAPALM:
nade_blast = autocvar_g_nades_napalm_blast;
case NADE_TYPE_MONSTER:
case NADE_TYPE_SPAWN:
nade_blast = false;
- switch(self.realowner.team)
+ switch(this.realowner.team)
{
case NUM_TEAM_1: expef = EFFECT_SPAWN_RED; break;
case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE; break;
default:
case NADE_TYPE_NORMAL:
- expef = EFFECT_NADE_EXPLODE(self.realowner.team);
+ expef = EFFECT_NADE_EXPLODE(this.realowner.team);
break;
}
if(expef)
- Send_Effect(expef, findbetterlocation(self.origin, 8), '0 0 0', 1);
+ Send_Effect(expef, findbetterlocation(this.origin, 8), '0 0 0', 1);
- sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- self.event_damage = func_null; // prevent somehow calling damage in the next call
+ this.event_damage = func_null; // prevent somehow calling damage in the next call
if(nade_blast)
{
- RadiusDamage(self, self.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
- autocvar_g_nades_nade_radius, self, world, autocvar_g_nades_nade_force, self.projectiledeathtype, self.enemy);
- Damage_DamageInfo(self.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, self.projectiledeathtype, 0, self);
+ RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
+ autocvar_g_nades_nade_radius, this, world, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy);
+ Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this);
}
- if(self.takedamage)
- switch ( Nades_from(self.nade_type) )
+ if(this.takedamage)
+ switch ( Nades_from(this.nade_type) )
{
- case NADE_TYPE_NAPALM: nade_napalm_boom(); break;
- case NADE_TYPE_ICE: nade_ice_boom(); break;
- case NADE_TYPE_TRANSLOCATE: nade_translocate_boom(); break;
- case NADE_TYPE_SPAWN: nade_spawn_boom(); break;
- case NADE_TYPE_HEAL: nade_heal_boom(); break;
- case NADE_TYPE_MONSTER: nade_monster_boom(); break;
+ case NADE_TYPE_NAPALM: nade_napalm_boom(this); break;
+ case NADE_TYPE_ICE: nade_ice_boom(this); break;
+ case NADE_TYPE_TRANSLOCATE: nade_translocate_boom(this); break;
+ case NADE_TYPE_SPAWN: nade_spawn_boom(this); break;
+ case NADE_TYPE_HEAL: nade_heal_boom(this); break;
+ case NADE_TYPE_MONSTER: nade_monster_boom(this); break;
}
- FOREACH_ENTITY_ENT(aiment, self,
+ FOREACH_ENTITY_ENT(aiment, this,
{
if(it.classname == "grapplinghook")
RemoveGrapplingHook(it.realowner);
});
- remove(self);
+ remove(this);
}
void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype);
void nade_beep()
{SELFPARAM();
- sound(self, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
- self.think = nade_boom;
- self.nextthink = max(self.wait, time);
+ sound(this, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
+ this.think = nade_boom;
+ this.nextthink = max(this.wait, time);
}
void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)