Resolution for bug #12659 (scripted cargo pods do not award cargo when scooped). Added the CLASS_CARGO scan class to alloy and splinter in shipdata.plist, so that they don't appear unscoopable and with legal status when spawned by scripts. Finally, yes, you guessed it, more strings externalized.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1448 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Nikos Barkas 2008-03-03 06:46:40 +00:00
parent 8db171cf6a
commit 74ae10a5c9
4 changed files with 89 additions and 9 deletions

View File

@ -958,6 +958,9 @@
"clock-format" = "%07d:%02d:%02d:%02d";
"clock-format-adjusting" = "%07d:%02d:%02d:%02d (adjusting)";
"danger-fuel-leak" = "Danger! Fuel leak!";
"legal-desc-alien" = "Alien";
"legal-desc-system-vessel" = "System Vessel";
"legal-desc-military-vessel" = "Military Vessel";
"planetname-derivative-suffix" = "ian"; // This is the suffix used with %I (producing 'Laveian' for example)

View File

@ -134,6 +134,7 @@
model = "alloy.dat";
name = "Metal fragment";
roles = "alloy oolite-alloy";
scanClass = "CLASS_CARGO";
thrust = 0;
};
"anaconda" =
@ -2223,6 +2224,7 @@
model = "scarred_alloy.dat";
name = "Metal fragment";
roles = "alloy oolite-scarred-alloy";
scanClass = "CLASS_CARGO";
thrust = 0;
};
"shuttle" =
@ -2320,6 +2322,7 @@
model = "splinter.dat";
name = "Splinter";
roles = "splinter oolite-splinter";
scanClass = "CLASS_CARGO";
smooth = yes;
thrust = 0;
unpiloted = yes;

View File

@ -1887,15 +1887,15 @@ void hudDrawReticleOnTarget(Entity* target, PlayerEntity* player1, GLfloat z1)
break;
case CLASS_THARGOID:
legal_desc = @"Alien";
legal_desc = DESC(@"legal-desc-alien");
break;
case CLASS_POLICE:
legal_desc = @"System Vessel";
legal_desc = DESC(@"legal-desc-system-vessel");
break;
case CLASS_MILITARY:
legal_desc = @"Military Vessel";
legal_desc = DESC(@"legal-desc-military-vessel");
break;
default:

View File

