Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Commit

Permalink
Bugfix release 2.6.2 (#97)
Browse files Browse the repository at this point in the history
- Fix self nuking by making another call while within a call.
- Fix visual bug by showing a contact while within a call.
- Fix neutral faction crest using flag instead (upstream bug).
- Fix excluder filtering (incorrect id in csv file).
- Reduce minimum quantity for profit calculation.
- Treat contact calls while docked at contact's location as vanilla calls.
- Reset cache on game load and dev reload (avoids memory leak with Nexerelin enabled).
  • Loading branch information
jaghaimo authored Apr 23, 2023
1 parent 539a90d commit a2d5ac6
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 18 deletions.
7 changes: 3 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"esbenp.prettier-vscode",
"gabrielbb.vscode-lombok",
"naco-siren.gradle-language",
"vscjava.vscode-gradle",
"vscjava.vscode-java-pack"
"vscjava.vscode-java-pack",
"vscjava.vscode-lombok"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
}
2 changes: 1 addition & 1 deletion assets/data/stelnet/exclude/market_by_faction.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
faction id
id
2 changes: 1 addition & 1 deletion assets/data/stelnet/exclude/market_by_id.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
market id
id
2 changes: 1 addition & 1 deletion assets/data/stelnet/exclude/market_by_system.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
system id
id
2 changes: 1 addition & 1 deletion assets/data/stelnet/exclude/market_by_tag.csv
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tag
id
4 changes: 4 additions & 0 deletions assets/data/world/factions/neutral.faction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"id": "neutral",
"crest": "graphics/factions/crest_neutral.png"
}
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": "2.6.1",
"version": "2.6.2",
"description": "A collection of intel boards for Starsector",
"gameVersion": "0.95.1a-RC6",
"modPlugin": "stelnet.StelnetMod",
Expand Down
4 changes: 2 additions & 2 deletions assets/stelnet.version
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"modVersion": {
"major": 2,
"minor": 6,
"patch": 1
"patch": 2
},
"directDownloadURL": "https://github.com/jaghaimo/stelnet/releases/download/2.6.1/stelnet-2.6.1.zip"
"directDownloadURL": "https://github.com/jaghaimo/stelnet/releases/download/2.6.2/stelnet-2.6.2.zip"
}
9 changes: 9 additions & 0 deletions src/stelnet/StelnetMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public void afterGameSave() {

@Override
public void beforeGameSave() {
Configurator.resetCache();
if (ConfigConstants.UNINSTALL_MOD) {
Configurator.deactivate(false);
}
Expand All @@ -34,10 +35,18 @@ public void onApplicationLoad() throws Exception {

@Override
public void onGameLoad(boolean newGame) {
Configurator.resetCache();
if (TutorialMissionIntel.isTutorialInProgress()) {
Configurator.deactivate(true);
return;
}
Configurator.activate();
}

@Override
public void onDevModeF8Reload() {
Configurator.deactivate(false);
Configurator.resetCache();
Configurator.activate();
}
}
2 changes: 1 addition & 1 deletion src/stelnet/board/commodity/table/ProfitTableRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@RequiredArgsConstructor
public class ProfitTableRow implements Comparable<ProfitTableRow>, TableContentRow {

private static final int MINIMUM_QUANTITY = 1000;
private static final int MINIMUM_QUANTITY = 100;

private final List<Object> elements = new LinkedList<>();
private final MarketAPI buyMarket;
Expand Down
5 changes: 4 additions & 1 deletion src/stelnet/board/contact/CallContact.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ public class CallContact extends Button {

public CallContact(String label, Size size, final MarketAPI market, final PersonAPI person) {
super(size, label, true, person.getFaction().getBrightUIColor(), person.getFaction().getDarkUIColor());
setEnabled(market.hasSubmarket(Submarkets.SUBMARKET_STORAGE));
boolean hasSubmarket = market.hasSubmarket(Submarkets.SUBMARKET_STORAGE);
boolean isCalling = ContactsBoard.isCalling();
setEnabled(hasSubmarket && !isCalling);
setCutStyle(CutStyle.C2_MENU);
setPadding(0);
setHandler(
new EventHandler() {
@Override
public void onConfirm(IntelUIAPI ui) {
ContactsBoard.registerCall();
ui.showDialog(
market.getPrimaryEntity(),
new ContactDialog(ui, person, market.getSubmarket(Submarkets.SUBMARKET_STORAGE))
Expand Down
29 changes: 25 additions & 4 deletions src/stelnet/board/contact/ContactDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ public ContactDialog(IntelUIAPI ui, PersonAPI person, SubmarketAPI storage) {
this.market = storage.getMarket();
this.ui = ui;
playerData = new CargoFleetData(Global.getSector().getPlayerFleet());
playerData.clear();
storageData = new CargoFleetData(storage);
if (this.isRemoteCall()) {
playerData.clear();
}
}

@Override
Expand All @@ -52,11 +54,30 @@ public void optionSelected(String text, Object optionData) {
super.optionSelected(text, optionData);
}

private boolean isRemoteCall() {
SectorEntityToken playerFocus = Global.getSector().getPlayerFleet().getOrbitFocus();
if (playerFocus == null) {
return true;
}
if (playerFocus.equals(this.market.getPrimaryEntity())) {
return false;
}
for (SectorEntityToken connectedEntity : this.market.getConnectedEntities()) {
if (playerFocus.equals(connectedEntity)) {
return false;
}
}
return true;
}

private void dismiss() {
ContactsBoard.unregisterCall();
ContactsBoard board = ContactsBoard.getInstance(ContactsBoard.class);
board.getRenderableState().addTrackingData(market, storageData, playerData);
storageData.add(playerData);
playerData.restore();
if (this.isRemoteCall()) {
board.getRenderableState().addTrackingData(market, storageData, playerData);
storageData.add(playerData);
playerData.restore();
}
dialog.dismiss();
ui.recreateIntelUI();
ui.updateUIForItem(board);
Expand Down
13 changes: 13 additions & 0 deletions src/stelnet/board/contact/ContactsBoard.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package stelnet.board.contact;

import com.fs.starfarer.api.Global;
import lombok.Getter;
import stelnet.board.BoardBasePlugin;
import stelnet.board.BoardRenderableInfo;
Expand Down Expand Up @@ -27,4 +28,16 @@ protected RenderableIntelInfo getIntelInfo() {
public boolean isHidden() {
return renderableState.getContactNumber() == 0;
}

public static boolean isCalling() {
return Global.getSector().getMemoryWithoutUpdate().getBoolean(ModConstants.MEMORY_IS_CALLING);
}

public static void registerCall() {
Global.getSector().getMemoryWithoutUpdate().set(ModConstants.MEMORY_IS_CALLING, true, 0);
}

public static void unregisterCall() {
Global.getSector().getMemoryWithoutUpdate().unset(ModConstants.MEMORY_IS_CALLING);
}
}
1 change: 1 addition & 0 deletions src/stelnet/board/contact/ShowContactButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ShowContactButton extends Button {

public ShowContactButton(String label, Size size, final ContactIntel intel, FactionAPI faction) {
super(size, label, true, faction.getBrightUIColor(), faction.getDarkUIColor());
setEnabled(!ContactsBoard.isCalling());
setCutStyle(CutStyle.C2_MENU);
setPadding(0);
setHandler(
Expand Down
6 changes: 5 additions & 1 deletion src/stelnet/board/query/provider/SkillProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

public class SkillProvider {

private transient List<SkillSpecAPI> allSkills;
private static transient List<SkillSpecAPI> allSkills;

public static void reset() {
allSkills = null;
}

public List<SkillSpecAPI> getMatching(List<Filter> filter) {
if (allSkills == null) {
Expand Down
15 changes: 15 additions & 0 deletions src/stelnet/util/Configurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
import stelnet.board.query.MarketUpdater;
import stelnet.board.query.QueryBoard;
import stelnet.board.query.ResultIntel;
import stelnet.board.query.provider.DmodProvider;
import stelnet.board.query.provider.FactionProvider;
import stelnet.board.query.provider.ItemProvider;
import stelnet.board.query.provider.MarketProvider;
import stelnet.board.query.provider.ShipProvider;
import stelnet.board.query.provider.SkillProvider;
import stelnet.board.storage.StorageBoard;
import stelnet.board.storage.StorageIntel;
import stelnet.board.storage.StorageListener;
Expand Down Expand Up @@ -44,6 +50,15 @@ public static void deactivate(boolean skipUiReset) {
log.info("Stelnet deactivated");
}

public static void resetCache() {
DmodProvider.reset();
FactionProvider.reset();
ItemProvider.reset();
MarketProvider.reset();
ShipProvider.reset();
SkillProvider.reset();
}

private static void purgeIntel(Class<?>... classNames) {
for (Class<?> className : classNames) {
log.debug("Removing intel " + className);
Expand Down
5 changes: 5 additions & 0 deletions src/stelnet/util/ModConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ public class ModConstants {
public static final String TAG_QUERY = TAG_MARKET;
public static final String TAG_STORAGE = "stelnetStorage";
public static final String TAG_VIEWER = TAG_MARKET;

/**
* Memory flags used.
*/
public static final String MEMORY_IS_CALLING = "$stelnetIsCalling";
}

0 comments on commit a2d5ac6

Please sign in to comment.