Request for Help: 0.16 compatibility

Place to get help with not working mods / modding interface.
Post Reply
Strategic Sage
Inserter
Inserter
Posts: 35
Joined: Tue Jan 24, 2017 11:52 pm
Contact:

Request for Help: 0.16 compatibility

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

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Request for Help: 0.16 compatibility

Post 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.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Strategic Sage
Inserter
Inserter
Posts: 35
Joined: Tue Jan 24, 2017 11:52 pm
Contact:

Re: Request for Help: 0.16 compatibility

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

Strategic Sage
Inserter
Inserter
Posts: 35
Joined: Tue Jan 24, 2017 11:52 pm
Contact:

Re: Request for Help: 0.16 compatibility

Post 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!

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Request for Help: 0.16 compatibility

Post 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++).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Request for Help: 0.16 compatibility

Post 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.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding help”