You really shouldn't need to, that code doesn't care where it runs. Well, I mean, if you want autogenerated jump-points related to what you're adding, that could be a problem since that's called from Hybrasil.java etc. But that aside, I don't see why you couldn't do what you're doing - I suspect the issue was how you got the star, and it wasn't the right entity. For example, maybe you got hold of the star's gravity well in hyperspace instead?
Yeah I don't really understand it myself.
The ambiguity of the error makes it quite difficult to place.
The only other thing I could come up with, after pondering it quite a bit, was the use of the "new" operator somehow causing weirdness. At first I thought it was that the star had to just be initialized for some reason, but that doesn't make sense.
My thought process: When I generated a custom planet and market - literally using the exact same method - in Galatia for use with the tutorial, it seemed to work just fine. The market showed up and you could click "Show Info" on any relevant entity. The market conditions appeared, etc. That's why I blindly re-used that method in 3 new systems, because it seemed "tried and tested." Not so.
Now, the only difference between anything implemented between those two planets is that one has a custom implemented market script, like Derinkuyu, and one does not. So, also like Derinkuyu, the market is added to the global economy during:
ArcheusTutorialMissionEvent.endGalatiaPortionofMission() using:
Global.getSector().getEconomy().addMarket(eldrus.getMarket());where:
"eldrus" is returned by:
SectorEntityToken eldrus = system.getEntityById("eldrus");That being said, I had originally populated two additional planets in Isirah, again same method, and added markets to them using a .JSON file in the data/campaign/econ directory - and
that also causes the error.
The market works fine, you can go there, see fleets spawn, even
dock and buy things but the second you try and view the planet info, or any other planet that would pull its info within its range, you get the error.
Edit** Ok... you know what, looking at it again, I wonder if the key here is:
system.getEntityById("eldrus")being used to put the market into the economy.
So,
Here is the script generating eldrus in galatia:
Spoiler
StarSystemAPI system = sector.getStarSystem("galatia");
// create the star and generate the hyperspace anchor for this system
PlanetAPI star = system.getStar();
// SectorEntityToken creation goes from star -> fringe
PlanetAPI eldrus = system.addPlanet("eldrus", star, "Eldrus", "barren", 130f, 120f, 12000f, 600f);
eldrus.setCustomDescriptionId("planet_eldrus");
eldrus.setFaction(ArcheusFactions.ARCHEUS);
eldrus.setInteractionImage("illustrations", "vacuum_colony");
// create a market for eldrus - not connected to the rest of the economy to start with
MarketAPI market = Global.getFactory().createMarket("eldrus_market", eldrus.getName(), 0);
market.setSize(1);
market.setSurveyLevel(MarketAPI.SurveyLevel.FULL);
market.setPrimaryEntity(eldrus);
market.setFactionId(eldrus.getFaction().getId());
market.addCondition(Conditions.POPULATION_2);
market.addCondition(Conditions.OUTPOST);
market.addSubmarket(Submarkets.SUBMARKET_OPEN);
market.addSubmarket(Submarkets.SUBMARKET_BLACK);
market.addSubmarket(Submarkets.SUBMARKET_STORAGE);
eldrus.setMarket(market);
market.getCommDirectory().addMissionBoard();
eldrus.addScript(new GalatiaMarketScript(market));
And one making a station in corvus:
Spoiler
StarSystemAPI system = sector.getStarSystem("corvus");
PlanetAPI star = system.getStar();
//add station
SectorEntityToken tg_station = system.addCustomEntity("jangalas_rest_station", "Jangala's Rest", "station_side02", ArcheusFactions.TRADERGUILDS);
tg_station.setCircularOrbitPointingDown(star, 315f, 7000f, 360f);
tg_station.setCustomDescriptionId("traderguilds_station_corvus");
The station has a market added through the .JSON file. -No error.
The planet has a market added to the global economy as displayed above. -No error.
Now if I put this:
Spoiler
PlanetAPI penumbros = system.addPlanet("penumbros_archeus", star, "Penumbros", "jungle", 145, 180, 7000, 600);
penumbros.setCustomDescriptionId("planet_penumbros");
SectorEntityToken fortress = system.addCustomEntity("eldritch_fortress", "Eldritch Fortress", "station_side03", ArcheusFactions.ARCHEUS);
fortress.setCircularOrbitPointingDown(system.getEntityById("penumbros_archeus"), 140f, 250f, 600f);
fortress.setCustomDescriptionId("eldritch_fortress");
fortress.setInteractionImage("illustrations", "eldritch_fortress");
in either file at all, whether I add a market through the JSON file, or not, but I don't do what I did with Eldrus and add a market to the global economy in
ArcheusTutorialMissionEvent.endGalatiaPortionofMission() like above. -Error.
That's the extent to which I understand what's going on. So, if anyone sees something I don't here please let me know! I would really like to not run into this error again in the future.