[Add] Pushback effect for weapons.
This commit is contained in:
parent
9fc0c72e71
commit
b55259321e
@ -4,7 +4,7 @@
|
|||||||
<general>
|
<general>
|
||||||
<max>5</max>
|
<max>5</max>
|
||||||
<tech>2</tech>
|
<tech>2</tech>
|
||||||
<mass>5</mass>
|
<mass>0</mass>
|
||||||
</general>
|
</general>
|
||||||
<specific type="1">
|
<specific type="1">
|
||||||
<gfx>lasergreen</gfx>
|
<gfx>lasergreen</gfx>
|
||||||
|
12
dat/ship.xml
12
dat/ship.xml
@ -20,12 +20,12 @@
|
|||||||
</health>
|
</health>
|
||||||
<characteristics>
|
<characteristics>
|
||||||
<crew>2</crew>
|
<crew>2</crew>
|
||||||
<mass>7</mass>
|
<mass>32</mass>
|
||||||
<cap_weapon>20</cap_weapon>
|
<cap_weapon>20</cap_weapon>
|
||||||
<cap_cargo>25</cap_cargo>
|
<cap_cargo>25</cap_cargo>
|
||||||
</characteristics>
|
</characteristics>
|
||||||
<outfits>
|
<outfits>
|
||||||
<outfit quantity='3'>Laser</outfit>
|
<outfit quantity='1'>Laser</outfit>
|
||||||
</outfits>
|
</outfits>
|
||||||
</ship>
|
</ship>
|
||||||
<ship name = "Leapard">
|
<ship name = "Leapard">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
</health>
|
</health>
|
||||||
<characteristics>
|
<characteristics>
|
||||||
<crew>2</crew>
|
<crew>2</crew>
|
||||||
<mass>5</mass>
|
<mass>25</mass>
|
||||||
<cap_weapon>25</cap_weapon>
|
<cap_weapon>25</cap_weapon>
|
||||||
<cap_cargo>10</cap_cargo>
|
<cap_cargo>10</cap_cargo>
|
||||||
</characteristics>
|
</characteristics>
|
||||||
@ -62,9 +62,9 @@
|
|||||||
<sound>engine</sound>
|
<sound>engine</sound>
|
||||||
<class>2</class>
|
<class>2</class>
|
||||||
<movement>
|
<movement>
|
||||||
<thrust>180</thrust>
|
<thrust>320</thrust>
|
||||||
<turn>130</turn>
|
<turn>150</turn>
|
||||||
<speed>260</speed>
|
<speed>360</speed>
|
||||||
</movement>
|
</movement>
|
||||||
<health>
|
<health>
|
||||||
<shield>160</shield>
|
<shield>160</shield>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Start>
|
<Start>
|
||||||
<name>Dark Tides</name>
|
<name>Dark Tides</name>
|
||||||
<player>
|
<player>
|
||||||
<ship>Merchant Ship</ship>
|
<ship>Lancer</ship>
|
||||||
<credits>
|
<credits>
|
||||||
<low>500</low>
|
<low>500</low>
|
||||||
<high>1500</high>
|
<high>1500</high>
|
||||||
|
23
src/pilot.c
23
src/pilot.c
@ -177,18 +177,33 @@ static void pilot_shootWeapon(Pilot* p, PilotOutfit* w, const unsigned int t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Damage the pilot.
|
// Damage the pilot.
|
||||||
void pilot_hit(Pilot* p, const double damage_shield, const double damage_armour) {
|
void pilot_hit(Pilot* p, const Solid* w,const double damage_shield,
|
||||||
if(p->shield - damage_shield > 0.)
|
const double damage_armour) {
|
||||||
|
|
||||||
|
double dam_mod;
|
||||||
|
|
||||||
|
if(p->shield - damage_shield > 0.) {
|
||||||
p->shield -= damage_shield;
|
p->shield -= damage_shield;
|
||||||
|
dam_mod = damage_shield/p->shield_max;
|
||||||
|
}
|
||||||
else if(p->shield > 0.) {
|
else if(p->shield > 0.) {
|
||||||
// Shields can take part of the blow.
|
// Shields can take part of the blow.
|
||||||
p->armour -= p->shield/damage_shield*damage_armour;
|
p->armour -= p->shield/damage_shield*damage_armour;
|
||||||
p->shield = 0.;
|
p->shield = 0.;
|
||||||
|
dam_mod = (damage_shield+damage_armour) / (p->shield_max + p->armour_max);
|
||||||
}
|
}
|
||||||
else if(p->armour-damage_armour > 0.)
|
else if(p->armour-damage_armour > 0.) {
|
||||||
p->armour -= damage_armour;
|
p->armour -= damage_armour;
|
||||||
else
|
dam_mod = damage_armour/p->armour_max;
|
||||||
|
}
|
||||||
|
else {
|
||||||
p->armour = 0.;
|
p->armour = 0.;
|
||||||
|
dam_mod = 0.;
|
||||||
|
}
|
||||||
|
|
||||||
|
vect_cadd(&p->solid->vel,
|
||||||
|
w->vel.x * (dam_mod/4. + w->mass/p->solid->mass/4.),
|
||||||
|
w->vel.y * (dam_mod/4. + w->mass/p->solid->mass/4.));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the pilot's ammo based on their secondary weapon.
|
// Set the pilot's ammo based on their secondary weapon.
|
||||||
|
@ -105,7 +105,8 @@ Fleet* fleet_get(const char* name);
|
|||||||
|
|
||||||
// MISC.
|
// MISC.
|
||||||
void pilot_shoot(Pilot* p, const unsigned int target, const int secondary);
|
void pilot_shoot(Pilot* p, const unsigned int target, const int secondary);
|
||||||
void pilot_hit(Pilot* p, const double damage_shield, const double damage_armour);
|
void pilot_hit(Pilot* p, const Solid* w,
|
||||||
|
const double damage_shield, const double damage_armour);
|
||||||
void pilot_setAmmo(Pilot* p);
|
void pilot_setAmmo(Pilot* p);
|
||||||
double pilot_face(Pilot* p, const float dir);
|
double pilot_face(Pilot* p, const float dir);
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer) {
|
|||||||
pilot_setFlag(p, PILOT_HOSTILE);
|
pilot_setFlag(p, PILOT_HOSTILE);
|
||||||
|
|
||||||
// Let the ship know that is should take some kind of damage.
|
// Let the ship know that is should take some kind of damage.
|
||||||
pilot_hit(p, w->outfit->damage_shield, w->outfit->damage_armour);
|
pilot_hit(p, w->solid, w->outfit->damage_shield, w->outfit->damage_armour);
|
||||||
// We don't need the weapon particle any longer.
|
// We don't need the weapon particle any longer.
|
||||||
weapon_destroy(w, layer);
|
weapon_destroy(w, layer);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user