Possible bug with displayNameForCommodity

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Possible bug with displayNameForCommodity

Post by phkb »

There seems to be a bug with the displayNameForCommodity function for non-core commodities (unless, of course, that displayNameForCommodity wasn't intended for this purpose!). For instance, using oxz's WIP "SolarHarvest" OXP, which has two additional commodities, "coronal_plasma", and "quirium_plasma", if I put this code into a startUpComplete routine I see the following:

Code: Select all

this.startUpComplete = function() {
	log(this.name, "coronal_plasma = " + displayNameForCommodity("coronal_plasma"));
16:58:47.276 [MyOxp]: coronal_plasma = coronal_plasma
And here's the trade-goods.plist entry for coronal_plasma, for reference:

Code: Select all

	"coronal_plasma" = {
		"name" = "Coronal Plasma";
		"capacity" = "-1";
		"classes" = ("oolite-dangerous","oolite-mining","oolite-rawmaterials");
		"comment" = "High energy plasma harvested from the corona of a star. The mixture is just sub-critical and save to transport. It is commonly used to extract Quirium from it to create Witchfuel or to further process it.";
		//"market_script" = "";
		"quantity_unit" = 0;  
		"peak_export" = 7; 
		"peak_import" = 0; 
		"price_average" = 0; //10;
		"price_economic" = 0; //0.2;
		"price_random" = 0; //0.04;
		"quantity_average" = 0; //33.5;
		"quantity_economic" = 0; //0.5;
		"quantity_random" = 0; //0.04;
		//"short_comment" = "Plasma harvested from the corona of a star.";
		"sort_order" = 2350;
		"legality_export" = 0;
		"legality_import" = 0;
		"trumble_opinion" = 0;
	};
Based on this, I should have seen "Coronal Plasma" instead of "coronal_plasma".
User avatar
Stormrider
Deadly
Deadly
Posts: 241
Joined: Sat Jan 25, 2014 2:35 am
Location: At work

Re: Possible bug with displayNameForCommodity

Post by Stormrider »

Has the author defined the name in a descriptons.plist? I had to create one for my commodity:

Code: Select all

{

	// Commodity names

	"commodity-name witchfire_whiskey"			= "Witchfire";


}
Image
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Possible bug with displayNameForCommodity

Post by phkb »

Ah! That might be the problem. I'll check...
Post Reply