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 network signal insulators #3963

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

iTwins
Copy link
Contributor

@iTwins iTwins commented Sep 3, 2023

Description

A feature for energy and cargo networks to stop nodes from connecting.

Proposed changes

Add 2 items, 1 for energy and 1 for cargo, that you can place in between network nodes to stop them form connecting.
To accomplish this the following is necessary:

  • Add INSULATOR to the network and energy component enums to classify them.
  • Stop discovering neighbors in the current direction if an insulator is found.
  • If an insulator is placed inside the network, rebuild it.
  • if an insulator is broken inside the network update all its neighbors that are connected to the network.

Related Issues (if applicable)

Implements approved suggestion #1652

Checklist

  • I have fully tested the proposed changes and promise that they will not break everything into chaos.
  • I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
  • I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.16.* - 1.20.*).
  • I followed the existing code standards and didn't mess up the formatting.
  • I did my best to add documentation to any public classes or methods I added.
  • I have added Nonnull and Nullable annotations to my methods to indicate their behaviour for null values
  • I added sufficient Unit Tests to cover my code.

@iTwins iTwins requested a review from a team as a code owner September 3, 2023 02:13
@github-actions github-actions bot added the 🎈 Feature This Pull Request adds a new feature. label Sep 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2023

Your Pull Request was automatically labelled as: "🎈 Feature"
Thank you for contributing to this project! ❤️

@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2023

Slimefun preview build

A Slimefun preview build is available for testing!
Commit: 813b55b7

https://preview-builds.walshy.dev/download/Slimefun/3963/813b55b7

Note: This is not a supported build and is only here for the purposes of testing.
Do not run this on a live server and do not report bugs anywhere but this PR!

Copy link
Contributor

@J3fftw1 J3fftw1 left a comment

Choose a reason for hiding this comment

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

quick review

@J3fftw1 J3fftw1 added the 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced. label Sep 3, 2023
@J3fftw1
Copy link
Contributor

J3fftw1 commented Sep 3, 2023

I like this feature, only worried about performance on this.
Can we maybe get some testing on performance on it.

Also we need some general testing on this. This is a major change for 2 essential things in Slimefun.
We should block this till it has been tested a bunch

@Sefiraat
Copy link
Member

Sefiraat commented Sep 3, 2023

Agreed, needs some good testing :)

@J3fftw1
Copy link
Contributor

J3fftw1 commented Sep 3, 2023

Can we also get a toggle on this maybe within a gui.
I think the reason few years ago was that people wanted this because the matter fabracitor uses so much energy and more machines do these days.
A toggle would solve this problem.

@iTwins
Copy link
Contributor Author

iTwins commented Sep 3, 2023

Can we also get a toggle on this maybe within a gui. I think the reason few years ago was that people wanted this because the matter fabracitor uses so much energy and more machines do these days. A toggle would solve this problem.

What about right clicking the insulator to enable/disable it?

Also yes, please test this a lot. I have tried my best to break this already, but I would feel a lot safer if someone else tested this as well.

@J3fftw1
Copy link
Contributor

J3fftw1 commented Sep 3, 2023

Yes that’s fine by me as well

@Boomer-1
Copy link

both cargo and energy insulators seem to be working as intended. my suggestion would be alter the appearance as the only difference is a white dot on the top.

@iTwins
Copy link
Contributor Author

iTwins commented Nov 23, 2023

Have you tested this with a large network or small network?
Also if anyone if up for designing better textures, please send the file or the base64 encoded string :DD.

@Boomer-1
Copy link

i didnt have a large network setup to test on. it was a pretty basic one

@iTwins
Copy link
Contributor Author

iTwins commented Nov 23, 2023

Alright, good to know. Maybe someone with a big network setup can also test this a little?

Comment on lines +256 to +257
for (int i = 1; i <= getRange(); i++) {
Location newLocation = l.clone().add(i * xDiff, i * yDiff, i * zDiff);
Copy link
Member

Choose a reason for hiding this comment

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

Slightly confused by this. What is this method supposed to do?

As it is written I don't see it ever being useful to pass anything but one unitary value (with sign) and two zeros, like you do below, therefore the method only updatesNeighbors in one direction.
But then the question arises on whether this format even makes sense, it would be a lot more readable (though not as compact) if it accepted a BlockFace at that point.

Was the idea just to avoid having to "decode" what versor each BlockFace refers to?

Copy link
Contributor Author

@iTwins iTwins Dec 8, 2023

Choose a reason for hiding this comment

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

This method checks if any Locations need to be added to the network when an insulator is broken.

It indeed is intended to only check the 6 directions in which a network can connect. The reason I went with this signature is because the method is similar to discoverNeighbors and that used the same way of passing the arguments. If you'd rather have the method take a BlockFace I would be happy to change it. Then perhaps discoverNeighbors should also be changed to take a BlockFace for consistency sake.

Copy link
Member

Choose a reason for hiding this comment

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

Oh my god I had not even noticed the other one. If you could make both accept a blockface that would be awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎈 Feature This Pull Request adds a new feature. 🎯 Needs testing This Issue needs to be tested by our team to see if it can be reproduced.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants