Fractal Softworks Forum

Starsector => Mods => Topic started by: andylizi on December 14, 2021, 03:39:30 AM

Title: [0.95a] Dialog Minimap
Post by: andylizi on December 14, 2021, 03:39:30 AM
Dialog Minimap

(https://i.imgur.com/0KAeEwN.png)
(https://i.imgur.com/C5K2L3S.png)

This mod shows a minimap besides the dialog when it asks you to accept a mission. It's the same map as the one on Intel screen, with fuel range, accepted mission icons, etc.
That's all it does. It's a utility mod and can be added or removed at any time.

NOTE: This mod is unnecessary in 0.95.1a and above. See below.


Download: https://drive.google.com/drive/folders/1eV-lnIwCSDIWPLJ0-2dGed6yoLugwfmF?usp=sharing (https://drive.google.com/drive/folders/1eV-lnIwCSDIWPLJ0-2dGed6yoLugwfmF?usp=sharing)

Source code: https://github.com/andylizi/starsector-dialog-minimap

FAQ

Why?

Because I'm tired of going through series of "See mission -> Note down the star name -> Decline -> ESC, ESC -> Open Intel -> Find the star with that name -> Show on map -> Decide whether to accept -> Go to the bar -> Click on the mission -> Continue, continue -> Finally accept" every damn time.

Wait, doesn't vanilla already have this feature in 0.95.1a?

Ah, yes. Yes it does.

So for those who are interested, here's the timeline:
Quote
Missions will present the player with a map showing the initial destination/mission target's location.
                 — From the patch notes that I haven't looked at too closely the first time

this is how the game looked, with 0.95.1a + my mod
(https://i.imgur.com/YJCHg9m.png)
[close]
That's some really, really unfortunate timing... So after I came to terms with reality, I decided to release this anyway. Maybe it can be useful to those who are playing older versions?

Needless to say, you don't need this mod if you're playing 0.95.1a or above.

How does it work? / Why doesn't it work for [...] mission?

Originally I'm going to go into a lot more details on this, but now I'm tired and just want to get this over with. I'll be brief.


Title: Re: [0.95a] Dialog Minimap
Post by: Helldiver on December 14, 2021, 04:09:20 AM
Thank you for releasing it anyways, as it will be very handy for people who stay on 0.95a for mod reasons.
Title: Re: [0.95a] Dialog Minimap
Post by: Jaghaimo on December 14, 2021, 05:01:02 AM
Amazing mod, I applaud your technical prowess. This is going to be a great example of how to extend vanilla functionality in a way Alex didn't expect.

The more orthodox way of it would probably be via a MapAwareDialog class extending RuleBasedInteractionDialogPluginImpl, and hooking it via rules.csv. Still, can't guarantee it would work as well as yours. This would avoid having to inject it mid-way, and having to deal with reflection (which I find your use of really educational, especially the trick with OptionDelegateProbe).

Either way, great stuff. Been feasting on your code for a while now :)
Title: Re: [0.95a] Dialog Minimap
Post by: andylizi on December 14, 2021, 05:41:33 AM
Amazing mod, I applaud your technical prowess. This is going to be a great example of how to extend vanilla functionality in a way Alex didn't expect.

The more orthodox way of it would probably be via a MapAwareDialog class extending RuleBasedInteractionDialogPluginImpl, and hooking it via rules.csv. Still, can't guarantee it would work as well as yours. This would avoid having to inject it mid-way, and having to deal with reflection (which I find your use of really educational, especially the trick with OptionDelegateProbe).

Either way, great stuff. Been feasting on your code for a while now :)

Thank you for your kind words! Yeah, now that I think about it, extending RuleBasedInteractionDialogPluginImpl is definitely less hacky than my approach. Although it probably wouldn't save me much time, since constructing and configuring the map component is the much more difficult part. Without a proper API there's no way to completely avoid reflection, unfortunately.

Actually, my original attempt is even more extreme: I thought the only way to modify the UI is using javaagent + ASM to inject bytecode, like what Minecraft mods do… Fortunately I quickly found out there's a thing called reportShownInteractionDialog() that can potentially make it work using "just" reflection, so that's good I guess. The half-written code for that approach can be found in the "javaagent" branch of the repo, if anyone's interested.
Title: Re: [0.95a] Dialog Minimap
Post by: SirHartley on December 14, 2021, 06:42:24 AM
Amazing work!

Also, you are a prime contender for "most unfortunate mod release 2021". My condolences :P
Title: Re: [0.95a] Dialog Minimap
Post by: Alex on December 14, 2021, 10:34:28 AM
I feel like I should apologize - so, ah, my sincere apologies :) This is really impressive work, regardless!
Title: Re: [0.95a] Dialog Minimap
Post by: IonDragonX on December 14, 2021, 04:18:45 PM
Amazing work! Also, you are a prime contender for "most unfortunate mod release 2021". My condolences :P
@andylizi
I agree with SirHartley! You did an amazing bit of coding and took initiative on something that has been an issue for at least a year or, probably, more. Certainly, I don't have the experience needed to code what you did.

Please don't let this discourage you from your future creative endeavors.
Title: Re: [0.95a] Dialog Minimap
Post by: Jackundor on December 28, 2021, 02:42:05 PM
lmao
Title: Re: [0.95a] Dialog Minimap
Post by: Netu on December 28, 2021, 03:58:17 PM
Still super useful for any of us waiting for other "important" mods to update to the latest version!  So thanks, regardless!  Hopefully you learned a few tricks coding/otherwise from this?  :D
Title: Re: [0.95a] Dialog Minimap
Post by: Jaghaimo on December 29, 2021, 03:43:25 AM
There's many people still using 0.9.1a so perhaps it could be advertised as such? 0.9.1a and 0.95a "backport" of a crucial functionality.