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
Posted: Wed Jul 09, 2014 7:55 pm
by FreeER
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
since 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
Re: Make recipe allowed producitivity Module
Posted: Wed Jul 09, 2014 8:35 pm
by omagaalpha
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
Posted: Wed Jul 09, 2014 8:55 pm
by FreeER
omagaalpha wrote:blast furnace recipes
ah, my apologies The blast furnace machine doesn't allow any module, to allow it to, use
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 )
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)
Re: Make recipe allowed producitivity Module
Posted: Wed Jul 09, 2014 9:17 pm
by omagaalpha
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.
Re: Make recipe allowed producitivity Module
Posted: Wed Jul 09, 2014 10:06 pm
by FreeER
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)
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
omagaalpha wrote:Edit: Good news Dytech module(4+) don't obey limitation list heehe.
hm, seems they don't I suppose that would be the 'legit' way to do this then
Re: Make recipe allowed producitivity Module
Posted: Wed Jul 09, 2014 10:22 pm
by omagaalpha
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
Posted: Wed Jul 09, 2014 10:31 pm
by FreeER
omagaalpha wrote:remove only molten
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.
here's the list of limitations from the item module.lua file (in base)
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
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
Re: Make recipe allowed producitivity Module
Posted: Fri Jul 11, 2014 12:14 pm
by omagaalpha
Got around implementing code and it work like charmed. So thank you for the help.
Re: Make recipe allowed producitivity Module
Posted: Fri Jul 11, 2014 12:23 pm
by FreeER
omagaalpha wrote:Got around implementing code and it work like charmed. So thank you for the help.
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 myself
Re: Make recipe allowed producitivity Module
Posted: Wed Jun 05, 2019 1:39 am
by BEEFE
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!
Re: Make recipe allowed producitivity Module
Posted: Wed Jun 05, 2019 7:45 am
by Bilka
BEEFE wrote: Wed Jun 05, 2019 1:39 am
I know this is from 5 years ago but this is some really basic, important information that's not in the wiki.