Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# Stellar Networks

[![latest release](https://img.shields.io/github/v/release/jaghaimo/stelnet?label=download%20latest)](https://github.com/jaghaimo/stelnet/releases/latest)
[![Github All Releases](https://img.shields.io/github/downloads/jaghaimo/stelnet/total.svg)](https://github.com/jaghaimo/stelnet/releases)
[![The latest release][release-badge]][release-url] [![Github All Releases][releases-badge]][releases-url]

Stellar Networks is a QoL oriented Starsector mod.
It adds three new intel tabs: Commodity, Market, and Storage.
Each tab comes with interactive boards that are used to manage presented intel.
Finally, the mod extends Contacts and Exploration tab by adding QoL boards to it.

For more details, see [this forums thread](https://fractalsoftworks.com/forum/index.php?topic=20836).
For more details, see [this forums thread].

## Contributing to the Mod

Non-technical contribution (ideas or bug reports) can be made via [Issues](https://github.com/jaghaimo/stelnet/issues).
Non-technical contribution (ideas or bug reports) can be made via [Issues].

In order to contribute code please fork this repository and work on your idea there.
Once you have enough to share, open a Pull Request and I will review your changes.
We will then work together to incorporate your changes into a next release.

### Translating the Mod

To translate this mod, edit files in [data/l10n](assets/data/l10n) directory.
To translate this mod, edit files in [`data/l10n`] directory.
You can then create the translation mod with just the following structure:

```yaml
Expand All @@ -32,15 +31,31 @@ mod_info.json # the usual content, no need for mod plugin

### Integration with Other Mods

To be able to exclude/include markets and storages in the Stelnet intel tab results
see various CSV files in [data/stelnet](assets/data/stelnet) directory.
For example, to exclude a faction in your mod create a file:
`starsector/mods/{your_mod_dir}/data/stelnet/exclude/market_by_faction.csv`
with content:
```text
To be able to change some of the behaviour of markets and commodities see various CSV files in the [`data/stelnet`]
directory. Those files can be either edited in the Stelnet mod's data directory, or created in another mod's data
directory. For example, to exclude all markets of the Hegemony faction in your mod, create a file:
`starsector/mods/{your_mod_dir}/data/stelnet/exclude/market_by_faction.csv`
<details><summary>content</summary>

```csv
id
hegemony
```
</details>

Mods introducing new commodities may hinder finding the basic commodities like supplies or fuel.
Commodity Market intel board can be forces to show commodities from a CSV file on the top of the right pane list,
followed by the remaining commodities sorted in alphabetical order. Example `data/stelnet/sort/priority_commodities.csv`:
<details><summary>content</summary>

```csv
id
supplies
fuel
crew
marines
```
</details>


### Testing unreleased versions
Expand Down Expand Up @@ -76,3 +91,13 @@ hegemony
</details>
* Now you can use `stelnet-{version}.zip` archive from the project root directory and unpack it to Starsector's `mods/` directory.
___Note that you need to remove all Stelnet copies from the `mods/` directory before unpacking!___


[release-badge]: https://img.shields.io/github/v/release/jaghaimo/stelnet?label=download%20latest
[release-url]: https://github.com/jaghaimo/stelnet/releases/latest
[releases-badge]: https://img.shields.io/github/downloads/jaghaimo/stelnet/total.svg
[releases-url]: https://github.com/jaghaimo/stelnet/releases
[this forums thread]: https://fractalsoftworks.com/forum/index.php?topic=20836
[Issues]: https://github.com/jaghaimo/stelnet/issues
[`data/l10n`]: assets/data/l10n
[`data/stelnet`]: assets/data/stelnet
1 change: 1 addition & 0 deletions assets/data/stelnet/sort/priority_commodities.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
id
2 changes: 1 addition & 1 deletion assets/mod_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Stellar Networks",
"author": "Jaghaimo",
"utility": true,
"version": "3.2.3",
"version": "3.3.0",
"description": "A collection of intel boards for Starsector",
"gameVersion": "0.98a-RC7",
"modPlugin": "stelnet.StelnetMod",
Expand Down
6 changes: 3 additions & 3 deletions assets/stelnet.version
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"modThreadId": 20836,
"modVersion": {
"major": 3,
"minor": 2,
"patch": 3
"minor": 3,
"patch": 0
},
"directDownloadURL": "https://github.com/jaghaimo/stelnet/releases/download/3.2.3/stelnet-3.2.3.zip",
"directDownloadURL": "https://github.com/jaghaimo/stelnet/releases/download/3.3.0/stelnet-3.3.0.zip",
"changelogURL": "https://raw.githubusercontent.com/jaghaimo/stelnet/master/changelog.txt"
}
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Unreleased (TBD)


Version 3.3.0 (2025.05.14)
- Add optional priority sorting for Commodity Market intel - commodities from the `priority_commodities.csv` file will
be sorted according to the order in the file, followed by the remaining commodities sorted in alphabetical order.


Version 3.2.3 (2025.05.12)
- Fix bug causing the game to crash when trying to start a new campaign with the Stelnet "Uninstall Mod" flag set to true.
- Change Commodities Intel tab to filter out markets returned by the `Excluder` - related files:
Expand Down
34 changes: 21 additions & 13 deletions src/stelnet/board/commodity/view/board/CommodityViewFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.econ.CommoditySpecAPI;
import com.fs.starfarer.api.campaign.econ.EconomyAPI;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import stelnet.filter.AnyHasTag;
import stelnet.filter.LogicalNot;
import stelnet.util.CollectionUtils;
import stelnet.util.Sorter;
import uilib.Button;
import uilib.Group;
import uilib.Renderable;
Expand All @@ -19,6 +16,12 @@
import uilib.property.Position;
import uilib.property.Size;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;


@RequiredArgsConstructor
public class CommodityViewFactory implements RenderableFactory {

Expand All @@ -37,7 +40,7 @@ public List<Renderable> create(Size size) {
Group group = new Group(buttons);
group.setSize(new Size(200, size.getHeight() - 100));
group.setOffset(new Position(size.getWidth() - 200, 28));
return Collections.<Renderable>singletonList(group);
return Collections.singletonList(group);
}

private void filterCommodities(List<CommoditySpecAPI> commodities) {
Expand All @@ -60,14 +63,19 @@ private Button getCommodityButton(CommoditySpecAPI commodity, String activeId) {
}

private void sortCommodities(List<CommoditySpecAPI> commodities) {
Collections.sort(
commodities,
new Comparator<CommoditySpecAPI>() {
@Override
public int compare(CommoditySpecAPI commodityA, CommoditySpecAPI commodityB) {
return commodityA.getName().compareToIgnoreCase(commodityB.getName());
}
Map<String, Integer> priorityByCommodityId = Sorter.getPriorityByCommodityId();
commodities.sort((commodityA, commodityB) -> {
Integer priorityA = priorityByCommodityId.get(commodityA.getId());
Integer priorityB = priorityByCommodityId.get(commodityB.getId());
if (priorityA != null) {
if (priorityB != null) return priorityA.compareTo(priorityB);

return -1;
}
);

if (priorityB != null) return 1;

return commodityA.getName().compareToIgnoreCase(commodityB.getName());
});
}
}
18 changes: 18 additions & 0 deletions src/stelnet/util/Sorter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package stelnet.util;

import java.util.HashMap;
import java.util.Map;


public class Sorter extends Reader {
private static final String PRIORITY_COMMODITIES_CSV = "data/stelnet/sort/priority_commodities.csv";

public static Map<String, Integer> getPriorityByCommodityId() {
Map<String, Integer> priorityByCommodityId = new HashMap<>();
int i = 0;
// Match order of priority commodities to the order of IDs in the CSV.
for (var commodityId : getStrings(PRIORITY_COMMODITIES_CSV, ModConstants.STELNET_ID))
priorityByCommodityId.put(commodityId, ++i);
return priorityByCommodityId;
}
}