Add an explosions.plist file to manage explosion types

Create a separate setting for asteroid explosions
This commit is contained in:
cim 2014-11-17 12:50:11 +00:00
parent b95a26d8d2
commit 6f85948528
7 changed files with 55 additions and 8 deletions

View File

@ -0,0 +1,25 @@
{
"oolite-default-ship-explosion" = {
"alpha" = 0.85;
"color_order" = "rgb";
"count" = 25;
"duration" = 1.5;
"growth_rate" = 1.5;
"size" = 2.5;
"texture" = "oolite-particle-cloud2.png";
};
"oolite-default-asteroid-explosion" = {
"alpha" = 0.15;
"color_order" = "white";
"count" = 10;
"duration" = 1.5;
"growth_rate" = 1.2;
"size" = 0.6;
"texture" = "oolite-particle-cloud.png";
};
}

View File

@ -525,9 +525,10 @@
ai_type = "dumbAI.plist";
bounty = 10;
cargo_type = "CARGO_NOT_CARGO";
energy_recharge_rate = 0;
debris_role = "boulder";
density = 5;
energy_recharge_rate = 0;
explosion_type = "oolite-default-asteroid-explosion";
forward_weapon_type = "WEAPON_NONE";
has_ecm = no;
has_escape_pod = no;
@ -925,6 +926,7 @@
debris_role = "splinter";
density = 5;
energy_recharge_rate = 0;
explosion_type = "oolite-default-asteroid-explosion";
forward_weapon_type = "WEAPON_NONE";
has_ecm = no;
has_escape_pod = no;
@ -3394,6 +3396,7 @@
bounty = 1;
cargo_type = "CARGO_MINERALS";
energy_recharge_rate = 0;
explosion_type = "oolite-default-asteroid-explosion";
forward_weapon_type = "WEAPON_NONE";
has_ecm = no;
has_escape_pod = no;

View File

@ -37,13 +37,13 @@ MA 02110-1301, USA.
#define kExplosionDefaultSize 2.5f
// keys for plist file
static NSString * const kExplosionGrowth = @"growth_rate";
static NSString * const kExplosionAlpha = @"alpha";
static NSString * const kExplosionDuration = @"duration";
static NSString * const kExplosionTexture = @"texture";
static NSString * const kExplosionColors = @"color_order";
static NSString * const kExplosionCount = @"count";
static NSString * const kExplosionDuration = @"duration";
static NSString * const kExplosionGrowth = @"growth_rate";
static NSString * const kExplosionSize = @"size";
static NSString * const kExplosionTexture = @"texture";
@interface OOExplosionCloudEntity (OOPrivate)

View File

@ -322,6 +322,8 @@ typedef enum
NSString *displayName; // name shown on screen
OORoleSet *roleSet; // Roles a ship can take, eg. trader, hunter, police, pirate, scavenger &c.
NSString *primaryRole; // "Main" role of the ship.
NSString *explosionType; // explosion.plist entry
// AI stuff
Vector jink; // x and y set factors for offsetting a pursuing ship's position

View File

@ -448,6 +448,7 @@ static ShipEntity *doOctreesCollide(ShipEntity *prime, ShipEntity *other);
// Get scriptInfo dictionary, containing arbitrary stuff scripts might be interested in.
scriptInfo = [[shipDict oo_dictionaryForKey:@"script_info" defaultValue:nil] retain];
explosionType = [[shipDict oo_stringForKey:@"explosion_type" defaultValue:@"oolite-default-ship-explosion"] retain];
return YES;
@ -1037,6 +1038,8 @@ static ShipEntity *doOctreesCollide(ShipEntity *prime, ShipEntity *other);
DESTROY(_beaconLabel);
DESTROY(_beaconDrawable);
DESTROY(explosionType);
[super dealloc];
}
@ -8319,7 +8322,8 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
}
// and a visual sign of the explosion
// "fireball" explosion effect
[UNIVERSE addEntity:[OOExplosionCloudEntity explosionCloudFromEntity:self withSize:range*3.0 andSettings:nil]];
NSDictionary *explosion = [UNIVERSE explosionSetting:@"oolite-default-ship-explosion"];
[UNIVERSE addEntity:[OOExplosionCloudEntity explosionCloudFromEntity:self withSize:range*3.0 andSettings:explosion]];
}
@ -8618,8 +8622,9 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
}
else
{
NSDictionary *explosion = [UNIVERSE explosionSetting:explosionType];
// "fireball" explosion effect
[UNIVERSE addEntity:[OOExplosionCloudEntity explosionCloudFromEntity:self withSettings:nil]];
[UNIVERSE addEntity:[OOExplosionCloudEntity explosionCloudFromEntity:self withSettings:explosion]];
}
}
// 3. flash

View File

@ -261,7 +261,8 @@ enum
NSDictionary *roleCategories; // Categories for roles from role-categories.plist, extending the old pirate-victim-roles.plist
NSDictionary *autoAIMap; // Default AIs for roles from autoAImap.plist.
NSDictionary *screenBackgrounds; // holds filenames for various screens backgrounds, loaded at initialisation
NSDictionary *explosionSettings; // explosion settings from explosions.plist
NSDictionary *cargoPods; // template cargo pods
OOGalaxyID galaxyID;
@ -604,6 +605,7 @@ enum
- (NSDictionary *) characters;
- (NSDictionary *) missiontext;
- (NSArray *) scenarios;
- (NSDictionary *) explosionSetting:(NSString *)explosion;
- (OOSystemDescriptionManager *) systemManager;

View File

@ -441,6 +441,7 @@ static GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEV
[system_repopulator release];
[allPlanets release];
[allStations release];
[explosionSettings release];
[activeWormholes release];
[characterPool release];
@ -7335,6 +7336,12 @@ static void VerifyDesc(NSString *key, id desc)
}
- (NSDictionary *) explosionSetting:(NSString *)explosion
{
return [explosionSettings oo_dictionaryForKey:explosion defaultValue:nil];
}
- (NSArray *) scenarios
{
return _scenarios;
@ -9550,8 +9557,11 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void *context)
NSArray *equipmentTemp = [ResourceManager arrayFromFilesNamed:@"equipment.plist" inFolder:@"Config" andMerge:YES];
equipmentData = [[equipmentTemp sortedArrayUsingFunction:equipmentSort context:NULL] retain];
[OOEquipmentType loadEquipment];
[explosionSettings autorelease];
explosionSettings = [[ResourceManager dictionaryFromFilesNamed:@"explosions.plist" inFolder:@"Config" andMerge:YES] retain];
}