Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: [1] 2 3 ... 6

Author Topic: [0.97a] LunaLib  (Read 147995 times)

Lukas04

  • Captain
  • ****
  • Posts: 337
    • View Profile
[0.97a] LunaLib
« on: November 17, 2022, 07:14:08 AM »

LunaLib
A Library mod for Mod Developers and other utility.
For users it adds ingame mod configs, a mod version checker and a debug panel.





For Users:

LunaSettings
An Ingame UI Solution for Mod Configurations.
  • Can be Opened in the campaign with F2 (Configurable) or from the main menu.
  • Settings persist between mod updates.

Save Location

All Settings are saved in:
starsector/saves/common/modname.json.data
The File will be re-created automaticly with default settings if removed.
[close]



Version Checker
Displays mod updates ingame, and provides links towards the download and displays changelogs if supported.
Originaly a mod made by LazyWizard.



Debug Screen
The debug screen contains multiple Tabs. One of them is for a feature called "Snippets", which are UI-based Alternatives to Console Commands that modders can expand upon.
The second screens include utilities for locating Entities (Planets, Fleets, Stations) and their Data, and the third screen contains tools for cheating in Ships, Commodities, Weapons and so on.
To access it, you need to set a Keybind in the Mod Settings menu.



For Modders:

LunaLibs' Github.
Documentation.

LunaLib Adds:
  • LunaSettings (An expandable UI Config Solution)
  • LunaDebug(An Debug screen for Entities and Items)
  • LunaUtils (A decent amount of utility classes.)
  • LunaExtensions (Kotlin-Extension Functions that add some much needed functionality to some of Starsectors APIs)
If you encounter any issues, have any questions or require some help, feel free to message me on Discord @Lukas04#0856

Credits:

LazyWizard: Allowed me to integrate Version Checker in to this mod.
SpeedRacer, President Matt Damon: Provided me with help for the Custom UI Screens.
Wisp: Gave lots of feedback and kotlin help.
Ruddygreat: Provided the code to render Planets & Stars in the Debug menu.
« Last Edit: February 02, 2024, 12:15:53 PM by Lukas04 »
Logged
My Mods

Big Bee

  • Commander
  • ***
  • Posts: 153
  • bugs are cool
    • View Profile
Re: [0.95.1a] LunaLib 1.0.0
« Reply #1 on: November 17, 2022, 08:03:46 AM »

Oh hell yeah! I can't wait to see how mods will end up using it.

More UI based stuff is definitely nice.
Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: [0.95.1a] LunaLib 1.0.0
« Reply #2 on: November 17, 2022, 08:44:48 AM »

Lovely, will make use of this. Thanks for your hard work. I was working on my own solution to config some settings that I needed for playtesting, but this seems to have that sorted :)
Logged

Lukas04

  • Captain
  • ****
  • Posts: 337
    • View Profile
Re: [0.95.1a] LunaLib 1.0.0
« Reply #4 on: November 17, 2022, 10:12:21 AM »

Released a small update, which fixes LunaSettings input locations to be in the wrong position on some resolutions

Also moved all Kotlin-Extensions from lunaUtil.LunaExtensions.kt to lunalib.LunaExtensions.*
This is to make sure that they scale better as more are added, as keeping all Extensions in one file would become heavily bloated.
« Last Edit: November 17, 2022, 10:14:01 AM by Lukas04 »
Logged
My Mods

Nick XR

  • Admiral
  • *****
  • Posts: 712
    • View Profile
Re: [0.95.1a] LunaLib 1.0.1
« Reply #5 on: November 17, 2022, 01:52:06 PM »

Great work!  I'll start on getting this integrated with DCR.

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: [0.95.1a] LunaLib 1.0.1
« Reply #6 on: November 17, 2022, 04:31:02 PM »

Oh this is really interesting!

I could see someone making an addon that essentially wraps Nexelerin's various config file setting with this, as there are a large number of "scenarios" that people have come up with that rely on changing a bunch of values in the config file.

