Fractal Softworks Forum

Starsector => Bug Reports & Support => Bug Reports & Support (modded) => Topic started by: Kesh on August 18, 2019, 03:55:05 PM

Title: How to enable Prism Freeport in-game? (SOLVED)
Post by: Kesh on August 18, 2019, 03:55:05 PM
I am a little bit late in the game now but I forgot to enable Prism Freeport which I wanted to. Is there a way to enable it in-game?
Title: Re: How to enable Prism Freeport in-game?
Post by: Midnight Kitsune on August 20, 2019, 08:49:00 PM
I am a little bit late in the game now but I forgot to enable Prism Freeport which I wanted to. Is there a way to enable it in-game?
Sadly no. Stations and planets are created with the map on the starting of a new game.
Title: Re: How to enable Prism Freeport in-game?
Post by: Harmful Mechanic on August 20, 2019, 11:54:49 PM
Technically, you could enter the entirety of the Prism Freeport generation code into the console with Console Commands, and that should run and generate it. No idea what could go wrong, though; try it at your own risk.
Title: Re: How to enable Prism Freeport in-game?
Post by: Kesh on August 21, 2019, 08:33:10 PM
Technically, you could enter the entirety of the Prism Freeport generation code into the console with Console Commands, and that should run and generate it. No idea what could go wrong, though; try it at your own risk.

Uhmm... No idea how to do that though. Do you know how?
Title: Re: How to enable Prism Freeport in-game?
Post by: Harmful Mechanic on August 21, 2019, 10:24:59 PM
Here's the code block:

It's long, so warm up those typing fingers.
Code
protected void addPrismMarket(SectorAPI sector)
{
SectorEntityToken prismEntity;

if (ExerelinSetupData.getInstance().numSystems == 1)
{
// FIXME
SectorEntityToken toOrbit = Global.getSector().getEntityById("jangala"); //null;
float radius = toOrbit.getRadius();
float orbitDistance = radius + 150;
if (toOrbit instanceof PlanetAPI)
{
PlanetAPI planet = (PlanetAPI)toOrbit;
if (planet.isStar())
{
orbitDistance = radius + 2000 + rand.nextFloat() * 500;
}
}
prismEntity = toOrbit.getContainingLocation().addCustomEntity("nex_prismFreeport", "Prism Freeport", "exerelin_freeport_type", "independent");
prismEntity.setCircularOrbitPointingDown(toOrbit, ExerelinUtilsAstro.getRandomAngle(rand), orbitDistance, ExerelinUtilsAstro.getOrbitalPeriod(toOrbit, orbitDistance));
}
else
{
LocationAPI hyperspace = sector.getHyperspace();
prismEntity = hyperspace.addCustomEntity("nex_prismFreeport", "Prism Freeport", "exerelin_freeport_type", "independent");
prismEntity.setCircularOrbitWithSpin(hyperspace.createToken(-8005, -4385), ExerelinUtilsAstro.getRandomAngle(rand), 150, 60, 30, 30);
}

prismEntity.addTag(ExerelinConstants.TAG_UNINVADABLE);

/*
EntityData data = new EntityData(null);
data.name = "Prism Freeport";
data.type = EntityType.STATION;
data.forceMarketSize = 4;

MarketAPI market = addMarketToEntity(prismEntity, data, "independent");
*/

MarketAPI market = Global.getFactory().createMarket("nex_prismFreeport" /*+ "_market"*/, "Prism Freeport", 5);
market.setFactionId(Factions.INDEPENDENT);
market.addCondition(Conditions.POPULATION_5);
market.addIndustry(Industries.POPULATION);
market.addIndustry("commerce");
market.addIndustry(Industries.LIGHTINDUSTRY);
market.addIndustry(Industries.MILITARYBASE);
market.addIndustry(Industries.MEGAPORT);
//market.addIndustry(Industries.HEAVYINDUSTRY);
market.addIndustry(Industries.HEAVYBATTERIES);
market.addIndustry(Industries.STARFORTRESS_HIGH);
market.addIndustry(Industries.CRYOSANCTUM);

market.setFreePort(true);
market.addSubmarket(Submarkets.SUBMARKET_OPEN);
market.addSubmarket(Submarkets.GENERIC_MILITARY);
market.addSubmarket(Submarkets.SUBMARKET_BLACK);
market.addSubmarket(Submarkets.SUBMARKET_STORAGE);

market.getMemoryWithoutUpdate().set(ExerelinConstants.MEMORY_KEY_UNINVADABLE, true);

market.getTariff().modifyFlat("generator", sector.getFaction(Factions.INDEPENDENT).getTariffFraction());
ExerelinUtilsMarket.setTariffs(market);
market.addSubmarket("exerelin_prismMarket");
market.setPrimaryEntity(prismEntity);
prismEntity.setMarket(market);
prismEntity.setFaction(Factions.INDEPENDENT);
market.setSurveyLevel(MarketAPI.SurveyLevel.FULL); // not doing this makes market condition tooltips fail to appear
sector.getEconomy().addMarket(market, true);

//prismEntity.removeTag(Tags.STATION); // workaround http://fractalsoftworks.com/forum/index.php?topic=12548.msg213678#msg213678

//pickEntityInteractionImage(prismEntity, market, "", EntityType.STATION);
//prismEntity.setInteractionImage("illustrations", "space_bar");
prismEntity.setCustomDescriptionId("exerelin_prismFreeport");

// deep hyperspace removal (copypasted from UW)
HyperspaceTerrainPlugin plugin = (HyperspaceTerrainPlugin) Misc.getHyperspaceTerrain().getPlugin();
NebulaEditor editor = new NebulaEditor(plugin);

float minRadius = plugin.getTileSize() * 2f;
float radius = 400;
editor.clearArc(prismEntity.getLocation().x, prismEntity.getLocation().y, 0, radius + minRadius * 0.5f, 0, 360f);
editor.clearArc(prismEntity.getLocation().x, prismEntity.getLocation().y, 0, radius + minRadius, 0, 360f, 0.25f);
}
[close]
Title: Re: How to enable Prism Freeport in-game?
Post by: Kesh on August 22, 2019, 12:15:10 AM
Here's the code block:

