bugfix:[ Bug #13711 ] Sun approach reports docking station. Plus for 1.72: changes to AI messages and js events: Getting close (2x radius from the surface) to any moon or planet generates "CLOSE_TO_PLANET" & shipEnteredPlanetaryVicinity, moving away from any planet generates "AWAY_FROM_PLANET" & shipExitedPlanetaryVicinity in addition to all other events/messages.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1635 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2008-05-13 23:21:16 +00:00
parent a04e4dcb37
commit a39a8f17c4
3 changed files with 24 additions and 9 deletions

View File

@ -2577,7 +2577,7 @@ double scoopSoundPlayTime = 0.0;
// aegis messages to advanced compass so in planet mode it behaves like the old compass // aegis messages to advanced compass so in planet mode it behaves like the old compass
if (compassMode != COMPASS_MODE_BASIC) if (compassMode != COMPASS_MODE_BASIC)
{ {
if ([ms isEqual:@"AEGIS_CLOSE_TO_PLANET"]&&(compassMode == COMPASS_MODE_PLANET)) if ([ms isEqual:@"AEGIS_CLOSE_TO_MAIN_PLANET"]&&(compassMode == COMPASS_MODE_PLANET))
{ {
[UNIVERSE playCustomSound:@"[aegis-planet]"]; [UNIVERSE playCustomSound:@"[aegis-planet]"];
[self setCompassMode:COMPASS_MODE_STATION]; [self setCompassMode:COMPASS_MODE_STATION];

View File

@ -3408,8 +3408,12 @@ static GLfloat mascem_color2[4] = { 0.4, 0.1, 0.4, 1.0}; // purple
[shipAI message:@"AEGIS_LEAVING_DOCKING_RANGE"]; [shipAI message:@"AEGIS_LEAVING_DOCKING_RANGE"];
} }
[self doScriptEvent:@"shipExitedPlanetaryVicinity"]; [self doScriptEvent:@"shipExitedPlanetaryVicinity"];
[shipAI message:@"AWAY_FROM_PLANET"];
if (aegis_status != AEGIS_CLOSE_TO_ANY_PLANET)
{
[shipAI message:@"AEGIS_NONE"]; [shipAI message:@"AEGIS_NONE"];
} }
}
aegis_status = AEGIS_NONE; aegis_status = AEGIS_NONE;
} }
@ -3494,9 +3498,19 @@ NSComparisonResult planetSort(id i1, id i2, void* context)
} }
} }
if (d2 < cr2 * 9.0f) // to 3x radius of planet if (d2 < cr2 * 9.0f && [UNIVERSE sun] != the_planet) //to 3x radius of any planet/moon
{ {
result = AEGIS_CLOSE_TO_PLANET; [self doScriptEvent:@"shipEnteredPlanetaryVicinity" withArgument:the_planet];
[shipAI message:@"CLOSE_TO_PLANET"];
result = AEGIS_CLOSE_TO_ANY_PLANET;
}
d2 = magnitude2(vector_subtract([[UNIVERSE planet] position], [self position]));
cr2 = [[UNIVERSE planet] collisionRadius];
cr2 *= cr2;
if (d2 < cr2 * 9.0f) // to 3x radius of main planet
{
result = AEGIS_CLOSE_TO_MAIN_PLANET;
} }
// check station // check station
@ -3521,18 +3535,18 @@ NSComparisonResult planetSort(id i1, id i2, void* context)
{ {
// script/AI messages on change in status // script/AI messages on change in status
// approaching.. // approaching..
if ((aegis_status == AEGIS_NONE)&&(result == AEGIS_CLOSE_TO_PLANET)) if ((aegis_status == AEGIS_NONE)&&(result == AEGIS_CLOSE_TO_MAIN_PLANET))
{ {
[self doScriptEvent:@"shipEnteredPlanetaryVicinity" withArgument:the_planet]; [self doScriptEvent:@"shipEnteredPlanetaryVicinity" withArgument:[UNIVERSE planet]];
[shipAI message:@"AEGIS_CLOSE_TO_PLANET"]; [shipAI message:@"AEGIS_CLOSE_TO_PLANET"];
} }
if (((aegis_status == AEGIS_CLOSE_TO_PLANET)||(aegis_status == AEGIS_NONE))&&(result == AEGIS_IN_DOCKING_RANGE)) if (((aegis_status == AEGIS_CLOSE_TO_MAIN_PLANET)||(aegis_status == AEGIS_NONE))&&(result == AEGIS_IN_DOCKING_RANGE))
{ {
[self doScriptEvent:@"shipEnteredStationAegis" withArgument:the_station]; [self doScriptEvent:@"shipEnteredStationAegis" withArgument:the_station];
[shipAI message:@"AEGIS_IN_DOCKING_RANGE"]; [shipAI message:@"AEGIS_IN_DOCKING_RANGE"];
} }
// leaving.. // leaving..
if ((aegis_status == AEGIS_IN_DOCKING_RANGE)&&(result == AEGIS_CLOSE_TO_PLANET)) if ((aegis_status == AEGIS_IN_DOCKING_RANGE)&&(result == AEGIS_CLOSE_TO_MAIN_PLANET))
{ {
[self doScriptEvent:@"shipExitedStationAegis"]; [self doScriptEvent:@"shipExitedStationAegis"];
[shipAI message:@"AEGIS_LEAVING_DOCKING_RANGE"]; [shipAI message:@"AEGIS_LEAVING_DOCKING_RANGE"];

View File

@ -242,7 +242,8 @@ typedef enum
typedef enum typedef enum
{ {
AEGIS_NONE, AEGIS_NONE,
AEGIS_CLOSE_TO_PLANET, AEGIS_CLOSE_TO_ANY_PLANET,
AEGIS_CLOSE_TO_MAIN_PLANET,
AEGIS_IN_DOCKING_RANGE AEGIS_IN_DOCKING_RANGE
} OOAegisStatus; } OOAegisStatus;