@ -1792,6 +1792,15 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
ShipEntity *ship;
ship = [self newShipWithRole:desc]; // retain count = 1
// Deal with scripted cargopods and ensure they are filled with something.
if (ship && [ship hasPrimaryRole:@"cargopod"])
{
NSArray *theCargopod = [self getContainersOfGoods:1 scarce:NO];
[ship release]; // We are about to pass to cargopod an already generated object.
ship = [theCargopod objectAtIndex:0];
}
if (ship)
{
if (![ship crew] && !(ship->scanClass == CLASS_CARGO || ship->scanClass == CLASS_ROCK))
@ -1807,7 +1816,10 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
[ship setStatus:STATUS_IN_FLIGHT]; // or ships that were 'demo' ships become invisible!
[ship release];
if (![ship hasPrimaryRole:@"cargopod"]) // cargopod does not require release due to the way it is created.
{
[ship release];
}
}
}
@ -2078,6 +2090,15 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
ShipEntity *ship;
ship = [self newShipWithRole:desc]; // retain count = 1
// Deal with scripted cargopods and ensure they are filled with something.
if (ship && [ship hasPrimaryRole:@"cargopod"])
{
NSArray *theCargopod = [self getContainersOfGoods:1 scarce:NO];
[ship release]; // We are about to pass to cargopod an already generated object.
ship = [theCargopod objectAtIndex:0];
}
if (ship)
{
if (![ship crew] && !(ship->scanClass == CLASS_CARGO || ship->scanClass == CLASS_ROCK))
@ -2091,7 +2112,10 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
[self addEntity:ship];
[[ship getAI] setState:@"GLOBAL"]; // must happen after adding to the universe!
[ship setStatus:STATUS_IN_FLIGHT]; // or ships that were 'demo' ships become invisible!
[ship release];
if (![ship hasPrimaryRole:@"cargopod"]) // cargopod does not require release due to the way it is created.
{
[ship release];
}
return YES;
}
@ -2117,6 +2141,17 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
ship = [self newShipWithRole:desc]; // retain count = 1
if (!ship)
return NO;
// Deal with scripted cargopods and ensure they are filled with something.
if (ship && [ship hasPrimaryRole:@"cargopod"])
{
NSArray *theCargopod = [self getContainersOfGoods:1 scarce:NO];
[ship release];
ship = [theCargopod objectAtIndex:0];
if (!ship)
return NO;
}
if (![ship crew] && !(ship->scanClass == CLASS_CARGO || ship->scanClass == CLASS_ROCK))
[ship setCrew:[NSArray arrayWithObject:
[OOCharacter randomCharacterWithRole: desc
@ -2175,7 +2210,10 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
[self addEntity:ship];
[[ship getAI] setState:@"GLOBAL"]; // must happen after adding to the universe!
[ship setStatus:STATUS_IN_FLIGHT]; // or ships that were 'demo' ships become invisible!
[ship release];
if (![ship hasPrimaryRole:@"cargopod"]) // cargopod does not require release due to the way it is created.
{
[ship release];
}
ship_positions[i] = ship_pos;
i++;
@ -2270,6 +2308,15 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
ShipEntity *ship;
ship = [self newShipWithRole:desc]; // retain count = 1
// Deal with scripted cargopods and ensure they are filled with something.
if (ship && [ship hasPrimaryRole:@"cargopod"])
{
NSArray *theCargopod = [self getContainersOfGoods:1 scarce:NO];
[ship release]; // We are about to pass to cargopod an already generated object.
ship = [theCargopod objectAtIndex:0];
}
if (ship)
{
if (![ship crew] && !(ship->scanClass == CLASS_CARGO || ship->scanClass == CLASS_ROCK))
@ -2283,7 +2330,10 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
[self addEntity:ship];
[[ship getAI] setState:@"GLOBAL"]; // must happen after adding to the universe!
[ship setStatus:STATUS_IN_FLIGHT]; // or ships that were 'demo' ships become invisible!
[ship release];
if (![ship hasPrimaryRole:@"cargopod"]) // cargopod does not require release due to the way it is created.
{
[ship release];
}
return YES; // success at last!
}
@ -2352,6 +2402,15 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
ShipEntity *ship = nil;
ship = [self newShipWithRole:role]; // retain count = 1
// Deal with scripted cargopods and ensure they are filled with something.
if (ship && [ship hasPrimaryRole:@"cargopod"])
{
NSArray *theCargopod = [self getContainersOfGoods:1 scarce:NO];
[ship release]; // We are about to pass to cargopod an already generated object.
ship = [theCargopod objectAtIndex:0];
}
if (ship)
{
if ((ship->scanClass == CLASS_NO_DRAW)||(ship->scanClass == CLASS_NOT_SET))
@ -2378,7 +2437,10 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
[[ship getAI] setState:@"GLOBAL"]; // must happen after adding to the universe!
[ship setStatus:STATUS_IN_FLIGHT]; // or ships may not werk rite d'uh!
[ship release];
if (![ship hasPrimaryRole:@"cargopod"]) // cargopod does not require release due to the way it is created.
{
[ship release];
}
}
}
@ -2395,6 +2457,15 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
GLfloat offset = (randf() + randf()) * entity->collision_radius;
spawn_pos.x += offset * vf.x; spawn_pos.y += offset * vf.y; spawn_pos.z += offset * vf.z;
ship = [self newShipWithRole:desc]; // retain count = 1
// Deal with scripted cargopods and ensure they are filled with something.
if (ship && [ship hasPrimaryRole:@"cargopod"])
{
NSArray *theCargopod = [self getContainersOfGoods:1 scarce:NO];
[ship release]; // We are about to pass to cargopod an already generated object.
ship = [theCargopod objectAtIndex:0];
}
if (ship)
{
if (![ship crew] && !(ship->scanClass == CLASS_CARGO || ship->scanClass == CLASS_ROCK))
@ -2409,7 +2480,10 @@ GLfloat docked_light_specular[4] = { (GLfloat) 1.0, (GLfloat) 1.0, (GLfloat) 0.5
[self addEntity:ship];
[[ship getAI] setState:@"GLOBAL"]; // must happen after adding to the universe!
[ship setStatus:STATUS_IN_FLIGHT];
[ship release];
if (![ship hasPrimaryRole:@"cargopod"]) // cargopod does not require release due to the way it is created.
{
[ship release];
}
}
}