Skip to content

Commit

Permalink
Merge pull request #4 from KelvallRogers/dev
Browse files Browse the repository at this point in the history
Adding nexerelin supported version thanks to Histidine yay
  • Loading branch information
BriannaTheBrave authored Apr 14, 2020
2 parents c74530a + cc3d4ab commit fc9f1c3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions ATTRIBUTIONS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Primary code work by Brian Deale: https://github.com/KelvallRogers
Thanks to Histidine for helping with Nexerelin support
18 changes: 3 additions & 15 deletions data/scripts/MoWeaponsMoShipsModPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
}

}
22 changes: 22 additions & 0 deletions data/scripts/campaign/submarkets/MWMS_MilitarySubmarketPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
}
}
}
3 changes: 3 additions & 0 deletions data/scripts/campaign/submarkets/SubmarketShared.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion mod_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
4 changes: 2 additions & 2 deletions moweaponsmoships.version
Original file line number Diff line number Diff line change
@@ -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,
}
}

0 comments on commit fc9f1c3

Please sign in to comment.