[Add] Applied some minimum docking requirements.

This commit is contained in:
Allanis 2013-12-31 04:31:20 +00:00
parent 3a87ce36ff
commit 584e97b0b7
2 changed files with 9 additions and 1 deletions

View File

@ -74,7 +74,7 @@ function flyback()
ai.dock(target) ai.dock(target)
-- Far away, must approach. -- Far away, must approach.
elseif dir < 10 and dist > 200 then elseif dir < 10 then
ai.accel() ai.accel()
end end
end end

View File

@ -592,6 +592,14 @@ int pilot_dock(Pilot* p, Pilot* target) {
int i; int i;
Outfit* o; Outfit* o;
/* Must be close. */
if(vect_dist(&p->solid->pos, &target->solid->pos) > 30.)
return -1;
/* Cannot be going much faster. */
if(vect_dist(&p->solid->vel, &target->solid->vel) > 2*MIN_VEL_ERR)
return -1;
/* Check to see if target has an available bay. */ /* Check to see if target has an available bay. */
for(i = 0; i < target->noutfits; i++) { for(i = 0; i < target->noutfits; i++) {
if(outfit_isFighterBay(target->outfits[i].outfit)) { if(outfit_isFighterBay(target->outfits[i].outfit)) {