-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
base: master
Are you sure you want to change the base?
Navmap Warp #31653
Conversation
does it also teleport to crew? could work as a temporary "follow on cameras" before the actual one |
Oh my god I love this |
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 |
I see, looking forward to it! |
Updated with a sound effect for the warp |
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 |
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? |
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.
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).
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); | ||
} | ||
|
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.
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.
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.
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
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 |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
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 |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Please merge this. Pleaseeee!!!! |
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
Changelog
🆑 Errant