Asteroids spawned as post-nova debris are now effectively heat-proof. This is achieved with a new standard role: cinder.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3728 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2010-07-28 15:00:14 +00:00
parent 5e0e3b4714
commit cbf12be920
2 changed files with 54 additions and 26 deletions

View File

@ -436,6 +436,7 @@
}; };
likely_cargo = 4; likely_cargo = 4;
debris_role = "boulder"; debris_role = "boulder";
heat_insulation = 5;
}; };
"asteroid-alternative" = "asteroid-alternative" =
{ {
@ -443,6 +444,31 @@
model = "asteroid1.dat"; model = "asteroid1.dat";
roles = "asteroid"; roles = "asteroid";
}; };
"oolite-cinder" =
{
// Cinders are spawned as debris in post-nova systems.
roles = "cinder";
like_ship = "asteroid";
heat_insulation = 10000; // Ridiculously high to survive post-nova environment.
};
"oolite-cinder-alternative" =
{
roles = "cinder";
like_ship = "asteroid-alternative";
heat_insulation = 10000;
};
"oolite-cinder-small" =
{
roles = "cinder(0.5)";
like_ship = "boulder";
heat_insulation = 10000;
};
"oolite-cinder-small-alternative" =
{
roles = "cinder(0.5)";
like_ship = "boulder-alternative";
heat_insulation = 10000;
};
"barrel" = "barrel" =
{ {
ai_type = "dumbAI.plist"; ai_type = "dumbAI.plist";
@ -770,6 +796,7 @@
}; };
}; };
debris_role = "splinter"; debris_role = "splinter";
heat_insulation = 3;
}; };
"boulder-alternative" = "boulder-alternative" =
{ {

View File

@ -179,8 +179,8 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
- (void) resetSystemDataCache; - (void) resetSystemDataCache;
- (void) populateSpaceFromActiveWormholes; - (void) populateSpaceFromActiveWormholes;
- (void) populateSpaceFromHyperPoint:(Vector) h1_pos toPlanetPosition:(Vector) p1_pos andSunPosition:(Vector) s1_pos; - (void) populateSpaceFromHyperPoint:(Vector)h1_pos toPlanetPosition:(Vector)p1_pos andSunPosition:(Vector)s1_pos;
- (int) scatterAsteroidsAt:(Vector) spawnPos withVelocity:(Vector) spawnVel includingRockHermit:(BOOL) spawnHermit; - (int) scatterAsteroidsAt:(Vector)spawnPos withVelocity:(Vector)spawnVel includingRockHermit:(BOOL)spawnHermit asCinders:(BOOL)asCinders;
#if OO_LOCALIZATION_TOOLS #if OO_LOCALIZATION_TOOLS
#if DEBUG_GRAPHVIZ #if DEBUG_GRAPHVIZ
@ -1032,8 +1032,8 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context);
int i; int i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
[self scatterAsteroidsAt:planetPos withVelocity:kZeroVector includingRockHermit:NO]; [self scatterAsteroidsAt:planetPos withVelocity:kZeroVector includingRockHermit:NO asCinders:YES];
[self scatterAsteroidsAt:witchPos withVelocity:kZeroVector includingRockHermit:NO]; [self scatterAsteroidsAt:witchPos withVelocity:kZeroVector includingRockHermit:NO asCinders:YES];
} }
} }
@ -8793,7 +8793,8 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
totalRocks += [self scatterAsteroidsAt:launchPos totalRocks += [self scatterAsteroidsAt:launchPos
withVelocity:kZeroVector withVelocity:kZeroVector
includingRockHermit:includeHermit]; includingRockHermit:includeHermit
asCinders:NO];
[pool release]; [pool release];
} }
@ -8956,31 +8957,34 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
totalRocks += [self scatterAsteroidsAt:launchPos totalRocks += [self scatterAsteroidsAt:launchPos
withVelocity:kZeroVector withVelocity:kZeroVector
includingRockHermit:includeHermit]; includingRockHermit:includeHermit
asCinders:NO];
[pool release]; [pool release];
} }
} }
- (int) scatterAsteroidsAt:(Vector) spawnPos withVelocity:(Vector) spawnVel includingRockHermit:(BOOL) spawnHermit - (int) scatterAsteroidsAt:(Vector)spawnPos withVelocity:(Vector)spawnVel includingRockHermit:(BOOL)spawnHermit asCinders:(BOOL)asCinders
{ {
int rocks = 0; OOUInteger rocks = 0;
Vector launchPos; // Vector launchPos;
int i; OOUInteger i, clusterSize = 1 + (Ranrot() % 6) + (Ranrot() % 6);
int clusterSize = 1 + (Ranrot() % 6) + (Ranrot() % 6);
NSString *role = asCinders ? @"cinder" : @"asteroid";
for (i = 0; i < clusterSize; i++) for (i = 0; i < clusterSize; i++)
{ {
ShipEntity* asteroid; Vector launchPos = vector_add(spawnPos, OOVectorRandomRadial(SCANNER_MAX_RANGE));
launchPos.x = spawnPos.x + SCANNER_MAX_RANGE * (randf() - randf());
launchPos.y = spawnPos.y + SCANNER_MAX_RANGE * (randf() - randf()); ShipEntity *asteroid = [self newShipWithRole:role]; // retain count = 1
launchPos.z = spawnPos.z + SCANNER_MAX_RANGE * (randf() - randf()); if (asteroid != nil)
asteroid = [self newShipWithRole:@"asteroid"]; // retain count = 1
if (asteroid)
{ {
[asteroid setPosition:launchPos]; [asteroid setPosition:launchPos];
if ([asteroid scanClass] == CLASS_NOT_SET) if ([asteroid scanClass] == CLASS_NOT_SET)
{
[asteroid setScanClass: CLASS_ROCK]; [asteroid setScanClass: CLASS_ROCK];
}
[asteroid setVelocity:spawnVel]; [asteroid setVelocity:spawnVel];
[self addEntity:asteroid]; // STATUS_IN_FLIGHT, AI state GLOBAL [self addEntity:asteroid]; // STATUS_IN_FLIGHT, AI state GLOBAL
[asteroid release]; [asteroid release];
@ -8995,22 +8999,19 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
if (spawnHermit) if (spawnHermit)
{ {
StationEntity* hermit; Vector launchPos = vector_add(spawnPos, OOVectorRandomRadial(SCANNER_MAX_RANGE));
launchPos.x = spawnPos.x + 0.5 * SCANNER_MAX_RANGE * (randf() - randf());
launchPos.y = spawnPos.y + 0.5 * SCANNER_MAX_RANGE * (randf() - randf()); ShipEntity *hermit = (StationEntity *)[self newShipWithRole:@"rockhermit"]; // retain count = 1
launchPos.z = spawnPos.z + 0.5 * SCANNER_MAX_RANGE * (randf() - randf()); if (hermit != nil)
hermit = (StationEntity *)[self newShipWithRole:@"rockhermit"]; // retain count = 1
if (hermit)
{ {
[hermit setPosition:launchPos]; [hermit setPosition:launchPos];
if ([hermit scanClass] == CLASS_NOT_SET) if ([hermit scanClass] == CLASS_NOT_SET)
{
[hermit setScanClass: CLASS_ROCK]; [hermit setScanClass: CLASS_ROCK];
}
[hermit setVelocity:spawnVel]; [hermit setVelocity:spawnVel];
[self addEntity:hermit]; // STATUS_IN_FLIGHT, AI state GLOBAL [self addEntity:hermit]; // STATUS_IN_FLIGHT, AI state GLOBAL
[hermit release]; [hermit release];
#if DEAD_STORE
clusterSize++;
#endif
} }
} }
return rocks; return rocks;