Page 1 of 1

Request for Help: 0.16 compatibility

Posted: Mon Jan 15, 2018 10:04 pm
by Strategic Sage
Full disclosure: I am attempting to make an existing mod(Wear and Tear) usable with 0.16; the author has not been around for some while and I am not attempting any changes to the features, just making it functional with the new version.

I have managed to deal with a number of errors, but the latest situation is beyond my(limited) knowledge. I'd appreciate any guidance or assistance.

data-final-fixes requires smokebuilder.lua, which exists and has the following problematic section:

Code: Select all

local function make_smoke(gas)
	local smoke = util.table.deepcopy(data.raw["smoke"]["vented_smoke"]) 
	smoke.color = {r=1.0, g=1.0, b=1.0}
	if gas.flow_color then smoke.color = gas.flow_color end
	smoke.name = ("wt_smoke_" .. gas.name)
	data:extend({smoke})
end
This gives an error on loading, referencing the second line above(local smoke = ...) with the error text "attempt to index local 'smoke'. a nil value"

The "vented smoke" is declared in prototypes/items.lua, with the following:

Code: Select all

data:extend({
  {
    name = "vented_smoke",
    type = "Trivial smoke", 
The type was originally simply "smoke", but that threw an error declaring "smoke as entity shouldn't be used any more. Use Trivial smoke instead". And so I did, leading to the first error. I thought perhaps I should change from "smoke" to "Trivial smoke" in smokebuilder.lua as well, but when I do that the game declares "No loader found for 'Trivial Smoke'".

Thanks in advance for any ideas on how to resolve this.

Re: Request for Help: 0.16 compatibility

Posted: Tue Jan 16, 2018 12:56 am
by eradicator
As part of my general license awareness campaign (that i just invented) i just wanted to say that the original mod is licensed under MIT on the mod portal. Meaning you're almost free to do whatever you want with it, without consent of the author. :) as long as you include the license text.

On topic:

Smoke handline changed in 0.16, have a look at the changelog (probably 0.16.0 -> ctrl-f "smoke") for details. Looks like you're spelling the prototype wrong? "trivial-smoke" not "trivial smoke" - prototypes names don't have spaces.

Re: Request for Help: 0.16 compatibility

Posted: Tue Jan 16, 2018 2:18 am
by Strategic Sage
Thanks for the reply. If I'm understanding correctly though, "vented smoke" is the prototype name. "smoke" is the prototype type. Either way, changing from "Trivial smoke"(as the error message itself suggested) to "Trivial-smoke" made not the slightest bit of difference. Moreover, there is no Modding reference to smoke at all in the 16.0 changelog, or in any of several versions following that. The only mention of it comes in noting a performance improvement related to smoke in the engine itself. I also tried searching the Factorio API but I admit that if the answer is to be found there, I don't know exactly where to look.

Re: Request for Help: 0.16 compatibility

Posted: Tue Jan 16, 2018 2:28 am
by Strategic Sage
Resolved this particular issue in a rather dumb way: progress in the form of Factorio actually trying to load now after processing the mods. I'll add on to this thread if I find any more issues I can't resolve. Anyway, turns out that my mistake was trusting the error message that called it 'Trival smoke'. Turns out 'trivial-smoke' is accurate, which I discovered by happening upon it on the wiki. So it would appear your suggestion was mostly correct -- kudos!

Re: Request for Help: 0.16 compatibility

Posted: Tue Jan 16, 2018 4:40 am
by eradicator
You should bookmark the Classes page for searching in the API. It mentions three methods concerning smoke, There's no info about the prototype definition there ofc :/. And while 0.16.0 changelog does mention smoke it only says that surface.create_trivial_smoke was added. Not the most useful info i admit, but one can start guessing from there :P.

The wording is a bit difficult there. Actually correct would be something like "prototype type name" or something. But that aside the actual names of prototypes added by mods do also not normally contain spaces ;).

If you don't know how something works it's always a good idea to look at the base game files btw. E.g. \data\base\prototypes\entity\demo-entities.lua. Get a text editor that can search directories if you don't already have one (e.g. Notepad++).

Re: Request for Help: 0.16 compatibility

Posted: Tue Jan 16, 2018 8:59 am
by bobingabout
I had some issues with smoke I had to fix for my mods, but only on entities that I had duplicated and edited from base game, such as the locomotive.

All I did to fix the issue was update the lines with the new version in the base game.