It's long, so warm up those typing fingers.
Code
protected void addPrismMarket(SectorAPI sector)
{
SectorEntityToken prismEntity;

if (ExerelinSetupData.getInstance().numSystems == 1)
{
// FIXME
SectorEntityToken toOrbit = Global.getSector().getEntityById("jangala"); //null;
float radius = toOrbit.getRadius();
float orbitDistance = radius + 150;
if (toOrbit instanceof PlanetAPI)
{
PlanetAPI planet = (PlanetAPI)toOrbit;
if (planet.isStar())
{
orbitDistance = radius + 2000 + rand.nextFloat() * 500;
}
}
prismEntity = toOrbit.getContainingLocation().addCustomEntity("nex_prismFreeport", "Prism Freeport", "exerelin_freeport_type", "independent");
prismEntity.setCircularOrbitPointingDown(toOrbit, ExerelinUtilsAstro.getRandomAngle(rand), orbitDistance, ExerelinUtilsAstro.getOrbitalPeriod(toOrbit, orbitDistance));
}
else
{
LocationAPI hyperspace = sector.getHyperspace();
prismEntity = hyperspace.addCustomEntity("nex_prismFreeport", "Prism Freeport", "exerelin_freeport_type", "independent");
prismEntity.setCircularOrbitWithSpin(hyperspace.createToken(-8005, -4385), ExerelinUtilsAstro.getRandomAngle(rand), 150, 60, 30, 30);
}

prismEntity.addTag(ExerelinConstants.TAG_UNINVADABLE);

/*
EntityData data = new EntityData(null);
data.name = "Prism Freeport";
data.type = EntityType.STATION;
data.forceMarketSize = 4;

MarketAPI market = addMarketToEntity(prismEntity, data, "independent");
*/

MarketAPI market = Global.getFactory().createMarket("nex_prismFreeport" /*+ "_market"*/, "Prism Freeport", 5);
market.setFactionId(Factions.INDEPENDENT);
market.addCondition(Conditions.POPULATION_5);
market.addIndustry(Industries.POPULATION);
market.addIndustry("commerce");
market.addIndustry(Industries.LIGHTINDUSTRY);
market.addIndustry(Industries.MILITARYBASE);
market.addIndustry(Industries.MEGAPORT);
//market.addIndustry(Industries.HEAVYINDUSTRY);
market.addIndustry(Industries.HEAVYBATTERIES);
market.addIndustry(Industries.STARFORTRESS_HIGH);
market.addIndustry(Industries.CRYOSANCTUM);

market.setFreePort(true);
market.addSubmarket(Submarkets.SUBMARKET_OPEN);
market.addSubmarket(Submarkets.GENERIC_MILITARY);
market.addSubmarket(Submarkets.SUBMARKET_BLACK);
market.addSubmarket(Submarkets.SUBMARKET_STORAGE);

market.getMemoryWithoutUpdate().set(ExerelinConstants.MEMORY_KEY_UNINVADABLE, true);

market.getTariff().modifyFlat("generator", sector.getFaction(Factions.INDEPENDENT).getTariffFraction());
ExerelinUtilsMarket.setTariffs(market);
market.addSubmarket("exerelin_prismMarket");
market.setPrimaryEntity(prismEntity);
prismEntity.setMarket(market);
prismEntity.setFaction(Factions.INDEPENDENT);
market.setSurveyLevel(MarketAPI.SurveyLevel.FULL); // not doing this makes market condition tooltips fail to appear
sector.getEconomy().addMarket(market, true);

//prismEntity.removeTag(Tags.STATION); // workaround http://fractalsoftworks.com/forum/index.php?topic=12548.msg213678#msg213678

//pickEntityInteractionImage(prismEntity, market, "", EntityType.STATION);
//prismEntity.setInteractionImage("illustrations", "space_bar");
prismEntity.setCustomDescriptionId("exerelin_prismFreeport");

// deep hyperspace removal (copypasted from UW)
HyperspaceTerrainPlugin plugin = (HyperspaceTerrainPlugin) Misc.getHyperspaceTerrain().getPlugin();
NebulaEditor editor = new NebulaEditor(plugin);

float minRadius = plugin.getTileSize() * 2f;
float radius = 400;
editor.clearArc(prismEntity.getLocation().x, prismEntity.getLocation().y, 0, radius + minRadius * 0.5f, 0, 360f);
editor.clearArc(prismEntity.getLocation().x, prismEntity.getLocation().y, 0, radius + minRadius, 0, 360f, 0.25f);
}
[close]

