Fractal Softworks Forum

Starsector => Mods => Topic started by: theDragn on July 25, 2021, 04:10:45 PM

Title: [0.97a] WhichMod 1.2.2a
Post by: theDragn on July 25, 2021, 04:10:45 PM
Have you ever posted "which mod is this ship from?" Well, have I got the mod for you!
WhichMod
(https://img.shields.io/github/downloads/theDragn/whichmod/total?style=for-the-badge) (https://github.com/theDragn/whichmod/releases/download/1.2.2/WhichMod_v1.2.2a.zip)

This mod adds the mod title to the descriptions of all weapons, ships, fighters, and hullmods added by mods.

Example:
(https://raw.githubusercontent.com/theDragn/whichmod/master/example.png)

Also has the option to use abbreviations instead of the full mod name, and will let you choose the abbreviations. Look in the settings file for more information.

(https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png) (http://creativecommons.org/licenses/by-nc-sa/4.0/)
WhichMod by theDragn is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-nc-sa/4.0/).

Spoiler
1.2.2a: version number update for 0.97. No other changes.
1.2.2: version number update for 0.96 compatibility. No other changes.
1.2.1: confirmed it works fine with 0.95.1a and updated compatible version number in mod info
1.2: now works on hullmods too
1.1: fixed an issue where it could add the mod title multiple times if you saved and loaded. No clue what was causing that, since descriptions aren't saved, but it's fixed anyway.
RIP to the old janky python script. (https://fractalsoftworks.com/forum/index.php?topic=19818)
[close]
Title: Re: [0.95a] WhichMod 1.0
Post by: Cyan Leader on July 25, 2021, 06:38:21 PM
Thanks!
Title: Re: [0.95a] WhichMod 1.0
Post by: IonDragonX on July 25, 2021, 07:26:30 PM
:o Is this For REAL?! Is it my Birthday?! Is it Christmas??!  ;D
Title: Re: [0.95a] WhichMod 1.0
Post by: Tecrys on July 25, 2021, 10:34:08 PM
Congrats to the new WhichMod version! I had a go at it and it works like a charm. The weird external thing it was before always put me off and I never tried it, but this is great!
I see this quickly becoming one of those mods everyone installs without thinking like console commands or commissioned crew.

Thanks for your hard work, you did a great job on this
Title: Re: [0.95a] WhichMod 1.0
Post by: theDragn on July 25, 2021, 11:17:52 PM
:o Is this For REAL?! Is it my Birthday?! Is it Christmas??!  ;D

Yes, I don't know, and no.

Thanks for your hard work, you did a great job on this

Ironically this was extremely easy to make- once DR told me about the API method I needed it took me about five hours of work to make and test it. Regardless, thanks for the praise!
Title: Re: [0.95a] WhichMod 1.0
Post by: Klokinator on July 25, 2021, 11:48:46 PM
Possibly one of the most important mods to me, since the number of times someone has asked "wHaT mOD is tHAt fROm??" and I'm like, "Uhhhhhh...."

Now they won't even need to ask most of the time, since the mod name will be right there in my screenshots, and if it isn't, I'll be able to find out easily!
Title: Re: [0.95a] WhichMod 1.0
Post by: Jaghaimo on July 26, 2021, 01:52:01 AM
Could you add conversion lists to ship descriptions? Some mods (e.g. Roider Union, THI) allows you to convert one hull into another - keeping track of which is convertible and to what is a pain.

For hullA that can be created from hullB or hullC I would expect:
Title: Re: [0.95a] WhichMod 1.0
Post by: theDragn on July 26, 2021, 02:43:18 AM
Could you add conversion lists to ship descriptions?

There's no internal way for a mod to check which hulls can be converted into other hulls, so I'd need support from other modders to do that (they'd probably have to include a .json file somewhere for whichmod to read). I'll have an example config next patch for other authors to copy, but it might be a week or two.
Title: Re: [0.95a] WhichMod 1.0
Post by: Nick XR on July 26, 2021, 09:40:53 AM
This is amazing, and so useful!   Nice work getting it functioning inside the normal modding framework.

Looking at the code, do you need to ensure that this mod is loaded after all other mods? 
Title: Re: [0.95a] WhichMod 1.1
Post by: theDragn on July 26, 2021, 10:23:29 AM
This is amazing, and so useful!   Nice work getting it functioning inside the normal modding framework.

Looking at the code, do you need to ensure that this mod is loaded after all other mods?

Nope. onApplicationLoad() is called after all the data from each mod has been loaded. Unless someone's mod is changing descriptions with hardcoded strings on load, order isn't important.

Also did a quick little patch to 1.1, because apparently loading a game would add on the mod title each time, resulting in multiple mod titles. Looks like onApplicationLoad() gets called when you load a game too.
Title: Re: [0.95a] WhichMod 1.1
Post by: Fhiach on August 10, 2021, 10:01:49 AM
Oh my god yes!
Title: Re: [0.95a] WhichMod 1.1
Post by: saya39 on December 06, 2021, 09:28:46 PM
This is exactly what I want!
May I post it with a light translate on Fossic, which is a Chinese Forum of Starsector? And of course with credit.
Here is the link: https://www.fossic.org/ (https://www.fossic.org/)

And btw, could you also the mod title to the descriptions of hullmods?
Title: Re: [0.95a] WhichMod 1.2.0
Post by: theDragn on December 09, 2021, 05:55:45 PM
Updated to 1.2, now works on hullmods too. This can be toggled off in the settings file.

May I post it with a light translate on Fossic, which is a Chinese Forum of Starsector? And of course with credit.
Sure.
Title: Re: [0.95a] WhichMod 1.2.0
Post by: saya39 on December 09, 2021, 09:42:12 PM
Updated to 1.2, now works on hullmods too. This can be toggled off in the settings file.

May I post it with a light translate on Fossic, which is a Chinese Forum of Starsector? And of course with credit.
Sure.
Thanks for the permission! And glad for the update!
When I finish I'll put the adress here.

Edit: And here it is https://www.fossic.org/thread-3730-1-1.html (https://www.fossic.org/thread-3730-1-1.html)
Title: Re: [0.95a] WhichMod 1.2.0
Post by: Nick XR on December 10, 2021, 10:04:59 AM
Thanks again for this mod, it made my latest play through a lot better.
Title: Re: [0.95a] WhichMod 1.2.0
Post by: Da5id on December 12, 2021, 02:31:24 AM
Bug(?): The Version Checker option to open the page of this mod sends me to High Tech Expansion instead!
Title: Re: [0.95a] WhichMod 1.2.0
Post by: Da5id on December 12, 2021, 02:31:53 AM
Also, this mod is wonderful. Thank you.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: Zalpha on December 22, 2021, 11:16:07 AM
Love this mod, thanks for making and sharing it with us.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: JustThatGoo on January 29, 2022, 12:09:33 AM
This mod is a must have on large modlists! Or any size if you're forgetful or haven't played in a while. Would it be possible to extend towards planet buildings/industries added by mods? Maybe even to mod added questlines/bar events at the start of the event?
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: theDragn on January 30, 2022, 03:49:09 AM
This mod is a must have on large modlists! Or any size if you're forgetful or haven't played in a while. Would it be possible to extend towards planet buildings/industries added by mods? Maybe even to mod added questlines/bar events at the start of the event?
No.

(kind of a terse reply I guess but it's literally not possible without some extremely fancy programming tricks like reflection, and even then I don't know if it's possible- and it would be a huge time investment for me to figure it out)
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: vaarelsauce on February 05, 2022, 04:19:56 PM
Goated mod, thank you so much! This reminds me a lot of my old 100+ modded gameplay on RimWorld, where I had the exact same situation where in the middle of a gameplay, sometimes the thought would cross, "Huh, where and when the hell did I installed this
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: Sythion on March 27, 2022, 10:02:38 AM
Just wanted to say awesome mod! Thanks for making this. Will say I noticed things lacking description don't work with it but presumably that's not something fixable.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: theDragn on April 13, 2022, 02:56:11 AM
Just wanted to say awesome mod! Thanks for making this. Will say I noticed things lacking description don't work with it but presumably that's not something fixable.

Yeah, unfortunately not. If it doesn't have a description, I can't look to see which mod's descriptions file has the description.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: Gabloc on May 12, 2022, 02:27:22 AM
A very useful mod indeed. I wonder whether it is possible to show which mod brought a certain market/planet into the game?

Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: TheTangy on May 12, 2022, 09:38:30 AM
Great work here.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: theDragn on May 12, 2022, 11:05:28 AM
A very useful mod indeed. I wonder whether it is possible to show which mod brought a certain market/planet into the game?
Yes, set the "shipsAndWeaponsOnly" option in WHICHMOD_SETTINGS.json to false. As the settings file indicates though, this may have unexpected results - it'll label everything in descriptions.csv, which might include some unexpected text strings.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: Gabloc on May 12, 2022, 03:49:29 PM
A very useful mod indeed. I wonder whether it is possible to show which mod brought a certain market/planet into the game?
Yes, set the "shipsAndWeaponsOnly" option in WHICHMOD_SETTINGS.json to false. As the settings file indicates though, this may have unexpected results - it'll label everything in descriptions.csv, which might include some unexpected text strings.

OK, thank you.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: Dwarden on June 17, 2022, 05:17:44 AM
first, thanks for great and useful mod
now some q,

does Whichmod support .skin with defined "description" ?
( based on documentation in https://starsector.fandom.com/wiki/.skin_File_Overview )

i noticed (while adding some \hulls\ .skin file) that descriptions from skins are missing whichmod [source] prefix
(even tried make sure the tech / manufacturer is defined extra in the .skin file)

"shipsAndWeaponsOnly":false, # doesn't help either

if both original .ship and new .skin description are shown together, then it shows only at the .hull one from description.csv

any tips or solution how-to support .skin description with whichmod prefix ?
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: theDragn on June 17, 2022, 03:56:52 PM
any tips or solution how-to support .skin description with whichmod prefix ?

It doesn't support skins. Typically this isn't a huge problem, since a skin is usually from the same mod that adds the base hull. There isn't anything I can do about the times where this isn't true (like a mod adding a skin of a vanilla ship, or a mod adding a skin of another mod's ship) because the skin description isn't accessible through code. (It uses the description in the .skin file along with the base hull's descriptions.csv entry.)
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: Troika on July 27, 2022, 09:37:17 AM
The most based mod for people like me who have way too many vanilla-themed ships flying around.
Title: Re: [0.95.1a] WhichMod 1.2.1
Post by: theDragn on October 18, 2022, 01:24:59 AM
Nothing to update here (and hopefully I won't ever have to update this), but I've been asked about how to include mod-identifying descriptions without interfering with WhichMod, so I've got some code for anyone who wants to include it in their mod. This will just add whichmod-style descriptions to ships and weapons from your mod if the user doesn't have whichmod active.

Code
public class YourModPlugin extends BaseModPlugin {
    @Override
    public void onApplicationLoad() {
        SettingsAPI settings = Global.getSettings();
        JSONArray csvData;
        if (settings.getModManager().isModEnabled("whichmod"))
            return;
        try {
            csvData = settings.loadCSV("data/strings/descriptions.csv", "YOUR MOD ID HERE");
        } catch (Exception e) {
            return;
        }

        // try reading each row in descriptions.csv
        for (int i = 0; i < csvData.length(); i++) {
            try {
                JSONObject row = csvData.getJSONObject(i);
                String id = row.getString("id");
                String type = row.getString("type");
                if (!(id == null || type == null || id.equals("") || type.equals(""))) {
                    Description desc;
                    Type descType = Enum.valueOf(Type.class, type);
                    if (descType == Type.SHIP || descType == Type.WEAPON)
                        desc = settings.getDescription(id, descType);
                    else
                        continue;
                    desc.setText1("[YOUR MOD NAME HERE] " + desc.getText1());
                    String prefix;
                }

            } catch (Exception e) {
                //logger.log(Level.INFO, e);
            }
        }
    }
}
Title: Re: [0.96a] WhichMod 1.2.2
Post by: theDragn on May 09, 2023, 10:41:49 PM
Updated version number for 0.96 compatibility. Will probably see about getting it to work on skins now that they have mutable descriptions, but for now it's just the quick and easy update.
Title: Re: [0.96a] WhichMod 1.2.2
Post by: eidolad on May 13, 2023, 07:16:01 PM
thanks very much for keeping this mod up to date...super useful
Title: Re: [0.96a] WhichMod 1.2.2
Post by: SpaceshipCaptainYukari on May 26, 2023, 04:36:28 AM
Excuse me, the downloadable version is ahead of the version on the version checker. Just letting you know.
Title: Re: [0.96a] WhichMod 1.2.2
Post by: theDragn on May 27, 2023, 04:17:27 PM
Excuse me, the downloadable version is ahead of the version on the version checker. Just letting you know.
Thanks for the heads up. Fixed.
Title: Re: [0.96a] WhichMod 1.2.2a
Post by: theDragn on February 03, 2024, 12:07:15 PM
Updated the version number for 0.97. No other changes.
Title: Re: [0.97a] WhichMod 1.2.2a
Post by: Arrevax on April 19, 2024, 06:34:41 PM
Is it possible to hide the mod name behind a button or at least shift it under the ship description?

Just a minor immersion issue; the mod's already much better than searching.
Title: Re: [0.96a] WhichMod 1.2.2
Post by: Bugatti on April 20, 2024, 06:05:19 PM
Excuse me, the downloadable version is ahead of the version on the version checker. Just letting you know.
Thanks for the heads up. Fixed.
Indeed the issue has arrived again. Also bump to the post above.