Ship Library adds Expansion Pack ships

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Vincentz
Deadly
Deadly
Posts: 174
Joined: Sun Mar 22, 2015 11:26 pm

Ship Library adds Expansion Pack ships

Post 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).
"There is a single light of science, and to brighten it anywhere is to brighten it everywhere." - Isaac Asimov
User avatar
Stormrider
Deadly
Deadly
Posts: 241
Joined: Sat Jan 25, 2014 2:35 am
Location: At work

Re: Ship Library adds Expansion Pack ships

Post 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.";
	}

)
Image
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: Ship Library adds Expansion Pack ships

Post 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?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Ship Library adds Expansion Pack ships

Post 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.).
Post Reply