Skip to content
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

Add a checkbox that uses net production instead of gross production for determining which recipes to display. #135

Merged
merged 3 commits into from
May 23, 2024

Conversation

DaleStan
Copy link
Collaborator

@DaleStan DaleStan commented May 22, 2024

For example, with the box checked, Kovarex enrichment will display as [snip previous confusing text] won't show up as a recipe option when attempting to consume U-235, nor when attempting to produce U-238.

image

I'm not sure we actually want this to be a checkbox, though. Should I make this always on instead?

@DaleStan DaleStan force-pushed the net-production-ce branch 2 times, most recently from 10abaa5 to 83573c1 Compare May 22, 2024 02:38
@veger
Copy link
Collaborator

veger commented May 22, 2024

I like to see both consumption and production sides, as it indicates that I need to find some way to start the process (the catalyst). So having this behind a checkbox would be nice (for me at least).

@veger
Copy link
Collaborator

veger commented May 22, 2024

Does coal liquefaction consume heavy oil

Yes it does! Now that I read this, I wondered if this is even a good change at all. A user might even forget to loop the oil back and their factory does not work anymore... (ofc they must not be paying too much attention to the game, but still)

veger
veger previously approved these changes May 22, 2024
Copy link
Collaborator

@veger veger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the design question, the code looks good to me

@DaleStan DaleStan marked this pull request as draft May 22, 2024 22:52
@DaleStan DaleStan marked this pull request as ready for review May 23, 2024 01:11
@DaleStan
Copy link
Collaborator Author

Sounds like a checkbox is the right choice, then. When I'm trying to produce U-238 or consume heavy oil, I don't want YAFC to suggest I add a line for Kovarex enrichment or Coal liquefaction.

DaleStan added 3 commits May 23, 2024 05:56
…or determining which recipes to display.

For example, with the box checked, Kovarex enrichment will display as producing only U-235, and as consuming only U-238.
You may want to produce fluid at the output temperature even if recipe consumes fluid overall.
@shpaass shpaass force-pushed the net-production-ce branch from bd03a80 to dd8b07f Compare May 23, 2024 03:56
@shpaass
Copy link
Owner

shpaass commented May 23, 2024

Updated the branch with a fresh master.

@shpaass
Copy link
Owner

shpaass commented May 23, 2024

Regarding the placement of the checkbox, what is the reasoning behind placing it on the welcome screen instead of Preferences?

My argument for using Preferences is that it's a change of view, when everything in the welcome screen affects the model itself.

The possible counter-argument might be that it's hard to put it in Preferences due to how the model is calculated, but it's just my guess why you implemented it like that.

@shpaass
Copy link
Owner

shpaass commented May 23, 2024

For example, with the box checked, Kovarex enrichment will display as producing only U-235, and as consuming only U-238.

It seems that it doesn't work.
With and without the net production enabled, the result is the same on vanilla Factorio.
Expected when enabled: With 1/s desired U-235, Kovarex consumes 3/s U-238 and produces 1/s U-235.
Actual result: 40/5 consumed and 41/2 of U-235/U-238 produced.

grafik

Same with the data on hover over the recipe:

grafik

@shpaass
Copy link
Owner

shpaass commented May 23, 2024

On a side note, that's some awesome documentation. Thank you very much!

@DaleStan
Copy link
Collaborator Author

DaleStan commented May 23, 2024

what is the reasoning behind placing [the checkbox] on the welcome screen

Yes, I put it on the Welcome screen because all of the changed code affected by that checkbox happens before the main screen appears. Putting it in the preferences windows is possible, but means duplicating some of the code in CalculateMaps (And maybe also in Dependencies.Calculate(), since the different links created by CalculateMaps create slightly different behavior in the Dependency Explorer.)

It seems that it doesn't work.
With and without the net production enabled, the result is the same on vanilla Factorio.

I wasn't clear about what I was changing.
The production table display itself is unchanged. The only intentional UI change is in these dropdowns, where you can select what recipes to add to the tables, and in the lists that appear when you click "Show full list":
image

There's also an unintentional change in the Dependency Explorer, which isn't great:
image
I'm inclined to put U-238 back into the dependents, but if end up moving the checkbox to the preferences it'll fix itself automatically.

@shpaass
Copy link
Owner

shpaass commented May 23, 2024

The only intentional UI change is in these dropdowns, where you can select what recipes to add to the tables

Alright! I confirm that this change works.

Copy link
Owner

@shpaass shpaass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting it in the preferences windows is possible, but means duplicating some of the code.

Since there are reasons for this setting to be on the welcome screen, then we can merge it as-is.

@shpaass shpaass merged commit 1e39ff6 into shpaass:master May 23, 2024
1 check passed
@DaleStan DaleStan deleted the net-production-ce branch June 5, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants