Make recipe allowed producitivity Module
-
- Inserter
- Posts: 23
- Joined: Mon Apr 29, 2013 4:49 pm
- Contact:
Make recipe allowed producitivity Module
I want to try change recipe as to allow producitivity Module work but I can not not figure how one goes about it and I can't figure it out from looking at the files .
Re: Make recipe allowed producitivity Module
If you open the data\base\prototypes\item\module.lua file you'll see on line 66 a function which returns a table of names (I'm not sure if they are item names or recipe names to be honest), which is used to provide a limitation table to the productivity modules. Since that is the case I would think that using something like the below (inside of a mod's data.lua that is loaded after the base game) would work
To change the beacon to allow productivity modules I think you'd need to use something likesince the beacons have a list of allowed_effects defined in their entity definition (data\base\prototypes\entity\entities.lua). Obviously you could use a for loop over the data.raw.beacon table instead (to change mod added beacons), I chose to just index the basic beacon since it's the only one in the base game
Code: Select all
for k, v in pairs(data.raw.module) do
if v.name:find("productivity-module") then
v.limitation = {} -- empty limitation table
end
end
Code: Select all
table.insert(data.raw.beacon["basic-beacon"].allowed_effects, "productivity")
-
- Inserter
- Posts: 23
- Joined: Mon Apr 29, 2013 4:49 pm
- Contact:
Re: Make recipe allowed producitivity Module
Nice know but does not help me since aim get recipe blast furnace(dytech) recipes to accept productivity module. Unfortunately find no hint purposely add some thing too prevent it from happening.
Re: Make recipe allowed producitivity Module
ah, my apologies The blast furnace machine doesn't allow any module, to allow it to, useomagaalpha wrote:blast furnace recipes
in general it's data.raw["machine-type"]["machine-name"].module_slots = number_of_slots and ...allowed_effects = {list_of_allowed_module_types} (though not all types allow modules, the assembling-machine obviously does )data.raw["assembling-machine"]["blast-furnace"].module_slots = 2
data.raw["assembling-machine"]["blast-furnace"].allowed_effects = {"consumption", "speed", "productivity", "pollution"}
just make sure that in your mod's info.json you set the dependency to ["mod-name-you-are-changing-taken-from-their-info-file >= the-mod-version-from-info"] so a dependency for dytech-metallurgy would be "dependencies": ["base", "DyTech-Metallurgy >= 1.0.0"], you can leave off the >= version if you're lazy The dependency makes the mod you're modifying load first (so that the data is actually there for your mod to change)
-
- Inserter
- Posts: 23
- Joined: Mon Apr 29, 2013 4:49 pm
- Contact:
Re: Make recipe allowed producitivity Module
Unfortunately did that already and double check nothing it did not work(I apologize for not telling you that I did that part).
How do go about remove few item from limitation list(assume somehow those item is on it)?
Edit: Good news Dytech module(4+) don't obey limitation list heehe.
How do go about remove few item from limitation list(assume somehow those item is on it)?
Edit: Good news Dytech module(4+) don't obey limitation list heehe.
Re: Make recipe allowed producitivity Module
sorry for the delay, I had to figure out why it wasn't working
So, the mistake I made on removing the limitations with the code earlier is that I used a '-' with string.find and '-'s are a special character when pattern matching so it needs to be escaped with a '%'...obviously still not an expert at lua
this worked for me (though I was lazy and just stuck it at the end of the metallurgy data.lua file)
So, the mistake I made on removing the limitations with the code earlier is that I used a '-' with string.find and '-'s are a special character when pattern matching so it needs to be escaped with a '%'...obviously still not an expert at lua
this worked for me (though I was lazy and just stuck it at the end of the metallurgy data.lua file)
Code: Select all
data.raw["assembling-machine"]["blast-furnace"].module_slots = 2
data.raw["assembling-machine"]["blast-furnace"].allowed_effects = {"consumption", "speed", "productivity", "pollution"}
for k, v in pairs(data.raw.module) do
if v.name:find("productivity%-module") then
v.limitation = nil -- empty limitation table
v.limitation_message_key = nil
end
end
hm, seems they don't I suppose that would be the 'legit' way to do this thenomagaalpha wrote:Edit: Good news Dytech module(4+) don't obey limitation list heehe.
-
- Inserter
- Posts: 23
- Joined: Mon Apr 29, 2013 4:49 pm
- Contact:
Re: Make recipe allowed producitivity Module
Maybe don't how wonder possible go through limitation table remove only molten(like molten-copper,molten-iron,molten-carbonated-iron) items from the list?
Re: Make recipe allowed producitivity Module
Well, the thing is that none of the dytech stuff is obviously written in the base And I don't see anywhere that Dysoch modified the base modules (and if he did I'm not sure why he wouldn't have made his modules limited as well...). As such, I've no idea how to make just the blast-furnace recipes able to use the productivity modules.omagaalpha wrote:remove only molten
here's the list of limitations from the item module.lua file (in base)
list
edit: had a thought, it may be that these are a list of the recpies that are allowed to be used...that kind of makes sense but not what I was thinking as such it'd only be a matter of adding to the list the DyTech recipe names that should be allowed as well
similar to the code I used above to set it to nil (meaning allow all) but instead use table.insert(v, "recipename"), could use a second for loop over a table of names like so
Code: Select all
for k, v in pairs(data.raw.module) do
if v.name:find("productivity%-module") and v.limitation then
for _, recipe in ipairs({table_of_dytech_recipe_names}) do
table.insert(v.limitation, recipe)
end
end
end
-
- Inserter
- Posts: 23
- Joined: Mon Apr 29, 2013 4:49 pm
- Contact:
Re: Make recipe allowed producitivity Module
Got around implementing code and it work like charmed. So thank you for the help.
Re: Make recipe allowed producitivity Module
No problem, glad it works I learned something as well since I'd never gotten around to seeing how the production module limitation had been implemented myselfomagaalpha wrote:Got around implementing code and it work like charmed. So thank you for the help.
Re: Make recipe allowed producitivity Module
I know this is from 5 years ago but this is some really basic, important information that's not in the wiki or the stickied tutorial thread. The code is different from what Angel and Bob's Mods seem to use, but I couldn't figure out how to repurpose them while this worked right out of the box.
If you're still around to read this, thanks for the help!
If you're still around to read this, thanks for the help!
Re: Make recipe allowed producitivity Module
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Make recipe allowed producitivity Module
Sorry, I meant in the tutorial in the wiki. You've got documentation so you've done your job as a developer!