-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add preferences for "change-recipe-productivity" technology unlocks #334
Conversation
The first part is my fault. It's fixed now in #336.
Looking forward to that! I've always been bothered by the icon rendering bugs, but never enough to dig through how it all works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I have a mod that does this
Code
function deep_copy(t)
local t2 = {}
for k,v in pairs(t) do
if type(v) == "table" then
t2[k] = deep_copy(v)
else
t2[k] = v
end
end
return t2
end
data.raw.technology["steel-plate-productivity-1"] = data.raw.technology["steel-plate-productivity"]
data.raw.technology["steel-plate-productivity-2"] = deep_copy(data.raw.technology["steel-plate-productivity"])
data.raw.technology["steel-plate-productivity-3"] = deep_copy(data.raw.technology["steel-plate-productivity"])
data.raw.technology["steel-plate-productivity"] = nil
data.raw.technology["steel-plate-productivity-1"].max_level = nil;
data.raw.technology["steel-plate-productivity-2"].max_level = nil;
data.raw.technology["steel-plate-productivity-1"].name = "steel-plate-productivity-1"
data.raw.technology["steel-plate-productivity-2"].name = "steel-plate-productivity-2"
data.raw.technology["steel-plate-productivity-3"].name = "steel-plate-productivity-3"
data.raw.technology["steel-plate-productivity-1"].effects[1].change = 0.04
data.raw.technology["steel-plate-productivity-2"].effects[1].change = 0.06
data.raw.technology["steel-plate-productivity-1"].effects[2].change = 0.04
data.raw.technology["steel-plate-productivity-2"].effects[2].change = 0.06
(which I stuffed in postprocess.lua for testing)
then I get this.
This works, but only if I fill in the boxes correctly. If I forget to subtract 2 from my actual research level before sticking it in the "Steel plate productivity 3 level" box, or don't put 1s in the other boxes, the calculations will be wrong.
Yafc.Parser/Data/FactorioDataDeserializer_RecipeAndTechnology.cs
Outdated
Show resolved
Hide resolved
The data is read into both the technology and recipe so it can be used either way around
317d872
to
22df67f
Compare
@DaleStan thanks for the review, I've rebased on your changes from #336 and included a little bug fix for calculating the max height too How would you feel about me splitting that code with mods into a follow up PR to keep this one clean? I have an idea of how to fix it but probably need to spend some more timing thinking about how to implement nicely, there seem to be a bunch of fun edge cases around defining multiple levels of technologies Code
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@will14smith Yeah, there's a lot of "fun" going on with the multi-level technologies. As long as you're aware of it and have a plan, I'm OK with merging.
I was playing over the weekend and needed this to plan out my factory, based on the discussion in #331 this would be option 3
I had to move the "done" button to the top of the screen to avoid it overlapping with the levels, and I couldn't quite figure out how to make a scrollable box
I'm happy to split the PR into the parsing/calculating change vs the UI change if you think there's a nicer UI to be had :)
Screenshots
Preferences screen:
(I have some WIP commits that fix the icon rendering too, I'll clean them up soon)
No tech unlocked:
Level 10 plastic (+100% productivity) unlocked: