[Fix] Bug concerning not being able to shoot seeker weapons.

This commit is contained in:
Allanis 2013-08-30 17:54:02 +01:00
parent 31146a0874
commit de91ebd91f
4 changed files with 29 additions and 20 deletions

View File

@ -315,7 +315,7 @@
<price>11500000</price>
<fabricator>House Goddard</fabricator>
<tech>9999</tech>
<description>A Dvaered Goddard.</description>
<description>A Draktharr Goddard.</description>
<movement>
<thrust>100</thrust>
<turn>80</turn>
@ -453,9 +453,9 @@
<sound>engine</sound>
<class>1</class>
<price>400000</price>
<fabricator>House Dvaered</fabricator>
<fabricator>House Draktharr</fabricator>
<tech>8</tech>
<description>The Vendetta displays the House Dvaered philosophy very well. Give a ship as many intimidating guns as you can, layer it with as much armour and you can, and sort of forget about giving it proper electronics. It's amazing to see that these fly.</description>
<description>The Vendetta displays the House Draktharr philosophy very well. Give a ship as many intimidating guns as you can, layer it with as much armour and you can, and sort of forget about giving it proper electronics. It's amazing to see that these fly.</description>
<movement>
<thrust>200</thrust>
<turn>125</turn>

View File

@ -944,6 +944,8 @@ static int ai_secondary(lua_State* L) {
char* type;
const char* otype;
po = NULL;
/* Search for a type. */
type = NULL;
if(lua_isstring(L, 1))

View File

@ -248,11 +248,19 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) {
}
}
/* Missile launchers. */
/* Must be secondary weapon, Shooter can't be the target. */
else if(outfit_isLauncher(w->outfit) && (w == p->secondary) && (p->id != t)) {
if(p->ammo && (p->ammo->quantity > 0)) {
/* Must be secondary weapon. */
else if(outfit_isLauncher(w->outfit) && (w == p->secondary)) {
/* Shooter can't be the target - Sanity check for the player. */
if((w->outfit->type != OUTFIT_TYPE_MISSILE_DUMB) && (p->id == t))
return;
/* Must have ammo left. */
if(p->ammo && (p->ammo->quantity <= 0))
return;
/* Enough energy? */
if(outfit_energy(w->outfit) > p->energy) return;
if(outfit_energy(w->outfit) > p->energy)
return;
p->energy -= outfit_energy(w->outfit);
weapon_add(p->ammo->outfit, p->solid->dir, &p->solid->pos,
@ -262,7 +270,6 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) {
p->ammo->quantity -= 1; /* There's no getting this one back. */
}
}
}
/* Damage the pilot. */
void pilot_hit(Pilot* p, const Solid* w, const unsigned int shooter,