Page 1 of 1

Strange weapons disappearance in saved ship files

Posted: Tue Jul 22, 2014 12:11 am
by UK_Eliter
Dear all

In the process of fixing-up my Fer-de-Lane 3G expansion pack for Oolite 1.8, and more specifically - or rather trying to adhere better to the newly stressed naming conventions - my main ship file (the one I use for play and for most testing), and various other commanders, all have no lasers and there is never any shipyard option to fit lasers.

The problem affects only ships provided by my expansion pack (i.e. Fer-de-lance 3Gs). I can't work out what is wrong. Shipyard file? Shipdata file? Save files? Also, the ships seem to be lacking some other equipment they should have. In all other respects, though, the ships are fine, i.e. they look fine, have the right stats, cause no errors in the log. Well, actually, I do (only sometimes?) get this in the log: '[cheat.tentative]: POSSIBLE CHEAT DETECTED'. That's caused by my fiddling with the save files, I think.

Can anyone help, please? Ta.

Re: Strange weapons disappearance in saved ship files

Posted: Tue Jul 22, 2014 12:37 am
by Cmdr Wyvern
hmm. Hard to say without knowing what your shipdata files looks like. Maybe looking at the shipdata from my slightly tweaked Griff Ferdy can help...

Code: Select all

"griff_ferdelance2013-PLAYER" = 
	{
		like_ship = "oolite_template_ferdelance-player";
		aft_eject_position = "0.0 -13.8 -36.8";
		exhaust = ("0.0 1.59051 -40.8958 5.0 5.0 1.2");
		exhaust_emissive_color = (1.0, 0.6145, 0.0);
		materials = 
					{ 
						"Hull" = 
						{ 
							diffuse_map = "griff_ferdelance_new2013_diffuse.png"; 
							specular_color = ( 0.6, 0.5, 0.5 );  // Applies when specular map is not used (no shaders) 
							shininess = 7; 
							emission_map = { name = "griff_ferdelance_new2013_normal.png"; extract_channel = "a"; }; 
							emission_modulate_color = (0.9926, 0.9686, 0.9926); 							
						}; 
					};
		missile_launch_position = "0.0 -10.2 32.49";
		model = "griff_ferdelance2013.dat"; 
		scoop_position = "0.0 -8.7105 21.6829";	
		laser_color = "blueColor";
		"max_cargo" = 12;
		"extra_cargo" = 10;
        "max_flight_pitch" = 1.5;
        "max_flight_roll" = 2;
		"hyperspace_motor_spin_time" = "8";
		shaders = 
			{ 
				"Hull" = 
				{ 
					vertex_shader = "griff_normalmap_ships_withScroll.vertex"; 
					fragment_shader = "griff_ferdelance_new2013-PLAYER.fragment"; 
					textures = 
							(
								{name = "griff_ferdelance_new2013_diffuse.png"; repeat_s = "yes"; repeat_t = "yes";}, 
								"griff_ferdelance_new2013_normal.png",
								"griff_ferdelance_new2013_effects.png",
								"rohi_decals_player.png"
							);
					uniforms =
							{
							uColorMap = { type = texture; value = 0; };
							uNormalMap = { type = texture; value = 1; };
							uEffectsMap = { type = texture; value = 2; };
							uDecalMap = { type = texture; value = 3; };	
							uTime = "universalTime";
							alertlevel = "alertCondition";	
							damage_amount = "damage";	
							hull_heat_level = "hullHeatLevel";
							laser_heat_level = "laserHeatLevel";					
							engine_power = "speedFactor"; 
							PaintColor1 = {type = "randomUnitVector"; scale = 1.0;};
							PaintColor2 = {type = "randomUnitVector"; scale = 1.0;};
							Decal1_Scale_Position = { type = vector; value = "0.395 0.44 8.6359"; };
							Decal1_Rotation = { type = "float"; value = -1.02; };	
							ExhaustCoreCol = {type = vector; value = "0.6157 1.0 0.8511";};
							ExhaustPlumeCol = {type = vector; value = "1.0 0.8089 0.0209";};	
							}; 
				};
			};
		view_position_aft = "0.0 12.0 -32.5";
		view_position_forward = "0.0 0.0 28.7";
		view_position_port = "-16.875 2.0 3.5";
		view_position_starboard = "16.875 2.0 3.5";
		weapon_position_aft = "0.0 0.0 -42.5";
		weapon_position_forward = "0.0 -6.86126 47.3988";
		weapon_position_port = "-16.875 -4.0 3.5";
		weapon_position_starboard = "16.875 -4.0 3.5";
		custom_views =
			(
				{
					view_description = "Rear View";
					view_orientation = "1.0 0.0 0.0 0.0";
					view_position = "0.0 15.0 -260.0";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Rear Right View";
					view_orientation = "0.9239 0.0 0.3827 0.0";
					view_position = "183.8479 15.0 -183.8479";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Right View";
					view_orientation = "0.7071 0.0 0.7071 0.0";
					view_position = "260.0 15.0 0.0";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Front Right View";
					view_orientation = "0.3827 0.0 0.9239 0.0";
					view_position = "183.8479 15.0 183.8479";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Front View";
					view_orientation = "0.0 0.0 1.0 0.0";
					view_position = "0.0 15.0 260.0";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Front Left View";
					view_orientation = "0.3827 0.0 -0.9239 0.0";
					view_position = "-183.8479 15.0 183.8479";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Left View";
					view_orientation = "0.7071 0.0 -0.7071 0.0";
					view_position = "-260.0 15.0 0.0";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Rear Left View";
					view_orientation = "0.9239 0.0 -0.3827 0.0";
					view_position = "-183.8479 15.0 -183.8479";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Top View";
					view_orientation = "-0.7071 0.7071 0.0 0.0";
					view_position = "0.0 270.0 10.0";
					weapon_facing = "FORWARD";
				},
				{
					view_description = "Bottom View";
					view_orientation = "0.0 0.0 0.7071 0.7071";
					view_position = "0.0 -270.0 10.0";
					weapon_facing = "FORWARD";
				}
			);
	};
