diff --git a/ATTRIBUTIONS b/ATTRIBUTIONS index 8d27c89..bec3700 100644 --- a/ATTRIBUTIONS +++ b/ATTRIBUTIONS @@ -1 +1,2 @@ Primary code work by Brian Deale: https://github.com/KelvallRogers +Thanks to Histidine for helping with Nexerelin support \ No newline at end of file diff --git a/data/scripts/MoWeaponsMoShipsModPlugin.java b/data/scripts/MoWeaponsMoShipsModPlugin.java index 647cebc..4d21531 100644 --- a/data/scripts/MoWeaponsMoShipsModPlugin.java +++ b/data/scripts/MoWeaponsMoShipsModPlugin.java @@ -2,24 +2,12 @@ import com.fs.starfarer.api.BaseModPlugin; import com.fs.starfarer.api.Global; -import com.fs.starfarer.api.campaign.SectorAPI; public class MoWeaponsMoShipsModPlugin extends BaseModPlugin { - private static void initMoWeaponsMoShips() { + @Override + public void onApplicationLoad() { Global.getLogger(MoWeaponsMoShipsModPlugin.class).info("Hooray MoWeaponsMoShips mod plugin in a jar is loaded!"); - //todo - //If we have Nexerelin and random worlds enabled, don't spawn our manual systems - //boolean haveNexerelin = Global.getSettings().getModManager().isModEnabled("nexerelin"); -// if (!haveNexerelin || SectorManager.getManager().isCorvusMode()){ -// initRedLegion(); -// //new tahlan_Rubicon().generate(sector); //logic from tahlan -// } - -// todo perform check van vs nex -// if (!haveNexerelin) { -// //Legio Infernalis relations -// RedLegionFactionRelations.initFactionRelationships(sector); -// } } + } \ No newline at end of file diff --git a/data/scripts/campaign/submarkets/MWMS_MilitarySubmarketPlugin.java b/data/scripts/campaign/submarkets/MWMS_MilitarySubmarketPlugin.java index ed73b4d..0cdd5ae 100644 --- a/data/scripts/campaign/submarkets/MWMS_MilitarySubmarketPlugin.java +++ b/data/scripts/campaign/submarkets/MWMS_MilitarySubmarketPlugin.java @@ -7,6 +7,11 @@ import com.fs.starfarer.campaign.econ.Submarket; import data.scripts.campaign.submarkets.SubmarketShared; +import static data.scripts.campaign.submarkets.SubmarketShared.HAVE_NEXERELIN; +import exerelin.campaign.AllianceManager; +import exerelin.campaign.PlayerFactionStore; +import exerelin.utilities.ExerelinUtilsFaction; + public class MWMS_MilitarySubmarketPlugin extends MilitarySubmarketPlugin { @Override public void updateCargoPrePlayerInteraction() { @@ -93,4 +98,21 @@ private void pickShips(float multiplier) { null, null); } + + //used with permission from Histidine to ensure compatibility + @Override + protected boolean hasCommission() { + if (HAVE_NEXERELIN) { + String commissionFaction = ExerelinUtilsFaction.getCommissionFactionId(); + if (commissionFaction != null && AllianceManager.areFactionsAllied(commissionFaction, submarket.getFaction().getId())) { + return true; + } + if (AllianceManager.areFactionsAllied(PlayerFactionStore.getPlayerFactionId(), submarket.getFaction().getId())) { + return true; + } + return submarket.getFaction().getId().equals(commissionFaction); + } else { + return super.hasCommission(); + } + } } \ No newline at end of file diff --git a/data/scripts/campaign/submarkets/SubmarketShared.java b/data/scripts/campaign/submarkets/SubmarketShared.java index 9234087..abd7c8f 100644 --- a/data/scripts/campaign/submarkets/SubmarketShared.java +++ b/data/scripts/campaign/submarkets/SubmarketShared.java @@ -3,6 +3,9 @@ import com.fs.starfarer.api.Global; public class SubmarketShared { + //If we have Nexerelin do its logic for commissions + public static boolean HAVE_NEXERELIN = Global.getSettings().getModManager().isModEnabled("nexerelin");; + static final boolean DEBUG = Global.getSettings().getBoolean("mwms_debug"); static final float WEAPON_MULT = Global.getSettings().getFloat("mwms_weapon_mult"); static final float FIGHTER_MULT = Global.getSettings().getFloat("mwms_fighter_mult"); diff --git a/mod_info.json b/mod_info.json index 069acf5..e652833 100644 --- a/mod_info.json +++ b/mod_info.json @@ -2,7 +2,7 @@ "id":"MoWeaponsMoShips", "name":"MoWeaponsMoShips", "author":"Brian Deale", - "version":"v 1.0.1van", + "version":"v 1.0.1nex", "description":"Allows you to multiply the number of ships, fighters, hullmods, and weapons available in markets", "gameVersion":"0.9.1a", "jars":["jars/MoWeaponsMoShips.jar"], diff --git a/moweaponsmoships.version b/moweaponsmoships.version index 9c998a6..78bebe6 100644 --- a/moweaponsmoships.version +++ b/moweaponsmoships.version @@ -1,11 +1,11 @@ { - "masterVersionFile":"https://raw.githubusercontent.com/KelvallRogers/moweaponsmoships/master/moweaponsmoships.version", + "masterVersionFile":"https://raw.githubusercontent.com/KelvallRogers/moweaponsmoships/nex/moweaponsmoships.version", "modName":"MoWeaponsMoShips", "modThreadId":18359, "modVersion": { "major":1, "minor":0, - "patch":1van, + "patch":1nex, } } \ No newline at end of file