using modifier values in a mod

Place to get help with not working mods / modding interface.
Cordina
Burner Inserter
Burner Inserter
Posts: 16
Joined: Fri Aug 12, 2016 4:54 pm
Contact:

using modifier values in a mod

Post by Cordina »

I have been looking on the internet and forum, but couldn't find a solution for my problem.
For a mod I'm working on, I need to get te value of a modifier used in the base game.
I don't have to use it on a new entity, I just need to read the value (i.e. the bonus given in the mining-drill-productivity-bonus).
Can anyone tell me how to read this value to be usable in the mod?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: using modifier values in a mod

Post by eradicator »

LuaForce.mining_drill_productivity_bonus
https://lua-api.factorio.com/latest/LuaForce.html
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.
Cordina
Burner Inserter
Burner Inserter
Posts: 16
Joined: Fri Aug 12, 2016 4:54 pm
Contact:

Re: using modifier values in a mod

Post by Cordina »

eradicator wrote:LuaForce.mining_drill_productivity_bonus
https://lua-api.factorio.com/latest/LuaForce.html
Just tried this one, but it doesn't seem to work.
The game throws an error: "attempt to index global 'LuaForce' (a nil value)"
So how can I read the value of the modifier to make use of it?
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: using modifier values in a mod

Post by eradicator »

A "LuaForce" is what factorio internally calls a team. Technology is per team, so if you want to read that you'll have to know what team you want to read it for. If you're having problems with that you should post some code and describe what you're trying to do instead of what you think the solution is.
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.
Post Reply

Return to “Modding help”