Merge branch 'bugfixes'
Fix docking behaviour (needs more testing) Fix assassin chase behaviour
This commit is contained in:
commit
07cbf8f3cf
@ -67,11 +67,6 @@ this.aiStarted = function() {
|
||||
behaviour: ai.behaviourEnterWitchspace,
|
||||
reconsider: 15
|
||||
},
|
||||
{
|
||||
condition: ai.conditionHasRememberedTarget,
|
||||
behaviour: ai.behaviourFollowCurrentTarget,
|
||||
reconsider: 15
|
||||
},
|
||||
/* Check for couriers */
|
||||
{
|
||||
preconfiguration: ai.configurationCheckScanner,
|
||||
@ -104,6 +99,11 @@ this.aiStarted = function() {
|
||||
behaviour: ai.behaviourDestroyCurrentTarget,
|
||||
reconsider: 20
|
||||
},
|
||||
{
|
||||
condition: ai.conditionHasRememberedTarget,
|
||||
behaviour: ai.behaviourFollowCurrentTarget,
|
||||
reconsider: 15
|
||||
},
|
||||
{
|
||||
preconfiguration: ai.configurationAppointGroupLeader,
|
||||
condition: ai.conditionIsGroupLeader,
|
||||
|
@ -1336,6 +1336,7 @@ this._addFreighter = function(pos)
|
||||
t[0].homeSystem = system.ID;
|
||||
t[0].destinationSystem = this._weightedNearbyTradeSystem();
|
||||
goods = "PLENTIFUL_GOODS";
|
||||
t[0].fuel = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2947,6 +2947,21 @@ PriorityAIController.prototype.behaviourDockWithStation = function()
|
||||
this.ship.performFaceDestination();
|
||||
// and will reconsider in a little bit
|
||||
break;
|
||||
case "TRY_AGAIN_LATER":
|
||||
if (this.distance(station) < 5000)
|
||||
{
|
||||
if (this.__ltcache.oolite_dockingclearpos)
|
||||
{
|
||||
this.ship.destination = this.__ltcache.oolite_dockingclearpos;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ship.destination = station.position.add(Vector3D.randomDirection(8000+station.collisionRadius));
|
||||
this.__ltcache.oolite_dockingclearpos = this.ship.destination;
|
||||
}
|
||||
}
|
||||
this.ship.performFlyToRangeFromDestination();
|
||||
break;
|
||||
case "APPROACH_COORDINATES":
|
||||
if (this.ship.escortGroup && this.ship.escortGroup.count > 1)
|
||||
{
|
||||
@ -2960,7 +2975,6 @@ PriorityAIController.prototype.behaviourDockWithStation = function()
|
||||
// and fall through
|
||||
case "APPROACH":
|
||||
case "BACK_OFF":
|
||||
case "TRY_AGAIN_LATER":
|
||||
this.ship.performFlyToRangeFromDestination();
|
||||
break;
|
||||
}
|
||||
@ -4845,6 +4859,7 @@ PriorityAIController.prototype.responsesAddDocking = function(handlers)
|
||||
{
|
||||
handlers.stationWithdrewDockingClearance = this.responseComponent_docking_stationWithdrewDockingClearance;
|
||||
handlers.shipAchievedDesiredRange = this.responseComponent_docking_shipAchievedDesiredRange;
|
||||
handlers.shipAIFrustrated = this.responseComponent_docking_shipAIFrustrated;
|
||||
}
|
||||
|
||||
/* Override of standard handlers for use while escorting */
|
||||
@ -5912,6 +5927,16 @@ PriorityAIController.prototype.responseComponent_docking_shipAchievedDesiredRang
|
||||
}
|
||||
|
||||
|
||||
PriorityAIController.prototype.responseComponent_docking_shipAIFrustrated = function()
|
||||
{
|
||||
var station = this.getParameter("oolite_dockingStation",null);
|
||||
station.abortDockingForShip(this.ship);
|
||||
this.communicate("oolite_abortDocking",{},3);
|
||||
this.setParameter("oolite_dockingStation",null);
|
||||
this.reconsiderNow();
|
||||
}
|
||||
|
||||
|
||||
PriorityAIController.prototype.responseComponent_docking_stationWithdrewDockingClearance = function()
|
||||
{
|
||||
this.setParameter("oolite_dockingStation",null);
|
||||
@ -5987,7 +6012,7 @@ PriorityAIController.prototype.responseComponent_expectWitchspace_shipTargetLost
|
||||
{
|
||||
target = this.getParameter("oolite_rememberedTarget");
|
||||
}
|
||||
if (target) {
|
||||
if (target && target.position) {
|
||||
var pos = target.position;
|
||||
var ws = system.wormholes;
|
||||
// most likely to be most recent
|
||||
|
@ -322,7 +322,7 @@ MA 02110-1301, USA.
|
||||
// some error has occurred - log it, and send the try-again message
|
||||
OOLogERR(@"station.issueDockingInstructions.failed", @"couldn't addShipToShipsOnApproach:%@ in %@, retrying later -- shipsOnApproach:\n%@", ship, self, shipsOnApproach);
|
||||
|
||||
return OOMakeDockingInstructions(station, [ship position], 0, 100, @"TRY_AGAIN_LATER", nil, NO, -1);
|
||||
return OOMakeDockingInstructions(station, [ship position], 200, 100, @"TRY_AGAIN_LATER", nil, NO, -1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -581,7 +581,7 @@ NSDictionary *OOMakeDockingInstructions(StationEntity *station, HPVector coords,
|
||||
}
|
||||
if (chosenDock == nil)
|
||||
{
|
||||
if (player_is_ahead || ([docking isEqualToString:@"TOO_BIG_TO_DOCK"] && !alldockstoosmall))
|
||||
if (player_is_ahead || ([docking isEqualToString:@"TOO_BIG_TO_DOCK"] && !alldockstoosmall) || docking == nil)
|
||||
{
|
||||
// either player is manually docking and we can't allocate new docks,
|
||||
// or the last dock was too small, and there may be an acceptable one
|
||||
@ -589,7 +589,7 @@ NSDictionary *OOMakeDockingInstructions(StationEntity *station, HPVector coords,
|
||||
docking = @"TRY_AGAIN_LATER";
|
||||
}
|
||||
// no docks accept this ship (or the player is blocking them)
|
||||
return OOMakeDockingInstructions(self, [ship position], 0, 100, docking, nil, NO, -1);
|
||||
return OOMakeDockingInstructions(self, [ship position], 200, 100, docking, nil, NO, -1);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user