[Fix] Silly hostility bug.
This commit is contained in:
parent
f6f1677614
commit
f107574b38
@ -6,6 +6,8 @@
|
||||
#include "faction.h"
|
||||
#include "ship.h"
|
||||
|
||||
#define PLAYER_ID 0
|
||||
|
||||
// Aproximation for pilot size.
|
||||
#define PILOT_SIZE_APROX 0.8
|
||||
#define PILOT_DISABLED 0.2 // Based on armor percentage.
|
||||
|
@ -2,8 +2,6 @@
|
||||
#include <SDL.h>
|
||||
#include "pilot.h"
|
||||
|
||||
#define PLAYER_ID 0
|
||||
|
||||
extern Pilot* pilot;
|
||||
|
||||
typedef enum { KEYBIND_NULL, KEYBIND_KEYBOARD, KEYBIND_JAXIS, KEYBIND_JBUTTON } KeybindType;
|
||||
|
@ -128,11 +128,12 @@ static void weapon_update(Weapon* w, const double dt, WeaponLayer layer) {
|
||||
CollideSprite(w->outfit->gfx_space, wsx, wsy, &w->solid->pos,
|
||||
pilot_stack[i]->ship->gfx_space, psx, psy, &pilot_stack[i]->solid->pos)) {
|
||||
|
||||
if(i != 0) {
|
||||
if(i != PLAYER_ID)
|
||||
// Inform the ai it has been attacked. Useless if we are player.
|
||||
ai_attacked(pilot_stack[i], w->parent);
|
||||
if(w->parent == PLAYER_ID) // Make hostile to player.
|
||||
pilot_setFlag(pilot_stack[i], PILOT_HOSTILE);
|
||||
}
|
||||
|
||||
// Inform the ship that it should take some damage.
|
||||
pilot_hit(pilot_stack[i], w->outfit->damage_shield, w->outfit->damage_armor);
|
||||
// No need for the weapon particle anymore.
|
||||
|
Loading…
Reference in New Issue
Block a user