...and the corresponding shipyard file...

Code: Select all

	"griff_ferdelance2013-PLAYER" = 
	{
		"chance" = 0.50;
		"optional_equipment" = (
			"EQ_CARGO_BAY",
			"EQ_ENERGY_BOMB",
			"EQ_ENERGY_UNIT",
			"EQ_NAVAL_ENERGY_UNIT",
			"EQ_WEAPON_PULSE_LASER",
			"EQ_WEAPON_BEAM_LASER",
			"EQ_WEAPON_MINING_LASER",
			"EQ_WEAPON_MILITARY_LASER",
			"EQ_GAL_DRIVE",
			"EQ_NAVAL_SHIELD_BOOSTER",
			"EQ_HEAT_SHIELD"
		);
		price = 485000;
		standard_equipment =
			{
				extras = 
					(
					"EQ_PASSENGER_BERTH",
					"EQ_FUEL_SCOOPS",
					"EQ_ECM",
					"EQ_ESCAPE_POD",
					"EQ_ADVANCED_COMPASS",
					"EQ_SCANNER_SHOW_MISSILE_TARGET",
					"EQ_FUEL_INJECTION",
					"EQ_MULTI_TARGET",
					"EQ_DOCK_COMP",
					"EQ_SHIELD_BOOSTER"
					);
			forward_weapon_type = "EQ_WEAPON_PULSE_LASER";
			missiles = 3;
			};
		techlevel = 8;
		weapon_facings = 15;
	};		
Could be a forward weapon wasn't specified, in your case. That should be taken care of if you like-shipped it to oolite's new fer-de-lance player template, which apparently has a fore weapon set already.

Re: Strange weapons disappearance in saved ship files

Posted: Tue Jul 22, 2014 2:27 am
by UK_Eliter
Thanks, Wyvern - I've now got about half the ships working. The problem seemed to be reference in shipdata to ship key names that no longer existed. That said - and presumably save files that referred to those names generated some sort of ship - I'd likeshipped the old names to the new names, in this manner:

Code: Select all

// For compatibility with my older naming conventions
	"ferdelance3-player" =
	{
		like_ship = "ferdelance3G_player";
	};
