[Fix] Issue with pilot being marked as hostile when not hostile. :/

This commit is contained in:
Allanis 2013-05-23 21:36:51 +01:00
parent e4f76c9b08
commit 484b482c4b

View File

@ -323,8 +323,10 @@ static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer) {
if(!pilot_isPlayer(p)) { if(!pilot_isPlayer(p)) {
if((player_target == p->id) || (RNG(0,2) == 0)) { if((player_target == p->id) || (RNG(0,2) == 0)) {
if((w->parent == PLAYER_ID) && if((w->parent == PLAYER_ID) &&
(!pilot_isFlag(p, PILOT_HOSTILE) || (RNG(0, 2) == 0))) (!pilot_isFlag(p, PILOT_HOSTILE) || (RNG(0, 2) == 0))) {
faction_modPlayer(p->faction, -1); // Slowly lower faction. faction_modPlayer(p->faction, -1); // Slowly lower faction.
pilot_setFlag(p, PILOT_HOSTILE);
}
ai_attacked(p, w->parent); ai_attacked(p, w->parent);
} }
spfx_add(outfit_spfx(w->outfit), spfx_add(outfit_spfx(w->outfit),
@ -335,10 +337,6 @@ static void weapon_hit(Weapon* w, Pilot* p, WeaponLayer layer) {
VX(w->solid->pos), VY(w->solid->pos), VX(w->solid->pos), VY(w->solid->pos),
VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_FRONT); VX(p->solid->vel), VY(p->solid->vel), SPFX_LAYER_FRONT);
if(w->parent == PLAYER_ID)
// Make hostile to player.
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->solid, w->parent, outfit_dmgShield(w->outfit), outfit_dmgShield(w->outfit)); pilot_hit(p, w->solid, w->parent, outfit_dmgShield(w->outfit), outfit_dmgShield(w->outfit));
// We don't need the weapon particle any longer. // We don't need the weapon particle any longer.