Question: could a mod maker use the enum field to have preset combinations of the different fields which are then populated? Like say the user selects "standard start" from an enum, and then that changes the user enterable field "starting ship" to "Wolf", but then the player could manually change it to something else?

I feel like I explained myself badly there, but the idea is to have preset options which can then be tweaked by the user.

[Edit] It also just ocured to me that this library makes it trivially easy to do something like game difficulty settings that can be customized either at game start or mid playthrough. Thats kind of excellent!
« Last Edit: November 17, 2022, 04:32:44 PM by Thaago »
Logged

Lukas04

  • Captain
  • ****
  • Posts: 337
    • View Profile
Re: [0.95.1a] LunaLib 1.0.1
« Reply #7 on: November 17, 2022, 04:59:52 PM »

Quote
I could see someone making an addon that essentially wraps Nexelerin's various config file setting with this, as there are a large number of "scenarios" that people have come up with that rely on changing a bunch of values in the config file.

Quote
It also just ocured to me that this library makes it trivially easy to do something like game difficulty settings that can be customized either at game start or mid playthrough. Thats kind of excellent!

Yeah both of those would be easy to implement, though, changing Nexelerin behaviour itself would not really work in that sense, except if Nexelerin itself would integrate with the mod, which id doubt since it has its own Settings Menus for its sector specific content. (Which also partly inspired me to make this). The mod itself uses its own saving system in saves/common, as thats the only place modders get Write FileIO access to, which means it can not be used to overwrite configs in mod folders. There is also no integration with MagicSettings, due to the same reason, and because having weird cross-compatibility would open lots of cases for weird behaviour.

Quote
Question: could a mod maker use the enum field to have preset combinations of the different fields which are then populated? Like say the user selects "standard start" from an enum, and then that changes the user enterable field "starting ship" to "Wolf", but then the player could manually change it to something else?

All fields are loaded on application load, so having another one appear only after one option was selected wouldnt currently work. It would also be very janky to update how a Field functions after its already added to the list of Options. What i would do in this case, is probably to keep that Enum, and add a String field below that would only do something if the Enum above has something selected.
I.e The enum could be a list of Starter ships, but one of them says "Custom Start", which you would then read a ship ID from another String Field.
Logged
My Mods

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: [0.95.1a] LunaLib 1.0.1
« Reply #8 on: November 23, 2022, 03:28:39 AM »

Great work!  I'll start on getting this integrated with DCR.

Seconded. Time to ditch those settings files and update Stelnet and Starpocalypse to use in-game configuration... probably in Jan when I have time :D
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: [0.95.1a] LunaLib 1.0.5
« Reply #9 on: December 03, 2022, 03:16:40 PM »

Starsector really needed something like LunaSettings, thank you for making it! Judging by that GIF and the documentation, it looks like you've done a great job, too. I'm hoping to integrate it into all of my mods before too long!

Lukas04

  • Captain
  • ****
  • Posts: 337
    • View Profile
Re: [0.95.1a] LunaLib 1.1.0
« Reply #10 on: December 05, 2022, 09:57:20 AM »

Released a mid-sized update
Part of the update allows modders to now add Keybinds in the Settings menu.
Also adds a Debugging Screen, that can be set through LunaLibs own Settings Window.

The Debug Screen mostly bases on one of my other mods, DevUtils, but ive merged a rework of it in to this Lib, as this way maintaining both mods is easier.

« Last Edit: December 05, 2022, 11:52:45 AM by Lukas04 »
Logged
My Mods

epiceuropean

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: [0.95.1a] LunaLib 1.1.0
« Reply #11 on: December 07, 2022, 12:05:39 PM »

This is excellent! I was just looking for something like Skyrim's Mod Config Menu or the incredible and cooperative mod ecosystem in Hollow Knight, and was really surprised that nothing like that seemed to exist for Starsector. Totally going to use this.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: [0.95.1a] LunaLib 1.1.0
« Reply #12 on: December 08, 2022, 06:13:29 PM »

