Page 1 of 1

Ship Library adds Expansion Pack ships

Posted: Thu Mar 26, 2015 10:00 pm
by Vincentz
Donno if its possible, but it would be really nice if the Ship Library somehow could read all ship classes currently in game (including those from addons).

Re: Ship Library adds Expansion Pack ships

Posted: Fri Mar 27, 2015 1:53 am
by Stormrider
Vincentz wrote:
Donno if its possible
It is, the oxp author just has to create a shiplibrary.plist:

Code: Select all

(
	{
		ship = "RNRL_Stormbrewer-trader";
		class = "ship";
		ship_data = true;
		summary = "Heavy Fighter";
		weapons = " 4 fixed, 4 pylon";
		description = "The Stormbrewer light transport has enough cargo space for to use for small cargo contracts or passenger transport, but still nimble enough to use as a heavy fighter.";
	}

)

Re: Ship Library adds Expansion Pack ships

Posted: Sat Apr 18, 2015 3:56 pm
by Day
Wouldn't it be possible to make an oxp parsing the other oxps?

I mean, I don't know if it is possible to access other oxps' data from one's own oxp?

Re: Ship Library adds Expansion Pack ships

Posted: Sat Apr 18, 2015 5:09 pm
by cim
That's certainly possible - you can read various bits of ship data using the static methods of the Ship class. You can't add entries at run time to the ship library data structure, but you could write a little helper script which would search for ships and print out a start on the shiplibrary.plist file to the log.

A lot of shiplibrary.plist is not particularly automatable, though. If an OXP provides multiple ships, you need to select each ship; if an OXP provides multiple ship variants to manage different roles - as the core does between cobra3-trader and cobra3-pirate, for instance - you only want to include one of those.

There's also decisions to be taken on what category to put the ships in to, and what description paragraph to add to them (in many cases it will be easy enough to put this together from the ship's Wiki page). For some entries - Oolite core does this for thargoid, police and military ships - you may want to mark some capabilities as classified or unknown.

But ... you certainly could have a "OXP Ship Descriptions" pack which just contained a shiplibrary.plist containing the descriptions for ship OXPs which were unlikely to be updated themselves. Entries in the file are discarded if they don't match an installed ship, so there's no problem there. You would need to occasionally maintain the pack to remove entries for ship OXPs which were updated, though, or you'd get duplicate entries.

If the ship OXP has an appropriate license, however, it might be considerably easier just to add a shiplibrary.plist to it and re-release it (a lot of the older ones are also in need of other maintenance work too - new roles, new shipdata properties, in some cases reconsideration of armament, etc.).