-
Notifications
You must be signed in to change notification settings - Fork 549
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
Evenly divide generated energy over all connected energy networks #3943
base: master
Are you sure you want to change the base?
Conversation
Pro Tip!
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀 |
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/3943/6e91c98f
|
What happens when an energy Network is fully saturated with power, I wouldn't expect the output of power to be divided like this if only one of the connected Networks is able to accept power? |
Oooh that's a great point, glad you brought that up |
Hmm. Yes. It'll still give the saturated energy network it's 'share' but that energy will just be voided. That definitely needs to be fixed. |
Fixed, right now it divides only among non saturated networks. However the supply holograms for the saturated networks show the supply the non saturated networks are getting. I was wondering if they should be like this or if they should display the supply they would be getting if they weren't saturated. |
src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java
Outdated
Show resolved
Hide resolved
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.
LGTM but want to get some more testing on this before we send it 👍
What if the connected energy network count exceeds the generator's power rate? It'll become 0. Not sure whether that is desired or not, but it could be an intended mechanic perhaps. |
I would say that would be intended. If there are more networks connected to a generator that the amount of the Joules it generates, each network would get <1 Joule which is floored to 0. You could also ceil the result of the division. The difference would be 1 Joule per network (max 6) which isn't very significant. |
I don't think the drop off is a problem. If we were to min it at 1 then that could lead to low level duplication if a generator only generated like 1-5 joules and gets split 6 ways. Plus if we want to give reasoning we can just say it's energy resistance being more an issue when using multiple regulators |
src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/energy/EnergyNet.java
Outdated
Show resolved
Hide resolved
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.
LGTM
Anyone up for testing this 👀 |
this still needs work. in placing 4 regulators and a lava generator, while all 4 went up nearly even, it was well above the rate that the lava generator produced. each went up 8 j/t, while the gen makes 10 total per tick, which created an excess of 22 per tick. additionally it sped up how fast the generator used up the lava. it's supposed to last 40 seconds, it lasted 10. then the amount of power in each network was way above what it should have been. this needs a lot more work |
Sooooooo not sure how you got those results. This PR can not affect how long the lava lasts. And I've tested this previously without issue. Are you sure you used the right tier of lava generator? |
I found out why. The pr didn't change how long the lava lasts, this was already the behavior before this pr. As for the excess power, that is because I only tested this for machines with no buffer 😅. The generated power is divided evenly |
The reason the lava went 4x as quick was because each energy net ticked it down. That happens regardless of this pr like iTwins said. Honestly I think that should be the behavior |
that would be fine if the power spread evenly as it should, and the total produced matched what the fuel would produce if just on one network |
iTwins if you can vc in a little bit to talk about some of this / make the changes necessary I'd be down. |
Description
When a generator was connected to multiple networks it supplied its full generated output to all connected networks.
Proposed changes
Evenly divide generated energy over all connected energy networks. output / networks.size * networks.size = output, so the generator will now produce the correct amount of energy when connected to multiple networks.
Related Issues (if applicable)
Resolves #3260
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values