/**
Do a inertia simulation based on velocity.
Basicaly, this allows you to simulate loss of steering with higher speed.
/**
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(vector vel_new, float vel_max,float newmin,float oldmax)
-{SELFPARAM();
+vector movelib_inertmove_byspeed(entity this, vector vel_new, float vel_max,float newmin,float oldmax)
+{
-vector movelib_inertmove(vector new_vel,float new_bias)
-{SELFPARAM();
- return new_vel * new_bias + self.velocity * (1-new_bias);
+vector movelib_inertmove(entity this, vector new_vel,float new_bias)
+{
+ return new_vel * new_bias + this.velocity * (1-new_bias);
-void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce)
-{SELFPARAM();
+void movelib_move(entity this, vector force,float max_velocity,float drag,float theMass,float breakforce)
+{
- breakvec = (normalize(self.velocity) * (breakforce / theMass) * deltatime);
- self.velocity = self.velocity - breakvec;
+ breakvec = (normalize(this.velocity) * (breakforce / theMass) * deltatime);
+ this.velocity = this.velocity - breakvec;
- self.velocity = self.velocity + force * (acceleration * deltatime);
- self.velocity = self.velocity + '0 0 0.05' * autocvar_sv_gravity * deltatime;
+ this.velocity = this.velocity + force * (acceleration * deltatime);
+ this.velocity = this.velocity + '0 0 0.05' * autocvar_sv_gravity * deltatime;
- //ggravity = (autocvar_sv_gravity / self.mass) * '0 0 100';
- acceleration = (force / self.mass) * dir;
- //acceleration -= old_dir * (old_speed / self.mass);
+ //ggravity = (autocvar_sv_gravity / this.mass) * '0 0 100';
+ acceleration = (force / this.mass) * dir;
+ //acceleration -= old_dir * (old_speed / this.mass);
- //self.velocity = self.velocity * (ffriction * movelib_deltatime);
- self.velocity += acceleration * movelib_deltatime;
- self.velocity_z = v_z;
+ //this.velocity = this.velocity * (ffriction * movelib_deltatime);
+ this.velocity += acceleration * movelib_deltatime;
+ this.velocity_z = v_z;
- mspeed = max(0,vlen(self.velocity) - force);
- mdir = normalize(self.velocity);
- vz = self.velocity.z;
- self.velocity = mdir * mspeed;
- self.velocity_z = vz;
+ mspeed = max(0,vlen(this.velocity) - force);
+ mdir = normalize(this.velocity);
+ vz = this.velocity.z;
+ this.velocity = mdir * mspeed;
+ this.velocity_z = vz;
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max)
-{SELFPARAM();
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
+{
vector a, b, c, d, e, r, push_angle, ahead, side;
push_angle.y = 0;
vector a, b, c, d, e, r, push_angle, ahead, side;
push_angle.y = 0;
- traceline(a, a - e,MOVE_NORMAL,self);
+ traceline(a, a - e,MOVE_NORMAL,this);
- traceline(b, b - e,MOVE_NORMAL,self);
+ traceline(b, b - e,MOVE_NORMAL,this);
- traceline(c, c - e,MOVE_NORMAL,self);
+ traceline(c, c - e,MOVE_NORMAL,this);
- traceline(d, d - e,MOVE_NORMAL,self);
+ traceline(d, d - e,MOVE_NORMAL,this);
- self.angles_x = ((1-blendrate) * self.angles.x) + (push_angle.x * blendrate);
- self.angles_z = ((1-blendrate) * self.angles.z) + (push_angle.z * blendrate);
+ this.angles_x = ((1-blendrate) * this.angles.x) + (push_angle.x * blendrate);
+ this.angles_z = ((1-blendrate) * this.angles.z) + (push_angle.z * blendrate);