Make traders and especially smugglers avoid suspicious craft
This commit is contained in:
parent
ba1c6511d1
commit
abddb9fc67
@ -37,6 +37,7 @@ this.aiStarted = function() {
|
||||
|
||||
|
||||
var commsrole = "trader";
|
||||
var cautionscan = ai.conditionScannerContainsTraderEnemy;
|
||||
// same AI works for freighters, couriers and smugglers with minimal
|
||||
// modification
|
||||
if (this.ship.primaryRole == "trader-smuggler")
|
||||
@ -45,6 +46,7 @@ this.aiStarted = function() {
|
||||
{
|
||||
commsrole = "trader-smuggler";
|
||||
}
|
||||
cautionscan = ai.conditionScannerContainsTraderSmugglerEnemy;
|
||||
ai.setParameter("oolite_flag_fleesPreemptively",true);
|
||||
}
|
||||
else if (this.ship.primaryRole == "trader-courier")
|
||||
@ -87,6 +89,20 @@ this.aiStarted = function() {
|
||||
behaviour: ai.behaviourLeaveVicinityOfDestination,
|
||||
reconsider: 20
|
||||
},
|
||||
{
|
||||
// if not near a friendly station, move away from
|
||||
// potentially hostile ships
|
||||
condition: ai.conditionFriendlyStationNearby,
|
||||
falsebranch: [
|
||||
{
|
||||
preconfiguration: ai.configurationCheckScanner,
|
||||
condition: cautionscan,
|
||||
configuration: ai.configurationAcquireScannedTarget,
|
||||
behaviour: ai.behaviourLeaveVicinityOfTarget,
|
||||
reconsider: 20
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
condition: ai.conditionCargoIsProfitableHere,
|
||||
// branch to head for station
|
||||
|
@ -1,8 +1,6 @@
|
||||
/* List of roles in various groupings. Used to determine initial
|
||||
* reactions of ships to each other, among other things. Roles may be
|
||||
* in more than one grouping.
|
||||
*
|
||||
* player-unknown should probably *only* be in oolite-pirate-victim
|
||||
*/
|
||||
{
|
||||
/* Roles which pirates think might have tasty cargo. Equivalent in
|
||||
@ -159,5 +157,49 @@
|
||||
);
|
||||
|
||||
|
||||
/* Roles that a trader will try to avoid being near */
|
||||
"oolite-trader-dislike" = (
|
||||
"pirate",
|
||||
"pirate-light-fighter",
|
||||
"pirate-medium-fighter",
|
||||
"pirate-heavy-fighter",
|
||||
"pirate-light-freighter",
|
||||
"pirate-medium-freighter",
|
||||
"pirate-heavy-freighter",
|
||||
"pirate-aegis-raider",
|
||||
"pirate-interceptor",
|
||||
"assassin-light",
|
||||
"assassin-medium",
|
||||
"assassin-heavy",
|
||||
"assassin-player",
|
||||
"player-unknown"
|
||||
);
|
||||
|
||||
|
||||
/* Roles that a smuggler will try to avoid being near */
|
||||
"oolite-smuggler-dislike" = (
|
||||
"pirate",
|
||||
"pirate-light-fighter",
|
||||
"pirate-medium-fighter",
|
||||
"pirate-heavy-fighter",
|
||||
"pirate-light-freighter",
|
||||
"pirate-medium-freighter",
|
||||
"pirate-heavy-freighter",
|
||||
"pirate-aegis-raider",
|
||||
"pirate-interceptor",
|
||||
"assassin-light",
|
||||
"assassin-medium",
|
||||
"assassin-heavy",
|
||||
"assassin-player",
|
||||
"player-unknown",
|
||||
"hunter",
|
||||
"hunter-medium",
|
||||
"hunter-heavy",
|
||||
"interceptor",
|
||||
"police",
|
||||
"police-station-patrol",
|
||||
"police-witchpoint-patrol"
|
||||
);
|
||||
|
||||
|
||||
}
|
@ -2428,6 +2428,22 @@ PriorityAIController.prototype.conditionScannerContainsThargoidMothership = func
|
||||
}
|
||||
|
||||
|
||||
PriorityAIController.prototype.conditionScannerContainsTraderEnemy = function()
|
||||
{
|
||||
return this.checkScannerWithPredicate(function(s) {
|
||||
return (s.primaryRole && this.shipInRoleCategory(s,"oolite-trader-dislike"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
PriorityAIController.prototype.conditionScannerContainsTraderSmugglerEnemy = function()
|
||||
{
|
||||
return this.checkScannerWithPredicate(function(s) {
|
||||
return (s.primaryRole && this.shipInRoleCategory(s,"oolite-smuggler-dislike"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
PriorityAIController.prototype.conditionScannerContainsUnspreadMissile = function()
|
||||
{
|
||||
if (!this.getParameter("oolite_flag_autoSpreadMissiles"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user