{
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{
- Casing_Delete(self);
+ Casing_Delete(this);
return;
}
- if (!self.silent)
+ if (!this.silent)
if (!trace_ent || trace_ent.solid == SOLID_BSP)
{
- if(vdist(self.velocity, >, 50))
+ if(vdist(this.velocity, >, 50))
{
- if (time >= self.nextthink)
+ if (time >= this.nextthink)
{
Sound s;
- switch (self.state)
+ switch (this.state)
{
case 1:
s = SND_CASINGS_RANDOM();
break;
}
- sound (self, CH_SHOTS, s, VOL_BASE, ATTEN_LARGE);
+ sound (this, CH_SHOTS, s, VOL_BASE, ATTEN_LARGE);
}
}
}
- self.nextthink = time + 0.2;
+ this.nextthink = time + 0.2;
}
void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector thisforce)
void SUB_RemoveOnNoImpact(entity this)
{
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
- Gib_Delete(self);
+ Gib_Delete(this);
}
void Gib_Touch(entity this)
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{
- Gib_Delete(self);
+ Gib_Delete(this);
return;
}
- if(!self.silent)
- sound(self, CH_PAIN, SND_GIB_SPLAT_RANDOM(), VOL_BASE, ATTEN_NORM);
- __pointparticles(_particleeffectnum(strcat(species_prefix(self.cnt), "blood")), self.origin + '0 0 1', '0 0 30', 10);
+ if(!this.silent)
+ sound(this, CH_PAIN, SND_GIB_SPLAT_RANDOM(), VOL_BASE, ATTEN_NORM);
+ __pointparticles(_particleeffectnum(strcat(species_prefix(this.cnt), "blood")), this.origin + '0 0 1', '0 0 30', 10);
- Gib_Delete(self);
+ Gib_Delete(this);
}
void Gib_Draw(entity this)
void b_draw()
{
- //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin);
- Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin);
+ //Draw_CylindricLine(this.fx_start, this.fx_end, this.fx_with, this.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin);
+ Draw_CylindricLine(this.fx_start, this.fx_end, this.fx_with, this.fx_texture, (this.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin);
}
void b_make(vector s,vector e, string t,float l,float z)
{
if(other.solid == SOLID_BSP)
{
- if(time > self.lastground + 0.1)
+ if(time > this.lastground + 0.1)
{
- _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
- self.lastground = time;
+ _sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
+ this.lastground = time;
}
- if(vlen(self.velocity) && !self.cnt)
- self.nextthink = time + autocvar_g_nexball_delay_idle;
+ if(this.velocity && !this.cnt)
+ this.nextthink = time + autocvar_g_nexball_delay_idle;
return;
}
if (!IS_PLAYER(other))
return;
if(other.health < 1)
return;
- if(!self.cnt)
- self.nextthink = time + autocvar_g_nexball_delay_idle;
+ if(!this.cnt)
+ this.nextthink = time + autocvar_g_nexball_delay_idle;
- self.pusher = other;
- self.team = other.team;
+ this.pusher = other;
+ this.team = other.team;
if(autocvar_g_nexball_football_physics == -1) // MrBougo try 1, before decompiling Rev's original
{
if(vlen(other.velocity))
- self.velocity = other.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
+ this.velocity = other.velocity * 1.5 + '0 0 1' * autocvar_g_nexball_football_boost_up;
}
else if(autocvar_g_nexball_football_physics == 1) // MrBougo's modded Rev style: partially independant of the height of the aiming point
{
makevectors(other.v_angle);
- self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up;
+ this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + '0 0 1' * autocvar_g_nexball_football_boost_up;
}
else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable!
{
makevectors(other.v_angle.y * '0 1 0');
- self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
+ this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
}
else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant)
{
makevectors(other.v_angle);
- self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
+ this.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up;
}
- self.avelocity = -250 * v_forward; // maybe there is a way to make it look better?
+ this.avelocity = -250 * v_forward; // maybe there is a way to make it look better?
}
void basketball_touch(entity this)
football_touch(this);
return;
}
- if(!self.cnt && IS_PLAYER(other) && !STAT(FROZEN, other) && !IS_DEAD(other) && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect))
+ if(!this.cnt && IS_PLAYER(other) && !STAT(FROZEN, other) && !IS_DEAD(other) && (other != this.nb_dropper || time > this.nb_droptime + autocvar_g_nexball_delay_collect))
{
if(other.health <= 0)
return;
LogNB("caught", other);
- GiveBall(other, self);
+ GiveBall(other, this);
}
else if(other.solid == SOLID_BSP)
{
- _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
- if(vlen(self.velocity) && !self.cnt)
- self.nextthink = min(time + autocvar_g_nexball_delay_idle, self.teamtime);
+ _sound(this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
+ if(vlen(this.velocity) && !this.cnt)
+ this.nextthink = min(time + autocvar_g_nexball_delay_idle, this.teamtime);
}
}
string pname;
if(gameover) return;
- if((self.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried)
+ if((this.spawnflags & GOAL_TOUCHPLAYER) && other.ballcarried)
ball = other.ballcarried;
else
ball = other;
if(ball.classname != "nexball_basketball")
if(ball.classname != "nexball_football")
return;
- if((!ball.pusher && self.team != GOAL_OUT) || ball.cnt)
+ if((!ball.pusher && this.team != GOAL_OUT) || ball.cnt)
return;
EXACTTRIGGER_TOUCH;
else
pname = "Someone (?)";
- if(ball.team == self.team) //owngoal (regular goals)
+ if(ball.team == this.team) //owngoal (regular goals)
{
LogNB("owngoal", ball.pusher);
bprint("Boo! ", pname, "^7 scored a goal against their own team!\n");
pscore = -1;
}
- else if(self.team == GOAL_FAULT)
+ else if(this.team == GOAL_FAULT)
{
LogNB("fault", ball.pusher);
if(nb_teams == 2)
bprint(Team_ColoredFullName(ball.team), " loses a point due to ", pname, "^7's silliness.\n");
pscore = -1;
}
- else if(self.team == GOAL_OUT)
+ else if(this.team == GOAL_OUT)
{
LogNB("out", ball.pusher);
- if((self.spawnflags & GOAL_TOUCHPLAYER) && ball.owner)
+ if((this.spawnflags & GOAL_TOUCHPLAYER) && ball.owner)
bprint(pname, "^7 went out of bounds.\n");
else
bprint("The ball was returned.\n");
}
else //score
{
- LogNB(strcat("goal:", ftos(self.team)), ball.pusher);
+ LogNB(strcat("goal:", ftos(this.team)), ball.pusher);
bprint("Goaaaaal! ", pname, "^7 scored a point for the ", Team_ColoredFullName(ball.team), ".\n");
pscore = 1;
}
- _sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NONE);
+ _sound(ball, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NONE);
if(ball.team && pscore)
{
setthink(ball, ResetBall);
if(ball.classname == "nexball_basketball")
settouch(ball, football_touch); // better than func_null: football control until the ball gets reset
- ball.nextthink = time + autocvar_g_nexball_delay_goal * (self.team != GOAL_OUT);
+ ball.nextthink = time + autocvar_g_nexball_delay_goal * (this.team != GOAL_OUT);
}
//=======================//
{
entity e, wp_owner;
e = WaypointSprite_getviewentity(other);
- wp_owner = self.owner;
+ wp_owner = this.owner;
if(SAME_TEAM(e, wp_owner)) { return false; }
return true;
float ball_customize(entity this)
{
- if(!self.owner)
+ if(!this.owner)
{
- self.effects &= ~EF_FLAME;
- self.scale = 1;
- setcefc(self, func_null);
+ this.effects &= ~EF_FLAME;
+ this.scale = 1;
+ setcefc(this, func_null);
return true;
}
- if(other == self.owner)
+ if(other == this.owner)
{
- self.scale = autocvar_g_nexball_viewmodel_scale;
- if(self.enemy)
- self.effects |= EF_FLAME;
+ this.scale = autocvar_g_nexball_viewmodel_scale;
+ if(this.enemy)
+ this.effects |= EF_FLAME;
else
- self.effects &= ~EF_FLAME;
+ this.effects &= ~EF_FLAME;
}
else
{
- self.effects &= ~EF_FLAME;
- self.scale = 1;
+ this.effects &= ~EF_FLAME;
+ this.scale = 1;
}
return true;
{
entity e = WaypointSprite_getviewentity(other);
- if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; }
- if(SAME_TEAM(self, e)) { return false; }
+ if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, e.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return false; }
+ if(SAME_TEAM(this, e)) { return false; }
return true;
}
void ons_CaptureShield_Touch(entity this)
{
- if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; }
+ if(!this.enemy.isshielded && (ons_ControlPoint_Attackable(this.enemy, other.team) > 0 || this.enemy.classname != "onslaught_controlpoint")) { return; }
if(!IS_PLAYER(other)) { return; }
- if(SAME_TEAM(other, self)) { return; }
+ if(SAME_TEAM(other, this)) { return; }
- vector mymid = (self.absmin + self.absmax) * 0.5;
+ vector mymid = (this.absmin + this.absmax) * 0.5;
vector othermid = (other.absmin + other.absmax) * 0.5;
- Damage(other, self, self, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force);
+ Damage(other, this, this, 0, DEATH_HURTTRIGGER.m_id, mymid, normalize(othermid - mymid) * ons_captureshield_force);
if(IS_REAL_CLIENT(other))
{
play2(other, SND(ONS_DAMAGEBLOCKEDBYSHIELD));
- if(self.enemy.classname == "onslaught_generator")
+ if(this.enemy.classname == "onslaught_generator")
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_GENERATOR_SHIELDED);
else
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_CONTROLPOINT_SHIELDED);
WriteByte(MSG_ENTITY, sendflags);
if(sendflags & 1)
{
- WriteCoord(MSG_ENTITY, self.goalentity.origin_x);
- WriteCoord(MSG_ENTITY, self.goalentity.origin_y);
- WriteCoord(MSG_ENTITY, self.goalentity.origin_z);
+ WriteCoord(MSG_ENTITY, this.goalentity.origin_x);
+ WriteCoord(MSG_ENTITY, this.goalentity.origin_y);
+ WriteCoord(MSG_ENTITY, this.goalentity.origin_z);
}
if(sendflags & 2)
{
- WriteCoord(MSG_ENTITY, self.enemy.origin_x);
- WriteCoord(MSG_ENTITY, self.enemy.origin_y);
- WriteCoord(MSG_ENTITY, self.enemy.origin_z);
+ WriteCoord(MSG_ENTITY, this.enemy.origin_x);
+ WriteCoord(MSG_ENTITY, this.enemy.origin_y);
+ WriteCoord(MSG_ENTITY, this.enemy.origin_z);
}
if(sendflags & 4)
{
- WriteByte(MSG_ENTITY, self.clientcolors); // which is goalentity's color + enemy's color * 16
+ WriteByte(MSG_ENTITY, this.clientcolors); // which is goalentity's color + enemy's color * 16
}
return true;
}
if(STAT(FROZEN, toucher)) { return; }
if(IS_DEAD(toucher)) { return; }
- if ( SAME_TEAM(self,toucher) )
- if ( self.iscaptured )
+ if ( SAME_TEAM(this,toucher) )
+ if ( this.iscaptured )
{
if(time <= toucher.teleport_antispam)
Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT_ANTISPAM, rint(toucher.teleport_antispam - time));
Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_ONS_TELEPORT);
}
- attackable = ons_ControlPoint_Attackable(self, toucher.team);
+ attackable = ons_ControlPoint_Attackable(this, toucher.team);
if(attackable != 2 && attackable != 4)
return;
// we've verified that this player has a legitimate claim to this point,
// so start building the captured point icon (which only captures this
// point if it successfully builds without being destroyed first)
- ons_ControlPoint_Icon_Spawn(self, toucher);
+ ons_ControlPoint_Icon_Spawn(this, toucher);
- self.ons_toucher = toucher;
+ this.ons_toucher = toucher;
onslaught_updatelinks();
}
void ons_ControlPoint_Think(entity this)
{
- self.nextthink = time + ONS_CP_THINKRATE;
- CSQCMODEL_AUTOUPDATE(self);
+ this.nextthink = time + ONS_CP_THINKRATE;
+ CSQCMODEL_AUTOUPDATE(this);
}
void ons_ControlPoint_Reset(entity this)
void ons_DelayedGeneratorSetup(entity this)
{
// 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;
// captureshield setup
- ons_CaptureShield_Spawn(self, true);
+ ons_CaptureShield_Spawn(this, true);
onslaught_updatelinks();
- Net_LinkEntity(self, false, 0, generator_send);
+ Net_LinkEntity(this, false, 0, generator_send);
}
void onslaught_generator_touch(entity this)
{
if ( IS_PLAYER(other) )
- if ( SAME_TEAM(self,other) )
- if ( self.iscaptured )
+ if ( SAME_TEAM(this,other) )
+ if ( this.iscaptured )
{
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_ONS_TELEPORT);
}
WriteByte(MSG_ENTITY, sf);
if(sf & CPSF_SETUP)
{
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
- WriteByte(MSG_ENTITY, self.health);
- WriteByte(MSG_ENTITY, self.max_health);
- WriteByte(MSG_ENTITY, self.count);
- WriteByte(MSG_ENTITY, self.team);
- WriteByte(MSG_ENTITY, self.owner.iscaptured);
+ WriteByte(MSG_ENTITY, this.health);
+ WriteByte(MSG_ENTITY, this.max_health);
+ WriteByte(MSG_ENTITY, this.count);
+ WriteByte(MSG_ENTITY, this.team);
+ WriteByte(MSG_ENTITY, this.owner.iscaptured);
}
if(sf & CPSF_STATUS)
{
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, this.team);
- if(self.health <= 0)
+ if(this.health <= 0)
WriteByte(MSG_ENTITY, 0);
else
- WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
+ WriteByte(MSG_ENTITY, ceil((this.health / this.max_health) * 255));
}
return true;
/*// Temporary placeholder for un-implemented Click actions
void HUD_MinigameMenu_ClickNoop()
{
- dprint("Placeholder for ",self.message,"\n");
+ dprint("Placeholder for ",this.message,"\n");
}*/
// Click action for Quit
if ( HUD_MinigameMenu_Click_ExpandCollapse(this) )
{
entity e;
- entity prev = self;
+ entity prev = this;
for(int i = 0; i < maxclients; ++i)
{
if ( player_localnum != i && playerslots[i] && entcs_GetName(i) != "" &&
{
e = HUD_MinigameMenu_SpawnSubEntry(
strzone(entcs_GetName(i)), HUD_MinigameMenu_ClickInvite_Entry,
- self );
+ this );
e.flags |= 1;
e.netname = strzone(ftos(i+1));
e.origin_x *= 2;
// Think equivalent of pong_ball_throw, used to delay throws
void pong_ball_throwthink(entity this)
{
- pong_ball_throw(self);
+ pong_ball_throw(this);
}
// Moves ball to the center and stops its motion
}
-#define FIELD(Flags, Type,Name) if ( sf & (Flags) ) Write##Type(MSG_ENTITY, self.Name);
+#define FIELD(Flags, Type,Name) if ( sf & (Flags) ) Write##Type(MSG_ENTITY, this.Name);
#define MSLE(Name,Fields) \
- else if ( self.classname == #Name ) { \
- if ( sf & MINIG_SF_CREATE ) WriteString(MSG_ENTITY,self.owner.netname); \
+ else if ( this.classname == #Name ) { \
+ if ( sf & MINIG_SF_CREATE ) WriteString(MSG_ENTITY,this.owner.netname); \
Fields }
// Send an entity to a client
bool minigame_CheckSend(entity this)
{
entity e;
- for ( e = self.owner.minigame_players; e != world; e = e.list_next )
+ for ( e = this.owner.minigame_players; e != world; e = e.list_next )
if ( e.minigame_players == other )
return true;
return false;
{
PROJECTILE_TOUCH(this);
- M_Mage_Attack_Spike_Explode(self);
+ M_Mage_Attack_Spike_Explode(this);
}
.float wait;
{
PROJECTILE_TOUCH(this);
- self.use(this, NULL, NULL);
+ this.use(this, NULL, NULL);
}
void M_Shambler_Attack_Lightning_Think(entity this)
void M_Zombie_Attack_Leap_Touch(entity this)
{
- if (self.health <= 0)
+ if (this.health <= 0)
return;
vector angles_face;
if(other.takedamage)
{
- angles_face = vectoangles(self.moveto - self.origin);
+ angles_face = vectoangles(this.moveto - this.origin);
angles_face = normalize(angles_face) * (autocvar_g_monster_zombie_attack_leap_force);
- Damage(other, self, self, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(self), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face);
- settouch(self, Monster_Touch); // instantly turn it off to stop damage spam
- self.state = 0;
+ Damage(other, this, this, (autocvar_g_monster_zombie_attack_leap_damage) * MONSTER_SKILLMOD(this), DEATH_MONSTER_ZOMBIE_JUMP.m_id, other.origin, angles_face);
+ settouch(this, Monster_Touch); // instantly turn it off to stop damage spam
+ this.state = 0;
}
if (trace_dphitcontents)
{
- self.state = 0;
- settouch(self, Monster_Touch);
+ this.state = 0;
+ settouch(this, Monster_Touch);
}
}
bool same_team;
player = WaypointSprite_getviewentity(other);
- myowner = self.owner;
+ myowner = this.owner;
same_team = (SAME_TEAM(player, myowner) || SAME_TEAM(player, myowner));
if(myowner.alpha <= 0.5 && !same_team && myowner.alpha != 0)
return false;
- if(MUTATOR_CALLHOOK(BuffModel_Customize, self, player))
+ if(MUTATOR_CALLHOOK(BuffModel_Customize, this, player))
return false;
if(player == myowner || (IS_SPEC(other) && other.enemy == myowner))
{
// somewhat hide the model, but keep the glow
- self.effects = 0;
- self.alpha = -1;
+ this.effects = 0;
+ this.alpha = -1;
}
else
{
- self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
- self.alpha = 1;
+ this.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
+ this.alpha = 1;
}
return true;
}
if(ITEM_TOUCH_NEEDKILL())
{
- buff_Respawn(self);
+ buff_Respawn(this);
return;
}
- if((self.team && DIFF_TEAM(other, self))
+ if((this.team && DIFF_TEAM(other, this))
|| (STAT(FROZEN, other))
|| (other.vehicle)
- || (!self.buff_active)
+ || (!this.buff_active)
)
{
// can't touch this
return;
}
- if(MUTATOR_CALLHOOK(BuffTouch, self, other))
+ if(MUTATOR_CALLHOOK(BuffTouch, this, other))
return;
if(!IS_PLAYER(other))
if (other.buffs)
{
- if (other.cvar_cl_buffs_autoreplace && other.buffs != self.buffs)
+ if (other.cvar_cl_buffs_autoreplace && other.buffs != this.buffs)
{
int buffid = buff_FirstFromFlags(other.buffs).m_id;
//Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_DROP, other.buffs);
else { return; } // do nothing
}
- self.owner = other;
- self.buff_active = false;
- self.lifetime = 0;
- int buffid = buff_FirstFromFlags(self.buffs).m_id;
+ this.owner = other;
+ this.buff_active = false;
+ this.lifetime = 0;
+ int buffid = buff_FirstFromFlags(this.buffs).m_id;
Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_BUFF_GOT, buffid);
Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_INFO, INFO_ITEM_BUFF, other.netname, buffid);
- Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
+ Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
sound(other, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTN_NORM);
- other.buffs |= (self.buffs);
+ other.buffs |= (this.buffs);
}
float buff_Available(entity buff)
MUTATOR_HOOKFUNCTION(buffs, PlayerRegen)
{SELFPARAM();
- if(self.buffs & BUFF_MEDIC.m_itemid)
+ if(this.buffs & BUFF_MEDIC.m_itemid)
{
regen_mod_rot = autocvar_g_buffs_medic_rot;
regen_mod_limit = regen_mod_max = autocvar_g_buffs_medic_max;
regen_mod_regen = autocvar_g_buffs_medic_regen;
}
- if(self.buffs & BUFF_SPEED.m_itemid)
+ if(this.buffs & BUFF_SPEED.m_itemid)
regen_mod_regen = autocvar_g_buffs_speed_regen;
}
// get weapon info
entity e = Weapons_from(nix_weapon);
- if(nix_nextchange != self.nix_lastchange_id) // this shall only be called once per round!
+ if(nix_nextchange != this.nix_lastchange_id) // this shall only be called once per round!
{
this.ammo_shells = this.ammo_nails = this.ammo_rockets = this.ammo_cells = this.ammo_plasma = this.ammo_fuel = 0;
MUTATOR_HOOKFUNCTION(ok, PlayerRegen)
{SELFPARAM();
// overkill's values are different, so use custom regen
- if(!STAT(FROZEN, self))
+ if(!STAT(FROZEN, this))
{
- self.armorvalue = CalcRotRegen(self.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 1 * frametime * (time > self.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > self.pauserotarmor_finished), autocvar_g_balance_armor_limit);
- self.health = CalcRotRegen(self.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > self.ok_pauseregen_finished), 200, 0, autocvar_g_balance_health_rotlinear, 1 * frametime * (time > self.pauserothealth_finished), autocvar_g_balance_health_limit);
+ this.armorvalue = CalcRotRegen(this.armorvalue, autocvar_g_balance_armor_regenstable, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 1 * frametime * (time > this.ok_pauseregen_finished), 0, 0, 1, 1 * frametime * (time > this.pauserotarmor_finished), autocvar_g_balance_armor_limit);
+ this.health = CalcRotRegen(this.health, autocvar_g_balance_health_regenstable, 0, 100, 1 * frametime * (time > this.ok_pauseregen_finished), 200, 0, autocvar_g_balance_health_rotlinear, 1 * frametime * (time > this.pauserothealth_finished), autocvar_g_balance_health_limit);
float minf, maxf, limitf;
minf = autocvar_g_balance_fuel_regenstable;
limitf = autocvar_g_balance_fuel_limit;
- self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
+ this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
}
return true; // return true anyway, as frozen uses no regen
}
void W_RocketPropelledChainsaw_Explode(entity this)
{
- self.event_damage = func_null;
- self.takedamage = DAMAGE_NO;
+ this.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
- RadiusDamage (self, self.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), world, world, WEP_CVAR(rpc, force), self.projectiledeathtype, other);
+ RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), world, world, WEP_CVAR(rpc, force), this.projectiledeathtype, other);
- remove (self);
+ remove (this);
}
void W_RocketPropelledChainsaw_Touch (entity this)
void W_RocketPropelledChainsaw_Think(entity this)
{
- if(self.cnt <= time)
+ if(this.cnt <= time)
{
- remove(self);
+ remove(this);
return;
}
- self.cnt = vlen(self.velocity);
- self.wait = self.cnt * sys_frametime;
- self.pos1 = normalize(self.velocity);
+ this.cnt = vlen(this.velocity);
+ this.wait = this.cnt * sys_frametime;
+ this.pos1 = normalize(this.velocity);
- tracebox(self.origin, self.mins, self.maxs, self.origin + self.pos1 * (2 * self.wait), MOVE_NORMAL, self);
+ tracebox(this.origin, this.mins, this.maxs, this.origin + this.pos1 * (2 * this.wait), MOVE_NORMAL, this);
if(IS_PLAYER(trace_ent))
- Damage (trace_ent, self, self.realowner, WEP_CVAR(rpc, damage2), self.projectiledeathtype, self.origin, normalize(self.origin - other.origin) * WEP_CVAR(rpc, force));
+ Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - other.origin) * WEP_CVAR(rpc, force));
- self.velocity = self.pos1 * (self.cnt + (WEP_CVAR(rpc, speedaccel) * sys_frametime));
+ this.velocity = this.pos1 * (this.cnt + (WEP_CVAR(rpc, speedaccel) * sys_frametime));
- UpdateCSQCProjectile(self);
- self.nextthink = time;
+ UpdateCSQCProjectile(this);
+ this.nextthink = time;
}
void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor)
{
- entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self);
+ entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(actor);
entity flash = spawn ();
W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo));
METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor))
{
- entity this = actor;
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
}
METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor))
{
- entity this = actor;
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
}
#endif
void physical_item_think(entity this)
{
- self.nextthink = time;
+ this.nextthink = time;
- self.alpha = self.owner.alpha; // apply fading and ghosting
+ this.alpha = this.owner.alpha; // apply fading and ghosting
- if(!self.cnt) // map item, not dropped
+ if(!this.cnt) // map item, not dropped
{
// copy ghost item properties
- self.colormap = self.owner.colormap;
- self.colormod = self.owner.colormod;
- self.glowmod = self.owner.glowmod;
+ this.colormap = this.owner.colormap;
+ this.colormod = this.owner.colormod;
+ this.glowmod = this.owner.glowmod;
// if the item is not spawned, make sure the invisible / ghost item returns to its origin and stays there
if(autocvar_g_physical_items_reset)
{
- if(self.owner.wait > time) // awaiting respawn
+ if(this.owner.wait > time) // awaiting respawn
{
- setorigin(self, self.spawn_origin);
- self.angles = self.spawn_angles;
- self.solid = SOLID_NOT;
- self.alpha = -1;
- self.movetype = MOVETYPE_NONE;
+ setorigin(this, this.spawn_origin);
+ this.angles = this.spawn_angles;
+ this.solid = SOLID_NOT;
+ this.alpha = -1;
+ this.movetype = MOVETYPE_NONE;
}
else
{
- self.alpha = 1;
- self.solid = SOLID_CORPSE;
- self.movetype = MOVETYPE_PHYSICS;
+ this.alpha = 1;
+ this.solid = SOLID_CORPSE;
+ this.movetype = MOVETYPE_PHYSICS;
}
}
}
- if(!self.owner.modelindex)
- remove(self); // the real item is gone, remove this
+ if(!this.owner.modelindex)
+ remove(this); // the real item is gone, remove this
}
void physical_item_touch(entity this)
{
- if(!self.cnt) // not for dropped items
+ if(!this.cnt) // not for dropped items
if (ITEM_TOUCH_NEEDKILL())
{
- setorigin(self, self.spawn_origin);
- self.angles = self.spawn_angles;
+ setorigin(this, this.spawn_origin);
+ this.angles = this.spawn_angles;
}
}
{
// apply material impact effects
- if(!self.material)
+ if(!this.material)
return;
- if(self.touch_timer > time)
+ if(this.touch_timer > time)
return; // don't execute each frame
- self.touch_timer = time + 0.1;
+ this.touch_timer = time + 0.1;
// make particle count and sound volume depend on impact speed
float intensity;
- intensity = vlen(self.velocity) + vlen(other.velocity);
+ intensity = vlen(this.velocity) + vlen(other.velocity);
if(intensity) // avoid divisions by 0
intensity /= 2; // average the two velocities
if (!(intensity >= autocvar_g_sandbox_object_material_velocity_min))
intensity -= autocvar_g_sandbox_object_material_velocity_min; // start from minimum velocity, not actual velocity
intensity = bound(0, intensity * autocvar_g_sandbox_object_material_velocity_factor, 1);
- _sound(self, CH_TRIGGER, strcat("object/impact_", self.material, "_", ftos(ceil(random() * 5)) , ".wav"), VOL_BASE * intensity, ATTEN_NORM);
- Send_Effect_(strcat("impact_", self.material), self.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
+ _sound(this, CH_TRIGGER, strcat("object/impact_", this.material, "_", ftos(ceil(random() * 5)) , ".wav"), VOL_BASE * intensity, ATTEN_NORM);
+ Send_Effect_(strcat("impact_", this.material), this.origin, '0 0 0', ceil(intensity * 10)); // allow a count from 1 to 10
}
void sandbox_ObjectFunction_Think(entity this)
{
bool doremove = false;
- if (self.fade_time && time >= self.teleport_time)
+ if (this.fade_time && time >= this.teleport_time)
{
doremove = true;
}
- if (self.exteriormodeltoclient)
- WaypointSprite_UpdateOrigin(self, self.exteriormodeltoclient.origin + self.view_ofs);
+ if (this.exteriormodeltoclient)
+ WaypointSprite_UpdateOrigin(this, this.exteriormodeltoclient.origin + this.view_ofs);
if (doremove)
- WaypointSprite_Kill(self);
+ WaypointSprite_Kill(this);
else
- self.nextthink = time; // WHY?!?
+ this.nextthink = time; // WHY?!?
}
bool WaypointSprite_visible_for_player(entity this, entity player, entity view)
// make spectators see what the player would see
entity e = WaypointSprite_getviewentity(other);
- if (MUTATOR_CALLHOOK(CustomizeWaypoint, self, other))
+ if (MUTATOR_CALLHOOK(CustomizeWaypoint, this, other))
return false;
- return self.waypointsprite_visible_for_player(self, other, e);
+ return this.waypointsprite_visible_for_player(this, other, e);
}
bool WaypointSprite_SendEntity(entity this, entity to, float sendflags);
/**
Simulate drag
- self.velocity = movelib_dragvec(self.velocity,0.02,0.5);
+ this.velocity = movelib_dragvec(this.velocity,0.02,0.5);
**/
vector movelib_dragvec(entity this, float drag, float exp_);
/**
Simulate drag
- self.velocity *= movelib_dragflt(somespeed,0.01,0.7);
+ this.velocity *= movelib_dragflt(somespeed,0.01,0.7);
**/
float movelib_dragflt(float fspeed,float drag,float exp_);
/**
Do a inertia simulation based on velocity.
Basicaly, this allows you to simulate loss of steering with higher speed.
- self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9);
+ this.velocity = movelib_inertmove_byspeed(this.velocity,newvel,1000,0.1,0.9);
**/
vector movelib_inertmove_byspeed(entity this, vector vel_new, float vel_max, float newmin, float oldmax);
/*
void movelib_move_simple(vector newdir,float velo,float blendrate)
{
- self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo;
+ this.velocity = this.velocity * (1 - blendrate) + (newdir * blendrate) * velo;
}
*/
#define movelib_move_simple(e,newdir,velo,blendrate) \
#ifdef SVQC
bool ItemSend(entity this, entity to, int sf)
{
- if(self.gravity)
+ if(this.gravity)
sf |= ISF_DROP;
else
sf &= ~ISF_DROP;
WriteHeader(MSG_ENTITY, ENT_CLIENT_ITEM);
WriteByte(MSG_ENTITY, sf);
- //WriteByte(MSG_ENTITY, self.cnt);
+ //WriteByte(MSG_ENTITY, this.cnt);
if(sf & ISF_LOCATION)
{
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
}
if(sf & ISF_ANGLES)
{
- WriteAngle(MSG_ENTITY, self.angles_x);
- WriteAngle(MSG_ENTITY, self.angles_y);
- WriteAngle(MSG_ENTITY, self.angles_z);
+ WriteAngle(MSG_ENTITY, this.angles_x);
+ WriteAngle(MSG_ENTITY, this.angles_y);
+ WriteAngle(MSG_ENTITY, this.angles_z);
}
if(sf & ISF_SIZE)
}
if(sf & ISF_STATUS)
- WriteByte(MSG_ENTITY, self.ItemStatus);
+ WriteByte(MSG_ENTITY, this.ItemStatus);
if(sf & ISF_MODEL)
{
Pickup p = this.itemdef;
WriteByte(MSG_ENTITY, p.instanceOfPowerup || p.instanceOfHealth || p.instanceOfArmor);
- WriteShort(MSG_ENTITY, self.fade_end);
- WriteShort(MSG_ENTITY, self.fade_start);
+ WriteShort(MSG_ENTITY, this.fade_end);
+ WriteShort(MSG_ENTITY, this.fade_start);
- if(self.mdl == "")
- LOG_TRACE("^1WARNING!^7 self.mdl is unset for item ", self.classname, "exspect a crash just aboute now\n");
+ if(this.mdl == "")
+ LOG_TRACE("^1WARNING!^7 this.mdl is unset for item ", this.classname, "exspect a crash just aboute now\n");
- WriteString(MSG_ENTITY, self.mdl);
+ WriteString(MSG_ENTITY, this.mdl);
}
if(sf & ISF_COLORMAP)
- WriteShort(MSG_ENTITY, self.colormap);
+ WriteShort(MSG_ENTITY, this.colormap);
if(sf & ISF_DROP)
{
- WriteCoord(MSG_ENTITY, self.velocity.x);
- WriteCoord(MSG_ENTITY, self.velocity.y);
- WriteCoord(MSG_ENTITY, self.velocity.z);
+ WriteCoord(MSG_ENTITY, this.velocity.x);
+ WriteCoord(MSG_ENTITY, this.velocity.y);
+ WriteCoord(MSG_ENTITY, this.velocity.z);
}
return true;
/*
float Item_Customize()
{
- if(self.spawnshieldtime)
+ if(this.spawnshieldtime)
return true;
- if(self.weapons & ~other.weapons)
+ if(this.weapons & ~other.weapons)
{
- self.colormod = '0 0 0';
- self.glowmod = self.colormod;
- self.alpha = 0.5 + 0.5 * g_ghost_items; // halfway more alpha
+ this.colormod = '0 0 0';
+ this.glowmod = this.colormod;
+ this.alpha = 0.5 + 0.5 * g_ghost_items; // halfway more alpha
return true;
}
else
{
if(g_ghost_items)
{
- self.colormod = stov(autocvar_g_ghost_items_color);
- self.glowmod = self.colormod;
- self.alpha = g_ghost_items;
+ this.colormod = stov(autocvar_g_ghost_items_color);
+ this.glowmod = this.colormod;
+ this.alpha = g_ghost_items;
return true;
}
else
void Item_Think(entity this)
{
- self.nextthink = time;
- if(self.origin != self.oldorigin)
- ItemUpdate(self);
+ this.nextthink = time;
+ if(this.origin != this.oldorigin)
+ ItemUpdate(this);
}
bool Item_ItemsTime_SpectatorOnly(GameItem it);
void Item_Respawn (entity this)
{
- Item_Show(self, 1);
+ Item_Show(this, 1);
// this is ugly...
- if(self.items == ITEM_Strength.m_itemid)
- sound (self, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
- else if(self.items == ITEM_Shield.m_itemid)
- sound (self, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
+ if(this.items == ITEM_Strength.m_itemid)
+ sound (this, CH_TRIGGER, SND_STRENGTH_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
+ else if(this.items == ITEM_Shield.m_itemid)
+ sound (this, CH_TRIGGER, SND_SHIELD_RESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
else
- sound (self, CH_TRIGGER, SND_ITEMRESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
- setorigin (self, self.origin);
+ sound (this, CH_TRIGGER, SND_ITEMRESPAWN, VOL_BASE, ATTEN_NORM); // play respawn sound
+ setorigin (this, this.origin);
- if (Item_ItemsTime_Allow(self.itemdef) || self.weapons & WEPSET_SUPERWEAPONS)
+ if (Item_ItemsTime_Allow(this.itemdef) || this.weapons & WEPSET_SUPERWEAPONS)
{
- float t = Item_ItemsTime_UpdateTime(self, 0);
- Item_ItemsTime_SetTime(self, t);
+ float t = Item_ItemsTime_UpdateTime(this, 0);
+ Item_ItemsTime_SetTime(this, t);
Item_ItemsTime_SetTimesForAllPlayers();
}
- setthink(self, Item_Think);
- self.nextthink = time;
+ setthink(this, Item_Think);
+ this.nextthink = time;
- //Send_Effect(EFFECT_ITEM_RESPAWN, self.origin + self.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
- Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
+ //Send_Effect(EFFECT_ITEM_RESPAWN, this.origin + this.mins_z * '0 0 1' + '0 0 48', '0 0 0', 1);
+ Send_Effect(EFFECT_ITEM_RESPAWN, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
}
void Item_RespawnCountdown (entity this)
{
- if(self.count >= ITEM_RESPAWN_TICKS)
+ if(this.count >= ITEM_RESPAWN_TICKS)
{
- if(self.waypointsprite_attached)
- WaypointSprite_Kill(self.waypointsprite_attached);
- Item_Respawn(self);
+ if(this.waypointsprite_attached)
+ WaypointSprite_Kill(this.waypointsprite_attached);
+ Item_Respawn(this);
}
else
{
- self.nextthink = time + 1;
- self.count += 1;
- if(self.count == 1)
+ this.nextthink = time + 1;
+ this.count += 1;
+ if(this.count == 1)
{
MUTATOR_CALLHOOK(Item_RespawnCountdown, string_null, '0 0 0');
do {
{
- entity wi = Weapons_from(self.weapon);
+ entity wi = Weapons_from(this.weapon);
if (wi != WEP_Null) {
- entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Weapon);
+ entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, this, '0 0 64', world, 0, this, waypointsprite_attached, true, RADARICON_Weapon);
wp.wp_extra = wi.m_id;
break;
}
}
{
- entity ii = self.itemdef;
+ entity ii = this.itemdef;
if (ii != NULL) {
- entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Item);
+ entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, this, '0 0 64', world, 0, this, waypointsprite_attached, true, RADARICON_Item);
wp.wp_extra = ii.m_id;
break;
}
}
} while (0);
- if(self.waypointsprite_attached)
+ if(this.waypointsprite_attached)
{
- GameItem def = self.itemdef;
+ GameItem def = this.itemdef;
if (Item_ItemsTime_SpectatorOnly(def))
- WaypointSprite_UpdateRule(self.waypointsprite_attached, 0, SPRITERULE_SPECTATOR);
- WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS);
+ WaypointSprite_UpdateRule(this.waypointsprite_attached, 0, SPRITERULE_SPECTATOR);
+ WaypointSprite_UpdateBuildFinished(this.waypointsprite_attached, time + ITEM_RESPAWN_TICKS);
}
}
- if(self.waypointsprite_attached)
+ if(this.waypointsprite_attached)
{
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
- if(self.waypointsprite_attached.waypointsprite_visible_for_player(self.waypointsprite_attached, it, it))
+ if(this.waypointsprite_attached.waypointsprite_visible_for_player(this.waypointsprite_attached, it, it))
{
msg_entity = it;
soundto(MSG_ONE, this, CH_TRIGGER, SND(ITEMRESPAWNCOUNTDOWN), VOL_BASE, ATTEN_NORM); // play respawn sound
}
});
- WaypointSprite_Ping(self.waypointsprite_attached);
- //WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count);
+ WaypointSprite_Ping(this.waypointsprite_attached);
+ //WaypointSprite_UpdateHealth(this.waypointsprite_attached, this.count);
}
}
}
void Item_RespawnThink(entity this)
{
- self.nextthink = time;
- if(self.origin != self.oldorigin)
- ItemUpdate(self);
+ this.nextthink = time;
+ if(this.origin != this.oldorigin)
+ ItemUpdate(this);
- if(time >= self.wait)
- Item_Respawn(self);
+ if(time >= this.wait)
+ Item_Respawn(this);
}
void Item_ScheduleRespawnIn(entity e, float t)
{
entity e;
- if(self.effects & EF_NODRAW)
+ if(this.effects & EF_NODRAW)
{
// marker for item team search
- LOG_TRACE("Initializing item team ", ftos(self.team), "\n");
+ LOG_TRACE("Initializing item team ", ftos(this.team), "\n");
RandomSelection_Init();
- FOREACH_ENTITY_FLOAT(team, self.team,
+ FOREACH_ENTITY_FLOAT(team, this.team,
{
if(it.flags & FL_ITEM)
if(it.classname != "item_flag_team" && it.classname != "item_key_team")
e.state = 0;
Item_Show(e, 1);
- FOREACH_ENTITY_FLOAT(team, self.team,
+ FOREACH_ENTITY_FLOAT(team, this.team,
{
if(it.flags & FL_ITEM)
if(it.classname != "item_flag_team" && it.classname != "item_key_team")
}
});
- Item_Reset(self);
+ Item_Reset(this);
}
}
// Savage: used for item garbage-collection
void RemoveItem(entity this)
{
- if(wasfreed(self) || !self) { return; }
- Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
- remove(self);
+ if(wasfreed(this) || !this) { return; }
+ Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
+ remove(this);
}
// pickup evaluation functions
float n, i;
string s;
- self.use = target_items_use;
- if(!self.strength_finished)
- self.strength_finished = autocvar_g_balance_powerup_strength_time;
- if(!self.invincible_finished)
- self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
- if(!self.superweapons_finished)
- self.superweapons_finished = autocvar_g_balance_superweapons_time;
+ this.use = target_items_use;
+ if(!this.strength_finished)
+ this.strength_finished = autocvar_g_balance_powerup_strength_time;
+ if(!this.invincible_finished)
+ this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+ if(!this.superweapons_finished)
+ this.superweapons_finished = autocvar_g_balance_superweapons_time;
- n = tokenize_console(self.netname);
+ n = tokenize_console(this.netname);
if(argv(0) == "give")
{
- self.netname = substring(self.netname, argv_start_index(1), argv_end_index(-1) - argv_start_index(1));
+ this.netname = substring(this.netname, argv_start_index(1), argv_end_index(-1) - argv_start_index(1));
}
else
{
for(i = 0; i < n; ++i)
{
- if (argv(i) == "unlimited_ammo") self.items |= IT_UNLIMITED_AMMO;
- else if(argv(i) == "unlimited_weapon_ammo") self.items |= IT_UNLIMITED_WEAPON_AMMO;
- else if(argv(i) == "unlimited_superweapons") self.items |= IT_UNLIMITED_SUPERWEAPONS;
- else if(argv(i) == "strength") self.items |= ITEM_Strength.m_itemid;
- else if(argv(i) == "invincible") self.items |= ITEM_Shield.m_itemid;
- else if(argv(i) == "superweapons") self.items |= IT_SUPERWEAPON;
- else if(argv(i) == "jetpack") self.items |= ITEM_Jetpack.m_itemid;
- else if(argv(i) == "fuel_regen") self.items |= ITEM_JetpackRegen.m_itemid;
+ if (argv(i) == "unlimited_ammo") this.items |= IT_UNLIMITED_AMMO;
+ else if(argv(i) == "unlimited_weapon_ammo") this.items |= IT_UNLIMITED_WEAPON_AMMO;
+ else if(argv(i) == "unlimited_superweapons") this.items |= IT_UNLIMITED_SUPERWEAPONS;
+ else if(argv(i) == "strength") this.items |= ITEM_Strength.m_itemid;
+ else if(argv(i) == "invincible") this.items |= ITEM_Shield.m_itemid;
+ else if(argv(i) == "superweapons") this.items |= IT_SUPERWEAPON;
+ else if(argv(i) == "jetpack") this.items |= ITEM_Jetpack.m_itemid;
+ else if(argv(i) == "fuel_regen") this.items |= ITEM_JetpackRegen.m_itemid;
else
{
FOREACH(Weapons, it != WEP_Null, {
s = W_UndeprecateName(argv(i));
if(s == it.netname)
{
- self.weapons |= (it.m_wepset);
- if(self.spawnflags == 0 || self.spawnflags == 2)
+ this.weapons |= (it.m_wepset);
+ if(this.spawnflags == 0 || this.spawnflags == 2)
it.wr_init(it);
break;
}
}
string itemprefix, valueprefix;
- if(self.spawnflags == 0)
+ if(this.spawnflags == 0)
{
itemprefix = "";
valueprefix = "";
}
- else if(self.spawnflags == 1)
+ else if(this.spawnflags == 1)
{
itemprefix = "max ";
valueprefix = "max ";
}
- else if(self.spawnflags == 2)
+ else if(this.spawnflags == 2)
{
itemprefix = "min ";
valueprefix = "min ";
}
- else if(self.spawnflags == 4)
+ else if(this.spawnflags == 4)
{
itemprefix = "minus ";
valueprefix = "max ";
itemprefix = valueprefix = string_null;
}
- self.netname = "";
- self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & IT_UNLIMITED_WEAPON_AMMO), "unlimited_weapon_ammo");
- self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons");
- self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.strength_finished * boolean(self.items & ITEM_Strength.m_itemid), "strength");
- self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.invincible_finished * boolean(self.items & ITEM_Shield.m_itemid), "invincible");
- self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.superweapons_finished * boolean(self.items & IT_SUPERWEAPON), "superweapons");
- self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & ITEM_Jetpack.m_itemid), "jetpack");
- self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, boolean(self.items & ITEM_JetpackRegen.m_itemid), "fuel_regen");
- if(self.ammo_shells != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_shells), "shells");
- if(self.ammo_nails != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_nails), "nails");
- if(self.ammo_rockets != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_rockets), "rockets");
- if(self.ammo_cells != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_cells), "cells");
- if(self.ammo_plasma != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_plasma), "plasma");
- if(self.ammo_fuel != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_fuel), "fuel");
- if(self.health != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.health), "health");
- if(self.armorvalue != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.armorvalue), "armor");
- FOREACH(Weapons, it != WEP_Null, self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (it.m_wepset)), it.netname));
+ this.netname = "";
+ this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_WEAPON_AMMO), "unlimited_weapon_ammo");
+ this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons");
+ this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.strength_finished * boolean(this.items & ITEM_Strength.m_itemid), "strength");
+ this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.invincible_finished * boolean(this.items & ITEM_Shield.m_itemid), "invincible");
+ this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.superweapons_finished * boolean(this.items & IT_SUPERWEAPON), "superweapons");
+ this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_Jetpack.m_itemid), "jetpack");
+ this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_JetpackRegen.m_itemid), "fuel_regen");
+ if(this.ammo_shells != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_shells), "shells");
+ if(this.ammo_nails != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_nails), "nails");
+ if(this.ammo_rockets != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_rockets), "rockets");
+ if(this.ammo_cells != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_cells), "cells");
+ if(this.ammo_plasma != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_plasma), "plasma");
+ if(this.ammo_fuel != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.ammo_fuel), "fuel");
+ if(this.health != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.health), "health");
+ if(this.armorvalue != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, this.armorvalue), "armor");
+ FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(this.weapons & (it.m_wepset)), it.netname));
}
- self.netname = strzone(self.netname);
- //print(self.netname, "\n");
+ this.netname = strzone(this.netname);
+ //print(this.netname, "\n");
- n = tokenize_console(self.netname);
+ n = tokenize_console(this.netname);
for(i = 0; i < n; ++i)
{
FOREACH(Weapons, it != WEP_Null && argv(i) == it.netname, {
void func_bobbing_controller_think(entity this)
{
vector v;
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
- if(self.owner.active != ACTIVE_ACTIVE)
+ if(this.owner.active != ACTIVE_ACTIVE)
{
- self.owner.velocity = '0 0 0';
+ this.owner.velocity = '0 0 0';
return;
}
// calculate sinewave using makevectors
- makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
- v = self.owner.destvec + self.owner.movedir * v_forward_y;
- if(self.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed
+ makevectors((this.nextthink * this.owner.cnt + this.owner.phase * 360) * '0 1 0');
+ v = this.owner.destvec + this.owner.movedir * v_forward_y;
+ if(this.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed
// * 10 so it will arrive in 0.1 sec
- self.owner.velocity = (v - self.owner.SUB_ORIGIN) * 10;
+ this.owner.velocity = (v - this.owner.SUB_ORIGIN) * 10;
}
/*QUAKED spawnfunc_func_bobbing (0 .5 .8) ? X_AXIS Y_AXIS
void button_wait(entity this)
{
- self.state = STATE_TOP;
- self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
- SUB_THINK(self, button_return);
- SUB_UseTargets(self, self.enemy, NULL);
- self.frame = 1; // use alternate textures
+ this.state = STATE_TOP;
+ this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
+ SUB_THINK(this, button_return);
+ SUB_UseTargets(this, this.enemy, NULL);
+ this.frame = 1; // use alternate textures
}
void button_done(entity this)
{
- self.state = STATE_BOTTOM;
+ this.state = STATE_BOTTOM;
}
void button_return(entity this)
{
- self.state = STATE_DOWN;
- SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, button_done);
- self.frame = 0; // use normal textures
- if (self.health)
- self.takedamage = DAMAGE_YES; // can be shot again
+ this.state = STATE_DOWN;
+ SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, button_done);
+ this.frame = 0; // use normal textures
+ if (this.health)
+ this.takedamage = DAMAGE_YES; // can be shot again
}
void button_fire(entity this)
{
- self.health = self.max_health;
- self.takedamage = DAMAGE_NO; // will be reset upon return
+ this.health = this.max_health;
+ this.takedamage = DAMAGE_NO; // will be reset upon return
- if (self.state == STATE_UP || self.state == STATE_TOP)
+ if (this.state == STATE_UP || this.state == STATE_TOP)
return;
- if (self.noise != "")
- _sound (self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
+ if (this.noise != "")
+ _sound (this, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
- self.state = STATE_UP;
- SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, button_wait);
+ this.state = STATE_UP;
+ SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, button_wait);
}
void button_reset(entity this)
return;
if (!other.iscreature)
return;
- if(other.velocity * self.movedir < 0)
+ if(other.velocity * this.movedir < 0)
return;
- self.enemy = other;
+ this.enemy = other;
if (other.owner)
- self.enemy = other.owner;
- button_fire (self);
+ this.enemy = other.owner;
+ button_fire (this);
}
void button_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
#ifdef CSQC
// TODO: check if this is what is causing the glitchiness when switching between them
- float dt = time - self.move_time;
- self.move_time = time;
+ float dt = time - this.move_time;
+ this.move_time = time;
if(dt <= 0) { return; }
#endif
entity e;
- // set myself as current conveyor where possible
- for(e = world; (e = findentity(e, conveyor, self)); )
+ // set mythis as current conveyor where possible
+ for(e = world; (e = findentity(e, conveyor, this)); )
e.conveyor = world;
- if(self.state)
+ if(this.state)
{
- for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
+ for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain)
if(!e.conveyor.state)
if(isPushable(e))
{
vector emin = e.absmin;
vector emax = e.absmax;
- if(self.solid == SOLID_BSP)
+ if(this.solid == SOLID_BSP)
{
emin -= '1 1 1';
emax += '1 1 1';
}
- if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
- e.conveyor = self;
+ if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
+ if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
+ e.conveyor = this;
}
- for(e = world; (e = findentity(e, conveyor, self)); )
+ for(e = world; (e = findentity(e, conveyor, this)); )
{
if(IS_CLIENT(e)) // doing it via velocity has quite some advantages
continue; // done in SV_PlayerPhysics continue;
- setorigin(e, e.origin + self.movedir * PHYS_INPUT_FRAMETIME);
+ setorigin(e, e.origin + this.movedir * PHYS_INPUT_FRAMETIME);
move_out_of_solid(e);
#ifdef SVQC
UpdateCSQCProjectile(e);
#endif
/*
// stupid conveyor code
- tracebox(e.origin, e.mins, e.maxs, e.origin + self.movedir * sys_frametime, MOVE_NORMAL, e);
+ tracebox(e.origin, e.mins, e.maxs, e.origin + this.movedir * sys_frametime, MOVE_NORMAL, e);
if(trace_fraction > 0)
setorigin(e, trace_endpos);
*/
}
#ifdef SVQC
- self.nextthink = time;
+ this.nextthink = time;
#endif
}
if(sf & 1)
{
- WriteByte(MSG_ENTITY, self.warpzone_isboxy);
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
-
- WriteCoord(MSG_ENTITY, self.mins_x);
- WriteCoord(MSG_ENTITY, self.mins_y);
- WriteCoord(MSG_ENTITY, self.mins_z);
- WriteCoord(MSG_ENTITY, self.maxs_x);
- WriteCoord(MSG_ENTITY, self.maxs_y);
- WriteCoord(MSG_ENTITY, self.maxs_z);
-
- WriteCoord(MSG_ENTITY, self.movedir_x);
- WriteCoord(MSG_ENTITY, self.movedir_y);
- WriteCoord(MSG_ENTITY, self.movedir_z);
-
- WriteByte(MSG_ENTITY, self.speed);
- WriteByte(MSG_ENTITY, self.state);
-
- WriteString(MSG_ENTITY, self.targetname);
- WriteString(MSG_ENTITY, self.target);
+ WriteByte(MSG_ENTITY, this.warpzone_isboxy);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
+
+ WriteCoord(MSG_ENTITY, this.mins_x);
+ WriteCoord(MSG_ENTITY, this.mins_y);
+ WriteCoord(MSG_ENTITY, this.mins_z);
+ WriteCoord(MSG_ENTITY, this.maxs_x);
+ WriteCoord(MSG_ENTITY, this.maxs_y);
+ WriteCoord(MSG_ENTITY, this.maxs_z);
+
+ WriteCoord(MSG_ENTITY, this.movedir_x);
+ WriteCoord(MSG_ENTITY, this.movedir_y);
+ WriteCoord(MSG_ENTITY, this.movedir_z);
+
+ WriteByte(MSG_ENTITY, this.speed);
+ WriteByte(MSG_ENTITY, this.state);
+
+ WriteString(MSG_ENTITY, this.targetname);
+ WriteString(MSG_ENTITY, this.target);
}
if(sf & 2)
- WriteByte(MSG_ENTITY, self.state);
+ WriteByte(MSG_ENTITY, this.state);
return true;
}
void door_blocked()
{SELFPARAM();
- if((self.spawnflags & 8)
+ if((this.spawnflags & 8)
#ifdef SVQC
&& (other.takedamage != DAMAGE_NO)
#elif defined(CSQC)
)
{ // KIll Kill Kill!!
#ifdef SVQC
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
}
else
{
#ifdef SVQC
- if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite?
- Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ if((this.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite?
+ Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
// don't change direction for dead or dying stuff
#endif
)
{
- if (self.wait >= 0)
+ if (this.wait >= 0)
{
- if (self.state == STATE_DOWN)
- if (self.classname == "door")
+ if (this.state == STATE_DOWN)
+ if (this.classname == "door")
{
- door_go_up (self);
+ door_go_up (this);
} else
{
- door_rotating_go_up (self);
+ door_rotating_go_up (this);
}
else
- if (self.classname == "door")
+ if (this.classname == "door")
{
- door_go_down (self);
+ door_go_down (this);
} else
{
- door_rotating_go_down (self);
+ door_rotating_go_down (this);
}
}
}
else
{
//gib dying stuff just to make sure
- if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite?
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ if((this.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite?
+ Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
#endif
}
void door_hit_top(entity this)
{
- if (self.noise1 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
- self.state = STATE_TOP;
- if (self.spawnflags & DOOR_TOGGLE)
+ if (this.noise1 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
+ this.state = STATE_TOP;
+ if (this.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
- if (self.classname == "door")
+ if (this.classname == "door")
{
- SUB_THINK(self, door_go_down);
+ SUB_THINK(this, door_go_down);
} else
{
- SUB_THINK(self, door_rotating_go_down);
+ SUB_THINK(this, door_rotating_go_down);
}
- self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
+ this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
}
void door_hit_bottom(entity this)
{
- if (self.noise1 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
- self.state = STATE_BOTTOM;
+ if (this.noise1 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
+ this.state = STATE_BOTTOM;
}
void door_go_down(entity this)
{
- if (self.noise2 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- if (self.max_health)
+ if (this.noise2 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
+ if (this.max_health)
{
- self.takedamage = DAMAGE_YES;
- self.health = self.max_health;
+ this.takedamage = DAMAGE_YES;
+ this.health = this.max_health;
}
- self.state = STATE_DOWN;
- SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, door_hit_bottom);
+ this.state = STATE_DOWN;
+ SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, door_hit_bottom);
}
void door_go_up(entity this)
{
- if (self.state == STATE_UP)
+ if (this.state == STATE_UP)
return; // already going up
- if (self.state == STATE_TOP)
+ if (this.state == STATE_TOP)
{ // reset top wait time
- self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
+ this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
return;
}
- if (self.noise2 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- self.state = STATE_UP;
- SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, door_hit_top);
+ if (this.noise2 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
+ this.state = STATE_UP;
+ SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, door_hit_top);
string oldmessage;
- oldmessage = self.message;
- self.message = "";
- SUB_UseTargets(self, NULL, NULL);
- self.message = oldmessage;
+ oldmessage = this.message;
+ this.message = "";
+ SUB_UseTargets(this, NULL, NULL);
+ this.message = oldmessage;
}
void door_use(entity this, entity actor, entity trigger)
{
- //dprint("door_use (model: ");dprint(self.model);dprint(")\n");
+ //dprint("door_use (model: ");dprint(this.model);dprint(")\n");
if (this.owner)
WITHSELF(this.owner, door_fire(this.owner, actor, trigger));
{
if (!IS_PLAYER(other))
return;
- if (self.owner.door_finished > time)
+ if (this.owner.door_finished > time)
return;
- self.owner.door_finished = time + 2;
+ this.owner.door_finished = time + 2;
#ifdef SVQC
- if (!(self.owner.dmg) && (self.owner.message != ""))
+ if (!(this.owner.dmg) && (this.owner.message != ""))
{
if (IS_CLIENT(other))
- centerprint(other, self.owner.message);
- play2(other, self.owner.noise);
+ centerprint(other, this.owner.message);
+ play2(other, this.owner.noise);
}
#endif
}
void door_generic_plat_blocked(entity this)
{
- if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
+ if((this.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
#ifdef SVQC
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
}
else
{
#ifdef SVQC
- if((self.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite?
- Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ if((this.dmg) && (other.takedamage == DAMAGE_YES)) // Shall we bite?
+ Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
//Dont chamge direction for dead or dying stuff
if(IS_DEAD(other) && (other.takedamage == DAMAGE_NO))
{
- if (self.wait >= 0)
+ if (this.wait >= 0)
{
- if (self.state == STATE_DOWN)
- door_rotating_go_up (self);
+ if (this.state == STATE_DOWN)
+ door_rotating_go_up (this);
else
- door_rotating_go_down (self);
+ door_rotating_go_down (this);
}
}
#ifdef SVQC
else
{
//gib dying stuff just to make sure
- if((self.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite?
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ if((this.dmg) && (other.takedamage != DAMAGE_NO)) // Shall we bite?
+ Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
#endif
}
void door_rotating_hit_top(entity this)
{
- if (self.noise1 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
- self.state = STATE_TOP;
- if (self.spawnflags & DOOR_TOGGLE)
+ if (this.noise1 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
+ this.state = STATE_TOP;
+ if (this.spawnflags & DOOR_TOGGLE)
return; // don't come down automatically
- SUB_THINK(self, door_rotating_go_down);
- self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
+ SUB_THINK(this, door_rotating_go_down);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
}
void door_rotating_hit_bottom(entity this)
{
- if (self.noise1 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
- if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating
+ if (this.noise1 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
+ if (this.lip==666) // this.lip is used to remember reverse opening direction for door_rotating
{
- self.pos2 = '0 0 0' - self.pos2;
- self.lip = 0;
+ this.pos2 = '0 0 0' - this.pos2;
+ this.lip = 0;
}
- self.state = STATE_BOTTOM;
+ this.state = STATE_BOTTOM;
}
void door_rotating_go_down(entity this)
{
- if (self.noise2 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- if (self.max_health)
+ if (this.noise2 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
+ if (this.max_health)
{
- self.takedamage = DAMAGE_YES;
- self.health = self.max_health;
+ this.takedamage = DAMAGE_YES;
+ this.health = this.max_health;
}
- self.state = STATE_DOWN;
- SUB_CalcAngleMove (self, self.pos1, TSPEED_LINEAR, self.speed, door_rotating_hit_bottom);
+ this.state = STATE_DOWN;
+ SUB_CalcAngleMove (this, this.pos1, TSPEED_LINEAR, this.speed, door_rotating_hit_bottom);
}
void door_rotating_go_up(entity this)
{
- if (self.state == STATE_UP)
+ if (this.state == STATE_UP)
return; // already going up
- if (self.state == STATE_TOP)
+ if (this.state == STATE_TOP)
{ // reset top wait time
- self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
+ this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
return;
}
- if (self.noise2 != "")
- _sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- self.state = STATE_UP;
- SUB_CalcAngleMove (self, self.pos2, TSPEED_LINEAR, self.speed, door_rotating_hit_top);
+ if (this.noise2 != "")
+ _sound (this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
+ this.state = STATE_UP;
+ SUB_CalcAngleMove (this, this.pos2, TSPEED_LINEAR, this.speed, door_rotating_hit_top);
string oldmessage;
- oldmessage = self.message;
- self.message = "";
- SUB_UseTargets(self, NULL, other); // TODO: is other needed here?
- self.message = oldmessage;
+ oldmessage = this.message;
+ this.message = "";
+ SUB_UseTargets(this, NULL, other); // TODO: is other needed here?
+ this.message = oldmessage;
}
#endif
return;
- if (time < self.door_finished)
+ if (time < this.door_finished)
return;
// check if door is locked
- if (!door_check_keys(self, other))
+ if (!door_check_keys(this, other))
return;
- self.door_finished = time + 1;
+ this.door_finished = time + 1;
door_use(this.owner, other, NULL);
}
trigger = new(doortriggerfield);
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
- trigger.owner = self;
+ trigger.owner = this;
#ifdef SVQC
settouch(trigger, door_trigger_touch);
#endif
door_link();
#endif
- if (self.enemy)
+ if (this.enemy)
return; // already linked by another door
- if (self.spawnflags & 4)
+ if (this.spawnflags & 4)
{
- self.owner = self.enemy = self;
+ this.owner = this.enemy = this;
- if (self.health)
+ if (this.health)
return;
IFTARGETED
return;
- if (self.items)
+ if (this.items)
return;
- door_spawnfield(self, self.absmin, self.absmax);
+ door_spawnfield(this, this.absmin, this.absmax);
return; // don't want to link this door
}
- FindConnectedComponent(self, enemy, LinkDoors_nextent, LinkDoors_isconnected, self);
+ FindConnectedComponent(this, enemy, LinkDoors_nextent, LinkDoors_isconnected, this);
// set owner, and make a loop of the chain
LOG_TRACE("LinkDoors: linking doors:");
- for(t = self; ; t = t.enemy)
+ for(t = this; ; t = t.enemy)
{
LOG_TRACE(" ", etos(t));
- t.owner = self;
+ t.owner = this;
if(t.enemy == world)
{
- t.enemy = self;
+ t.enemy = this;
break;
}
}
LOG_TRACE("\n");
// collect health, targetname, message, size
- cmins = self.absmin;
- cmaxs = self.absmax;
- for(t = self; ; t = t.enemy)
+ cmins = this.absmin;
+ cmaxs = this.absmax;
+ for(t = this; ; t = t.enemy)
{
- if(t.health && !self.health)
- self.health = t.health;
- if((t.targetname != "") && (self.targetname == ""))
- self.targetname = t.targetname;
- if((t.message != "") && (self.message == ""))
- self.message = t.message;
+ if(t.health && !this.health)
+ this.health = t.health;
+ if((t.targetname != "") && (this.targetname == ""))
+ this.targetname = t.targetname;
+ if((t.message != "") && (this.message == ""))
+ this.message = t.message;
if (t.absmin_x < cmins_x)
cmins_x = t.absmin_x;
if (t.absmin_y < cmins_y)
cmaxs_y = t.absmax_y;
if (t.absmax_z > cmaxs_z)
cmaxs_z = t.absmax_z;
- if(t.enemy == self)
+ if(t.enemy == this)
break;
}
// distribute health, targetname, message
- for(t = self; t; t = t.enemy)
+ for(t = this; t; t = t.enemy)
{
- t.health = self.health;
- t.targetname = self.targetname;
- t.message = self.message;
- if(t.enemy == self)
+ t.health = this.health;
+ t.targetname = this.targetname;
+ t.message = this.message;
+ if(t.enemy == this)
break;
}
// shootable, or triggered doors just needed the owner/enemy links,
// they don't spawn a field
- if (self.health)
+ if (this.health)
return;
IFTARGETED
return;
- if (self.items)
+ if (this.items)
return;
- door_spawnfield(self, cmins, cmaxs);
+ door_spawnfield(this, cmins, cmaxs);
}
REGISTER_NET_LINKED(ENT_CLIENT_DOOR)
if(sf & SF_TRIGGER_INIT)
{
- WriteString(MSG_ENTITY, self.classname);
- WriteByte(MSG_ENTITY, self.spawnflags);
+ WriteString(MSG_ENTITY, this.classname);
+ WriteByte(MSG_ENTITY, this.spawnflags);
- WriteString(MSG_ENTITY, self.model);
+ WriteString(MSG_ENTITY, this.model);
- trigger_common_write(self, true);
+ trigger_common_write(this, true);
- WriteCoord(MSG_ENTITY, self.pos1_x);
- WriteCoord(MSG_ENTITY, self.pos1_y);
- WriteCoord(MSG_ENTITY, self.pos1_z);
- WriteCoord(MSG_ENTITY, self.pos2_x);
- WriteCoord(MSG_ENTITY, self.pos2_y);
- WriteCoord(MSG_ENTITY, self.pos2_z);
+ WriteCoord(MSG_ENTITY, this.pos1_x);
+ WriteCoord(MSG_ENTITY, this.pos1_y);
+ WriteCoord(MSG_ENTITY, this.pos1_z);
+ WriteCoord(MSG_ENTITY, this.pos2_x);
+ WriteCoord(MSG_ENTITY, this.pos2_y);
+ WriteCoord(MSG_ENTITY, this.pos2_z);
- WriteCoord(MSG_ENTITY, self.size_x);
- WriteCoord(MSG_ENTITY, self.size_y);
- WriteCoord(MSG_ENTITY, self.size_z);
+ WriteCoord(MSG_ENTITY, this.size_x);
+ WriteCoord(MSG_ENTITY, this.size_y);
+ WriteCoord(MSG_ENTITY, this.size_z);
- WriteShort(MSG_ENTITY, self.wait);
- WriteShort(MSG_ENTITY, self.speed);
- WriteByte(MSG_ENTITY, self.lip);
- WriteByte(MSG_ENTITY, self.state);
- WriteCoord(MSG_ENTITY, self.SUB_LTIME);
+ WriteShort(MSG_ENTITY, this.wait);
+ WriteShort(MSG_ENTITY, this.speed);
+ WriteByte(MSG_ENTITY, this.lip);
+ WriteByte(MSG_ENTITY, this.state);
+ WriteCoord(MSG_ENTITY, this.SUB_LTIME);
}
if(sf & SF_TRIGGER_RESET)
if(sf & SF_TRIGGER_UPDATE)
{
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
-
- WriteCoord(MSG_ENTITY, self.pos1_x);
- WriteCoord(MSG_ENTITY, self.pos1_y);
- WriteCoord(MSG_ENTITY, self.pos1_z);
- WriteCoord(MSG_ENTITY, self.pos2_x);
- WriteCoord(MSG_ENTITY, self.pos2_y);
- WriteCoord(MSG_ENTITY, self.pos2_z);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
+
+ WriteCoord(MSG_ENTITY, this.pos1_x);
+ WriteCoord(MSG_ENTITY, this.pos1_y);
+ WriteCoord(MSG_ENTITY, this.pos1_z);
+ WriteCoord(MSG_ENTITY, this.pos2_x);
+ WriteCoord(MSG_ENTITY, this.pos2_y);
+ WriteCoord(MSG_ENTITY, this.pos2_z);
}
return true;
void door_link()
{
// set size now, as everything is loaded
- //FixSize(self);
- //Net_LinkEntity(self, false, 0, door_send);
+ //FixSize(this);
+ //Net_LinkEntity(this, false, 0, door_send);
}
#endif
void door_init_startopen(entity this)
{
- SUB_SETORIGIN(self, self.pos2);
- self.pos2 = self.pos1;
- self.pos1 = self.origin;
+ SUB_SETORIGIN(this, this.pos2);
+ this.pos2 = this.pos1;
+ this.pos1 = this.origin;
#ifdef SVQC
- self.SendFlags |= SF_TRIGGER_UPDATE;
+ this.SendFlags |= SF_TRIGGER_UPDATE;
#endif
}
void door_rotating_init_startopen(entity this)
{
- self.angles = self.movedir;
- self.pos2 = '0 0 0';
- self.pos1 = self.movedir;
+ this.angles = this.movedir;
+ this.pos2 = '0 0 0';
+ this.pos1 = this.movedir;
}
// Wait after first movement...
void fd_secret_move1(entity this)
{
- self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
- setthink(self, fd_secret_move2);
- if (self.noise3 != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + 1.0;
+ setthink(this, fd_secret_move2);
+ if (this.noise3 != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM);
}
// Start moving sideways w/sound...
void fd_secret_move2(entity this)
{
- if (self.noise2 != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- SUB_CalcMove(self, self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3);
+ if (this.noise2 != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
+ SUB_CalcMove(this, this.dest2, TSPEED_LINEAR, this.speed, fd_secret_move3);
}
// Wait here until time to go back...
void fd_secret_move3(entity this)
{
- if (self.noise3 != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
- if (!(self.spawnflags & SECRET_OPEN_ONCE))
+ if (this.noise3 != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM);
+ if (!(this.spawnflags & SECRET_OPEN_ONCE))
{
- self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
- setthink(self, fd_secret_move4);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
+ setthink(this, fd_secret_move4);
}
}
// Move backward...
void fd_secret_move4(entity this)
{
- if (self.noise2 != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- SUB_CalcMove(self, self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5);
+ if (this.noise2 != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
+ SUB_CalcMove(this, this.dest1, TSPEED_LINEAR, this.speed, fd_secret_move5);
}
// Wait 1 second...
void fd_secret_move5(entity this)
{
- self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
- setthink(self, fd_secret_move6);
- if (self.noise3 != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + 1.0;
+ setthink(this, fd_secret_move6);
+ if (this.noise3 != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM);
}
void fd_secret_move6(entity this)
{
- if (self.noise2 != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
- SUB_CalcMove(self, self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done);
+ if (this.noise2 != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise2, VOL_BASE, ATTEN_NORM);
+ SUB_CalcMove(this, this.oldorigin, TSPEED_LINEAR, this.speed, fd_secret_done);
}
void fd_secret_done(entity this)
{
- if (self.spawnflags&SECRET_YES_SHOOT)
+ if (this.spawnflags&SECRET_YES_SHOOT)
{
- self.health = 10000;
- self.takedamage = DAMAGE_YES;
- //self.th_pain = fd_secret_use;
+ this.health = 10000;
+ this.takedamage = DAMAGE_YES;
+ //this.th_pain = fd_secret_use;
}
- if (self.noise3 != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
+ if (this.noise3 != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise3, VOL_BASE, ATTEN_NORM);
}
.float door_finished;
void secret_blocked()
{SELFPARAM();
- if (time < self.door_finished)
+ if (time < this.door_finished)
return;
- self.door_finished = time + 0.5;
- //T_Damage (other, self, self, self.dmg, self.dmg, self.deathtype, DT_IMPACT, (self.absmin + self.absmax) * 0.5, '0 0 0', Obituary_Generic);
+ this.door_finished = time + 0.5;
+ //T_Damage (other, this, this, this.dmg, this.dmg, this.deathtype, DT_IMPACT, (this.absmin + this.absmax) * 0.5, '0 0 0', Obituary_Generic);
}
/*
{
if (!other.iscreature)
return;
- if (self.door_finished > time)
+ if (this.door_finished > time)
return;
- self.door_finished = time + 2;
+ this.door_finished = time + 2;
- if (self.message)
+ if (this.message)
{
if (IS_CLIENT(other))
- centerprint(other, self.message);
- play2(other, self.noise);
+ centerprint(other, this.message);
+ play2(other, this.noise);
}
}
vector v;
float n, i, t;
- self.nextthink = time + 0.1;
- if(self.owner.active != ACTIVE_ACTIVE)
+ this.nextthink = time + 0.1;
+ if(this.owner.active != ACTIVE_ACTIVE)
{
- self.owner.velocity = '0 0 0';
+ this.owner.velocity = '0 0 0';
return;
}
- n = floor((tokenize_console(self.owner.netname)) / 5);
- t = self.nextthink * self.owner.cnt + self.owner.phase * 360;
+ n = floor((tokenize_console(this.owner.netname)) / 5);
+ t = this.nextthink * this.owner.cnt + this.owner.phase * 360;
- v = self.owner.destvec;
+ v = this.owner.destvec;
for(i = 0; i < n; ++i)
{
makevectors((t * stof(argv(i*5)) + stof(argv(i*5+1)) * 360) * '0 1 0');
- v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward_y;
+ v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * this.owner.height * v_forward_y;
}
- if(self.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed
+ if(this.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed
// * 10 so it will arrive in 0.1 sec
- self.owner.velocity = (v - self.owner.origin) * 10;
+ this.owner.velocity = (v - this.owner.origin) * 10;
}
spawnfunc(func_fourier)
EXACTTRIGGER_TOUCH;
other.ladder_time = time + 0.1;
- other.ladder_entity = self;
+ other.ladder_entity = this;
}
#ifdef SVQC
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
- WriteString(MSG_ENTITY, self.classname);
- WriteByte(MSG_ENTITY, self.skin);
- WriteCoord(MSG_ENTITY, self.speed);
+ WriteString(MSG_ENTITY, this.classname);
+ WriteByte(MSG_ENTITY, this.skin);
+ WriteCoord(MSG_ENTITY, this.speed);
- trigger_common_write(self, false);
+ trigger_common_write(this, false);
return true;
}
void func_pendulum_controller_think(entity this)
{
float v;
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
- if (!(self.owner.active == ACTIVE_ACTIVE))
+ if (!(this.owner.active == ACTIVE_ACTIVE))
{
- self.owner.avelocity_x = 0;
+ this.owner.avelocity_x = 0;
return;
}
// calculate sinewave using makevectors
- makevectors((self.nextthink * self.owner.freq + self.owner.phase) * '0 360 0');
- v = self.owner.speed * v_forward_y + self.cnt;
- if(self.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed
+ makevectors((this.nextthink * this.owner.freq + this.owner.phase) * '0 360 0');
+ v = this.owner.speed * v_forward_y + this.cnt;
+ if(this.owner.classname == "func_pendulum") // don't brake stuff if the func_bobbing was killtarget'ed
{
// * 10 so it will arrive in 0.1 sec
- self.owner.avelocity_z = (remainder(v - self.owner.angles_z, 360)) * 10;
+ this.owner.avelocity_z = (remainder(v - this.owner.angles_z, 360)) * 10;
}
}
REGISTER_NET_LINKED(ENT_CLIENT_PLAT)
#ifdef SVQC
-void plat_link();
+void plat_link(entity this);
void plat_delayedinit(entity this)
{
- plat_link();
+ plat_link(this);
plat_spawn_inside_trigger(this); // the "start moving" trigger
}
if(sf & SF_TRIGGER_INIT)
{
- WriteByte(MSG_ENTITY, self.platmovetype_start);
- WriteByte(MSG_ENTITY, self.platmovetype_turn);
- WriteByte(MSG_ENTITY, self.platmovetype_end);
- WriteByte(MSG_ENTITY, self.spawnflags);
+ WriteByte(MSG_ENTITY, this.platmovetype_start);
+ WriteByte(MSG_ENTITY, this.platmovetype_turn);
+ WriteByte(MSG_ENTITY, this.platmovetype_end);
+ WriteByte(MSG_ENTITY, this.spawnflags);
- WriteString(MSG_ENTITY, self.model);
+ WriteString(MSG_ENTITY, this.model);
- trigger_common_write(self, true);
+ trigger_common_write(this, true);
- WriteCoord(MSG_ENTITY, self.pos1_x);
- WriteCoord(MSG_ENTITY, self.pos1_y);
- WriteCoord(MSG_ENTITY, self.pos1_z);
- WriteCoord(MSG_ENTITY, self.pos2_x);
- WriteCoord(MSG_ENTITY, self.pos2_y);
- WriteCoord(MSG_ENTITY, self.pos2_z);
+ WriteCoord(MSG_ENTITY, this.pos1_x);
+ WriteCoord(MSG_ENTITY, this.pos1_y);
+ WriteCoord(MSG_ENTITY, this.pos1_z);
+ WriteCoord(MSG_ENTITY, this.pos2_x);
+ WriteCoord(MSG_ENTITY, this.pos2_y);
+ WriteCoord(MSG_ENTITY, this.pos2_z);
- WriteCoord(MSG_ENTITY, self.size_x);
- WriteCoord(MSG_ENTITY, self.size_y);
- WriteCoord(MSG_ENTITY, self.size_z);
+ WriteCoord(MSG_ENTITY, this.size_x);
+ WriteCoord(MSG_ENTITY, this.size_y);
+ WriteCoord(MSG_ENTITY, this.size_z);
- WriteAngle(MSG_ENTITY, self.mangle_x);
- WriteAngle(MSG_ENTITY, self.mangle_y);
- WriteAngle(MSG_ENTITY, self.mangle_z);
+ WriteAngle(MSG_ENTITY, this.mangle_x);
+ WriteAngle(MSG_ENTITY, this.mangle_y);
+ WriteAngle(MSG_ENTITY, this.mangle_z);
- WriteShort(MSG_ENTITY, self.speed);
- WriteShort(MSG_ENTITY, self.height);
- WriteByte(MSG_ENTITY, self.lip);
- WriteByte(MSG_ENTITY, self.state);
+ WriteShort(MSG_ENTITY, this.speed);
+ WriteShort(MSG_ENTITY, this.height);
+ WriteByte(MSG_ENTITY, this.lip);
+ WriteByte(MSG_ENTITY, this.state);
- WriteShort(MSG_ENTITY, self.dmg);
+ WriteShort(MSG_ENTITY, this.dmg);
}
if(sf & SF_TRIGGER_RESET)
return true;
}
-void plat_link()
+void plat_link(entity this)
{
- //Net_LinkEntity(self, 0, false, plat_send);
+ //Net_LinkEntity(this, 0, false, plat_send);
}
spawnfunc(func_plat)
// optional features to save space
fl = fl & 0x0F;
- if(self.spawnflags & 2)
+ if(this.spawnflags & 2)
fl |= 0x10; // absolute count on toggle-on
- if(self.movedir != '0 0 0' || self.velocity != '0 0 0')
+ if(this.movedir != '0 0 0' || this.velocity != '0 0 0')
fl |= 0x20; // 4 bytes - saves CPU
- if(self.waterlevel || self.count != 1)
+ if(this.waterlevel || this.count != 1)
fl |= 0x40; // 4 bytes - obscure features almost never used
- if(self.mins != '0 0 0' || self.maxs != '0 0 0')
+ if(this.mins != '0 0 0' || this.maxs != '0 0 0')
fl |= 0x80; // 14 bytes - saves lots of space
WriteByte(MSG_ENTITY, fl);
if(fl & 2)
{
- if(self.state)
- WriteCoord(MSG_ENTITY, self.impulse);
+ if(this.state)
+ WriteCoord(MSG_ENTITY, this.impulse);
else
WriteCoord(MSG_ENTITY, 0); // off
}
if(fl & 4)
{
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
}
if(fl & 1)
{
- if(self.model != "null")
+ if(this.model != "null")
{
- WriteShort(MSG_ENTITY, self.modelindex);
+ WriteShort(MSG_ENTITY, this.modelindex);
if(fl & 0x80)
{
- WriteCoord(MSG_ENTITY, self.mins_x);
- WriteCoord(MSG_ENTITY, self.mins_y);
- WriteCoord(MSG_ENTITY, self.mins_z);
- WriteCoord(MSG_ENTITY, self.maxs_x);
- WriteCoord(MSG_ENTITY, self.maxs_y);
- WriteCoord(MSG_ENTITY, self.maxs_z);
+ WriteCoord(MSG_ENTITY, this.mins_x);
+ WriteCoord(MSG_ENTITY, this.mins_y);
+ WriteCoord(MSG_ENTITY, this.mins_z);
+ WriteCoord(MSG_ENTITY, this.maxs_x);
+ WriteCoord(MSG_ENTITY, this.maxs_y);
+ WriteCoord(MSG_ENTITY, this.maxs_z);
}
}
else
WriteShort(MSG_ENTITY, 0);
if(fl & 0x80)
{
- WriteCoord(MSG_ENTITY, self.maxs_x);
- WriteCoord(MSG_ENTITY, self.maxs_y);
- WriteCoord(MSG_ENTITY, self.maxs_z);
+ WriteCoord(MSG_ENTITY, this.maxs_x);
+ WriteCoord(MSG_ENTITY, this.maxs_y);
+ WriteCoord(MSG_ENTITY, this.maxs_z);
}
}
- WriteShort(MSG_ENTITY, self.cnt);
- WriteString(MSG_ENTITY, self.mdl);
+ WriteShort(MSG_ENTITY, this.cnt);
+ WriteString(MSG_ENTITY, this.mdl);
if(fl & 0x20)
{
- WriteShort(MSG_ENTITY, compressShortVector(self.velocity));
- WriteShort(MSG_ENTITY, compressShortVector(self.movedir));
+ WriteShort(MSG_ENTITY, compressShortVector(this.velocity));
+ WriteShort(MSG_ENTITY, compressShortVector(this.movedir));
}
if(fl & 0x40)
{
- WriteShort(MSG_ENTITY, self.waterlevel * 16.0);
- WriteByte(MSG_ENTITY, self.count * 16.0);
+ WriteShort(MSG_ENTITY, this.waterlevel * 16.0);
+ WriteByte(MSG_ENTITY, this.count * 16.0);
}
- WriteString(MSG_ENTITY, self.noise);
- if(self.noise != "")
+ WriteString(MSG_ENTITY, this.noise);
+ if(this.noise != "")
{
- WriteByte(MSG_ENTITY, floor(self.atten * 64));
- WriteByte(MSG_ENTITY, floor(self.volume * 255));
+ WriteByte(MSG_ENTITY, floor(this.atten * 64));
+ WriteByte(MSG_ENTITY, floor(this.volume * 255));
}
- WriteString(MSG_ENTITY, self.bgmscript);
- if(self.bgmscript != "")
+ WriteString(MSG_ENTITY, this.bgmscript);
+ if(this.bgmscript != "")
{
- WriteByte(MSG_ENTITY, floor(self.bgmscriptattack * 64));
- WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64));
- WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255));
- WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64));
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptattack * 64));
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64));
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255));
+ WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64));
}
}
return 1;
void pointparticles_think(entity this)
{
- if(self.origin != self.oldorigin)
+ if(this.origin != this.oldorigin)
{
- self.SendFlags |= 4;
- self.oldorigin = self.origin;
+ this.SendFlags |= 4;
+ this.oldorigin = this.origin;
}
- self.nextthink = time;
+ this.nextthink = time;
}
void pointparticles_reset(entity this)
spawnfunc(func_sparks)
{
- // self.cnt is the amount of sparks that one burst will spawn
- if(self.cnt < 1) {
- self.cnt = 25.0; // nice default value
+ // this.cnt is the amount of sparks that one burst will spawn
+ if(this.cnt < 1) {
+ this.cnt = 25.0; // nice default value
}
- // self.wait is the probability that a sparkthink will spawn a spark shower
+ // this.wait is the probability that a sparkthink will spawn a spark shower
// range: 0 - 1, but 0 makes little sense, so...
- if(self.wait < 0.05) {
- self.wait = 0.25; // nice default value
+ if(this.wait < 0.05) {
+ this.wait = 0.25; // nice default value
}
- self.count = self.cnt;
- self.mins = '0 0 0';
- self.maxs = '0 0 0';
- self.velocity = '0 0 -1';
- self.mdl = "TE_SPARK";
- self.impulse = 10 * self.wait; // by default 2.5/sec
- self.wait = 0;
- self.cnt = 0; // use mdl
+ this.count = this.cnt;
+ this.mins = '0 0 0';
+ this.maxs = '0 0 0';
+ this.velocity = '0 0 -1';
+ this.mdl = "TE_SPARK";
+ this.impulse = 10 * this.wait; // by default 2.5/sec
+ this.wait = 0;
+ this.cnt = 0; // use mdl
spawnfunc_func_pointparticles(this);
}
void train_wait(entity this)
{
SUB_UseTargets(this.enemy, NULL, NULL);
- self.enemy = world;
+ this.enemy = world;
// if turning is enabled, the train will turn toward the next point while waiting
- if(self.platmovetype_turn && !self.train_wait_turning)
+ if(this.platmovetype_turn && !this.train_wait_turning)
{
entity targ, cp;
vector ang;
- targ = find(world, targetname, self.target);
- if((self.spawnflags & 1) && targ.curvetarget)
+ targ = find(world, targetname, this.target);
+ if((this.spawnflags & 1) && targ.curvetarget)
cp = find(world, targetname, targ.curvetarget);
else
cp = world;
if(cp) // bezier curves movement
- ang = cp.origin - (self.origin - self.view_ofs); // use the origin of the control point of the next path_corner
+ ang = cp.origin - (this.origin - this.view_ofs); // use the origin of the control point of the next path_corner
else // linear movement
- ang = targ.origin - (self.origin - self.view_ofs); // use the origin of the next path_corner
+ ang = targ.origin - (this.origin - this.view_ofs); // use the origin of the next path_corner
ang = vectoangles(ang);
ang_x = -ang_x; // flip up / down orientation
- if(self.wait > 0) // slow turning
- SUB_CalcAngleMove(self, ang, TSPEED_TIME, self.SUB_LTIME - time + self.wait, train_wait);
+ if(this.wait > 0) // slow turning
+ SUB_CalcAngleMove(this, ang, TSPEED_TIME, this.SUB_LTIME - time + this.wait, train_wait);
else // instant turning
- SUB_CalcAngleMove(self, ang, TSPEED_TIME, 0.0000001, train_wait);
- self.train_wait_turning = true;
+ SUB_CalcAngleMove(this, ang, TSPEED_TIME, 0.0000001, train_wait);
+ this.train_wait_turning = true;
return;
}
#ifdef SVQC
- if(self.noise != "")
- stopsoundto(MSG_BROADCAST, self, CH_TRIGGER_SINGLE); // send this as unreliable only, as the train will resume operation shortly anyway
+ if(this.noise != "")
+ stopsoundto(MSG_BROADCAST, this, CH_TRIGGER_SINGLE); // send this as unreliable only, as the train will resume operation shortly anyway
#endif
#ifdef SVQC
- entity tg = find(world, targetname, self.target);
+ entity tg = find(world, targetname, this.target);
if(tg.spawnflags & 4)
{
- self.use = train_use;
- SUB_THINK(self, func_null);
- self.SUB_NEXTTHINK = 0;
+ this.use = train_use;
+ SUB_THINK(this, func_null);
+ this.SUB_NEXTTHINK = 0;
}
else
#endif
- if(self.wait < 0 || self.train_wait_turning) // no waiting or we already waited while turning
+ if(this.wait < 0 || this.train_wait_turning) // no waiting or we already waited while turning
{
- self.train_wait_turning = false;
- train_next(self);
+ this.train_wait_turning = false;
+ train_next(this);
}
else
{
- SUB_THINK(self, train_next);
- self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
+ SUB_THINK(this, train_next);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
}
}
entity targ, cp = world;
vector cp_org = '0 0 0';
- targ = find(world, targetname, self.target);
- self.target = targ.target;
- if (self.spawnflags & 1)
+ targ = find(world, targetname, this.target);
+ this.target = targ.target;
+ if (this.spawnflags & 1)
{
if(targ.curvetarget)
{
cp = find(world, targetname, targ.curvetarget); // get its second target (the control point)
- cp_org = cp.origin - self.view_ofs; // no control point found, assume a straight line to the destination
+ cp_org = cp.origin - this.view_ofs; // no control point found, assume a straight line to the destination
}
}
- if (self.target == "")
+ if (this.target == "")
objerror("train_next: no next target");
- self.wait = targ.wait;
- if (!self.wait)
- self.wait = 0.1;
+ this.wait = targ.wait;
+ if (!this.wait)
+ this.wait = 0.1;
if(targ.platmovetype)
{
// this path_corner contains a movetype overrider, apply it
- self.platmovetype_start = targ.platmovetype_start;
- self.platmovetype_end = targ.platmovetype_end;
+ this.platmovetype_start = targ.platmovetype_start;
+ this.platmovetype_end = targ.platmovetype_end;
}
else
{
// this path_corner doesn't contain a movetype overrider, use the train's defaults
- self.platmovetype_start = self.platmovetype_start_default;
- self.platmovetype_end = self.platmovetype_end_default;
+ this.platmovetype_start = this.platmovetype_start_default;
+ this.platmovetype_end = this.platmovetype_end_default;
}
if (targ.speed)
{
if (cp)
- SUB_CalcMove_Bezier(self, cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
+ SUB_CalcMove_Bezier(this, cp_org, targ.origin - this.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
else
- SUB_CalcMove(self, targ.origin - self.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
+ SUB_CalcMove(this, targ.origin - this.view_ofs, TSPEED_LINEAR, targ.speed, train_wait);
}
else
{
if (cp)
- SUB_CalcMove_Bezier(self, cp_org, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait);
+ SUB_CalcMove_Bezier(this, cp_org, targ.origin - this.view_ofs, TSPEED_LINEAR, this.speed, train_wait);
else
- SUB_CalcMove(self, targ.origin - self.view_ofs, TSPEED_LINEAR, self.speed, train_wait);
+ SUB_CalcMove(this, targ.origin - this.view_ofs, TSPEED_LINEAR, this.speed, train_wait);
}
- if(self.noise != "")
- _sound(self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE);
+ if(this.noise != "")
+ _sound(this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE);
}
REGISTER_NET_LINKED(ENT_CLIENT_TRAIN)
if(sf & SF_TRIGGER_INIT)
{
- WriteString(MSG_ENTITY, self.platmovetype);
- WriteByte(MSG_ENTITY, self.platmovetype_turn);
- WriteByte(MSG_ENTITY, self.spawnflags);
+ WriteString(MSG_ENTITY, this.platmovetype);
+ WriteByte(MSG_ENTITY, this.platmovetype_turn);
+ WriteByte(MSG_ENTITY, this.spawnflags);
- WriteString(MSG_ENTITY, self.model);
+ WriteString(MSG_ENTITY, this.model);
- trigger_common_write(self, true);
+ trigger_common_write(this, true);
- WriteString(MSG_ENTITY, self.curvetarget);
+ WriteString(MSG_ENTITY, this.curvetarget);
- WriteCoord(MSG_ENTITY, self.pos1_x);
- WriteCoord(MSG_ENTITY, self.pos1_y);
- WriteCoord(MSG_ENTITY, self.pos1_z);
- WriteCoord(MSG_ENTITY, self.pos2_x);
- WriteCoord(MSG_ENTITY, self.pos2_y);
- WriteCoord(MSG_ENTITY, self.pos2_z);
+ WriteCoord(MSG_ENTITY, this.pos1_x);
+ WriteCoord(MSG_ENTITY, this.pos1_y);
+ WriteCoord(MSG_ENTITY, this.pos1_z);
+ WriteCoord(MSG_ENTITY, this.pos2_x);
+ WriteCoord(MSG_ENTITY, this.pos2_y);
+ WriteCoord(MSG_ENTITY, this.pos2_z);
- WriteCoord(MSG_ENTITY, self.size_x);
- WriteCoord(MSG_ENTITY, self.size_y);
- WriteCoord(MSG_ENTITY, self.size_z);
+ WriteCoord(MSG_ENTITY, this.size_x);
+ WriteCoord(MSG_ENTITY, this.size_y);
+ WriteCoord(MSG_ENTITY, this.size_z);
- WriteCoord(MSG_ENTITY, self.view_ofs_x);
- WriteCoord(MSG_ENTITY, self.view_ofs_y);
- WriteCoord(MSG_ENTITY, self.view_ofs_z);
+ WriteCoord(MSG_ENTITY, this.view_ofs_x);
+ WriteCoord(MSG_ENTITY, this.view_ofs_y);
+ WriteCoord(MSG_ENTITY, this.view_ofs_z);
- WriteAngle(MSG_ENTITY, self.mangle_x);
- WriteAngle(MSG_ENTITY, self.mangle_y);
- WriteAngle(MSG_ENTITY, self.mangle_z);
+ WriteAngle(MSG_ENTITY, this.mangle_x);
+ WriteAngle(MSG_ENTITY, this.mangle_y);
+ WriteAngle(MSG_ENTITY, this.mangle_z);
- WriteShort(MSG_ENTITY, self.speed);
- WriteShort(MSG_ENTITY, self.height);
- WriteByte(MSG_ENTITY, self.lip);
- WriteByte(MSG_ENTITY, self.state);
- WriteByte(MSG_ENTITY, self.wait);
+ WriteShort(MSG_ENTITY, this.speed);
+ WriteShort(MSG_ENTITY, this.height);
+ WriteByte(MSG_ENTITY, this.lip);
+ WriteByte(MSG_ENTITY, this.state);
+ WriteByte(MSG_ENTITY, this.wait);
- WriteShort(MSG_ENTITY, self.dmg);
- WriteByte(MSG_ENTITY, self.dmgtime);
+ WriteShort(MSG_ENTITY, this.dmg);
+ WriteByte(MSG_ENTITY, this.dmgtime);
}
if(sf & SF_TRIGGER_RESET)
return true;
}
-void train_link()
+void train_link(entity this)
{
- //Net_LinkEntity(self, 0, false, train_send);
+ //Net_LinkEntity(this, 0, false, train_send);
}
void train_use(entity this, entity actor, entity trigger)
void func_train_find(entity this)
{
entity targ;
- targ = find(world, targetname, self.target);
- self.target = targ.target;
- if (self.target == "")
+ targ = find(world, targetname, this.target);
+ this.target = targ.target;
+ if (this.target == "")
objerror("func_train_find: no next target");
- SUB_SETORIGIN(self, targ.origin - self.view_ofs);
+ SUB_SETORIGIN(this, targ.origin - this.view_ofs);
- if(!(self.spawnflags & 4))
+ if(!(this.spawnflags & 4))
{
- self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
- SUB_THINK(self, train_next);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + 1;
+ SUB_THINK(this, train_next);
}
- train_link();
+ train_link(this);
}
#endif
void func_vectormamamam_controller_think(entity this)
{
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
- if(self.owner.active != ACTIVE_ACTIVE)
+ if(this.owner.active != ACTIVE_ACTIVE)
{
- self.owner.velocity = '0 0 0';
+ this.owner.velocity = '0 0 0';
return;
}
- if(self.owner.classname == "func_vectormamamam") // don't brake stuff if the func_vectormamamam was killtarget'ed
- self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
+ if(this.owner.classname == "func_vectormamamam") // don't brake stuff if the func_vectormamamam was killtarget'ed
+ this.owner.velocity = (this.owner.destvec + func_vectormamamam_origin(this.owner, 0.1) - this.owner.origin) * 10;
}
void func_vectormamamam_findtarget(entity this)
void misc_laser_init(entity this)
{
- if(self.target != "")
- self.enemy = find(world, targetname, self.target);
+ if(this.target != "")
+ this.enemy = find(world, targetname, this.target);
}
.entity pusher;
entity hitent;
vector hitloc;
- self.nextthink = time;
+ this.nextthink = time;
- if(!self.state)
+ if(!this.state)
return;
misc_laser_aim(this);
- if(self.enemy)
+ if(this.enemy)
{
- o = self.enemy.origin;
- if (!(self.spawnflags & 2))
- o = self.origin + normalize(o - self.origin) * 32768;
+ o = this.enemy.origin;
+ if (!(this.spawnflags & 2))
+ o = this.origin + normalize(o - this.origin) * 32768;
}
else
{
- makevectors(self.mangle);
- o = self.origin + v_forward * 32768;
+ makevectors(this.mangle);
+ o = this.origin + v_forward * 32768;
}
- if(self.dmg || self.enemy.target != "")
+ if(this.dmg || this.enemy.target != "")
{
- traceline(self.origin, o, MOVE_NORMAL, self);
+ traceline(this.origin, o, MOVE_NORMAL, this);
}
hitent = trace_ent;
hitloc = trace_endpos;
- if(self.enemy.target != "") // DETECTOR laser
+ if(this.enemy.target != "") // DETECTOR laser
{
if(trace_ent.iscreature)
{
- self.pusher = hitent;
- if(!self.count)
+ this.pusher = hitent;
+ if(!this.count)
{
- self.count = 1;
+ this.count = 1;
- SUB_UseTargets(self.enemy, self.enemy.pusher, NULL);
+ SUB_UseTargets(this.enemy, this.enemy.pusher, NULL);
}
}
else
{
- if(self.count)
+ if(this.count)
{
- self.count = 0;
+ this.count = 0;
- SUB_UseTargets(self.enemy, self.enemy.pusher, NULL);
+ SUB_UseTargets(this.enemy, this.enemy.pusher, NULL);
}
}
}
- if(self.dmg)
+ if(this.dmg)
{
- if(self.team)
- if(((self.spawnflags & 8) == 0) == (self.team != hitent.team))
+ if(this.team)
+ if(((this.spawnflags & 8) == 0) == (this.team != hitent.team))
return;
if(hitent.takedamage)
- Damage(hitent, self, self, ((self.dmg < 0) ? 100000 : (self.dmg * frametime)), DEATH_HURTTRIGGER.m_id, hitloc, '0 0 0');
+ Damage(hitent, this, this, ((this.dmg < 0) ? 100000 : (this.dmg * frametime)), DEATH_HURTTRIGGER.m_id, hitloc, '0 0 0');
}
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_LASER);
fl = fl - (fl & 0xF0); // use that bit to indicate finite length laser
- if(self.spawnflags & 2)
+ if(this.spawnflags & 2)
fl |= 0x80;
- if(self.alpha)
+ if(this.alpha)
fl |= 0x40;
- if(self.scale != 1 || self.modelscale != 1)
+ if(this.scale != 1 || this.modelscale != 1)
fl |= 0x20;
- if(self.spawnflags & 4)
+ if(this.spawnflags & 4)
fl |= 0x10;
WriteByte(MSG_ENTITY, fl);
if(fl & 1)
{
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
}
if(fl & 8)
{
- WriteByte(MSG_ENTITY, self.colormod_x * 255.0);
- WriteByte(MSG_ENTITY, self.colormod_y * 255.0);
- WriteByte(MSG_ENTITY, self.colormod_z * 255.0);
+ WriteByte(MSG_ENTITY, this.colormod_x * 255.0);
+ WriteByte(MSG_ENTITY, this.colormod_y * 255.0);
+ WriteByte(MSG_ENTITY, this.colormod_z * 255.0);
if(fl & 0x40)
- WriteByte(MSG_ENTITY, self.alpha * 255.0);
+ WriteByte(MSG_ENTITY, this.alpha * 255.0);
if(fl & 0x20)
{
- WriteByte(MSG_ENTITY, bound(0, self.scale * 16.0, 255));
- WriteByte(MSG_ENTITY, bound(0, self.modelscale * 16.0, 255));
+ WriteByte(MSG_ENTITY, bound(0, this.scale * 16.0, 255));
+ WriteByte(MSG_ENTITY, bound(0, this.modelscale * 16.0, 255));
}
if((fl & 0x80) || !(fl & 0x10)) // effect doesn't need sending if the laser is infinite and has collision testing turned off
- WriteShort(MSG_ENTITY, self.cnt + 1);
+ WriteShort(MSG_ENTITY, this.cnt + 1);
}
if(fl & 2)
{
if(fl & 0x80)
{
- WriteCoord(MSG_ENTITY, self.enemy.origin_x);
- WriteCoord(MSG_ENTITY, self.enemy.origin_y);
- WriteCoord(MSG_ENTITY, self.enemy.origin_z);
+ WriteCoord(MSG_ENTITY, this.enemy.origin_x);
+ WriteCoord(MSG_ENTITY, this.enemy.origin_y);
+ WriteCoord(MSG_ENTITY, this.enemy.origin_z);
}
else
{
- WriteAngle(MSG_ENTITY, self.mangle_x);
- WriteAngle(MSG_ENTITY, self.mangle_y);
+ WriteAngle(MSG_ENTITY, this.mangle_x);
+ WriteAngle(MSG_ENTITY, this.mangle_y);
}
}
if(fl & 4)
- WriteByte(MSG_ENTITY, self.state);
+ WriteByte(MSG_ENTITY, this.state);
return 1;
}
{
#ifdef SVQC
SELFPARAM();
- if(self.dmg && other.takedamage != DAMAGE_NO)
+ if(this.dmg && other.takedamage != DAMAGE_NO)
{
- if(self.dmgtime2 < time)
+ if(this.dmgtime2 < time)
{
- Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
- self.dmgtime2 = time + self.dmgtime;
+ Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ this.dmgtime2 = time + this.dmgtime;
}
// Gib dead/dying stuff
if(IS_DEAD(other))
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
#endif
}
settouch(trigger, plat_center_touch);
trigger.movetype = MOVETYPE_NONE;
trigger.solid = SOLID_TRIGGER;
- trigger.enemy = self;
+ trigger.enemy = this;
- tmin = self.absmin + '25 25 0';
- tmax = self.absmax - '25 25 -8';
- tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
- if (self.spawnflags & PLAT_LOW_TRIGGER)
+ tmin = this.absmin + '25 25 0';
+ tmax = this.absmax - '25 25 -8';
+ tmin_z = tmax_z - (this.pos1_z - this.pos2_z + 8);
+ if (this.spawnflags & PLAT_LOW_TRIGGER)
tmax_z = tmin_z + 8;
- if (self.size_x <= 50)
+ if (this.size_x <= 50)
{
- tmin_x = (self.mins_x + self.maxs_x) / 2;
+ tmin_x = (this.mins_x + this.maxs_x) / 2;
tmax_x = tmin_x + 1;
}
- if (self.size_y <= 50)
+ if (this.size_y <= 50)
{
- tmin_y = (self.mins_y + self.maxs_y) / 2;
+ tmin_y = (this.mins_y + this.maxs_y) / 2;
tmax_y = tmin_y + 1;
}
void plat_hit_top(entity this)
{
- _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
- self.state = 1;
+ _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
+ this.state = 1;
- SUB_THINK(self, plat_go_down);
- self.SUB_NEXTTHINK = self.SUB_LTIME + 3;
+ SUB_THINK(this, plat_go_down);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + 3;
}
void plat_hit_bottom(entity this)
{
- _sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
- self.state = 2;
+ _sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
+ this.state = 2;
}
void plat_go_down(entity this)
{
- _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
- self.state = 3;
- SUB_CalcMove (self, self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
+ _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
+ this.state = 3;
+ SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, plat_hit_bottom);
}
void plat_go_up(entity this)
{
- _sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
- self.state = 4;
- SUB_CalcMove (self, self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
+ _sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
+ this.state = 4;
+ SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, plat_hit_top);
}
void plat_center_touch(entity this)
return;
#endif
- if (self.enemy.state == 2) {
- entity e = self.enemy;
+ if (this.enemy.state == 2) {
+ entity e = this.enemy;
WITHSELF(e, plat_go_up(e));
- } else if (self.enemy.state == 1)
- self.enemy.SUB_NEXTTHINK = self.enemy.SUB_LTIME + 1;
+ } else if (this.enemy.state == 1)
+ this.enemy.SUB_NEXTTHINK = this.enemy.SUB_LTIME + 1;
}
void plat_outside_touch(entity this)
return;
#endif
- if (self.enemy.state == 1) {
- entity e = self.enemy;
+ if (this.enemy.state == 1) {
+ entity e = this.enemy;
WITHSELF(e, plat_go_down(e));
}
}
void plat_crush()
{SELFPARAM();
- if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
+ if((this.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
{ // KIll Kill Kill!!
#ifdef SVQC
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
#endif
}
else
{
#ifdef SVQC
- if((self.dmg) && (other.takedamage != DAMAGE_NO))
+ if((this.dmg) && (other.takedamage != DAMAGE_NO))
{ // Shall we bite?
- Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
// Gib dead/dying stuff
if(IS_DEAD(other))
- Damage (other, self, self, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (other, this, this, 10000, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
#endif
- if (self.state == 4)
- plat_go_down (self);
- else if (self.state == 3)
- plat_go_up (self);
+ if (this.state == 4)
+ plat_go_down (this);
+ else if (this.state == 3)
+ plat_go_up (this);
// when in other states, then the plat_crush event came delayed after
// plat state already had changed
// this isn't a bug per se!
==================
SUB_Friction
-Applies some friction to self
+Applies some friction to this
==================
*/
.float friction;
void SUB_Friction (entity this)
{
- self.SUB_NEXTTHINK = time;
- if(self.SUB_FLAGS & FL_ONGROUND)
- self.SUB_VELOCITY = self.SUB_VELOCITY * (1 - frametime * self.friction);
+ this.SUB_NEXTTHINK = time;
+ if(this.SUB_FLAGS & FL_ONGROUND)
+ this.SUB_VELOCITY = this.SUB_VELOCITY * (1 - frametime * this.friction);
}
/*
=============
SUB_CalcMove
-calculate self.SUB_VELOCITY and self.SUB_NEXTTHINK to reach dest from
-self.SUB_ORIGIN traveling at speed
+calculate this.SUB_VELOCITY and this.SUB_NEXTTHINK to reach dest from
+this.SUB_ORIGIN traveling at speed
===============
*/
void SUB_CalcMoveDone(entity this)
{
// After moving, set origin to exact final destination
- SUB_SETORIGIN (self, self.finaldest);
- self.SUB_VELOCITY = '0 0 0';
- self.SUB_NEXTTHINK = -1;
- if (self.think1)
- self.think1 (self);
+ SUB_SETORIGIN (this, this.finaldest);
+ this.SUB_VELOCITY = '0 0 0';
+ this.SUB_NEXTTHINK = -1;
+ if (this.think1)
+ this.think1 (this);
}
.float platmovetype_turn;
vector veloc;
vector angloc;
vector nextpos;
- delta = self.destvec;
- delta2 = self.destvec2;
- if(time < self.animstate_endtime)
+ delta = this.destvec;
+ delta2 = this.destvec2;
+ if(time < this.animstate_endtime)
{
nexttick = time + PHYS_INPUT_FRAMETIME;
- traveltime = self.animstate_endtime - self.animstate_starttime;
- phasepos = (nexttick - self.animstate_starttime) / traveltime; // range: [0, 1]
- phasepos = cubic_speedfunc(self.platmovetype_start, self.platmovetype_end, phasepos);
- nextpos = self.origin + (delta * phasepos) + (delta2 * phasepos * phasepos);
+ traveltime = this.animstate_endtime - this.animstate_starttime;
+ phasepos = (nexttick - this.animstate_starttime) / traveltime; // range: [0, 1]
+ phasepos = cubic_speedfunc(this.platmovetype_start, this.platmovetype_end, phasepos);
+ nextpos = this.origin + (delta * phasepos) + (delta2 * phasepos * phasepos);
// derivative: delta + 2 * delta2 * phasepos (e.g. for angle positioning)
- if(self.owner.platmovetype_turn)
+ if(this.owner.platmovetype_turn)
{
vector destangle;
destangle = delta + 2 * delta2 * phasepos;
destangle_x = -destangle_x; // flip up / down orientation
// take the shortest distance for the angles
- vector v = SUB_ANGLES(self.owner);
+ vector v = SUB_ANGLES(this.owner);
v.x -= 360 * floor((v.x - destangle_x) / 360 + 0.5);
v.y -= 360 * floor((v.y - destangle_y) / 360 + 0.5);
v.z -= 360 * floor((v.z - destangle_z) / 360 + 0.5);
- SUB_ANGLES(self.owner) = v;
- angloc = destangle - SUB_ANGLES(self.owner);
+ SUB_ANGLES(this.owner) = v;
+ angloc = destangle - SUB_ANGLES(this.owner);
angloc = angloc * (1 / PHYS_INPUT_FRAMETIME); // so it arrives for the next frame
- self.owner.SUB_AVELOCITY = angloc;
+ this.owner.SUB_AVELOCITY = angloc;
}
- if(nexttick < self.animstate_endtime)
- veloc = nextpos - self.owner.SUB_ORIGIN;
+ if(nexttick < this.animstate_endtime)
+ veloc = nextpos - this.owner.SUB_ORIGIN;
else
- veloc = self.finaldest - self.owner.SUB_ORIGIN;
+ veloc = this.finaldest - this.owner.SUB_ORIGIN;
veloc = veloc * (1 / PHYS_INPUT_FRAMETIME); // so it arrives for the next frame
- self.owner.SUB_VELOCITY = veloc;
- self.nextthink = nexttick;
+ this.owner.SUB_VELOCITY = veloc;
+ this.nextthink = nexttick;
}
else
{
// derivative: delta + 2 * delta2 (e.g. for angle positioning)
- entity own = self.owner;
- SUB_THINK(own, self.think1);
- remove(self);
+ entity own = this.owner;
+ SUB_THINK(own, this.think1);
+ remove(this);
WITHSELF(own, SUB_THUNK(own)(own));
}
}
if (!tspeed)
objerror ("No speed is defined!");
- self.think1 = func;
- self.finaldest = tdest;
- SUB_THINK(self, SUB_CalcMoveDone);
+ this.think1 = func;
+ this.finaldest = tdest;
+ SUB_THINK(this, SUB_CalcMoveDone);
switch(tspeedtype)
{
default:
case TSPEED_START:
- traveltime = 2 * vlen(tcontrol - self.SUB_ORIGIN) / tspeed;
+ traveltime = 2 * vlen(tcontrol - this.SUB_ORIGIN) / tspeed;
break;
case TSPEED_END:
traveltime = 2 * vlen(tcontrol - tdest) / tspeed;
break;
case TSPEED_LINEAR:
- traveltime = vlen(tdest - self.SUB_ORIGIN) / tspeed;
+ traveltime = vlen(tdest - this.SUB_ORIGIN) / tspeed;
break;
case TSPEED_TIME:
traveltime = tspeed;
if (traveltime < 0.1) // useless anim
{
- self.SUB_VELOCITY = '0 0 0';
- self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1;
+ this.SUB_VELOCITY = '0 0 0';
+ this.SUB_NEXTTHINK = this.SUB_LTIME + 0.1;
return;
}
controller = new(SUB_CalcMove_controller);
- controller.owner = self;
- controller.platmovetype = self.platmovetype;
- controller.platmovetype_start = self.platmovetype_start;
- controller.platmovetype_end = self.platmovetype_end;
- SUB_CalcMove_controller_setbezier(controller, self.SUB_ORIGIN, tcontrol, tdest);
+ controller.owner = this;
+ controller.platmovetype = this.platmovetype;
+ controller.platmovetype_start = this.platmovetype_start;
+ controller.platmovetype_end = this.platmovetype_end;
+ SUB_CalcMove_controller_setbezier(controller, this.SUB_ORIGIN, tcontrol, tdest);
controller.finaldest = (tdest + '0 0 0.125'); // where do we want to end? Offset to overshoot a bit.
controller.animstate_starttime = time;
controller.animstate_endtime = time + traveltime;
setthink(controller, SUB_CalcMove_controller_think);
- controller.think1 = SUB_THUNK(self);
+ controller.think1 = SUB_THUNK(this);
// the thinking is now done by the controller
- SUB_THINK(self, SUB_NullThink); // for PushMove
- self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
+ SUB_THINK(this, SUB_NullThink); // for PushMove
+ this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime;
// invoke controller
WITHSELF(controller, getthink(controller)(controller));
if (!tspeed)
objerror ("No speed is defined!");
- self.think1 = func;
- self.finaldest = tdest;
- SUB_THINK(self, SUB_CalcMoveDone);
+ this.think1 = func;
+ this.finaldest = tdest;
+ SUB_THINK(this, SUB_CalcMoveDone);
- if (tdest == self.SUB_ORIGIN)
+ if (tdest == this.SUB_ORIGIN)
{
- self.SUB_VELOCITY = '0 0 0';
- self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1;
+ this.SUB_VELOCITY = '0 0 0';
+ this.SUB_NEXTTHINK = this.SUB_LTIME + 0.1;
return;
}
- delta = tdest - self.SUB_ORIGIN;
+ delta = tdest - this.SUB_ORIGIN;
switch(tspeedtype)
{
// of controlled animation, so let's just use linear movement.
// Alternatively entities can choose to specify non-controlled movement.
// The only currently implemented alternative movement is linear (value 1)
- if (traveltime < 0.15 || (self.platmovetype_start == 1 && self.platmovetype_end == 1)) // is this correct?
+ if (traveltime < 0.15 || (this.platmovetype_start == 1 && this.platmovetype_end == 1)) // is this correct?
{
- self.SUB_VELOCITY = delta * (1/traveltime); // QuakeC doesn't allow vector/float division
- self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
+ this.SUB_VELOCITY = delta * (1/traveltime); // QuakeC doesn't allow vector/float division
+ this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime;
return;
}
// now just run like a bezier curve...
- SUB_CalcMove_Bezier(self, (self.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func);
+ SUB_CalcMove_Bezier(this, (this.SUB_ORIGIN + tdest) * 0.5, tdest, tspeedtype, tspeed, func);
}
void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
=============
SUB_CalcAngleMove
-calculate self.SUB_AVELOCITY and self.SUB_NEXTTHINK to reach destangle from
-self.angles rotating
+calculate this.SUB_AVELOCITY and this.SUB_NEXTTHINK to reach destangle from
+this.angles rotating
-The calling function should make sure self.SUB_THINK is valid
+The calling function should make sure this.SUB_THINK is valid
===============
*/
void SUB_CalcAngleMoveDone(entity this)
{
// After rotating, set angle to exact final angle
- self.angles = self.finalangle;
- self.SUB_AVELOCITY = '0 0 0';
- self.SUB_NEXTTHINK = -1;
- if (self.think1)
- self.think1 (self);
+ this.angles = this.finalangle;
+ this.SUB_AVELOCITY = '0 0 0';
+ this.SUB_NEXTTHINK = -1;
+ if (this.think1)
+ this.think1 (this);
}
// FIXME: I fixed this function only for rotation around the main axes
objerror ("No speed is defined!");
// take the shortest distance for the angles
- self.angles_x -= 360 * floor((self.angles_x - destangle_x) / 360 + 0.5);
- self.angles_y -= 360 * floor((self.angles_y - destangle_y) / 360 + 0.5);
- self.angles_z -= 360 * floor((self.angles_z - destangle_z) / 360 + 0.5);
- delta = destangle - self.angles;
+ this.angles_x -= 360 * floor((this.angles_x - destangle_x) / 360 + 0.5);
+ this.angles_y -= 360 * floor((this.angles_y - destangle_y) / 360 + 0.5);
+ this.angles_z -= 360 * floor((this.angles_z - destangle_z) / 360 + 0.5);
+ delta = destangle - this.angles;
switch(tspeedtype)
{
break;
}
- self.think1 = func;
- self.finalangle = destangle;
- SUB_THINK(self, SUB_CalcAngleMoveDone);
+ this.think1 = func;
+ this.finalangle = destangle;
+ SUB_THINK(this, SUB_CalcAngleMoveDone);
if (traveltime < 0.1)
{
- self.SUB_AVELOCITY = '0 0 0';
- self.SUB_NEXTTHINK = self.SUB_LTIME + 0.1;
+ this.SUB_AVELOCITY = '0 0 0';
+ this.SUB_NEXTTHINK = this.SUB_LTIME + 0.1;
return;
}
- self.SUB_AVELOCITY = delta * (1 / traveltime);
- self.SUB_NEXTTHINK = self.SUB_LTIME + traveltime;
+ this.SUB_AVELOCITY = delta * (1 / traveltime);
+ this.SUB_NEXTTHINK = this.SUB_LTIME + traveltime;
}
void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void(entity this) func)
void Ent_TriggerMusic_Think(entity this)
{
- if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world))
+ if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, this, world))
{
- music_trigger = self;
+ music_trigger = this;
}
- self.nextthink = time;
+ this.nextthink = time;
}
void Ent_TriggerMusic_Remove(entity this)
{
- if(self.noise)
- strunzone(self.noise);
- self.noise = string_null;
+ if(this.noise)
+ strunzone(this.noise);
+ this.noise = string_null;
}
NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
void target_spawn_helper_setmodel(entity this)
{
- _setmodel(self, self.model);
+ _setmodel(this, this.model);
}
void target_spawn_helper_setsize(entity this)
{
- setsize(self, self.mins, self.maxs);
+ setsize(this, this.mins, this.maxs);
}
void target_spawn_edit_entity(entity this, entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act, entity trigger)
void trigger_gravity_check_think(entity this)
{
// This spawns when a player enters the gravity zone and checks if he left.
- // Each frame, self.count is set to 2 by trigger_gravity_touch() and decreased by 1 here.
+ // Each frame, this.count is set to 2 by trigger_gravity_touch() and decreased by 1 here.
// It the player has left the gravity trigger, this will be allowed to reach 0 and indicate that.
- if(self.count <= 0)
+ if(this.count <= 0)
{
- if(self.owner.trigger_gravity_check == self)
- trigger_gravity_remove(self.owner);
+ if(this.owner.trigger_gravity_check == this)
+ trigger_gravity_remove(this.owner);
else
- remove(self);
+ remove(this);
return;
}
else
{
- self.count -= 1;
- self.nextthink = time;
+ this.count -= 1;
+ this.nextthink = time;
}
}
{
float g;
- if(self.state != true)
+ if(this.state != true)
return;
EXACTTRIGGER_TOUCH;
- g = self.gravity;
+ g = this.gravity;
- if (!(self.spawnflags & 1))
+ if (!(this.spawnflags & 1))
{
if(other.trigger_gravity_check)
{
- if(self == other.trigger_gravity_check.enemy)
+ if(this == other.trigger_gravity_check.enemy)
{
// same?
other.trigger_gravity_check.count = 2; // gravity one more frame...
}
// compare prio
- if(self.cnt > other.trigger_gravity_check.enemy.cnt)
+ if(this.cnt > other.trigger_gravity_check.enemy.cnt)
trigger_gravity_remove(other);
else
return;
}
other.trigger_gravity_check = spawn();
- other.trigger_gravity_check.enemy = self;
+ other.trigger_gravity_check.enemy = this;
other.trigger_gravity_check.owner = other;
other.trigger_gravity_check.gravity = other.gravity;
setthink(other.trigger_gravity_check, trigger_gravity_check_think);
if (other.gravity != g)
{
other.gravity = g;
- if(self.noise != "")
- _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
- UpdateCSQCProjectile(self.owner);
+ if(this.noise != "")
+ _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
+ UpdateCSQCProjectile(this.owner);
}
}
.float triggerhealtime;
void trigger_heal_touch(entity this)
{
- if (self.active != ACTIVE_ACTIVE)
+ if (this.active != ACTIVE_ACTIVE)
return;
// only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
EXACTTRIGGER_TOUCH;
other.triggerhealtime = time + 1;
- if (other.health < self.max_health)
+ if (other.health < this.max_health)
{
- other.health = min(other.health + self.health, self.max_health);
+ other.health = min(other.health + this.health, this.max_health);
other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
- _sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
+ _sound (other, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
}
}
}
.float triggerhurttime;
void trigger_hurt_touch(entity this)
{
- if (self.active != ACTIVE_ACTIVE)
+ if (this.active != ACTIVE_ACTIVE)
return;
- if(self.team)
- if(((self.spawnflags & 4) == 0) == (self.team != other.team))
+ if(this.team)
+ if(((this.spawnflags & 4) == 0) == (this.team != other.team))
return;
// only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu)
other.triggerhurttime = time + 1;
entity own;
- own = self.enemy;
+ own = this.enemy;
if (!IS_PLAYER(own))
{
- own = self;
- self.enemy = world; // I still hate you all
+ own = this;
+ this.enemy = world; // I still hate you all
}
- Damage (other, self, own, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage (other, this, own, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
}
else if(other.damagedbytriggers)
if(other.takedamage)
{
EXACTTRIGGER_TOUCH;
- Damage(other, self, self, self.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
+ Damage(other, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, other.origin, '0 0 0');
}
}
float pushdeltatime;
float str;
- if (self.active != ACTIVE_ACTIVE)
+ if (this.active != ACTIVE_ACTIVE)
return;
if (!isPushable(other))
EXACTTRIGGER_TOUCH;
- targ = find(world, targetname, self.target);
+ targ = find(world, targetname, this.target);
if(!targ)
{
objerror("trigger_force without a (valid) .target!\n");
- remove(self);
+ remove(this);
return;
}
#ifdef SVQC
- str = min(self.radius, vlen(self.origin - other.origin));
+ str = min(this.radius, vlen(this.origin - other.origin));
#elif defined(CSQC)
- str = min(self.radius, vlen(self.origin - other.move_origin));
+ str = min(this.radius, vlen(this.origin - other.move_origin));
#endif
- if(self.falloff == 1)
- str = (str / self.radius) * self.strength;
- else if(self.falloff == 2)
- str = (1 - (str / self.radius)) * self.strength;
+ if(this.falloff == 1)
+ str = (str / this.radius) * this.strength;
+ else if(this.falloff == 2)
+ str = (1 - (str / this.radius)) * this.strength;
else
- str = self.strength;
+ str = this.strength;
pushdeltatime = time - other.lastpushtime;
if (pushdeltatime > 0.15) pushdeltatime = 0;
other.lastpushtime = time;
if(!pushdeltatime) return;
- if(self.spawnflags & 64)
+ if(this.spawnflags & 64)
{
#ifdef SVQC
- float addspeed = str - other.velocity * normalize(targ.origin - self.origin);
+ float addspeed = str - other.velocity * normalize(targ.origin - this.origin);
if (addspeed > 0)
{
float accelspeed = min(8 * pushdeltatime * str, addspeed);
- other.velocity += accelspeed * normalize(targ.origin - self.origin);
+ other.velocity += accelspeed * normalize(targ.origin - this.origin);
}
#elif defined(CSQC)
- float addspeed = str - other.move_velocity * normalize(targ.origin - self.origin);
+ float addspeed = str - other.move_velocity * normalize(targ.origin - this.origin);
if (addspeed > 0)
{
float accelspeed = min(8 * pushdeltatime * str, addspeed);
- other.move_velocity += accelspeed * normalize(targ.origin - self.origin);
+ other.move_velocity += accelspeed * normalize(targ.origin - this.origin);
}
#endif
}
else
#ifdef SVQC
- other.velocity = other.velocity + normalize(targ.origin - self.origin) * str * pushdeltatime;
+ other.velocity = other.velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
#elif defined(CSQC)
- other.move_velocity = other.move_velocity + normalize(targ.origin - self.origin) * str * pushdeltatime;
+ other.move_velocity = other.move_velocity + normalize(targ.origin - this.origin) * str * pushdeltatime;
#endif
#ifdef SVQC
{
float pushdeltatime;
- if (self.active != ACTIVE_ACTIVE)
+ if (this.active != ACTIVE_ACTIVE)
return;
if (!isPushable(other))
// div0: ticrate independent, 1 = identity (not 20)
#ifdef SVQC
- other.velocity = other.velocity * pow(self.strength, pushdeltatime);
+ other.velocity = other.velocity * pow(this.strength, pushdeltatime);
UpdateCSQCProjectile(other);
#elif defined(CSQC)
- other.move_velocity = other.move_velocity * pow(self.strength, pushdeltatime);
+ other.move_velocity = other.move_velocity * pow(this.strength, pushdeltatime);
#endif
}
float pushdeltatime;
float str;
- if (self.active != ACTIVE_ACTIVE)
+ if (this.active != ACTIVE_ACTIVE)
return;
if (!isPushable(other))
other.lastpushtime = time;
if(!pushdeltatime) return;
- setsize(self, '-1 -1 -1' * self.radius,'1 1 1' * self.radius);
+ setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius);
#ifdef SVQC
- str = min(self.radius, vlen(self.origin - other.origin));
+ str = min(this.radius, vlen(this.origin - other.origin));
#elif defined(CSQC)
- str = min(self.radius, vlen(self.origin - other.move_origin));
+ str = min(this.radius, vlen(this.origin - other.move_origin));
#endif
- if(self.falloff == 1)
- str = (1 - str / self.radius) * self.strength; // 1 in the inside
- else if(self.falloff == 2)
- str = (str / self.radius) * self.strength; // 0 in the inside
+ if(this.falloff == 1)
+ str = (1 - str / this.radius) * this.strength; // 1 in the inside
+ else if(this.falloff == 2)
+ str = (str / this.radius) * this.strength; // 0 in the inside
else
- str = self.strength;
+ str = this.strength;
#ifdef SVQC
- other.velocity = other.velocity + normalize(other.origin - self.origin) * str * pushdeltatime;
+ other.velocity = other.velocity + normalize(other.origin - this.origin) * str * pushdeltatime;
UpdateCSQCProjectile(other);
#elif defined(CSQC)
- other.move_velocity = other.move_velocity + normalize(other.move_origin - self.origin) * str * pushdeltatime;
+ other.move_velocity = other.move_velocity + normalize(other.move_origin - this.origin) * str * pushdeltatime;
#endif
}
return;
// check silver key
- if(self.itemkeys)
- key_used = item_keys_usekey(self, other);
+ if(this.itemkeys)
+ key_used = item_keys_usekey(this, other);
- if(self.itemkeys)
+ if(this.itemkeys)
{
#ifdef SVQC
// at least one of the keys is missing
if(key_used)
{
// one or more keys were given, but others are still missing!
- play2(other, self.noise1);
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(self.itemkeys));
+ play2(other, this.noise1);
+ Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_ALSONEED, item_keys_keylist(this.itemkeys));
other.key_door_messagetime = time + 2;
}
else if(other.key_door_messagetime <= time)
{
// no keys were given
- play2(other, self.noise2);
- Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(self.itemkeys));
+ play2(other, this.noise2);
+ Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_DOOR_LOCKED_NEED, item_keys_keylist(this.itemkeys));
other.key_door_messagetime = time + 2;
}
#endif
// trigger target2
- if(self.delay <= time || started_delay == true)
- if(self.target2)
+ if(this.delay <= time || started_delay == true)
+ if(this.target2)
{
- trigger_keylock_trigger(this, other, self.target2);
+ trigger_keylock_trigger(this, other, this.target2);
started_delay = true;
- self.delay = time + self.wait;
+ this.delay = time + this.wait;
}
}
else
{
#ifdef SVQC
// all keys were given!
- play2(other, self.noise);
- centerprint(other, self.message);
+ play2(other, this.noise);
+ centerprint(other, this.message);
#endif
- if(self.target)
- trigger_keylock_trigger(this, other, self.target);
+ if(this.target)
+ trigger_keylock_trigger(this, other, this.target);
- if(self.killtarget)
- trigger_keylock_kill(self.killtarget);
+ if(this.killtarget)
+ trigger_keylock_kill(this.killtarget);
- remove(self);
+ remove(this);
}
}
void multi_touch(entity this)
{
- if(!(self.spawnflags & 2))
+ if(!(this.spawnflags & 2))
if(!other.iscreature)
return;
- if(self.team)
- if(((self.spawnflags & 4) == 0) == (self.team != other.team))
+ if(this.team)
+ if(((this.spawnflags & 4) == 0) == (this.team != other.team))
return;
// if the trigger has an angles field, check player's facing direction
- if (self.movedir != '0 0 0')
+ if (this.movedir != '0 0 0')
{
makevectors (other.angles);
- if (v_forward * self.movedir < 0)
+ if (v_forward * this.movedir < 0)
return; // not facing the right way
}
// if the trigger has pressed keys, check that the player is pressing those keys
- if(self.pressedkeys)
+ if(this.pressedkeys)
if(IS_PLAYER(other)) // only for players
- if(!(other.pressedkeys & self.pressedkeys))
+ if(!(other.pressedkeys & this.pressedkeys))
return;
EXACTTRIGGER_TOUCH;
- self.enemy = other;
- self.goalentity = other;
- multi_trigger(self);
+ this.enemy = other;
+ this.goalentity = other;
+ multi_trigger(this);
}
void multi_eventdamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
//print(ftos(secret_counter.count), "\n");
// centerprint message (multi_touch() doesn't always call centerprint())
- centerprint(other, self.message);
- self.message = "";
+ centerprint(other, this.message);
+ this.message = "";
// handle normal trigger features
- multi_touch(self);
- remove(self);
+ multi_touch(this);
+ remove(this);
}
/*QUAKED trigger_secret (.5 .5 .5) ?
void swampslug_think(entity this)
{
//Slowly kill the slug
- self.health = self.health - 1;
+ this.health = this.health - 1;
//Slug dead? then remove curses.
- if(self.health <= 0)
+ if(this.health <= 0)
{
- self.owner.in_swamp = 0;
- remove(self);
- //centerprint(self.owner,"Killing slug...\n");
+ this.owner.in_swamp = 0;
+ remove(this);
+ //centerprint(this.owner,"Killing slug...\n");
return;
}
// Or we have exited it very recently.
// Do the damage and renew the timer.
#ifdef SVQC
- Damage (self.owner, self, self, self.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0');
+ Damage (this.owner, this, this, this.dmg, DEATH_SWAMP.m_id, other.origin, '0 0 0');
#endif
- self.nextthink = time + self.swamp_interval;
+ this.nextthink = time + this.swamp_interval;
}
void swamp_touch(entity this)
setthink(other.swampslug, swampslug_think);
other.swampslug.nextthink = time;
other.swampslug.owner = other;
- other.swampslug.dmg = self.dmg;
- other.swampslug.swamp_interval = self.swamp_interval;
- other.swamp_slowdown = self.swamp_slowdown;
+ other.swampslug.dmg = this.dmg;
+ other.swampslug.swamp_interval = this.swamp_interval;
+ other.swamp_slowdown = this.swamp_slowdown;
other.in_swamp = 1;
return;
}
void Teleport_Touch (entity this)
{
- if (self.active != ACTIVE_ACTIVE)
+ if (this.active != ACTIVE_ACTIVE)
return;
#ifdef SVQC
if(IS_DEAD(other))
return;
- if(self.team)
- if(((self.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
+ if(this.team)
+ if(((this.spawnflags & 4) == 0) == (DIFF_TEAM(this, other)))
return;
EXACTTRIGGER_TOUCH;
#endif
entity e;
- e = Simple_TeleportPlayer(self, other);
+ e = Simple_TeleportPlayer(this, other);
#ifdef SVQC
- string s = self.target; self.target = string_null;
- SUB_UseTargets(self, other, other); // TODO: should we be using other for trigger too?
- if (!self.target) self.target = s;
+ string s = this.target; this.target = string_null;
+ SUB_UseTargets(this, other, other); // TODO: should we be using other for trigger too?
+ if (!this.target) this.target = s;
SUB_UseTargets(e, other, other);
#endif
// we abuse this method, rather than using normal .touch, because touch isn't reliable with multiple clients inside the same trigger, and can't "untouch" entities
// set myself as current viewloc where possible
- for(e = world; (e = findentity(e, viewloc, self)); )
+ for(e = world; (e = findentity(e, viewloc, this)); )
e.viewloc = world;
- for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
+ for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain)
if(!e.viewloc)
if(IS_PLAYER(e)) // should we support non-player entities with this?
//if(!IS_DEAD(e)) // death view is handled separately, we can't override this just yet
{
vector emin = e.absmin;
vector emax = e.absmax;
- if(self.solid == SOLID_BSP)
+ if(this.solid == SOLID_BSP)
{
emin -= '1 1 1';
emax += '1 1 1';
}
- if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
- if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
- e.viewloc = self;
+ if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
+ if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
+ e.viewloc = this;
}
- self.nextthink = time;
+ this.nextthink = time;
}
bool trigger_viewloc_send(entity this, entity to, int sf)
void trigger_viewloc_updatelink(entity this)
{
- self.enemy = findfloat(world, entnum, self.cnt);
- self.goalentity = findfloat(world, entnum, self.count);
+ this.enemy = findfloat(world, entnum, this.cnt);
+ this.goalentity = findfloat(world, entnum, this.count);
}
NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew)
the global "activator" should be set to the entity that initiated the firing.
-If self.delay is set, a DelayedUse entity will be created that will actually
+If this.delay is set, a DelayedUse entity will be created that will actually
do the SUB_UseTargets after that many seconds have passed.
-Centerprints any self.message to the activator.
+Centerprints any this.message to the activator.
-Removes all entities with a targetname that match self.killtarget,
+Removes all entities with a targetname that match this.killtarget,
and removes them, so some events can remove other triggers.
Search for (string)targetname in all entities that
-match (string)self.target and call their .use function
+match (string)this.target and call their .use function
==============================
*/
.float height;
.float nottargeted;
-#define IFTARGETED if(!self.nottargeted && self.targetname != "")
+#define IFTARGETED if(!this.nottargeted && this.targetname != "")
.float lip;
/*
entity path_makeorcache(entity forwho,entity start, entity end)
{
- entity oldself;
entity pth;
- oldself = self;
- self = forwho;
- //pth = pathlib_makepath(start.origin,end.origin,PFL_GROUNDSNAP,500,1.5,PT_QUICKSTAR);
+ //pth = pathlib_makepath(forwho, start.origin,end.origin,PFL_GROUNDSNAP,500,1.5,PT_QUICKSTAR);
- self = oldself;
return pth;
}
*/
void turret_die(entity this)
{
- sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
+ sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
if (!autocvar_cl_nogibs)
{
// Base
- if(self.m_id == TUR_EWHEEL.m_id)
- turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true);
- else if (self.m_id == TUR_WALKER.m_id)
- turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true);
- else if (self.m_id == TUR_TESLA.m_id)
- turret_gibtoss((get_turretinfo(self.m_id)).model, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', false);
+ if(this.m_id == TUR_EWHEEL.m_id)
+ turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', this.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true);
+ else if (this.m_id == TUR_WALKER.m_id)
+ turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', this.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true);
+ else if (this.m_id == TUR_TESLA.m_id)
+ turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', '0 0 200', '-1 -1 -1', false);
else
{
if (random() > 0.5)
{
- turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
- turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
- turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
+ turret_gibtoss("models/turrets/base-gib2.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
+ turret_gibtoss("models/turrets/base-gib3.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
+ turret_gibtoss("models/turrets/base-gib4.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
}
else
- turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', true);
+ turret_gibtoss("models/turrets/base-gib1.md3", this.origin + '0 0 8', '0 0 0', '0 0 0', true);
- entity headgib = turret_gibtoss((get_turretinfo(self.m_id)).head_model, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true);
+ entity headgib = turret_gibtoss((get_turretinfo(this.m_id)).head_model, this.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true);
if(headgib)
{
- headgib.angles = headgib.move_angles = self.tur_head.angles;
- headgib.avelocity = headgib.move_avelocity = self.tur_head.move_avelocity + randomvec() * 45;
+ headgib.angles = headgib.move_angles = this.tur_head.angles;
+ headgib.avelocity = headgib.move_avelocity = this.tur_head.move_avelocity + randomvec() * 45;
headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity_y * 5;
headgib.gravity = 0.5;
}
}
}
- setmodel(self, MDL_Null);
- setmodel(self.tur_head, MDL_Null);
+ setmodel(this, MDL_Null);
+ setmodel(this.tur_head, MDL_Null);
}
NET_HANDLE(ENT_CLIENT_TURRET, bool isnew)
// Generic damage handling
void turret_hide(entity this)
{
- self.effects |= EF_NODRAW;
- self.nextthink = time + self.respawntime - 0.2;
- setthink(self, turret_respawn);
+ this.effects |= EF_NODRAW;
+ this.nextthink = time + this.respawntime - 0.2;
+ setthink(this, turret_respawn);
}
void turret_die(entity this)
{
- self.deadflag = DEAD_DEAD;
- self.tur_head.deadflag = self.deadflag;
+ this.deadflag = DEAD_DEAD;
+ this.tur_head.deadflag = this.deadflag;
// Unsolidify and hide real parts
- self.solid = SOLID_NOT;
- self.tur_head.solid = self.solid;
+ this.solid = SOLID_NOT;
+ this.tur_head.solid = this.solid;
- self.event_damage = func_null;
- self.takedamage = DAMAGE_NO;
+ this.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
- self.health = 0;
+ this.health = 0;
// Go boom
- //RadiusDamage (self,self, min(self.ammo,50),min(self.ammo,50) * 0.25,250,world,min(self.ammo,50)*5,DEATH_TURRET,world);
+ //RadiusDamage (this,this, min(this.ammo,50),min(this.ammo,50) * 0.25,250,world,min(this.ammo,50)*5,DEATH_TURRET,world);
- Turret tur = get_turretinfo(self.m_id);
- if(self.damage_flags & TFL_DMG_DEATH_NORESPAWN)
+ Turret tur = get_turretinfo(this.m_id);
+ if(this.damage_flags & TFL_DMG_DEATH_NORESPAWN)
{
- tur.tr_death(tur, self);
+ tur.tr_death(tur, this);
- remove(self.tur_head);
- remove(self);
+ remove(this.tur_head);
+ remove(this);
}
else
{
// Setup respawn
- self.SendFlags |= TNSF_STATUS;
- self.nextthink = time + 0.2;
- setthink(self, turret_hide);
+ this.SendFlags |= TNSF_STATUS;
+ this.nextthink = time + 0.2;
+ setthink(this, turret_hide);
- tur.tr_death(tur, self);
+ tur.tr_death(tur, this);
}
}
{
// Make sure all parts belong to the same team since
// this function doubles as "teamchange" function.
- self.tur_head.team = self.team;
- self.effects &= ~EF_NODRAW;
- self.deadflag = DEAD_NO;
- self.effects = EF_LOWPRECISION;
- self.solid = SOLID_BBOX;
- self.takedamage = DAMAGE_AIM;
- self.event_damage = turret_damage;
- self.avelocity = '0 0 0';
- self.tur_head.avelocity = self.avelocity;
- self.tur_head.angles = self.idle_aim;
- self.health = self.max_health;
- self.enemy = world;
- self.volly_counter = self.shot_volly;
- self.ammo = self.ammo_max;
-
- self.nextthink = time + self.ticrate;
- setthink(self, turret_think);
-
- self.SendFlags = TNSF_FULL_UPDATE;
-
- Turret tur = get_turretinfo(self.m_id);
- tur.tr_setup(tur, self);
+ this.tur_head.team = this.team;
+ this.effects &= ~EF_NODRAW;
+ this.deadflag = DEAD_NO;
+ this.effects = EF_LOWPRECISION;
+ this.solid = SOLID_BBOX;
+ this.takedamage = DAMAGE_AIM;
+ this.event_damage = turret_damage;
+ this.avelocity = '0 0 0';
+ this.tur_head.avelocity = this.avelocity;
+ this.tur_head.angles = this.idle_aim;
+ this.health = this.max_health;
+ this.enemy = world;
+ this.volly_counter = this.shot_volly;
+ this.ammo = this.ammo_max;
+
+ this.nextthink = time + this.ticrate;
+ setthink(this, turret_think);
+
+ this.SendFlags = TNSF_FULL_UPDATE;
+
+ Turret tur = get_turretinfo(this.m_id);
+ tur.tr_setup(tur, this);
}
WriteByte(MSG_ENTITY, sf);
if(sf & TNSF_SETUP)
{
- WriteByte(MSG_ENTITY, self.m_id);
+ WriteByte(MSG_ENTITY, this.m_id);
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
- WriteAngle(MSG_ENTITY, self.angles_x);
- WriteAngle(MSG_ENTITY, self.angles_y);
+ WriteAngle(MSG_ENTITY, this.angles_x);
+ WriteAngle(MSG_ENTITY, this.angles_y);
}
if(sf & TNSF_ANG)
{
- WriteShort(MSG_ENTITY, rint(self.tur_head.angles_x));
- WriteShort(MSG_ENTITY, rint(self.tur_head.angles_y));
+ WriteShort(MSG_ENTITY, rint(this.tur_head.angles_x));
+ WriteShort(MSG_ENTITY, rint(this.tur_head.angles_y));
}
if(sf & TNSF_AVEL)
{
- WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x));
- WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y));
+ WriteShort(MSG_ENTITY, rint(this.tur_head.avelocity_x));
+ WriteShort(MSG_ENTITY, rint(this.tur_head.avelocity_y));
}
if(sf & TNSF_MOVE)
{
- WriteShort(MSG_ENTITY, rint(self.origin_x));
- WriteShort(MSG_ENTITY, rint(self.origin_y));
- WriteShort(MSG_ENTITY, rint(self.origin_z));
+ WriteShort(MSG_ENTITY, rint(this.origin_x));
+ WriteShort(MSG_ENTITY, rint(this.origin_y));
+ WriteShort(MSG_ENTITY, rint(this.origin_z));
- WriteShort(MSG_ENTITY, rint(self.velocity_x));
- WriteShort(MSG_ENTITY, rint(self.velocity_y));
- WriteShort(MSG_ENTITY, rint(self.velocity_z));
+ WriteShort(MSG_ENTITY, rint(this.velocity_x));
+ WriteShort(MSG_ENTITY, rint(this.velocity_y));
+ WriteShort(MSG_ENTITY, rint(this.velocity_z));
- WriteShort(MSG_ENTITY, rint(self.angles_y));
+ WriteShort(MSG_ENTITY, rint(this.angles_y));
}
if(sf & TNSF_ANIM)
{
- WriteCoord(MSG_ENTITY, self.anim_start_time);
- WriteByte(MSG_ENTITY, self.frame);
+ WriteCoord(MSG_ENTITY, this.anim_start_time);
+ WriteByte(MSG_ENTITY, this.frame);
}
if(sf & TNSF_STATUS)
{
- WriteByte(MSG_ENTITY, self.team);
+ WriteByte(MSG_ENTITY, this.team);
- if(self.health <= 0)
+ if(this.health <= 0)
WriteByte(MSG_ENTITY, 0);
else
- WriteByte(MSG_ENTITY, ceil((self.health / self.max_health) * 255));
+ WriteByte(MSG_ENTITY, ceil((this.health / this.max_health) * 255));
}
return true;
void turret_projectile_explode(entity this)
{
- self.takedamage = DAMAGE_NO;
- self.event_damage = func_null;
+ this.takedamage = DAMAGE_NO;
+ this.event_damage = func_null;
#ifdef TURRET_DEBUG
float d;
- d = RadiusDamage (self, self.owner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
- self.owner.tur_debug_dmg_t_h = self.owner.tur_debug_dmg_t_h + d;
- self.owner.tur_debug_dmg_t_f = self.owner.tur_debug_dmg_t_f + self.owner.shot_dmg;
+ d = RadiusDamage (this, this.owner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world);
+ this.owner.tur_debug_dmg_t_h = this.owner.tur_debug_dmg_t_h + d;
+ this.owner.tur_debug_dmg_t_f = this.owner.tur_debug_dmg_t_f + this.owner.shot_dmg;
#else
- RadiusDamage (self, self.realowner, self.owner.shot_dmg, 0, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
+ RadiusDamage (this, this.realowner, this.owner.shot_dmg, 0, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world);
#endif
- remove(self);
+ remove(this);
}
void turret_projectile_touch(entity this)
METHOD(Turret, tr_attack, void(Turret this, entity it)) {
Weapon w = this.m_weapon;
.entity weaponentity = weaponentities[0];
- w.wr_think(w, self, weaponentity, 1);
+ w.wr_think(w, this, weaponentity, 1);
}
#endif
/** (ALL) */
it.velocity = '0 0 0';
#ifdef EWHEEL_FANCYPATH
- if (self.pathcurrent)
+ if (it.pathcurrent)
pathlib_deletepath(it.pathcurrent.owner);
#endif
it.pathcurrent = NULL;
void turret_flac_projectile_think_explode(entity this)
{
- if(self.enemy != world)
- if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 3))
- setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
+ if(this.enemy != world)
+ if(vdist(this.origin - this.enemy.origin, <, this.owner.shot_radius * 3))
+ setorigin(this,this.enemy.origin + randomvec() * this.owner.shot_radius);
#ifdef TURRET_DEBUG
- float d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
- self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
- self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
+ float d = RadiusDamage (this, this.owner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world);
+ this.owner.tur_dbg_dmg_t_h = this.owner.tur_dbg_dmg_t_h + d;
+ this.owner.tur_dbg_dmg_t_f = this.owner.tur_dbg_dmg_t_f + this.owner.shot_dmg;
#else
- RadiusDamage (self, self.realowner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
+ RadiusDamage (this, this.realowner, this.owner.shot_dmg, this.owner.shot_dmg, this.owner.shot_radius, this, world, this.owner.shot_force, this.totalfrags, world);
#endif
- remove(self);
+ remove(this);
}
#endif
METHOD(FusionReactor, tr_attack, void(FusionReactor this, entity it))
{
- self.enemy.ammo = min(self.enemy.ammo + self.shot_dmg,self.enemy.ammo_max);
- vector fl_org = 0.5 * (self.enemy.absmin + self.enemy.absmax);
+ it.enemy.ammo = min(it.enemy.ammo + it.shot_dmg,it.enemy.ammo_max);
+ vector fl_org = 0.5 * (it.enemy.absmin + it.enemy.absmax);
te_smallflash(fl_org);
}
METHOD(FusionReactor, tr_think, void(FusionReactor thistur, entity it))
vector pre_pos;
float itime;
- self.nextthink = time + 0.05;
+ this.nextthink = time + 0.05;
- olddir = normalize(self.velocity);
+ olddir = normalize(this.velocity);
- if(self.max_health < time)
- turret_projectile_explode(self);
+ if(this.max_health < time)
+ turret_projectile_explode(this);
// Enemy dead? just keep on the current heading then.
- if ((self.enemy == world) || (IS_DEAD(self.enemy)))
+ if ((this.enemy == world) || (IS_DEAD(this.enemy)))
{
// Make sure we dont return to tracking a respawned player
- self.enemy = world;
+ this.enemy = world;
// Turn model
- self.angles = vectoangles(self.velocity);
+ this.angles = vectoangles(this.velocity);
- if(vdist(self.origin - self.owner.origin, >, (self.owner.shot_radius * 5)))
- turret_projectile_explode(self);
+ if(vdist(this.origin - this.owner.origin, >, (this.owner.shot_radius * 5)))
+ turret_projectile_explode(this);
// Accelerate
- self.velocity = olddir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
+ this.velocity = olddir * min(vlen(this.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
- UpdateCSQCProjectile(self);
+ UpdateCSQCProjectile(this);
return;
}
// Enemy in range?
- if(vdist(self.origin - self.enemy.origin, <, self.owner.shot_radius * 0.2))
- turret_projectile_explode(self);
+ if(vdist(this.origin - this.enemy.origin, <, this.owner.shot_radius * 0.2))
+ turret_projectile_explode(this);
// Predict enemy position
- itime = vlen(self.enemy.origin - self.origin) / vlen(self.velocity);
- pre_pos = self.enemy.origin + self.enemy.velocity * itime;
+ itime = vlen(this.enemy.origin - this.origin) / vlen(this.velocity);
+ pre_pos = this.enemy.origin + this.enemy.velocity * itime;
- pre_pos = (pre_pos + self.enemy.origin) * 0.5;
+ pre_pos = (pre_pos + this.enemy.origin) * 0.5;
// Find out the direction to that place
- newdir = normalize(pre_pos - self.origin);
+ newdir = normalize(pre_pos - this.origin);
// Turn
newdir = normalize(olddir + newdir * 0.35);
// Turn model
- self.angles = vectoangles(self.velocity);
+ this.angles = vectoangles(this.velocity);
// Accelerate
- self.velocity = newdir * min(vlen(self.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
+ this.velocity = newdir * min(vlen(this.velocity) * (autocvar_g_turrets_unit_hellion_shot_speed_gain), (autocvar_g_turrets_unit_hellion_shot_speed_max));
if (itime < 0.05)
- setthink(self, turret_projectile_explode);
+ setthink(this, turret_projectile_explode);
- UpdateCSQCProjectile(self);
+ UpdateCSQCProjectile(this);
}
#endif
entity e;
float ad,edist;
- self.nextthink = time + self.ticrate;
+ this.nextthink = time + this.ticrate;
- //if (self.cnt < time)
+ //if (this.cnt < time)
// turret_hk_missile_explode();
- if (IS_DEAD(self.enemy))
- self.enemy = world;
+ if (IS_DEAD(this.enemy))
+ this.enemy = world;
// Pick the closest valid target.
- if (!self.enemy)
+ if (!this.enemy)
{
- e = findradius(self.origin, 5000);
+ e = findradius(this.origin, 5000);
while (e)
{
if (hk_is_valid_target(this, e))
{
- if (!self.enemy)
- self.enemy = e;
+ if (!this.enemy)
+ this.enemy = e;
else
- if (vlen2(self.origin - e.origin) < vlen2(self.origin - self.enemy.origin))
- self.enemy = e;
+ if (vlen2(this.origin - e.origin) < vlen2(this.origin - this.enemy.origin))
+ this.enemy = e;
}
e = e.chain;
}
}
- self.angles = vectoangles(self.velocity);
- self.angles_x = self.angles_x * -1;
- makevectors(self.angles);
- self.angles_x = self.angles_x * -1;
+ this.angles = vectoangles(this.velocity);
+ this.angles_x = this.angles_x * -1;
+ makevectors(this.angles);
+ this.angles_x = this.angles_x * -1;
- if (self.enemy)
+ if (this.enemy)
{
- edist = vlen(self.origin - self.enemy.origin);
+ edist = vlen(this.origin - this.enemy.origin);
// Close enougth to do decent damage?
- if ( edist <= (self.owner.shot_radius * 0.25) )
+ if ( edist <= (this.owner.shot_radius * 0.25) )
{
- turret_projectile_explode(self);
+ turret_projectile_explode(this);
return;
}
// Get data on enemy position
- pre_pos = self.enemy.origin +
- self.enemy.velocity *
- min((vlen(self.enemy.origin - self.origin) / vlen(self.velocity)),0.5);
+ pre_pos = this.enemy.origin +
+ this.enemy.velocity *
+ min((vlen(this.enemy.origin - this.origin) / vlen(this.velocity)),0.5);
- traceline(self.origin, pre_pos,true,self.enemy);
- ve = normalize(pre_pos - self.origin);
+ traceline(this.origin, pre_pos,true,this.enemy);
+ ve = normalize(pre_pos - this.origin);
fe = trace_fraction;
}
fe = 0;
}
- if ((fe != 1) || (self.enemy == world) || (edist > 1000))
+ if ((fe != 1) || (this.enemy == world) || (edist > 1000))
{
- myspeed = vlen(self.velocity);
+ myspeed = vlen(this.velocity);
lt_for = myspeed * 3;
lt_seek = myspeed * 2.95;
// Trace forward
- traceline(self.origin, self.origin + v_forward * lt_for,false,self);
+ traceline(this.origin, this.origin + v_forward * lt_for,false,this);
vf = trace_endpos;
ff = trace_fraction;
// Find angular offset
- ad = vlen(vectoangles(normalize(self.enemy.origin - self.origin)) - self.angles);
+ ad = vlen(vectoangles(normalize(this.enemy.origin - this.origin)) - this.angles);
// To close to something, Slow down!
if ( ((ff < 0.7) || (ad > 4)) && (myspeed > (autocvar_g_turrets_unit_hk_shot_speed)) )
if (ff < 0.5) pt_seek = 1;
// Trace left
- traceline(self.origin, self.origin + (-1 * (v_right * pt_seek) + (v_forward * ff)) * lt_seek,false,self);
+ traceline(this.origin, this.origin + (-1 * (v_right * pt_seek) + (v_forward * ff)) * lt_seek,false,this);
vl = trace_endpos;
fl = trace_fraction;
// Trace right
- traceline(self.origin, self.origin + ((v_right * pt_seek) + (v_forward * ff)) * lt_seek ,false,self);
+ traceline(this.origin, this.origin + ((v_right * pt_seek) + (v_forward * ff)) * lt_seek ,false,this);
vr = trace_endpos;
fr = trace_fraction;
// Trace up
- traceline(self.origin, self.origin + ((v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,self);
+ traceline(this.origin, this.origin + ((v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,this);
vu = trace_endpos;
fu = trace_fraction;
// Trace down
- traceline(self.origin, self.origin + (-1 * (v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,self);
+ traceline(this.origin, this.origin + (-1 * (v_up * pt_seek) + (v_forward * ff)) * lt_seek ,false,this);
vd = trace_endpos;
fd = trace_fraction;
- vl = normalize(vl - self.origin);
- vr = normalize(vr - self.origin);
- vu = normalize(vu - self.origin);
- vd = normalize(vd - self.origin);
+ vl = normalize(vl - this.origin);
+ vr = normalize(vr - this.origin);
+ vu = normalize(vu - this.origin);
+ vd = normalize(vd - this.origin);
// Panic tresh passed, find a single direction and turn as hard as we can
if (pt_seek == 1)
wishdir = normalize( (vl * fl) + (vr * fr) + (vu * fu) + (vd * fd) );
}
- if (self.enemy)
+ if (this.enemy)
{
if (fe < 0.1) fe = 0.1; // Make sure we always try to move sligtly towards our target
wishdir = (wishdir * (1 - fe)) + (ve * fe);
else
{
// Got a clear path to target, speed up fast (if not at full speed) and go straight for it.
- myspeed = vlen(self.velocity);
+ myspeed = vlen(this.velocity);
if (myspeed < (autocvar_g_turrets_unit_hk_shot_speed_max))
myspeed = min(myspeed * (autocvar_g_turrets_unit_hk_shot_speed_accel2),(autocvar_g_turrets_unit_hk_shot_speed_max));
wishdir = ve;
}
- if ((myspeed > (autocvar_g_turrets_unit_hk_shot_speed)) && (self.cnt > time))
+ if ((myspeed > (autocvar_g_turrets_unit_hk_shot_speed)) && (this.cnt > time))
myspeed = min(myspeed * (autocvar_g_turrets_unit_hk_shot_speed_accel2),(autocvar_g_turrets_unit_hk_shot_speed_max));
// Ranoutagazfish?
- if (self.cnt < time)
+ if (this.cnt < time)
{
- self.cnt = time + 0.25;
- self.nextthink = 0;
- self.movetype = MOVETYPE_BOUNCE;
+ this.cnt = time + 0.25;
+ this.nextthink = 0;
+ this.movetype = MOVETYPE_BOUNCE;
return;
}
// Calculate new heading
- olddir = normalize(self.velocity);
+ olddir = normalize(this.velocity);
newdir = normalize(olddir + wishdir * (autocvar_g_turrets_unit_hk_shot_speed_turnrate));
// Set heading & speed
- self.velocity = newdir * myspeed;
+ this.velocity = newdir * myspeed;
// Align model with new heading
- self.angles = vectoangles(self.velocity);
+ this.angles = vectoangles(this.velocity);
#ifdef TURRET_DEBUG_HK
- //if(self.atime < time) {
+ //if(this.atime < time) {
if ((fe <= 0.99)||(edist > 1000))
{
- te_lightning2(world,self.origin, self.origin + vr * lt_seek);
- te_lightning2(world,self.origin, self.origin + vl * lt_seek);
- te_lightning2(world,self.origin, self.origin + vu * lt_seek);
- te_lightning2(world,self.origin, self.origin + vd * lt_seek);
- te_lightning2(world,self.origin, vf);
+ te_lightning2(world,this.origin, this.origin + vr * lt_seek);
+ te_lightning2(world,this.origin, this.origin + vl * lt_seek);
+ te_lightning2(world,this.origin, this.origin + vu * lt_seek);
+ te_lightning2(world,this.origin, this.origin + vd * lt_seek);
+ te_lightning2(world,this.origin, vf);
}
else
{
- te_lightning2(world,self.origin, self.enemy.origin);
+ te_lightning2(world,this.origin, this.enemy.origin);
}
bprint("Speed: ", ftos(rint(myspeed)), "\n");
bprint("Trace to solid: ", ftos(rint(ff * 100)), "%\n");
bprint("Trace to target:", ftos(rint(fe * 100)), "%\n");
- self.atime = time + 0.2;
+ this.atime = time + 0.2;
//}
#endif
- UpdateCSQCProjectile(self);
+ UpdateCSQCProjectile(this);
}
bool hk_is_valid_target(entity this, entity e_target)
void beam_think(entity this)
{
- if ((time > self.cnt) || (IS_DEAD(self.owner)))
+ if ((time > this.cnt) || (IS_DEAD(this.owner)))
{
- self.owner.attack_finished_single[0] = time + self.owner.shot_refire;
- self.owner.fireflag = 2;
- self.owner.tur_head.frame = 10;
- sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
- remove(self);
+ this.owner.attack_finished_single[0] = time + this.owner.shot_refire;
+ this.owner.fireflag = 2;
+ this.owner.tur_head.frame = 10;
+ sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+ remove(this);
return;
}
- turret_do_updates(self.owner);
+ turret_do_updates(this.owner);
- if (time - self.shot_spread > 0)
+ if (time - this.shot_spread > 0)
{
- self.shot_spread = time + 2;
- sound (self, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM);
+ this.shot_spread = time + 2;
+ sound (this, CH_SHOTS_SINGLE, SND_TUR_PHASER, VOL_BASE, ATTEN_NORM);
}
- self.nextthink = time + self.ticrate;
+ this.nextthink = time + this.ticrate;
- self.owner.attack_finished_single[0] = time + frametime;
- FireImoBeam ( self.owner, self.tur_shotorg,
- self.tur_shotorg + self.tur_shotdir_updated * self.target_range,
- '-1 -1 -1' * self.shot_radius,
- '1 1 1' * self.shot_radius,
- self.shot_force,
+ this.owner.attack_finished_single[0] = time + frametime;
+ FireImoBeam ( this.owner, this.tur_shotorg,
+ this.tur_shotorg + this.tur_shotdir_updated * this.target_range,
+ '-1 -1 -1' * this.shot_radius,
+ '1 1 1' * this.shot_radius,
+ this.shot_force,
this.shot_dmg,
0.75,
DEATH_TURRET_PHASER.m_id);
- self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256;
+ this.scale = vlen(this.owner.tur_shotorg - trace_endpos) / 256;
}
/*
-* Update self.tur_shotorg by getting up2date bone info
+* Update this.tur_shotorg by getting up2date bone info
* NOTICE this func overwrites the global v_forward, v_right and v_up vectors.
*/
float turret_tag_fire_update(entity this)
if(sf & VSF_SPAWN)
{
- WriteByte(MSG_ENTITY, self.vehicleid);
+ WriteByte(MSG_ENTITY, this.vehicleid);
}
if(sf & VSF_SETUP)
void vehicles_projectile_explode(entity this)
{
- if(self.owner && other != world)
+ if(this.owner && other != world)
{
- if(other == self.owner.vehicle)
+ if(other == this.owner.vehicle)
return;
- if(other == self.owner.vehicle.tur_head)
+ if(other == this.owner.vehicle.tur_head)
return;
}
PROJECTILE_TOUCH(this);
- self.event_damage = func_null;
- RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, world, self.shot_force, self.totalfrags, other);
+ this.event_damage = func_null;
+ RadiusDamage (this, this.realowner, this.shot_dmg, 0, this.shot_radius, this, world, this.shot_force, this.totalfrags, other);
- remove (self);
+ remove (this);
}
void vehicles_projectile_explode_use(entity this, entity actor, entity trigger)
void vehicles_gib_explode(entity this)
{
- sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
- Send_Effect(EFFECT_EXPLOSION_SMALL, self.wp00.origin + '0 0 64', '0 0 0', 1);
- remove(self);
+ sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
+ Send_Effect(EFFECT_EXPLOSION_SMALL, this.wp00.origin + '0 0 64', '0 0 0', 1);
+ remove(this);
}
void vehicles_gib_think(entity this)
{
- self.alpha -= 0.1;
- if(self.cnt >= time)
- remove(self);
+ this.alpha -= 0.1;
+ if(this.cnt >= time)
+ remove(this);
else
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
}
entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
void vehicles_spawn(entity this);
void vehicles_return(entity this)
{
- Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1);
+ Send_Effect(EFFECT_TELEPORT, this.wp00.origin + '0 0 64', '0 0 0', 1);
- setthink(self.wp00, vehicles_spawn);
- self.wp00.nextthink = time;
+ setthink(this.wp00, vehicles_spawn);
+ this.wp00.nextthink = time;
- if(self.waypointsprite_attached)
- WaypointSprite_Kill(self.waypointsprite_attached);
+ if(this.waypointsprite_attached)
+ WaypointSprite_Kill(this.waypointsprite_attached);
- remove(self);
+ remove(this);
}
void vehicles_showwp_goaway(entity this)
{
- if(self.waypointsprite_attached)
- WaypointSprite_Kill(self.waypointsprite_attached);
+ if(this.waypointsprite_attached)
+ WaypointSprite_Kill(this.waypointsprite_attached);
- remove(self);
+ remove(this);
}
void shieldhit_think(entity this)
{
- self.alpha -= 0.1;
- if (self.alpha <= 0)
+ this.alpha -= 0.1;
+ if (this.alpha <= 0)
{
- // setmodel(self, MDL_Null);
- self.alpha = -1;
- self.effects |= EF_NODRAW;
+ // setmodel(this, MDL_Null);
+ this.alpha = -1;
+ this.effects |= EF_NODRAW;
}
else
{
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
}
}
void vehicles_touch(entity this)
{
- if(MUTATOR_CALLHOOK(VehicleTouch, self, other))
+ if(MUTATOR_CALLHOOK(VehicleTouch, this, other))
return;
// Vehicle currently in use
- if(self.owner)
+ if(this.owner)
{
- if(!forbidWeaponUse(self.owner))
+ if(!forbidWeaponUse(this.owner))
if(other != world)
- if((self.origin_z + self.maxs_z) > (other.origin_z))
+ if((this.origin_z + this.maxs_z) > (other.origin_z))
if(vehicles_crushable(other))
{
- if(vdist(self.velocity, >=, 30))
- Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force);
+ if(vdist(this.velocity, >=, 30))
+ Damage(other, this, this.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - this.origin) * autocvar_g_vehicles_crush_force);
return; // Dont do selfdamage when hitting "soft targets".
}
- if(self.play_time < time) {
- Vehicle info = Vehicles_from(self.vehicleid);
- info.vr_impact(info, self);
+ if(this.play_time < time) {
+ Vehicle info = Vehicles_from(this.vehicleid);
+ info.vr_impact(info, this);
}
return;
if(autocvar_g_vehicles_enter)
return;
- vehicles_enter(other, self);
+ vehicles_enter(other, this);
}
bool vehicle_impulse(entity this, int imp)
{
case IMP_weapon_drop.impulse:
{
- stuffcmd(self, "\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n");
+ stuffcmd(this, "\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n");
return true;
}
}
void vehicles_think(entity this)
{
- self.nextthink = time;
+ this.nextthink = time;
- if(self.owner)
- self.owner.vehicle_weapon2mode = self.vehicle_weapon2mode;
+ if(this.owner)
+ this.owner.vehicle_weapon2mode = this.vehicle_weapon2mode;
- Vehicle info = Vehicles_from(self.vehicleid);
- info.vr_think(info, self);
+ Vehicle info = Vehicles_from(this.vehicleid);
+ info.vr_think(info, this);
- vehicles_painframe(self);
+ vehicles_painframe(this);
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
// initialization
void vehicles_spawn(entity this)
{
- LOG_TRACE("Spawning vehicle: ", self.classname, "\n");
+ LOG_TRACE("Spawning vehicle: ", this.classname, "\n");
// disown & reset
- self.vehicle_hudmodel.viewmodelforclient = self;
-
- self.owner = world;
- settouch(self, vehicles_touch);
- self.event_damage = vehicles_damage;
- self.iscreature = true;
- self.teleportable = false; // no teleporting for vehicles, too buggy
- self.damagedbycontents = true;
- self.movetype = MOVETYPE_WALK;
- self.solid = SOLID_SLIDEBOX;
- self.takedamage = DAMAGE_AIM;
- self.deadflag = DEAD_NO;
- self.bot_attack = true;
- self.flags = FL_NOTARGET;
- self.avelocity = '0 0 0';
- self.velocity = '0 0 0';
- setthink(self, vehicles_think);
- self.nextthink = time;
+ this.vehicle_hudmodel.viewmodelforclient = this;
+
+ this.owner = world;
+ settouch(this, vehicles_touch);
+ this.event_damage = vehicles_damage;
+ this.iscreature = true;
+ this.teleportable = false; // no teleporting for vehicles, too buggy
+ this.damagedbycontents = true;
+ this.movetype = MOVETYPE_WALK;
+ this.solid = SOLID_SLIDEBOX;
+ this.takedamage = DAMAGE_AIM;
+ this.deadflag = DEAD_NO;
+ this.bot_attack = true;
+ this.flags = FL_NOTARGET;
+ this.avelocity = '0 0 0';
+ this.velocity = '0 0 0';
+ setthink(this, vehicles_think);
+ this.nextthink = time;
// Reset locking
- self.lock_strength = 0;
- self.lock_target = world;
- self.misc_bulletcounter = 0;
+ this.lock_strength = 0;
+ this.lock_target = world;
+ this.misc_bulletcounter = 0;
// Return to spawn
- self.angles = self.pos2;
- setorigin(self, self.pos1);
+ this.angles = this.pos2;
+ setorigin(this, this.pos1);
// Show it
- Send_Effect(EFFECT_TELEPORT, self.origin + '0 0 64', '0 0 0', 1);
+ Send_Effect(EFFECT_TELEPORT, this.origin + '0 0 64', '0 0 0', 1);
- if(self.vehicle_controller)
- self.team = self.vehicle_controller.team;
+ if(this.vehicle_controller)
+ this.team = this.vehicle_controller.team;
- FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == self, RemoveGrapplingHook(it));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == this, RemoveGrapplingHook(it));
- vehicles_reset_colors(self);
+ vehicles_reset_colors(this);
- Vehicle info = Vehicles_from(self.vehicleid);
- info.vr_spawn(info, self);
+ Vehicle info = Vehicles_from(this.vehicleid);
+ info.vr_spawn(info, this);
- CSQCMODEL_AUTOINIT(self);
+ CSQCMODEL_AUTOINIT(this);
}
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
.entity gunner1;
.entity gunner2;
-.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value.
-.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value.
-.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value.
-
-.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If self is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If self is vehile, this is the real ammo1 value.
-.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If self is player this is 0..100 indicating percentage of primary reload status. If self is vehile, this is the real reload1 value.
-.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If self is player this is 0..100 indicating percentage of secondary ammo left. If self is vehile, this is the real ammo2 value.
-.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If self is player this is 0..100 indicating percentage of secondary reload status. If self is vehile, this is the real reload2 value.
+.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If ent is player this is 0..100 indicating precentage of health left on vehicle. If ent is vehile, this is the real health value.
+.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehile, this is the real energy value.
+.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehile, this is the real shield value.
+
+.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehile, this is the real ammo1 value.
+.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehile, this is the real reload1 value.
+.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehile, this is the real ammo2 value.
+.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehile, this is the real reload2 value.
.float sound_nexttime;
const float VOL_VEHICLEENGINE = 1;
float hgt;
hgt = raptor_altitude(this, 512);
- self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
- self.angles_x *= 0.95;
- self.angles_z *= 0.95;
+ this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime);
+ this.angles_x *= 0.95;
+ this.angles_z *= 0.95;
if(hgt < 16)
- setthink(self, vehicles_think);
+ setthink(this, vehicles_think);
- self.nextthink = time;
+ this.nextthink = time;
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
void bumblebee_exit(entity this, int eject)
void bumblebee_blowup(entity this)
{
- RadiusDamage(self, self.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
+ RadiusDamage(this, this.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
autocvar_g_vehicle_bumblebee_blowup_edgedamage,
- autocvar_g_vehicle_bumblebee_blowup_radius, self, world,
+ autocvar_g_vehicle_bumblebee_blowup_radius, this, world,
autocvar_g_vehicle_bumblebee_blowup_forceintensity,
DEATH_VH_BUMB_DEATH.m_id, world);
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- Send_Effect(EFFECT_EXPLOSION_BIG, (self.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ Send_Effect(EFFECT_EXPLOSION_BIG, (this.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1);
- if(self.owner.deadflag == DEAD_DYING)
- self.owner.deadflag = DEAD_DEAD;
+ if(this.owner.deadflag == DEAD_DYING)
+ this.owner.deadflag = DEAD_DEAD;
- remove(self);
+ remove(this);
}
void bumblebee_diethink(entity this)
{
- if(time >= self.wait)
- setthink(self, bumblebee_blowup);
+ if(time >= this.wait)
+ setthink(this, bumblebee_blowup);
if(random() < 0.1)
{
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
}
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
}
spawnfunc(vehicle_bumblebee)
WriteByte(MSG_ENTITY, sf);
if(sf & BRG_SETUP)
{
- WriteByte(MSG_ENTITY, etof(self.realowner));
- WriteByte(MSG_ENTITY, self.realowner.team);
- WriteByte(MSG_ENTITY, self.cnt);
+ WriteByte(MSG_ENTITY, etof(this.realowner));
+ WriteByte(MSG_ENTITY, this.realowner.team);
+ WriteByte(MSG_ENTITY, this.cnt);
}
if(sf & BRG_START)
{
- WriteCoord(MSG_ENTITY, self.hook_start_x);
- WriteCoord(MSG_ENTITY, self.hook_start_y);
- WriteCoord(MSG_ENTITY, self.hook_start_z);
+ WriteCoord(MSG_ENTITY, this.hook_start_x);
+ WriteCoord(MSG_ENTITY, this.hook_start_y);
+ WriteCoord(MSG_ENTITY, this.hook_start_z);
}
if(sf & BRG_END)
{
- WriteCoord(MSG_ENTITY, self.hook_end_x);
- WriteCoord(MSG_ENTITY, self.hook_end_y);
- WriteCoord(MSG_ENTITY, self.hook_end_z);
+ WriteCoord(MSG_ENTITY, this.hook_end_x);
+ WriteCoord(MSG_ENTITY, this.hook_end_y);
+ WriteCoord(MSG_ENTITY, this.hook_end_z);
}
return true;