-
Notifications
You must be signed in to change notification settings - Fork 9
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
Reintegrate KK with our fork of Kruise Kontrol with a remote API. #211
Conversation
Reminding myself here to check for left over references to old KK code |
|
Roger that about landing later, I will need to do a fuller review anyway. |
Yeah I mean I remember we literally had a whole debate back and forth and back and forth and... about when to land your changes. I just can't for the life of me remember what they are. Or how they'd work well with the deprecated function. I'm nominally fine with leaving this as it is if only because I'm around and if you don't get to tech debt I probably will. Makes me sad inside in any case. |
extra KK inputsYes, we can give them an obscure long keybind if we cannot just pass an empty string. our alt inputsThey work by overwriting the KK inputs in data-updates.lua, which is part of the whole build order thing. defining custom inputsYou can find the internal names given to keys on this page. https://wiki.factorio.com/Prototype/CustomInput weird cursor posI need to repro that because i have not encountered it before keeping remote view onI am sure we can do that new status reporting conceptI like the idea of a background sound like the crafting sound for conveying that KK is active. As for announcing the status, it is nice to do it when you first send a command and maybe it should also be possible on demand by pressing a keybind. |
regarding search by position. I'm pretty sure it only returns entities whose position is with the radius specified. So it doesn't use the entity bounding boxes when searching. |
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.
The changes in the code all seem to be good. I will test before final approval.
{ | ||
name = "fa-kk-cancel", | ||
type = "custom-input", | ||
linked_game_control = "toggle-driving", |
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.
Why is it intentionally linked to driving? The ENTER key was selected for convenience.
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.
Because of the linked game control, perhaps it might be that the cancel operation does not fire properly unless you are next to a vehicle.
end | ||
-- We screwed around with the running modifier. Put it back based on | ||
-- cursor mode. | ||
fix_walk(pindex) |
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.
Info: The thing about messing with walking is that telestep mode goes bonkers in multiplayer, so in this walking mode we intentionally force the player walking speed to become zero.
The new version of this file handles this matter correctly.
scripts/kruise-kontrol-wrapper.lua
Outdated
end | ||
-- If remote view was on turn it off. unclear if this is necessary now | ||
-- that KK isn't moving the mouse to work but it really doesn't hurt. | ||
toggle_remote_view(pindex, false, true) |
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.
We will need to test if we can remove this but I prefer to.
Test session results:
|
Ok so note that getting replies inline is a whole thing, so I'm going to put it here and then later I'm going to follow through on exploring VSCode's options for reviews which are probably better. To copy a bunch of stuff from Discord and some:
Note also I need to land the PR instead of you all. I'd normally use history rewrites but idk if either of you know how to deal with it and this is complex enough that people have to check out repo branches. As a consequence I'll be landing as an atomic commit with some squashing and/or history rewrites depending. Dealing with devs doing history rewrites in these cases is reasonably pedestrian and common in many projects if important devs to the project know how to deal with it. In all honestly Austin PRs are landed by Austin may be a good rule in general. |
Ok, pushed readme improvements. We've also maybe made the decision to fork KK ourselves for mod portal. Also the cancellation issues should be fixed. I would like to get an approval on this so that I can move on to other coding work while we figure out the rest, which is important in this case because I will end up needing to do rebases to keep this pr in my local copy (which I want because it's almost unbelievably better UX). We may wish to move the readme around. We can do so later but the section is now big enough that it really doesn't belong much in the keystrokes bit. Seems out of scope. We'll also have to backfill the link. |
Ok, regrettably I did have to just do a history rewrite. To deal with this (back up first if you don't know what these do):
The last is destructive and will take out any uncommitted local changes. |
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.
Review complete, changes made in line comments, README, and info.json. Testing comes next...
Maybe consider renaming the interface in the code to "kruise_kontrol_remote"? |
Toggling cursor mode and remote view can now be muted, while they are not muted by default.
I fixed a crash for when the character is missing and I cleaned up the muting options for when the cursor mode and remote view are toggled. |
I also just went ahead and formally named the magic constants that are the walking modes. This will be necessary for solving how to keep the cursor on and walking behavior work as intended. |
Testing looks good and keeping cursor mode on while KK is active turns out to be more complex than expected because it messes with movement rules. More thinking and testing will be needed for that later. At the moment this PR is good to merge, except maybe for renaming the remote interface to "kruise_kontrol_remote". Great work! |
The fork is at https://github.com/factorio-access/kk-remote
See remote.lua over there for the API (with documentation!).
This also includes some fixes, since I basically rewrote it anyway. And comments. Please check the accuracy of the comments.
basically what I did was add a remote API matching our needs. It can tell you whether it's active and whatever else. The strings changed a bit, in particular the walking string is now "moved to (x, y)" literally with the parens.
Of course there's a bunch of open questions. Firstly before continuing note that this is behind the ruler change by a commit, I'll rebase before landing. The rulers are too annoying, I can't actually play with them yet. At least fixing sounds is next on my list.
Anyway, a summary:
access.long-name
is annoying, can we just switch tofa
before going hard in that direction?)And now for the concerns, weirdness, and general questions.
Anyway I've done minimal testing. I'm thinking we don't land for like a week. It seems to work but this is a large change. To test it yourself remove the kk zip and clone the other repo directly to (case sensitive) Kruise_Kontrol_Updated.
I'll make issues or just fix them, but I noticed three things that should be followed up on:
schedule
in control.lua). There are much simpler, better ways which can balance work without inventing some new random modulus and shoving it somewhere. easy to fold this into my pending event handling rework.