From 627e5a9b574dc5ea80469024cfffdef08595f0ea Mon Sep 17 00:00:00 2001 From: Jens Ayton Date: Tue, 11 Mar 2008 08:25:42 +0000 Subject: [PATCH] shipWillLaunchFromStation() is once e again called for the player. Ejected items and debris are now spawned with 85% of the parent's cabin temperature. Incompatible OXP message is now loaded from descriptions.plist, but only the internal descriptions.plist; listing incompatible OXPs and generating the messages later would be a better approach. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1476 127b21dd-08f5-0310-b4b7-95ae10353056 --- Resources/Config/descriptions.plist | 2 ++ Resources/Config/logcontrol.plist | 3 +++ src/Core/Entities/PlayerEntity.m | 1 + src/Core/Entities/ShipEntity.h | 1 + src/Core/Entities/ShipEntity.m | 19 +++++++++++-------- src/Core/ResourceManager.m | 2 +- src/Core/Universe.m | 5 +++++ 7 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Resources/Config/descriptions.plist b/Resources/Config/descriptions.plist index 661c1861..4df616ed 100644 --- a/Resources/Config/descriptions.plist +++ b/Resources/Config/descriptions.plist @@ -968,6 +968,8 @@ "legal-desc-military-vessel" = "Military Vessel"; "planetname-derivative-suffix" = "ian"; // This is the suffix used with %I (producing 'Laveian' for example) + "oxp-is-incompatible" = "\t“%@” is incompatible with version %@ of Oolite."; + // delivery reports "arrival-report-title" = "%H Arrival Report"; diff --git a/Resources/Config/logcontrol.plist b/Resources/Config/logcontrol.plist index 9213ca69..eaf49028 100644 --- a/Resources/Config/logcontrol.plist +++ b/Resources/Config/logcontrol.plist @@ -302,6 +302,9 @@ strings.conversion.randomSeed = inherit; + sun.nova = no; // Debug messages for nova + + texture.planet.generate = inherit; diff --git a/src/Core/Entities/PlayerEntity.m b/src/Core/Entities/PlayerEntity.m index 68de8b27..449c2563 100644 --- a/src/Core/Entities/PlayerEntity.m +++ b/src/Core/Entities/PlayerEntity.m @@ -3684,6 +3684,7 @@ double scoopSoundPlayTime = 0.0; ident_engaged = NO; + [self doScriptEvent:@"shipWillLaunchFromStation" withArgument:station]; [self playLaunchFromStation]; } diff --git a/src/Core/Entities/ShipEntity.h b/src/Core/Entities/ShipEntity.h index fd0d9f12..64da12bd 100644 --- a/src/Core/Entities/ShipEntity.h +++ b/src/Core/Entities/ShipEntity.h @@ -61,6 +61,7 @@ MA 02110-1301, USA. #define SHIP_INSULATION_FACTOR 0.00175 #define SHIP_MAX_CABIN_TEMP 256.0 #define SHIP_MIN_CABIN_TEMP 60.0 +#define EJECTA_TEMP_FACTOR 0.85 // Ejected items have 85% of parent's temperature #define SUN_TEMPERATURE 1250.0 diff --git a/src/Core/Entities/ShipEntity.m b/src/Core/Entities/ShipEntity.m index b21d5fe1..2396bd54 100644 --- a/src/Core/Entities/ShipEntity.m +++ b/src/Core/Entities/ShipEntity.m @@ -3979,6 +3979,7 @@ static GLfloat mascem_color2[4] = { 0.4, 0.1, 0.4, 1.0}; // purple [plate setCommodity:9 andAmount:1]; [UNIVERSE addEntity:plate]; [plate setStatus:STATUS_IN_FLIGHT]; + [plate setTemperature:[self temperature] * EJECTA_TEMP_FACTOR]; [[plate getAI] setState:@"GLOBAL"]; [plate release]; } @@ -6000,6 +6001,7 @@ BOOL class_masslocks(int some_class) [jetto setVelocity:vel]; [jetto setScanClass: CLASS_CARGO]; [jetto setStatus: STATUS_IN_FLIGHT]; + [jetto setTemperature:[self temperature] * EJECTA_TEMP_FACTOR]; [UNIVERSE addEntity:jetto]; [[jetto getAI] setState:@"GLOBAL"]; cargo_dump_time = [UNIVERSE getTime]; @@ -6601,17 +6603,16 @@ BOOL class_masslocks(int some_class) { if (station == nil) return; - Vector launchPos = station->position; - Vector stat_f = vector_forward_from_quaternion(station->orientation); - launchPos.x += 500.0*stat_f.x; - launchPos.y += 500.0*stat_f.y; - launchPos.z += 500.0*stat_f.z; - position = launchPos; - orientation = station->orientation; + Vector stat_f = vector_forward_from_quaternion([station orientation]); + [self setPosition:vector_add([station position], vector_multiply_scalar(stat_f, 500.0f))]; + + [self setOrientation:[station orientation]]; flightRoll = [station flightRoll]; flightPitch = 0.0; flightSpeed = maxFlightSpeed * 0.5; + status = STATUS_LAUNCHING; + [self doScriptEvent:@"shipWillLaunchFromStation" withArgument:station]; [shipAI message:@"LAUNCHED"]; [UNIVERSE addEntity:self]; @@ -7251,6 +7252,7 @@ static BOOL AuthorityPredicate(Entity *entity, void *parameter) NSArray *tokens = ScanTokensFromString(roles_number); NSString *roleString = nil; NSString *numberString = nil; + ShipEntity *spawned = nil; if ([tokens count] != 2) { @@ -7267,7 +7269,8 @@ static BOOL AuthorityPredicate(Entity *entity, void *parameter) do { - [UNIVERSE spawnShipWithRole:roleString near:self]; + spawned = [UNIVERSE spawnShipWithRole:roleString near:self]; + [spawned setTemperature:[self temperature] * EJECTA_TEMP_FACTOR]; } while (--number); } diff --git a/src/Core/ResourceManager.m b/src/Core/ResourceManager.m index f1f984c0..1f2713df 100644 --- a/src/Core/ResourceManager.m +++ b/src/Core/ResourceManager.m @@ -245,7 +245,7 @@ static NSMutableDictionary *string_cache; { NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; OOLog(@"oxp.versionMismatch", @"OXP %@ is incompatible with version %@ of Oolite.", path, version); - [self addError:[NSString stringWithFormat:@"\t'%@' is incompatible with version %@ of Oolite", [path lastPathComponent], version]]; + [self addError:[NSString stringWithFormat:DESC(@"oxp-is-incompatible"), [path lastPathComponent], version]]; } } diff --git a/src/Core/Universe.m b/src/Core/Universe.m index 5209fbdd..70a17a15 100644 --- a/src/Core/Universe.m +++ b/src/Core/Universe.m @@ -112,6 +112,11 @@ static NSComparisonResult comparePrice(NSDictionary *dict1, NSDictionary *dict2, [self setGameView:inGameView]; gSharedUniverse = self; + // Load internal descriptions.plist for use in internal init; it will be replaced by merged version later. + descriptions = [NSDictionary dictionaryWithContentsOfFile:[[[ResourceManager builtInPath] + stringByAppendingPathComponent:@"Config"] + stringByAppendingPathComponent:@"descriptions.plist"]]; + n_entities = 0; x_list_start = y_list_start = z_list_start = nil;