Undocking in interstellar space is now possible:

- to enable the new functionality, added the interstellar_undocking key to station/carriers. If "interstellar_undocking" = YES; , the station will remain where it is instead of moving to the nearest system, as it's always been the case up to now.
- quick fix to the nova mission to take this new possibility into account.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3725 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Marc 2010-07-28 12:01:39 +00:00
parent fc0d9a962d
commit cabe9792c7
7 changed files with 34 additions and 23 deletions

View File

@ -298,7 +298,8 @@
"equipment_price_factor",
"requires_docking_clearance",
"docking_pattern_model",
"market"
"market",
"interstellar_undocking"
);
knownPlayerKeys =
(

View File

@ -279,7 +279,7 @@ this.shipWillExitWitchspace = function () // call this as soon as possible so o
this.shipLaunchedFromStation = function()
{
if ((system.sun.isGoingNova || system.sun.hasGoneNova) && missionVariables.nova === "NOVA_ESCAPE_COWARD")
if (system.sun && (system.sun.isGoingNova || system.sun.hasGoneNova) && missionVariables.nova === "NOVA_ESCAPE_COWARD")
{
this.blowUpAllStations();
}

View File

@ -125,6 +125,7 @@
requires_docking_clearance = "boolean";
docking_pattern_model = "$modelName";
market = "string";
interstellar_undocking = "boolean";
extra_equipment = "$extraEquipmentDictionary";
hud = "$hudFileName";

View File

@ -4502,7 +4502,7 @@ static GLfloat sBaseMass = 0.0;
ship_clock_adjust = 600.0; // 10 minutes to leave dock
[self setStatus: STATUS_LAUNCHING]; // Required before shipWillLaunchFromStation so Planet.setTexture() will work.
[self setStatus: STATUS_LAUNCHING]; // Required before shipWillLaunchFromStation.
[self doScriptEvent:@"shipWillLaunchFromStation" withArgument:station];
[station launchShip:self];

View File

@ -92,11 +92,12 @@ typedef enum
double last_patrol_report_time;
double patrol_launch_interval;
BOOL suppress_arrival_reports;
BOOL suppress_arrival_reports;
#if DOCKING_CLEARANCE_ENABLED
BOOL requiresDockingClearance;
BOOL requiresDockingClearance;
#endif
BOOL interstellarUndockingAllowed;
}
@ -165,9 +166,9 @@ typedef enum
- (ShipEntity *) launchIndependentShip:(NSString*) role;
- (void) noteDockedShip:(ShipEntity *) ship;
- (BOOL)hasNPCTraffic;
- (void)setHasNPCTraffic:(BOOL)flag;
- (BOOL) interstellarUndockingAllowed;
- (BOOL) hasNPCTraffic;
- (void) setHasNPCTraffic:(BOOL)flag;
- (OOStationAlertLevel) alertLevel;
- (void) setAlertLevel:(OOStationAlertLevel)level signallingScript:(BOOL)signallingScript;

View File

@ -806,6 +806,7 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
NSString *defaultBreakPattern = [universalInfo oo_stringForKey:@"default_dockpattern_model" defaultValue:[universalInfo oo_stringForKey:@"default_breakpattern_model"]];
if (defaultBreakPattern == nil) defaultBreakPattern = @"oolite-tunnel.dat";
dockingPatternModelFileName = [dict oo_stringForKey:@"docking_pattern_model" defaultValue:defaultBreakPattern];
interstellarUndockingAllowed = [dict oo_boolForKey:@"interstellar_undocking" defaultValue:NO];
double unitime = [UNIVERSE getTime];
@ -1326,6 +1327,12 @@ static NSDictionary* instructions(int station_id, Vector coords, float speed, fl
}
- (BOOL) interstellarUndockingAllowed
{
return interstellarUndockingAllowed;
}
- (BOOL)hasNPCTraffic
{
return hasNPCTraffic;

View File

@ -490,24 +490,24 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
if (![self sun])
{
// we're in witchspace or this is the first launch...
// save the player
PlayerEntity* player = [PlayerEntity sharedPlayer];
// save the docked craft
Entity* dockedStation = [player dockedStation];
// jump to the nearest system
Random_Seed s_seed = [self findSystemAtCoords:[player galaxy_coordinates] withGalaxySeed:[player galaxy_seed]];
[player setSystem_seed:s_seed];
closeSystems = nil;
// I think we need to do this too!
[self setSystemTo: s_seed];
PlayerEntity *player = [PlayerEntity sharedPlayer];
Entity *dockedStation = [player dockedStation];
NSPoint coords = [player galaxy_coordinates];
// check the nearest system
Random_Seed s_seed = [self findSystemAtCoords:coords withGalaxySeed:[player galaxy_seed]];
BOOL interstel =[(StationEntity *)dockedStation interstellarUndockingAllowed] && (s_seed.d != coords.x || s_seed.b != coords.y);
// remove everything except the player and the docked station
if (dockedStation)
{
if (dockedStation && !interstel)
{ // jump to the nearest system
[player setSystem_seed:s_seed];
closeSystems = nil;
[self setSystemTo: s_seed];
int index = 0;
while ([entities count] > 2)
{
Entity* ent = [entities objectAtIndex:index];
Entity *ent = [entities objectAtIndex:index];
if ((ent != player)&&(ent != dockedStation))
{
if (ent->isStation) // clear out queues
@ -522,12 +522,13 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
}
else
{
[self removeAllEntitiesExceptPlayer:NO]; // get rid of witchspace sky etc. if still extant
if (!dockedStation) [self removeAllEntitiesExceptPlayer:NO]; // get rid of witchspace sky etc. if still extant
}
[self setUpSpace]; // first launch
if (!dockedStation || !interstel) [self setUpSpace]; // first launch
}
if(!autoSaveNow) [self setViewDirection:VIEW_FORWARD];
displayGUI = NO;