Cannot remove Transformer Upgrade when "EnableKeysInGuis" Config option set to "False"
AtomicWaffle14 opened this issue ยท 10 comments
No not a bug. I just tried it. It works fine. My guess is: "Keybinding Conflicts"
I ran a test with no other mods installed, just IC2C on a blank profile. The issue is being caused by the EnableKeysInGuis config option being set to false. This will disable the functionality (outside of JEI usage) of the Alt key in guis.
Some kind of exception should be made in order to fix this. Having to leave the EnableKeysInGUIs option to True means that any time I type into JEI, typing certain letters will cause my character to do things I don't want them to do. It just would make sense for that not to happen by default anyways.
Yeah. On the other hand you can change it in game realitivly quickly.
Like Hit Esc => Go to ModSettings => Select IC2C => Select Config => Select Client => Change setting => Close gui.
Ok just to throw this information out. What if you have a machine set into a HighVoltage line. I have to make sure that you can not i mean can not pull out the upgrade on accident. Because if you do that. The machine will blow up. Do you want to have a machine blow up because of a accidental picking up of a upgrade?
So i have to use keybindings some how. Shift is a bad idea.
And here is the issue: MC has no i mean no Key Synchorinzation on its own. So i can not even check if a key is pressed because its client only. This feature is unique to the mod.
So tell me a good way to make this happen that isnt worse then this!
What i suggest you is make your keybindings settings so you dont conflict with jei.
Alright, so firstly, changing my keybindings so they don't conflict with JEI is very difficult, because in order to search by item name I have to type letters. This means potentially any letter key may be pressed, thus restricting my ic2 controls to a very small set of rather inconvenient to press keys, like punctuation, function keys, and the numpad.
Second, I have a couple of ideas that may solve the problem, although they may require some new code:
-
If the EnableKeysInGUIs option is set to true, do not display the message in the UIs saying that you can press it to remove the upgrade. Instead say that you must pick up the machine. Upon doing so, make any transformer/locked upgrades pop out.
-
The Alt key does nothing on it's own, unless pressed with another key, right? Would it be possible then to disable all keys except the Alt key when setting EnableKeysInGuis to false? This would definitely require some testing but theoretically it should work, unless the keybindings are all linked under some unchangeable behavior.
-
Add a separate keybinding that does not follow the EnableKeysInGuis rule and use that to remove locked upgrades. Also may be problematic based on how controls are linked
-
Add a small button in the machine interface that you must click in order to unlock locked upgrades. Add a precaution where it has a timer, twice click, or something to prevent accidents.
-
Lock transformer upgrades if and only if a cable, transformer upgrade, or power storage block is adjacent to the machine. This would require checking neighboring blocks. Is a machine capable of doing that?
I hope at least some of these ideas are good/doable. It just doesn't make sense to me in game that when I'm in a machine interface and I press the space bar while wearing a jetpack, my character will fly away from the machine I'm looking at.
Thanks for your hard work and consideration.
Ok i can give you at least 3 keys that you wont use within the game: Tab, Windows Key, Right Keys (Shift & Ctrl) which almost nobody uses unless he uses arrow keys but even then you can the opposite side.
To further my point: "Mouse Buttons" are also supported. I actually have the mode switch & Hotswitch key for jetpacks on to it.
About the Ideas:
- I might add that you have to have the config enabled so they are able to do so.
- Thats not wrong: Memory Stick (delete data), Wrench (alternative Rotation), MiningDrill (Use Scanner), Obsucrator (All side affect instead of 1 side), Quarry Scanner (Radius change), Upgrades (Setting owner), ItemLimiterUpgrade (settings). To give that point. The key has a lot of uses on its own. Some are even in guis itself.
- Sadly not possible since the entire network packet that is sending over the data is blocked with this. So the server doesnt get any changes delivered. In fact it gets send that all keys get unpressed. (Also same reason why the other 2 wont work either)
- Not really possible. Especially since i have to design the button for every machine that supports upgrades. Since all are different and have that enabled to make that feature workable. Also this would require a packet to be send that needs to be invalidated somehow over time since the data has to notify the server somehow. Interesting approach but not a good idea overall. Especially the data needs to be split between per player somehow.
- What if the cable has no power? Unlike other mods IC2 Cables are just "Holder" Objects that have no logic inside of them (except for detector/splitter cable). They are just litterly written the way that they handle as "Pathfinding" helper for the energynet. So you cant see if and how much energy is flowing through that line. Unless i rewrite that energynet for the 4-6th time?
Well you gave me a bug to fix at least. That the upgrade should tell that keys in guis should be enabled if not present.
Other then that, thanks for the comment but nope that wasnt helpful.
2. Thats not wrong: Memory Stick (delete data), Wrench (alternative Rotation), MiningDrill (Use Scanner), Obsucrator (All side affect instead of 1 side), Quarry Scanner (Radius change), Upgrades (Setting owner), ItemLimiterUpgrade (settings). To give that point. The key has a lot of uses on its own. Some are even in guis itself.
This is the big one. Nowhere have I been able to see the Alt key do anything outside of a gui without the need for a mouse button to be clicked. I have tested this with many different items (with KeysEnabledInGuis set to true). In addition, none of these items will activate when pressing the Alt key and mouse button when a gui is open, probably due to the way click events are treated. In conclusion, it is not actually necessary to disable the Alt key with KeysEnabledInGuis set to false in the first place. Then how do we let it through?
I have found a very simple solution that only requires changing a couple lines of code:
In ic2\core\platform\player\KeyboardClient.java, there is a function called sendKeyUpdate( ), which controls what keys are being sent to the server. The currentKeyState integer is being built from a series of bits that correspond to each keypress, with the Alt key being the first (conveniently). When the guiDissabled (typo?) setting is true, and a gui is open (mc.field_71462_r != null), the currentKeyState will be forced to 0, essentially nullifying all of the keys. It will also do this when the chat is opened (mc.field_71462_r instanceof net.minecraft.client.gui.GuiChat)).
However, because the Alt key does not need to be forced to 0, we can allow it through.
The if statement must be broken into two separate ifs, one for each condition. In the first (where guiDissabled and gui being open), have the currentKeyState be set to itself, logically ANDed with a 1. This will allow the first bit (Alt key state) through, while nullifying all other key states. Then, for the second if (where chat is open), have it set currentKeyState to 0.
Here is how I would change the code:
Does this make sense?
You could have just said "I don't want to change my code" at the beginning and I wouldn't have wasted a few hours of my time trying to find a solution for you. I'm sorry I like your mod and I want to improve it.
has nothing todo with "I dont want to change my code", its: I dont want to change this feature.
Gotcha. I'll stop bugging you then. :)
Edit: I just realized that there is a use for the Alt key on it's own, with the jetpack rocket mode. So it makes sense not to ignore that fact. I feel really dumb lol. A change to the tooltip, saying to break the machine to get it out, would make a lot more sense. Sorry about that.
You are aware that this is a intendet feature how it is programmed?
Removing part of this feature (what you are suggesting) is basically suggesting that i could just remove the entire config setting because you can never be sure if a addon or ic2c is going to use other things like that inside of a gui correct?
And since i am tired of that disscussion, i am going to close this and tell you. Live with it, or just dont use upgrades that have a transformer changing effect.
Or just break the machine with wrenches instead of removing transformer upgrades.
Anyway this is over now. Bye