- planetPatrol ships do no longer block the docking queue

- new station key: has_patrol_ships

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3939 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Eric Walch 2010-12-31 17:12:49 +00:00
parent 9aa698b483
commit 552301c3c5
7 changed files with 32 additions and 10 deletions

View File

@ -97,6 +97,11 @@
// Ceteri
sea_hsb_color = "0.03 0.3 1";
};
"2 112" =
{
// Celace
land_hsb_color = "0.9 0.2 0.9"; // Pink Ondiabweed plantations.
};
"2 115" =
{
// Usraer

View File

@ -289,6 +289,7 @@
"defense_ship",
"defense_ship_role",
"has_npc_traffic",
"has_patrol_ships",
"has_shipyard",
"hasShipyard",
"port_radius",
@ -302,7 +303,8 @@
"docking_pattern_model",
"market",
"interstellar_undocking",
"allows_fast_docking"
"allows_fast_docking",
"allows_auto_docking"
);
knownPlayerKeys =
(

View File

@ -738,6 +738,7 @@ BOOL class_masslocks(int some_class);
- (void) setFound_target:(Entity *) targetEntity;
- (void) setPrimaryAggressor:(Entity *) targetEntity;
- (void) setTargetStation:(Entity *) targetEntity;
- (void) addTarget:(Entity *) targetEntity;
- (void) removeTarget:(Entity *) targetEntity;
- (id) primaryTarget;

View File

@ -6511,6 +6511,13 @@ BOOL class_masslocks(int some_class)
}
- (void) setTargetStation:(Entity *) targetEntity
{
if (targetEntity)
targetStation = [targetEntity universalID];
}
- (void) addTarget:(Entity *) targetEntity
{
if (targetEntity == self) return;
@ -9288,7 +9295,7 @@ BOOL class_masslocks(int some_class)
// act individually now!
if ([escort group] == escortGroup) [escort setGroup:nil];
if ([escort owner] == self) [escort setOwner:nil];
if(target && [target isStation]) [escort addTarget:target];
if(target && [target isStation]) [escort setTargetStation:target];
[ai setStateMachine:@"dockingAI.plist" afterDelay:delay];
[ai setState:@"ABORT" afterDelay:delay + 0.25];

View File

@ -1442,7 +1442,7 @@ static WormholeEntity *whole = nil;
#endif
}
[self setOwner:NULL];
[self setOwner:self];
[shipAI message:@"NOT_ESCORTING"];
}
@ -1585,8 +1585,8 @@ static WormholeEntity *whole = nil;
if (magnitude2(r_pos) < 1000000 || patrol_counter == 0)
{
Entity *the_sun = [UNIVERSE sun];
Entity *the_station = [self owner]; // was: [UNIVERSE station]; // let it work for any station.
if(!the_station) the_station = [UNIVERSE station];
ShipEntity *the_station = [[self group] leader];
if(!the_station || ![the_station isStation]) the_station = [UNIVERSE station];
if ((!the_sun)||(!the_station))
return;
Vector sun_pos = the_sun->position;
@ -1595,7 +1595,7 @@ static WormholeEntity *whole = nil;
Vector vSun = make_vector(0, 0, 1);
if (sun_dir.x||sun_dir.y||sun_dir.z)
vSun = vector_normal(sun_dir);
Vector v0 = vector_forward_from_quaternion(the_station->orientation);
Vector v0 = [the_station forwardVector];
Vector v1 = cross_product(v0, vSun);
Vector v2 = cross_product(v0, v1);
switch (patrol_counter)
@ -1631,7 +1631,9 @@ static WormholeEntity *whole = nil;
if (randf() < .25)
{
// consider docking
targetStation = [the_station universalID];
[self setAITo:@"dockingAI.plist"];
return;
}
else
{
@ -1686,7 +1688,10 @@ static WormholeEntity *whole = nil;
- (void) patrolReportIn
{
[[UNIVERSE station] acceptPatrolReportFrom:self];
// Set a report time in the patrolled station to delay a new launch.
ShipEntity *the_station = [[self group] leader];
if(!the_station || ![the_station isStation]) the_station = [UNIVERSE station];
[(StationEntity*)the_station acceptPatrolReportFrom:self];
}

View File

@ -74,6 +74,7 @@ typedef enum
unsigned no_docking_while_launching: 1,
hasNPCTraffic: 1;
BOOL hasPatrolShips;
OOUniversalID planet;

View File

@ -804,6 +804,7 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
equipmentPriceFactor = [dict oo_nonNegativeFloatForKey:@"equipment_price_factor" defaultValue:1.0];
equipmentPriceFactor = OOMax_f(equipmentPriceFactor, 0.5f);
hasNPCTraffic = [dict oo_fuzzyBooleanForKey:@"has_npc_traffic" defaultValue:YES];
hasPatrolShips = [dict oo_fuzzyBooleanForKey:@"has_patrol_ships" defaultValue:NO];
suppress_arrival_reports = [dict oo_boolForKey:@"suppress_arrival_reports" defaultValue:NO];
NSDictionary *universalInfo = [[UNIVERSE planetInfo] oo_dictionaryForKey:PLANETINFO_UNIVERSAL_KEY];
@ -1212,9 +1213,9 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
}
// testing patrols
if ((unitime > (last_patrol_report_time + patrol_launch_interval))&&(isMainStation))
if (unitime > (last_patrol_report_time + patrol_launch_interval))
{
if (![self hasNPCTraffic] || [self launchPatrol] != nil)
if (!((isMainStation && [self hasNPCTraffic]) || hasPatrolShips) || [self launchPatrol] != nil)
last_patrol_report_time = unitime;
}
}
@ -1309,7 +1310,7 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
[ship setStatus: STATUS_LAUNCHING];
[ship setDesiredSpeed:launchSpeed]; // must be set after initialising the AI to correct any speed set by AI
last_launch_time = [UNIVERSE getTime];
double delay = port_corridor/launchSpeed + 2 * port_dimensions.z/launchSpeed; // pause until 2 portlengths outside of the station.
double delay = (port_corridor + 2 * port_dimensions.z)/launchSpeed; // pause until 2 portlengths outside of the station.
[ship setLaunchDelay:delay];
[[ship getAI] setNextThinkTime:last_launch_time + delay]; // pause while launching