Wow... Thank you very much... Soooo i just need to type this in console commands?
Title: Re: How to enable Prism Freeport in-game?
Post by: Midnight Kitsune on August 22, 2019, 05:47:11 PM
Here's the code block:

It's long, so warm up those typing fingers.
Code
protected void addPrismMarket(SectorAPI sector)
{
SectorEntityToken prismEntity;

if (ExerelinSetupData.getInstance().numSystems == 1)
{
// FIXME
SectorEntityToken toOrbit = Global.getSector().getEntityById("jangala"); //null;
float radius = toOrbit.getRadius();
float orbitDistance = radius + 150;
if (toOrbit instanceof PlanetAPI)
{
PlanetAPI planet = (PlanetAPI)toOrbit;
if (planet.isStar())
{
orbitDistance = radius + 2000 + rand.nextFloat() * 500;
}
}
prismEntity = toOrbit.getContainingLocation().addCustomEntity("nex_prismFreeport", "Prism Freeport", "exerelin_freeport_type", "independent");
prismEntity.setCircularOrbitPointingDown(toOrbit, ExerelinUtilsAstro.getRandomAngle(rand), orbitDistance, ExerelinUtilsAstro.getOrbitalPeriod(toOrbit, orbitDistance));
}
else
{
LocationAPI hyperspace = sector.getHyperspace();
prismEntity = hyperspace.addCustomEntity("nex_prismFreeport", "Prism Freeport", "exerelin_freeport_type", "independent");
prismEntity.setCircularOrbitWithSpin(hyperspace.createToken(-8005, -4385), ExerelinUtilsAstro.getRandomAngle(rand), 150, 60, 30, 30);
}

prismEntity.addTag(ExerelinConstants.TAG_UNINVADABLE);

/*
EntityData data = new EntityData(null);
data.name = "Prism Freeport";
data.type = EntityType.STATION;
data.forceMarketSize = 4;

MarketAPI market = addMarketToEntity(prismEntity, data, "independent");
*/

MarketAPI market = Global.getFactory().createMarket("nex_prismFreeport" /*+ "_market"*/, "Prism Freeport", 5);
market.setFactionId(Factions.INDEPENDENT);
market.addCondition(Conditions.POPULATION_5);
market.addIndustry(Industries.POPULATION);
market.addIndustry("commerce");
market.addIndustry(Industries.LIGHTINDUSTRY);
market.addIndustry(Industries.MILITARYBASE);
market.addIndustry(Industries.MEGAPORT);
//market.addIndustry(Industries.HEAVYINDUSTRY);
market.addIndustry(Industries.HEAVYBATTERIES);
market.addIndustry(Industries.STARFORTRESS_HIGH);
market.addIndustry(Industries.CRYOSANCTUM);

market.setFreePort(true);
market.addSubmarket(Submarkets.SUBMARKET_OPEN);
market.addSubmarket(Submarkets.GENERIC_MILITARY);
market.addSubmarket(Submarkets.SUBMARKET_BLACK);
market.addSubmarket(Submarkets.SUBMARKET_STORAGE);

market.getMemoryWithoutUpdate().set(ExerelinConstants.MEMORY_KEY_UNINVADABLE, true);

market.getTariff().modifyFlat("generator", sector.getFaction(Factions.INDEPENDENT).getTariffFraction());
ExerelinUtilsMarket.setTariffs(market);
market.addSubmarket("exerelin_prismMarket");
market.setPrimaryEntity(prismEntity);
prismEntity.setMarket(market);
prismEntity.setFaction(Factions.INDEPENDENT);
market.setSurveyLevel(MarketAPI.SurveyLevel.FULL); // not doing this makes market condition tooltips fail to appear
sector.getEconomy().addMarket(market, true);

//prismEntity.removeTag(Tags.STATION); // workaround http://fractalsoftworks.com/forum/index.php?topic=12548.msg213678#msg213678

//pickEntityInteractionImage(prismEntity, market, "", EntityType.STATION);
//prismEntity.setInteractionImage("illustrations", "space_bar");
prismEntity.setCustomDescriptionId("exerelin_prismFreeport");

// deep hyperspace removal (copypasted from UW)
HyperspaceTerrainPlugin plugin = (HyperspaceTerrainPlugin) Misc.getHyperspaceTerrain().getPlugin();
NebulaEditor editor = new NebulaEditor(plugin);

float minRadius = plugin.getTileSize() * 2f;
float radius = 400;
editor.clearArc(prismEntity.getLocation().x, prismEntity.getLocation().y, 0, radius + minRadius * 0.5f, 0, 360f);
editor.clearArc(prismEntity.getLocation().x, prismEntity.getLocation().y, 0, radius + minRadius, 0, 360f, 0.25f);
}
[close]

Wow... Thank you very much... Soooo i just need to type this in console commands?
Sadly it looks like it doesn't work
Title: Re: How to enable Prism Freeport in-game?
Post by: Histidine on August 23, 2019, 02:09:16 AM
Implemented an easier way to do it.

- Download the Nexerelin hotfix .jar from this post (http://fractalsoftworks.com/forum/index.php?topic=9175.msg258196#msg258196)
- Enter in console (copy and paste): runcode new exerelin.world.ExerelinNewGameSetup().addPrismMarket(Global.getSector(), false);
Title: Re: How to enable Prism Freeport in-game? (SOLVED)
Post by: Kesh on August 23, 2019, 03:09:40 AM
Implemented an easier way to do it.

- Download the Nexerelin hotfix .jar from this post (http://fractalsoftworks.com/forum/index.php?topic=9175.msg258196#msg258196)
- Enter in console (copy and paste): runcode new exerelin.world.ExerelinNewGameSetup().addPrismMarket(Global.getSector(), false);

It worked!! Thank you very much!!