And yet, weirdly to my mind, that resulted in the under-equipped ships. Also, I can't find similar errors in my remaining under-equipped ships, and yet they remain under-equipped. Still investigating. It complicates matters that I've loads of models and a fairly complex template structure . .

Re: Strange weapons disappearance in saved ship files

Posted: Tue Jul 22, 2014 3:46 am
by Cmdr Wyvern
1.8 comes with Griff ship models, and native shipdata templates for each one. That includes template entries for NPC and player Ferdys, with auto-AI, auto-weapons, weighted roles et al for the NPCs. Also includes a default fore weapon for the player ship.

As an example, your shipdata file could look something like this:

Code: Select all

 "ferdelance3-player" =
   {
      like_ship = "oolite_template_ferdelance-player";
   // insert custom specs, model, shaders, name ect here.
   };
 "ferdelance3G_player" =
   {
      like_ship = "oolite_template_ferdelance-player";
   // insert custom specs, model, shaders, name ect here.
   };
 "ferdelance3-npc" =
   {
      like_ship = "oolite_template_ferdelance";
   // insert custom specs, model, shaders, name ect here.
   };
 "ferdelance3G_npc" =
   {
      like_ship = "oolite_template_ferdelance";
   // insert custom specs, model, shaders, name ect here.
   };
...and so on & so forth, yadda yadda.

Re: Strange weapons disappearance in saved ship files

Posted: Tue Jul 22, 2014 5:17 am
by UK_Eliter
Yes, but I am not in fact using any of the inbuilt Fer-de-Lance shipdata. Rather what I have - and which was working until I changed some thing recently - includes this:

Code: Select all


	// ===================================
	//			TEMPLATES
	// ===================================

	"ferdelance3G_template" =
	{
		"is_template" = yes;
		aft_eject_position = "0.0 3.0 -38.0";
		cargo_type = "CARGO_NOT_CARGO";
		exhaust = ("0.0 -5 -39.0 3.9 3.9 17.0");
		forward_weapon_type = "WEAPON_BEAM_LASER";
		has_ecm = 1;
		has_escape_pod = 1;
		fuel = 50;
		has_fuel_injection = 1;
		has_scoop = 1;
		hyperspace_motor_spin_time = 9;
		laser_color = "redColor";
		materials =
		{
			"ferdelance3G.png" =
			{
				emission_map = "ferdelance3G_em-map.png";
				ambient_color = (1/2, 0, 1/2, 1);
				shininess = 4;
				specular_color = (0.3, 0.3, 0.3, 0.1);
			};
		};
		max_energy = 320;
		max_flight_roll = 3.70;
		max_flight_pitch = 1.4;
		max_flight_speed = 510;
		max_flight_yaw = 1.5;
		max_missiles = 5;
		missile_launch_position = "0.0 -10.5 16.5";
		model = "ferdelance3G.dat";
		name = "Fer-de-Lance 3G";
		scoop_position = "0.0 -8.0 -14";
		thrust = 59;
		weapon_facings = 15;
		weapon_position_aft = "0.0 0.0 -42.5";
		weapon_position_forward = "0.0 -9.5 35.0";
	};

	"ferdelance3G_templateNPC" =
	{
		"is_template" = yes;
		like_ship = "ferdelance3G_template";
		// max_flight_pitch = 1.2; // to avoid Oolite's 'twitching' problem.
	};
and

