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

Goto GUI (Jump to Player) #116

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MattSturgeon
Copy link
Member

@MattSturgeon MattSturgeon commented Nov 22, 2023

Goto GUI

(Originally "Jump" GUI, now renamed to "Goto". Open to other suggestions.)

This feature allows the user to view a list of useful targets (currently players within render distance) and then teleport Freecam to the selected target.

Freecam is automatically enabled if required.

Motivation

@TangoTek has been using a freecam mod in order to spectate players of his game Decked Out 2. However he often looses sight of the player and struggles to locate them. On such occasions he's expressed a wish for features that'd better enable freecam to locate and track nearby players.

This PR hopes to aid in locating players, active tracking/following/spectating is left out of scope, to be addressed by other issues.

Status

This PR is functional and lightly tested. The PR needs some further polish and iteration before it should be merged, however review, feedback and testing are still greatly appreciated.

Marking as draft for now.

Video

Some translation strings have changed since recording this video:

2023-11-22.11-26-05.trimmed.mp4

TODO

  • New keybind to toggle Goto GUI (default G)
  • In-Game GUI lists players that are in-range
  • Avoid listing players-in-range on modrinth build
  • GUI list is updated dynamically as players leave/join render distance
  • GUI search filter and alphabetical sorting
  • GUI supports keyboard navigation and double-clicking
  • Configurable initial perspective
  • "Tab" system ready for being able to jump to other targets, perhaps managing tripods?
  • Actually support teleporting Freecam to target player
  • Optional notification when teleporting
  • Iterate on design if required

Follow on goals (separate issues)

  • A (client-sided) command with the same functionality.
  • An additional tab for Tripod locations (opening, closing, & resetting).
  • An additional "tab" that allows users to jump to arbitrary (non-player-related) co-ordinates.
  • An additional "tab" where users can bookmark arbitrary jump locations
    • Ability to filter in-range bookmarks
    • Bookmarks should persist on local storage.
  • A button to "follow" or "spectate" a player instead of simply jumping to them (using something like I hacked in a spectator-like follow mode #115).

@MattSturgeon MattSturgeon changed the title Jump2 Jump to Player (GUI) Nov 22, 2023
@hashalite
Copy link
Collaborator

This is seriously impressive, thanks for taking the time to implement this, and your continued dedication to improving this mod! It's definitely something I would consider merging after some additional testing and polishing has been done.

This would probably have to be blocked off to the Modrinth version unless someone (lol) wants write something to detect whether the target is accessible without NoClip. Providing a list of players in render distance may also be problematic here, I would have to check with Modrinth staff.

@MattSturgeon MattSturgeon marked this pull request as ready for review December 4, 2023 01:02
@MattSturgeon
Copy link
Member Author

MattSturgeon commented Dec 4, 2023

Marking this as ready to review, since the actual changes now feel more-or-less done. I still want to cleanup the history and rebase once related commits are merged.

Namely, Hack-fix common resources missing at runtime is part of #122 and Cleanup translatable config enums is part of #121.

Some of the positioning consts & magic numbers could also be improved, but this feels like a loosing battle with GUI code...


This would probably have to be blocked off to the Modrinth version

Yes, I think so. It's a shame, as it is only the players within render distance, but I can see how it could be abused for cheating.

@MattSturgeon
Copy link
Member Author

MattSturgeon commented Dec 30, 2023

Marking this as ready for review again.

It will still need rebasing and a bunch of squashing, but I think the actual changes are more or less there. I'm ready to get some thoughts/suggestions/feedback/etc.

I'll probably try to add some more javadocs too. Let me know if there's anything in particular you feel would benefit from some docs or comments.

This would probably have to be blocked off to the Modrinth version

Done, see this method.

@MattSturgeon MattSturgeon marked this pull request as ready for review December 30, 2023 10:52
@MattSturgeon MattSturgeon changed the title Jump to Player (GUI) Goto GUI (Jump to Player) Jan 3, 2024
Introduce `.get()`, `.save()`, & `.getConfig()`.

No need to set `@Excluded` on a static field.
Move "perspective" concept to `FreecamPosition`.

Move `isInRange` to `FreecamPosition`.
Enables Freecam if not already.

Teleports freecam to the specified `FreecamPosition`.

Intended for use by "Goto GUI".
Adds a GUI which allows jumping freecam to a player within render distance.

Limited on Modrinth to `MC.player`.

Could be expanded in future with tripod locations and other "saved" positions.
The `Tab` implementation provides a method to produce a list of `TargetListEntries`.

Currently, the only implementation is `PlayerTab`, which provides a list of `PlayerListEntries` & a "perspective" button.
Comment on lines +129 to +131
// FIXME this will move the camera to the default position and show a notification,
// even though we'll move the camera and show our own notification immediately after.
toggle();
Copy link
Member Author

Choose a reason for hiding this comment

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

Can probably reword this so it is less severe; doesn't need to be a FIXME if we're happy with the current behavior?

Should at least note that we do want to use the default msg.freecam.enable notification when gotoNotify is disabled and notifyFreecam isn't.

@MattSturgeon
Copy link
Member Author

MattSturgeon commented Jan 4, 2024

I think I'm happy to call this "finished" pending any feedback or requested changes.

The first three-or-four commits are really "prepping" the codebase for the meat of this PR, which is in the final few commits. Those initial prep commits could be moved to dedicated PRs if it makes this easier to review.

That said, I've deliberately cleaned up the commit history such that you can review the commits individually, without having to go through the entire PR in one go.

The last round of rebases were on my laptop, so I'll test them properly when I get chance.

@MattSturgeon MattSturgeon added the enhancement New feature or request label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants