altering fuel

Place to get help with not working mods / modding interface.
Post Reply
aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

altering fuel

Post by aober93 »

I need help. How do i find out where fuel values are stored, so i can mod them?

Afaik every value is stored in data.raw . Some sort of global table you can directly access.
I tried like /c game.player.print(data.raw.fuel.coal) but i get errors :?

anyone know whats wrong? (And sometimes it sais "attempt to index data ,a nil value" wtf i thought data has everything how can it be nil)

And whats a prototype exactly?

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: altering fuel

Post by prg »

Access to the data table is only available during the data loading stage, see Data Lifecycle.

You can see how the base game defines fuel values in data/base/prototypes/item/demo-item.lua and item.lua.

During runtime, you can access fuel values via LuaItemPrototype.fuel_value.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

Re: altering fuel

Post by aober93 »

k that helps alot! Im trying to modify recipes, but i dont know how the recipes are stored. I mean i checked "demo_recipes" for exampel wood. Do i like data.raw.{type = "recipe", name = "wood", ingredients = {{"raw-wood", 1}}, result = "wood", result_count = 2}

or data.raw.recipe.wood.result_count = 10 ?

Is it correct if i assume that the prototypes are in the form of "structure of (type,name,other attributes)", while data.raw is structured like data.raw.type.name.structure of (type,name,other attributes)? Because i checke one tutorial and it didnt tell exactly. It just pointed me at a lua file lol, and i dont know lua.

i tried to print it out, so i understand the structure ,no other way right?

Post Reply

Return to “Modding help”