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)
:o Is this For REAL?! Is it my Birthday?! Is it Christmas??! ;D
: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!
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.
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);
}
}
}
}