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