Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.98a is out! (03/27/25)

Author Topic: [0.98a] RetroLib 1.1.0  (Read 51160 times)

SafariJohn

  • Admiral
  • *****
  • Posts: 3132
    • View Profile
[0.98a] RetroLib 1.1.0
« on: February 11, 2024, 07:05:06 PM »

RetroLib
By SafariJohn
Download v1.1.0
Requires LazyLib
Requires MagicLib


A framework for mods to provide ship conversion services.


How To Use RetroLib (in a nutshell)

A working example is included with RetroLib - it adds a retrofitter to every bar when dev mode is active. It consists of 2 entries in rules.csv and a rule command located at src/retroLib.impl.rulecmd.RetroLib_DefaultAccess.


Your goal when making your own version is to create an adjuster, filter, manager, and delivery service, hand them off to a class or classes that create a UI, then show that UI to the player. The default UI, as shown in the example, is a dialog plugin with separate classes to handle the logic (interactor), UI (view), and passing data between them (model).


There are 2 tricks RetroLib provides. The first trick is you can use the Base classes in retroLib.impl and only modify what you need to customize your retrofitter.

- Filter - filters out retrofits you don't want your retrofitter to ever show
- Adjuster - modifies retrofit data before and after filtering - cost, how long it takes to complete, anything
- Manager - handles which retrofits are shown at which times (allowed, unavailable, illegal, or otherwise not allowed)
- Delivery Service - handles delivering the completed retrofits

The second trick is that your UI does not need to be a dialog plugin. It could be a submarket or a fully custom GUI - anything at all. The four pieces above don't care.


My Roider Union mod demonstrates several modifications in src/roiderUnion.retrofit. The UnionHQ version simply filters retrofits (filter), makes retrofits instant (delivery service), and plays a music loop (view). Shipworks and Nomad retrofits are a little more involved. Finally, Argos retrofitting is accessed through an ability, uses commodities instead of credits, and is limited by the Argosi in the player's fleet, which requires a lot more code to achieve.


Changelog:
Version 1.1.0
 Changes
 - Updated to 0.98a
 - Replaced S-mod transfer with bonus XP

Version 1.0.1
 Bug Fixes
 - Stopped built-in wings from dropping as LPCs when RetroLib strips a ship

Version 1.0.0
 - Initial release
[close]
« Last Edit: April 20, 2025, 08:25:26 AM by SafariJohn »
Logged

Helldiver

  • Captain
  • ****
  • Posts: 394
  • space fruit
    • View Profile
Re: [0.97a] RetroLib 1.0.0
« Reply #1 on: February 12, 2024, 06:54:11 AM »

Thank you for making this, the Roider retrofit system was excellent in how easily it could be adjusted between ships, requirements, prices etc, to say nothing of the practical UI, I'm looking forward to being able to use the framework to make similar services for certain factions.
If I can suggest this, maybe it would be better located in the Modding Resources section, where the other libs/tools are usually found.
Logged
Afflictor bean plushie that glows purple when you squeeze it
30$

Achi Cirno

  • Ensign
  • *
  • Posts: 35
  • sine qua non
    • View Profile
Re: [0.97a] RetroLib 1.0.0
« Reply #2 on: February 15, 2024, 09:10:23 PM »

Thanks, gonna see if I can play around it. Though I never did kotlin

SafariJohn

  • Admiral
  • *****
  • Posts: 3132
    • View Profile
Re: [0.97a] RetroLib 1.0.1
« Reply #3 on: February 22, 2024, 01:16:08 PM »

RetroLib 1.0.1
Download in OP
Fixed built in wings dropping as LPCs.

Version 1.0.1
 Bug Fixes
 - Stopped built-in wings from being given as LPCs when RetroLib strips a ship
Logged

WolfPriest

  • Lieutenant
  • **
  • Posts: 52
    • View Profile
Re: [0.97a] RetroLib 1.0.1
« Reply #4 on: February 24, 2024, 06:29:21 AM »

A framework for mods to provide ship conversion services.
This makes me hopeful for the return of Tiandong Heavy Industries.
Not that Roiders is bad, I love it, but I wish I had both.
Logged

robepriority

  • Captain
  • ****
  • Posts: 458
  • robepriority#2626
    • View Profile
Re: [0.97a] RetroLib 1.0.1
« Reply #5 on: March 03, 2024, 10:38:11 AM »

Is adding retrofits to already existing ships (for example. falcon to falcon-P) just a case of editing the .csv, or does more need to be done to implement?

SafariJohn

  • Admiral
  • *****
  • Posts: 3132
    • View Profile
Re: [0.97a] RetroLib 1.0.1
« Reply #6 on: March 03, 2024, 04:27:58 PM »

All you have to do is edit the CSV. Or do a minimod with just a CSV for your changes - they are merged.
Logged

Akarthus

  • Ensign
  • *
  • Posts: 8
    • View Profile
Re: [0.97a] RetroLib 1.0.1
« Reply #7 on: March 29, 2024, 04:31:26 AM »

I use the devModeRetrofitter and created a separate mod for retrofits.csv, but after I retro fitted my ships, it took my ship but did not produce anything, I am not sure whats happening.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3132
    • View Profile
Re: [0.97a] RetroLib 1.0.1
« Reply #8 on: March 29, 2024, 07:24:16 PM »

Added a brief guide to using RetroLib to the OP!

I use the devModeRetrofitter and created a separate mod for retrofits.csv, but after I retro fitted my ships, it took my ship but did not produce anything, I am not sure whats happening.

Not sure why that would be happening. Did you specify a retrofit time? It would take that many days for the finished ship to appear in storage at that market.
Logged

Helldiver

  • Captain
  • ****
  • Posts: 394
  • space fruit
    • View Profile
Re: [0.97a] RetroLib 1.0.1
« Reply #9 on: March 29, 2024, 09:57:03 PM »

Added a brief guide to using RetroLib to the OP!

Ooooh thank you for that!
Logged
Afflictor bean plushie that glows purple when you squeeze it
30$

SafariJohn

  • Admiral
  • *****
  • Posts: 3132
    • View Profile
Re: [0.98a] RetroLib 1.1.0
« Reply #10 on: April 09, 2025, 12:09:18 PM »

RetroLib 1.1.0.
Download in OP
No more S-mod shenanigans. Sorry. Not sorry.

Version 1.1.0
 Changes
 - Updated to 0.98a
 - Replaced S-mod transfer with bonus XP
Logged