I got around to checking out LunaSettings integration yesterday and have some questions/feedback.
  • It was extremely easy to set up, so thank you for that! I also really appreciate the formatting options and the ability to add read-only text blocks.
  • The gui is very clean and responsive, but I think the boolean and enum elements don't hold up to the quality of everything else. If possible, I think it would be an improvement for the bool button to display either true or false instead of "true/false," depending on its state. The enum element could be improved by preventing other options from being highlighted and showing their tooltips while the orange selection list is shown. Also, I think it would be intuitive for the list to disappear when the user clicks elsewhere.
  • If a mod only has new game options it will still show up in the side panel after the start of a game, even though options are no longer available for it. It might be better not to list mods in such cases, but I think there's an argument for keeping it as is, so *shrug*
  • Are newGame settings intended only for options that, for technical reasons, can't be changed after a game starts? I imaging many users would like to choose for themselves whether individual settings apply globally or only to a specific save, regardless of whether or not the setting supports changes mid-game.
Generally, I'm very impressed with this library. It already has all of the features I'll need to solve a lot of the problems with my clunky config files. I've been contemplating making something like this for several years while hoping someone else would, so again, thanks!  ;D

Lukas04

  • Captain
  • ****
  • Posts: 337
    • View Profile
Re: [0.95.1a] LunaLib 1.1.0
« Reply #13 on: December 08, 2022, 08:15:30 PM »

I got around to checking out LunaSettings integration yesterday and have some questions/feedback.
  • It was extremely easy to set up, so thank you for that! I also really appreciate the formatting options and the ability to add read-only text blocks.
  • The gui is very clean and responsive, but I think the boolean and enum elements don't hold up to the quality of everything else. If possible, I think it would be an improvement for the bool button to display either true or false instead of "true/false," depending on its state. The enum element could be improved by preventing other options from being highlighted and showing their tooltips while the orange selection list is shown. Also, I think it would be intuitive for the list to disappear when the user clicks elsewhere.
  • If a mod only has new game options it will still show up in the side panel after the start of a game, even though options are no longer available for it. It might be better not to list mods in such cases, but I think there's an argument for keeping it as is, so *shrug*
  • Are newGame settings intended only for options that, for technical reasons, can't be changed after a game starts? I imaging many users would like to choose for themselves whether individual settings apply globally or only to a specific save, regardless of whether or not the setting supports changes mid-game.
Generally, I'm very impressed with this library. It already has all of the features I'll need to solve a lot of the problems with my clunky config files. I've been contemplating making something like this for several years while hoping someone else would, so again, thanks!  ;D

2. An annoying thing with Buttons in Starsectors implementation is that their text cant be changed after creation, at best i could try making the buttons text empty, and overlaying a paragraph over it, not sure how well that would work though. I definitly need to improve the enums though, and good suggestion on making them dissapear when clicked somewhere else, though im not sure if i can implement that, since i cant be sure if a click on the button would be processed before it processes the click for exciting. I can make a rightclick close it atleast though.

4. Ive been considering removing the newgame option, i did intend it to be a setting that will always reset to a default, and the modders can make sure that a save will always have the same setting as that from first creation on, but i do realize now that its something that a modder should probably just do themself. I also did realize that having to set generation configs for each run would get tiring, so i will most likely remove this. I will put a deprecation warning on the doc for it. 
« Last Edit: December 08, 2022, 08:19:18 PM by Lukas04 »
Logged
My Mods

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: [0.95.1a] LunaLib 1.1.0
« Reply #14 on: December 08, 2022, 09:17:57 PM »

Sounds good. I figured a lot of that was due to API limitations, but figured I might as well mention it anyway.

Removing the newGame option would certainly simplify things and clean them up a bit, but I do think it's useful. There will inevitably be cases where a setting can't be changed after new game creation, and it would be a bit messy to display those options once changing them no longer has an effect. There are a slew of other considerations though, so I can respect deprecating it.

Feel free to PM me on discord, if you like. I'm often very slow to respond though.
Pages: [1] 2 3 ... 6