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

Navmap Warp #31653

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

Navmap Warp #31653

wants to merge 13 commits into from

Conversation

Errant-4
Copy link
Member

@Errant-4 Errant-4 commented Aug 30, 2024

About the PR

Specific entities can now teleport using a navmap (or any navmap-inheritors such as the Crew Monitor)
Simply Alt-Click (Alternate Activate Item In World) on the map screen, and you are teleported to that location

Why / Balance

The AI Eye and aghosts can now get around the station more easily and quickly. A case could be made that regular ghosts should also be given some sort of navmap and this power, but currently only aghosts and AI Eyes are allowed.
#31543 asked for AI Ghost Warp

Technical details

Upon the specified input, client calculates the global coordinates at the cursor, gets the player's current entity, and sends a network event to the server. Server checks for the required component that allows warp, replaces the requesting entity with it's EyeComponent.Target if there was one, then teleports the entity to the specified location. There are no collision checks due to everything that is expected to use this being incorporeal

There is also no limit to where this can go, by scrolling the map away from the station any arbitrary distance can theoretically be reached. I don't know why anyone would do that. This creates a "stuck" state since there is no Crew Monitor available offgrid, but an AI's Go Home ability or GhostWarp can bring the player back to the station.

Media

original video
https://github.com/user-attachments/assets/0752a807-b410-402c-a6ba-3c14ac3a8a24

Now with a sound effect to better communicate to the brain "something happened"

warpsound.mp4

Requirements

  • I have read and I am following the Pull Request Guidelines. I understand that not doing so may get my pr closed at maintainer’s discretion
  • I have added screenshots/videos to this PR showcasing its changes ingame, or this PR does not require an ingame showcase

Changelog

🆑 Errant

  • add: The AI Eye can now teleport to any location on the station by Alt-Clicking on the Crew Monitor map.

@Errant-4 Errant-4 requested a review from DrSmugleaf as a code owner August 30, 2024 18:54
@github-actions github-actions bot added the S: Needs Review Status: Requires additional reviews before being fully accepted label Aug 30, 2024
@Everturning
Copy link

does it also teleport to crew? could work as a temporary "follow on cameras" before the actual one

@ScarKy0
Copy link
Contributor

ScarKy0 commented Aug 30, 2024

Oh my god I love this
Once this gets merged the crew monitor just needs a search bar to look for specific people and thats basically AI warping done

@Errant-4
Copy link
Member Author

Errant-4 commented Aug 30, 2024

does it also teleport to crew? could work as a temporary "follow on cameras" before the actual one

It can only teleport to location, so if you want to teleport to a certain crewmember you have to click on the crewmember's list entry to filter to their dot on the map, locate it visually, then teleport to that location

@ScarKy0
Copy link
Contributor

ScarKy0 commented Aug 30, 2024

It can only teleport to location, so if you want to teleport to a certain crewmember you have to click on the crewmember's list entry to filter to their dot on the map, locate it visually, then teleport to that location

Any chance a "Search" field could be added to the crew monitor then? Or is that for an entirely different PR?

@Errant-4
Copy link
Member Author

It can only teleport to location, so if you want to teleport to a certain crewmember you have to click on the crewmember's list entry to filter to their dot on the map, locate it visually, then teleport to that location

Any chance a "Search" field could be added to the crew monitor then? Or is that for an entirely different PR?

I might look into that, but on a different PR

@ScarKy0
Copy link
Contributor

ScarKy0 commented Aug 30, 2024

I might look into that, but on a different PR

I see, looking forward to it!

@Errant-4
Copy link
Member Author

Errant-4 commented Sep 1, 2024

Updated with a sound effect for the warp

@Errant-4
Copy link
Member Author

Errant-4 commented Sep 2, 2024

I'm starting to hear that there is some sort of "pop" in one of the three static samples that can play, I might swap out that one for an alternate

@nymhole
Copy link

nymhole commented Sep 4, 2024

you should allow the map to have an adjustable size, WHEN DOES THIS MERGE. i guess it merges when ai can use crew monitor correctly?

@TheShuEd TheShuEd mentioned this pull request Sep 10, 2024
16 tasks
Copy link
Contributor

@metalgearsloth metalgearsloth left a comment

Choose a reason for hiding this comment

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

I think this should just be stationmap only / a dedicated control rather than diluting other ones with functionality, especially because if you accidentally misclick on power or whatever it can be annoying. I've asked other maints for their opinion on it.

Also this needs a do_after to mask the pop-in because it will be pretty bad on live (live entity counts are significantly higher than dev).

