[Fix] Fixed Mace Rockets
This commit is contained in:
parent
0dd9514139
commit
b75cf3d698
@ -586,8 +586,8 @@
|
||||
<sound>missile</sound>
|
||||
<spfx_shield>ExpM</spfx_shield>
|
||||
<spfx_armour>ExpM</spfx_armour>
|
||||
<duration>5</duration>
|
||||
<thrust>600</thrust>
|
||||
<duration>3</duration>
|
||||
<thrust>300</thrust>
|
||||
<speed>1000</speed>
|
||||
<damage type="kinetic">35</damage>
|
||||
</specific>
|
||||
|
49
src/weapon.c
49
src/weapon.c
@ -842,38 +842,34 @@ static Weapon* weapon_create(const Outfit* outfit, const double dir, const Vec2*
|
||||
w->solid->pos.y + w->solid->vel.y);
|
||||
break;
|
||||
|
||||
/* Turrets are a special case. */
|
||||
/* Dumb missiles and turrets. */
|
||||
case OUTFIT_TYPE_TURRET_DUMB_AMMO:
|
||||
case OUTFIT_TYPE_MISSILE_DUMB_AMMO:
|
||||
if(w->outfit->type == OUTFIT_TYPE_TURRET_DUMB_AMMO) {
|
||||
pilot_target = pilot_get(w->target);
|
||||
if(pilot_target == NULL)
|
||||
rdir = dir;
|
||||
|
||||
else {
|
||||
/* Get the distance. */
|
||||
dist = vect_dist(pos, &pilot_target->solid->pos);
|
||||
|
||||
/* Aim. */
|
||||
/*
|
||||
* Try to predict where the enemy will be.
|
||||
*
|
||||
* Time for shots to reach that distance.
|
||||
*/
|
||||
/* Try to predict where the enemy will be. */
|
||||
/* Time for shots to reach that distance. */
|
||||
t = dist / w->outfit->u.amm.speed;
|
||||
|
||||
/* Position is calculated on where it should be. */
|
||||
x = (pilot_target->solid->pos.x + pilot_target->solid->vel.x*t)
|
||||
- (pos->x + vel->x*t);
|
||||
y = (pilot_target->solid->pos.y + pilot_target->solid->vel.y*t)
|
||||
- (pos->y + vel->y*t);
|
||||
- (pos->y + vel->y * t);
|
||||
|
||||
/* Set angle to face. */
|
||||
rdir = ANGLE(x, y);
|
||||
}
|
||||
if(outfit->u.amm.accuracy != 0.) {
|
||||
rdir += NormalInverse(RNGF()*0.9 + 0.05) /* Get rid of extreme values. */
|
||||
* outfit->u.amm.accuracy/2. * 1./180.*M_PI;
|
||||
if((rdir > 2.*M_PI) || (rdir < 0.))
|
||||
rdir = fmod(rdir, 2.*M_PI);
|
||||
}
|
||||
else {
|
||||
rdir = dir;
|
||||
}
|
||||
|
||||
/* If thrust is 0. We assume it starts out at speed. */
|
||||
@ -886,33 +882,8 @@ static Weapon* weapon_create(const Outfit* outfit, const double dir, const Vec2*
|
||||
w->timer = outfit->u.amm.duration;
|
||||
w->solid = solid_create(mass, rdir, pos, &v);
|
||||
if(w->outfit->u.amm.thrust != 0.)
|
||||
vect_pset(&w->solid->force, w->outfit->u.amm.thrust, rdir);
|
||||
w->voice = sound_playPos(w->outfit->u.amm.sound,
|
||||
w->solid->pos.x + w->solid->vel.x,
|
||||
w->solid->pos.y + w->solid->vel.y);
|
||||
break;
|
||||
vect_pset(&w->solid->force, w->outfit->u.amm.thrust * mass, rdir);
|
||||
|
||||
/* Dumb missiles are a mix of missile and bolt. */
|
||||
case OUTFIT_TYPE_MISSILE_DUMB_AMMO:
|
||||
mass = w->outfit->mass;
|
||||
|
||||
rdir = dir;
|
||||
|
||||
if(outfit->u.amm.accuracy != 0.) {
|
||||
rdir += NormalInverse(RNGF()*0.9 + 0.05) /* Get rid of extreme values. */
|
||||
* outfit->u.amm.accuracy/2. * 1./180.*M_PI;
|
||||
if((rdir > 2.*M_PI) || (rdir < 0.))
|
||||
rdir = fmod(rdir, 2.*M_PI);
|
||||
}
|
||||
|
||||
/* If thrust is 0. we assume it starts out at speed. */
|
||||
if(outfit->u.amm.thrust == 0.)
|
||||
vect_pset(&v, w->outfit->u.amm.speed, rdir);
|
||||
else
|
||||
vectnull(&v);
|
||||
|
||||
w->timer = outfit->u.amm.duration;
|
||||
w->solid = solid_create(mass, rdir, pos, &v);
|
||||
w->voice = sound_playPos(w->outfit->u.amm.sound,
|
||||
w->solid->pos.x + w->solid->vel.x,
|
||||
w->solid->pos.y + w->solid->vel.y);
|
||||
|
Loading…
Reference in New Issue
Block a user