Code: Select all


	// ===================================
	// 		PLAYER VERSIONS
	// ===================================

	"ferdelance3G_player" =
	{
		like_ship = "ferdelance3G_template";
		custom_views =
		(
			{
				view_description = "Rear View";
				view_orientation = "1.0 0.0 0.0 0.0";
				view_position = "0.0 20.0 -150.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Rear Right View";
				view_orientation = "0.9239 0.0 0.3827 0.0";
				view_position = "106.06 20.0 -106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Right View";
				view_orientation = "0.7071 0.0 0.7071 0.0";
				view_position = "150.0 20.0 0.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Front Right View";
				view_orientation = "0.3827 0.0 0.9239 0.0";
				view_position = "106.06 20.0 106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Front View";
				view_orientation = "0.0 0.0 1.0 0.0";
				view_position = "0.0 20.0 150.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Front Left View";
				view_orientation = "0.3827 0.0 -0.9239 0.0";
				view_position = "-106.06 20.0 106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Left View";
				view_orientation = "0.7071 0.0 -0.7071 0.0";
				view_position = "-150.0 20.0 0.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Rear Left View";
				view_orientation = "0.9239 0.0 -0.3827 0.0";
				view_position = "-106.06 20.0 -106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Top View";
				view_orientation = "-0.7071 0.7071 0.0 0.0";
				view_position = "0.0 150.0 -13.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Bottom View";
				view_orientation = "0.0 0.0 0.7071 0.7071";
				view_position = "0.0 -165.0 -12.0";
				weapon_facing = "FORWARD";
			}
		);
		energy_recharge_rate = 4.9;
		fuel = 50;
		frangible = false;
		max_cargo = 22;
		roles = "player";
		weapon_position_port = "-16.875 -4.0 3.5";
		weapon_position_starboard = "16.875 -4.0 3.5";
		view_position_aft = "0.0 5.0 -32.5";
		view_position_forward = "0.0 0.0 9.0";
		view_position_port = "-16.875 2.0 3.5";
		view_position_starboard = "16.875 2.0 3.5";
		script = "";
	};

	// For compatibility with my older naming conventions
	"ferdelance3-player" =
	{
		like_ship = "ferdelance3G_player";
	};

	"ferdelance3G_playerVariant" =
	{
		like_ship = "ferdelance3G_variantTemplate";
		custom_views =
		(
			{
				view_description = "Rear View";
				view_orientation = "1.0 0.0 0.0 0.0";
				view_position = "0.0 20.0 -150.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Rear Right View";
				view_orientation = "0.9239 0.0 0.3827 0.0";
				view_position = "106.06 20.0 -106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Right View";
				view_orientation = "0.7071 0.0 0.7071 0.0";
				view_position = "150.0 20.0 0.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Front Right View";
				view_orientation = "0.3827 0.0 0.9239 0.0";
				view_position = "106.06 20.0 106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Front View";
				view_orientation = "0.0 0.0 1.0 0.0";
				view_position = "0.0 20.0 150.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Front Left View";
				view_orientation = "0.3827 0.0 -0.9239 0.0";
				view_position = "-106.06 20.0 106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Left View";
				view_orientation = "0.7071 0.0 -0.7071 0.0";
				view_position = "-150.0 20.0 0.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Rear Left View";
				view_orientation = "0.9239 0.0 -0.3827 0.0";
				view_position = "-106.06 20.0 -106.06";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Top View";
				view_orientation = "-0.7071 0.7071 0.0 0.0";
				view_position = "0.0 150.0 -13.0";
				weapon_facing = "FORWARD";
			},
			{
				view_description = "Bottom View";
				view_orientation = "0.0 0.0 0.7071 0.7071";
				view_position = "0.0 -165.0 -12.0";
				weapon_facing = "FORWARD";
			}
		);
		energy_recharge_rate = 4.9;
		fuel = 50;
		frangible = false;
		max_cargo = 22;
		roles = "player";
		weapon_position_port = "-16.875 -4.0 3.5";
		weapon_position_starboard = "16.875 -4.0 3.5";
		view_position_aft = "0.0 5.0 -32.5";
		view_position_forward = "0.0 0.0 9.0";
		view_position_port = "-16.875 2.0 3.5";
		view_position_starboard = "16.875 2.0 3.5";
	};

	// For compatibility with my older naming conventions
	"ferdelance3-playerVariant" =
	{
		like_ship = "ferdelance3G_playerVariant";
	};
And I think I am managing to fix things. The problem, at this stage, is that the actual save files have got the wrong/missing equipment keys - owing to previous different problems - and so I need to fix those (whereas buying a new version of one of the ships should work fine). Testing. . .

Thanks again for the help.

EDIT: Of the fundamental problems, the main one turns out to be lack of shipyard data for ships that are not normally playable-flyable, but which I was trying to make player-flyable for testing.