Possible bug with displayNameForCommodity

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

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
phkb
Commodore
Commodore
Posts: 2433
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Possible bug with displayNameForCommodity

Post by phkb » Wed Apr 27, 2016 7:44 am

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: 211
Joined: Sat Jan 25, 2014 2:35 am
Location: Skiing the Rice Ridge burn

Re: Possible bug with displayNameForCommodity

Post by Stormrider » Wed Apr 27, 2016 1:36 pm

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";


}
Realize collective conscious creation

User avatar
phkb
Commodore
Commodore
Posts: 2433
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Possible bug with displayNameForCommodity

Post by phkb » Wed Apr 27, 2016 9:42 pm

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

Post Reply