Content.Shared/Maps/NavMapWarpComponent.cs Outdated Show resolved Hide resolved
Content.Shared/Maps/NavMapWarpComponent.cs Outdated Show resolved Hide resolved
Content.Shared/Pinpointer/SharedNavMapSystem.cs Outdated Show resolved Hide resolved
Comment on lines 93 to 124
public void RequestWarpTo(EntityUid uid, Vector2 target)
{
var message = new MapWarpRequest(GetNetEntity(uid), target);
RaiseNetworkEvent(message);
}

private void OnMapWarp(MapWarpRequest args)
{
var uid = GetEntity(args.Uid);

// This was only tested with the AI Eye but should theoretically work with any other future remote-controlled things
if (TryComp<EyeComponent>(uid, out var eye) && eye.Target is not null)
uid = eye.Target.Value;

if (!TryComp<NavMapWarpComponent>(uid, out var warpComp))
return;

var xform = Transform(uid);

if (xform.MapUid is null)
return;

var index = _random.Next(warpComp.Sounds.Count);
_audio.PlayGlobal(warpComp.Sounds[index],
GetEntity(args.Uid),
AudioParams.Default.WithVariation(warpComp.PitchVariation));

// This was designed for incorporeal entities, thus there aren't any collision checks or anything
_transformSystem.SetCoordinates(uid, xform, new EntityCoordinates(xform.MapUid.Value, args.Target));
_transformSystem.AttachToGridOrMap(uid, xform);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you're better off just making it a BUI event so it gets validation done.

Also the audio should be predicted instead. Also don't do multiple transformsystem calls as it will double the amount of moveevents that get raised which are extremely expensive, just set the position once. Use PlaceAt or the likes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Audio is now predicted. I have removed the AttachToGridOrMap call entirely, because it does not actually seem to bee needed at all (it was mostly just skipped by checks anyway).

There is now also a 2 second "cooldown" on warps so they can't be spammed

@metalgearsloth metalgearsloth added S: Awaiting Changes Status: Changes are required before another review can happen and removed S: Needs Review Status: Requires additional reviews before being fully accepted labels Sep 11, 2024
@ScarKy0
Copy link
Contributor

ScarKy0 commented Sep 11, 2024

@metalgearsloth

I think this should just be stationmap only / a dedicated control rather than diluting other ones with functionality

I think it shouldnt be stationmap, at least a crew monitor so you can see where the people requesting you are, stationmap doesnt tell you anything about whoever calls you to do anything

@slarticodefast slarticodefast added the S: Undergoing Maintainer Discussion Status: Currently going through an extended discussion amongst maintainers, as per procedure. label Sep 11, 2024
@github-actions github-actions bot added the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Sep 17, 2024
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Sep 26, 2024
@chromiumboy
Copy link
Contributor

chromiumboy commented Oct 16, 2024

I agree with Sloth about using a BUI event for initiating the warp request, rather than calling the method directly from the client

Also, regarding the point Sloth raised on the Discord discussion, you really should consider using ViewSubscriberSystem.AddViewSubscriber to get PVS updates from the area prior to warping in. Just use RemoveViewSubscriber when your finished warping

Otherwise the code looks good to me, tested fine

@github-actions github-actions bot added the S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted label Oct 23, 2024
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@SlamBamActionman SlamBamActionman added the S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. label Nov 14, 2024
@eoineoineoin eoineoineoin added P3: Standard Priority: Default priority for repository items. T: New Feature Type: New feature or content, or extending existing content D3: Low Difficulty: Some codebase knowledge required. A: General Interactions Area: General in-game interactions that don't relate to another area. T: Of Admin Interest Type: Affects administration work a lot, and might require admins to weigh in on and removed S: Untriaged Status: Indicates an item has not been triaged and doesn't have appropriate labels. labels Nov 20, 2024
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added size/M Denotes a PR that changes 100-999 lines. Changes: Audio Changes: Might require knowledge of audio. and removed S: Merge Conflict Status: Needs to resolve merge conflicts before it can be accepted labels Dec 18, 2024
@Niomi0
Copy link

Niomi0 commented Jan 29, 2025

Please merge this. Pleaseeee!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: General Interactions Area: General in-game interactions that don't relate to another area. Changes: Audio Changes: Might require knowledge of audio. D3: Low Difficulty: Some codebase knowledge required. Merge Conflict P3: Standard Priority: Default priority for repository items. S: Awaiting Changes Status: Changes are required before another review can happen S: Undergoing Maintainer Discussion Status: Currently going through an extended discussion amongst maintainers, as per procedure. size/M Denotes a PR that changes 100-999 lines. T: New Feature Type: New feature or content, or extending existing content T: Of Admin Interest Type: Affects administration work a lot, and might require admins to weigh in on
Projects
None yet
Development

Successfully merging this pull request may close these issues.