So I've been at it, trying to fix this damn system. It's obvious I'm missing something.
The mod starts up fine (no errors), but the new system does not show up in the Hyperspace map (or in space). WHY!?
package data.scripts.world;
import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.InteractionDialogImageVisual;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.campaign.JumpPointAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.OrbitAPI;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.fleet.FleetMemberType;
import com.fs.starfarer.api.impl.campaign.CoreCampaignPluginImpl;
import java.awt.Color;
import java.util.List;
@SuppressWarnings("unchecked")
public class NihilGen {
public void generate(SectorAPI sector) {
StarSystemAPI system = sector.createStarSystem("Noll");
LocationAPI hyper = Global.getSector().getHyperspace();
system.setBackgroundTextureFilename("graphics/backgrounds/background4.jpg");
//system.setBackgroundTextureFilename("graphics/backgrounds/background2.png");
// create the star and generate the hyperspace anchor for this system
PlanetAPI star = system.initStar("star_neutron", // id in planets.json
1000f, // radius (in pixels at default zoom)
1500, 1500); // location in hyperspace
system.setLightColor(new Color(45, 35, 45)); // light color in entire system, affects all entities
/*
* addPlanet() parameters:
* 1. What the planet orbits (orbit is always circular)
* 2. Name
* 3. Planet type id in planets.json
* 4. Starting angle in orbit, i.e. 0 = to the right of the star
* 5. Planet radius, pixels at default zoom
* 6. Orbit radius, pixels at default zoom
* 7. Days it takes to complete an orbit. 1 day = 10 seconds.
*/
PlanetAPI n1 = system.addPlanet(star, "Nihil", "nihil", 290, 120, 11500, 450);
PlanetAPI n2 = system.addPlanet(star, "Zenit", "cryovolcanic", 5, 180, 2500, 100);
PlanetAPI n21 = system.addPlanet(n2, "Zenit Minor", "rocky_unstable", 35, 85, 800, 25);
/*
* addAsteroidBelt() parameters:
* 1. What the belt orbits
* 2. Number of asteroids
* 3. Orbit radius
* 4. Belt width
* 6/7. Range of days to complete one orbit. Value picked randomly for each asteroid.
*/
/*
* addRingBand() parameters:
* 1. What it orbits
* 2. Category under "graphics" in settings.json
* 3. Key in category
* 4. Width of band within the texture
* 5. Index of band
* 6. Color to apply to band
* 7. Width of band (in the game)
* 8. Orbit radius (of the middle of the band)
* 9. Orbital period, in days
*/
system.addRingBand(n1, "misc", "rings2", 256f, 2, Color.white, 256f, 200, 20f);
system.addRingBand(n1, "misc", "rings2", 256f, 2, Color.white, 256f, 400, 40f);
system.addRingBand(n1, "misc", "rings3", 256f, 2, Color.white, 256f, 800, 60f);
JumpPointAPI jumpPoint = Global.getFactory().createJumpPoint("Unstable Jump Point");
OrbitAPI orbit = Global.getFactory().createCircularOrbit(n1, 0, 500, 30);
jumpPoint.setOrbit(orbit);
jumpPoint.setRelatedPlanet(n1);
jumpPoint.setStandardWormholeToHyperspaceVisual();
system.addEntity(jumpPoint);
FactionAPI nihil = sector.getFaction( "nihil" );
nihil.setRelationship( "hegemony", -1 );
nihil.setRelationship( "tritachyon", -1 );
nihil.setRelationship( "pirates", -1 );
nihil.setRelationship( "independent", -1 );
nihil.setRelationship( "nomads", -1 );
nihil.setRelationship( "junk_pirates", -1 );
nihil.setRelationship( "sindrian_diktat", -1);
nihil.setRelationship( "player", -1 );
// SectorEntityToken station = system.addOrbitalStation(a1, 45, 300, 50, "Command & Control", "sindrian_diktat");
// initStationCargo(station);
// example of using custom visuals below
// a1.setCustomInteractionDialogImageVisual(new InteractionDialogImageVisual("illustrations", "hull_breach", 800, 800));
jumpPoint.setCustomInteractionDialogImageVisual(new InteractionDialogImageVisual("illustrations", "space_wreckage", 1200, 1200));
// station.setCustomInteractionDialogImageVisual(new InteractionDialogImageVisual("illustrations", "cargo_loading", 1200, 1200));
// generates hyperspace destinations for in-system jump points
system.autogenerateHyperspaceJumpPoints(true, true);
//NihilSpawnPoint patrolSpawn = new NihilSpawnPoint(sector, system, 5, 3, n1);
//system.addScript(patrolSpawn);
//for (int i = 0; i < 5; i++)
// patrolSpawn.spawnFleet();
//NihilSpawnPoint garrisonSpawn = new NihilSpawnPoint(sector, system, 1, 2, n1);
//system.addSpawnPoint(Nihilspawn);
//Nihilspawn.spawnFleet();
// NihilSpawnPoint NihilSpawn = new NihilSpawnPoint(sector, system, 1, 2, n1);
//system.addSpawnPoint(NihilSpawn);
//Nihilspawn.spawnFleet();
NihilSpawnPoint nihilSpawn = new NihilSpawnPoint( sector, system, 1, 2, n1 );
system.addSpawnPoint( nihilSpawn );
// for (int i = 0; i < 3; i++) nihilSpawn.spawnFleet();
// system.addScript(new IndependentTraderSpawnPoint(sector, hyper, 1, 10, hyper.createToken(-6000, 2000), station));
sector.registerPlugin(new CoreCampaignPluginImpl());
}
// private void initStationCargo(SectorEntityToken station) {
// CargoAPI cargo = station.getCargo();
// addRandomWeapons(cargo, 5);
//
// cargo.addCrew(CrewXPLevel.VETERAN, 20);
// cargo.addCrew(CrewXPLevel.REGULAR, 500);
// cargo.addMarines(200);
// cargo.addSupplies(1000);
// cargo.addFuel(500);
//
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "conquest_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "heron_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "heron_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "crig_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "crig_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "crig_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "ox_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "ox_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "ox_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "ox_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "ox_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "monitor_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.SHIP, "monitor_Hull"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "gladius_wing"));
// cargo.getMothballedShips().addFleetMember(Global.getFactory().createFleetMember(FleetMemberType.FIGHTER_WING, "gladius_wing"));
// }
// private void addRandomWeapons(CargoAPI cargo, int count) {
// List weaponIds = Global.getSector().getAllWeaponIds();
// for (int i = 0; i < count; i++) {
// String weaponId = (String) weaponIds.get((int) (weaponIds.size() * Math.random()));
// int quantity = (int)(Math.random() * 4f + 2f);
// cargo.addWeapons(weaponId, quantity);
// }
}
Code is full of placeholders and things commented as of trying to find the damn problem.