Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: CTD (Market / Industry Related)  (Read 1942 times)

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
CTD (Market / Industry Related)
« on: February 23, 2019, 08:16:28 PM »

6244142 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.campaign.ui.public.<init>(Unknown Source)
   at com.fs.starfarer.coreui.public.sizeChanged(Unknown Source)
   at com.fs.starfarer.ui.OO0O.set(Unknown Source)
   at com.fs.starfarer.ui.supernew.super(Unknown Source)
   at com.fs.starfarer.ui.OoO0.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.Q.advance(Unknown Source)
   at com.fs.starfarer.ui.donew.advanceImpl(Unknown Source)
   at com.fs.starfarer.campaign.ui.marketinfo.O0o0.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.Q.advance(Unknown Source)
   at com.fs.starfarer.ui.donew.advanceImpl(Unknown Source)
   at com.fs.starfarer.campaign.ui.marketinfo.intsuper.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.Q.advance(Unknown Source)
   at com.fs.starfarer.ui.donew.advanceImpl(Unknown Source)
   at com.fs.starfarer.campaign.ui.marketinfo.ooo0.advanceImpl(Unknown Source)
   at com.fs.starfarer.ui.Q.advance(Unknown Source)
   at com.fs.starfarer.campaign.ui.marketinfo.T.showOverview(Unknown Source)
   at com.fs.starfarer.campaign.ui.marketinfo.T.sizeChanged(Unknown Source)
   at com.fs.starfarer.ui.OO0O.setSize(Unknown Source)
   at com.fs.starfarer.campaign.ui.o0OO.sizeChanged(Unknown Source)
   at com.fs.starfarer.ui.OO0O.setSize(Unknown Source)
   at com.fs.starfarer.ui.Q.setSize(Unknown Source)
   at com.fs.starfarer.coreui.O00o.sizeChanged(Unknown Source)
   at com.fs.starfarer.ui.OO0O.setSize(Unknown Source)
   at com.fs.starfarer.ui.Q.setSize(Unknown Source)
   at com.fs.starfarer.ui.newui.J$5.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.newui.J.setCurrentTab(Unknown Source)
   at com.fs.starfarer.ui.newui.J.setCurrentTab(Unknown Source)
   at com.fs.starfarer.ui.newui.U.showCoreInternal(Unknown Source)
   at com.fs.starfarer.ui.newui.U.showCore(Unknown Source)
   at com.fs.starfarer.api.impl.campaign.rulecmd.OpenCoreTab.execute(OpenCoreTab.java:40)
   at com.fs.starfarer.ui.newui.oOOO.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.OoO0.buttonPressed(Unknown Source)
   at com.fs.starfarer.ui.oooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.?0000(Unknown Source)
   at com.fs.starfarer.ui.oooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.processInput(Unknown Source)
   at com.fs.starfarer.ui.V.super(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: CTD (Market / Industry Related)
« Reply #1 on: February 23, 2019, 08:17:22 PM »

This is after setting up a new inhabited planet w/ what I thought (and appeared) to be working EZ Faction.  Happened when I clicked on the UI button to visit the Open Market.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: CTD (Market / Industry Related)
« Reply #2 on: February 23, 2019, 10:21:46 PM »

I think this one's resolved.

However... the Systems where I've built the Markets aren't currently showing up on the main navigation screen.  It's weird, I seem to recall having this issue before with early builds of EZ Faction, but I can't remember what I did to fix it.

Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: CTD (Market / Industry Related)
« Reply #3 on: February 23, 2019, 10:23:27 PM »

(To clarify, the bug reports section is not, generally speaking, for debugging help for a modder. That's what the Modding section is, in part, for.)
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: CTD (Market / Industry Related)
« Reply #4 on: February 23, 2019, 10:27:55 PM »

Fair enough, but I started with a bug.  Sorry. 

Anyhow, last time... meh, IIRC, it had something to do with having a Station or Population or something; there was a <something> that causes Systems to show as "populated" and actually show their names in the Navigation screen.

Everything else appears to work, I think.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: CTD (Market / Industry Related)
« Reply #5 on: February 23, 2019, 10:34:41 PM »

Code
	private static SectorEntityToken buildEntity(StarSystemAPI pickedSystem, FactionAPI faction, int minMarketSize, int maxMarketSize, boolean isCapital){
int marketSize = MathUtils.getRandomNumberInRange(minMarketSize, maxMarketSize);
if(isCapital) marketSize = maxMarketSize;

float orbit = pickOrbitalRadius(pickedSystem);
float orbitalPeriod = ((orbit / 4500f) * 200f) * MathUtils.getRandomNumberInRange(0.5f, 1.5f);
SectorEntityToken ezColony;

String starName = pickedSystem.getStar().getName();
String factionID = faction.getId();
String denomination = pickDenomination(pickedSystem,false,true);
try{
ezColony = pickedSystem.addPlanet(starName + factionID + "planet" + denomination + MathUtils.getRandom(),//Attempts to build a random numbered location id; needs improving
pickedSystem.getStar(), //Orbital focus
starName + " Colony " + denomination,//Probably needs improving
planetType(faction),//Pulls a string at random
MathUtils.getRandomNumberInRange(30f,60f),//Planet angle
MathUtils.getRandomNumberInRange(50f,300f),//Planet radius
orbit,//Orbital radius
orbitalPeriod);//Orbital period
}catch (Throwable ex) {
return null;
}
ezColony.setFaction(faction.getId());
ezColony.setInteractionImage("illustrations", ILLUSTRATIONS.get((int)MathUtils.getRandomNumberInRange(0, ILLUSTRATIONS.size()-1)));
ezColony.addTag("customPlanet");

//Sets up the Market and attaches to the ezColony SectorEntityAPI
MarketAPI market = Global.getFactory().createMarket(faction.getId() + ezColony.getId() +"_market"+MathUtils.getRandom(), ezColony.getName(), marketSize);
market.setHidden(false);
market.setSurveyLevel(SurveyLevel.FULL);
market.setFactionId(faction.getId());
market.setPrimaryEntity(ezColony);

//Set the market's size and population here
market.setSize(marketSize);
assignPopulation(market,marketSize);

//Set up all of the Market Conditions here
if(isCapital == true || MathUtils.getRandomNumberInRange(0f, 100f) > 66f) {
int thisStationType = MathUtils.getRandomNumberInRange(0, 2);
switch (thisStationType){
case 0:
market.addIndustry(Industries.BATTLESTATION);
market.addIndustry(Industries.MILITARYBASE);
market.addIndustry(Industries.HEAVYINDUSTRY);
break;
case 1:
market.addIndustry(Industries.BATTLESTATION_MID);
market.addIndustry(Industries.MILITARYBASE);
market.addIndustry(Industries.HEAVYINDUSTRY);
break;
case 2:
market.addIndustry(Industries.BATTLESTATION_HIGH);
market.addIndustry(Industries.MILITARYBASE);
market.addIndustry(Industries.HEAVYINDUSTRY);
break;
default:
market.addIndustry(Industries.BATTLESTATION);
market.addIndustry(Industries.MILITARYBASE);
market.addIndustry(Industries.HEAVYINDUSTRY);
break;
}
}

//Sets up the Market with Conditions and some Industries.
market.addIndustry(Industries.SPACEPORT);
setMarketConditions(market, ezColony, false, false);

if(market.hasIndustry(Industries.HEAVYINDUSTRY) && market.hasIndustry(Industries.MILITARYBASE)){
market.addSubmarket(Submarkets.GENERIC_MILITARY);
}

market.addSubmarket(Submarkets.SUBMARKET_OPEN);
market.addSubmarket(Submarkets.LOCAL_RESOURCES);
market.addSubmarket(Submarkets.SUBMARKET_BLACK);
market.addSubmarket(Submarkets.SUBMARKET_STORAGE);

market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCommodity(Commodities.FOOD, 1000);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCommodity(Commodities.DOMESTIC_GOODS, 100);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCommodity(Commodities.ORGANICS, 3000);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCommodity(Commodities.VOLATILES, 3000);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCommodity(Commodities.HEAVY_MACHINERY, 1000);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCommodity(Commodities.METALS, 1000);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCommodity(Commodities.RARE_METALS, 1000);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addCrew(300);
market.getSubmarket(Submarkets.SUBMARKET_OPEN).getCargo().addFuel(5000);

Misc.getLocalResourcesCargo(market).addSupplies(4000f);
Misc.getLocalResourcesCargo(market).addFuel(10000f);
Misc.getLocalResourcesCargo(market).addItems(CargoItemType.RESOURCES, Commodities.HEAVY_MACHINERY, 500f);
Misc.getLocalResourcesCargo(market).addItems(CargoItemType.RESOURCES, Commodities.FOOD, 8000f);

market.setUseStockpilesForShortages(true);
market.setEconGroup(market.getId());

buildCommRelayIfNeeded(pickedSystem,faction);

//Logger log = Global.getLogger(CoreScript.class);
//log.info("Created EZ Faction Colony " + ezColony.getName() + " for Faction " + faction.getDisplayName() + " at System " +pickedSystem.getBaseName());
ezColony.setMarket(market);

Global.getSector().getEconomy().addMarket(market,true);
//PICKED_SYSTEMS.add(pickedSystem.getName());
return ezColony;
}


All of the above should mean the Market's populated, has all the bits and pieces and has a Spaceport.  Not sure what triggers the visibility thing in the UI, though.  At one point, it worked; then, after I fixed the crash-bug above... somewhere along the way, it's stopped working. 
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: CTD (Market / Industry Related)
« Reply #6 on: February 24, 2019, 11:57:12 PM »

All right, I appear to have gotten EZ Faction working again.  Not quite sure why the changes I made worked, but whatever, it worked.
Logged
Please check out my SS projects :)
Xeno's Mod Pack