Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - mathwizi2005

Pages: [1]
1
Mods / Re: [0.95a] Console Commands v2021.04.10
« on: May 10, 2021, 01:03:48 AM »
I'm trying to get a code that spawns a jump point at the player location and I'm doing it repurposing the old Stable Location spawn code but it keeps erroring out

Spoiler
runcode Random rndm = new Random;
    StarSystemAPI starSystem = Global.getSector().getPlayerFleet().getStarSystem();
    JumpPointAPI newJumpPoint = Global.getFactory().createJumpPoint("console_added_jumppoint" + rndm.nextInt(), "Hyperspace Jump Point " + starSystem.getJumpPoints().size());
    float distance = MathUtils.getDistance(Global.getSector().getPlayerFleet().getLocation(), starSystem.getStar().getLocation());
    OrbitAPI newJumpPointOrbitAroundStar = Global.getFactory().createCircularOrbit(starSystem.getStar(), 0, distance, distance / 10);
    newJumpPoint.setOrbit(newJumpPointOrbitAroundStar);
    newJumpPoint.setStandardWormholeToHyperspaceVisual();
[close]

Is this just overcomplicating things or are my calls no longer active?  This is from the past version

2
Mods / Re: [0.9.1a] Console Commands v3.0 WIP 7.6 (released 2018-12-07)
« on: November 02, 2020, 03:37:26 PM »
Is there a way to spawn the hyperspace jump point to the player's location?

Code
runcode Global.getSector().getStarSystem("System Name").autogenerateHyperspaceJumpPoints(true,true)
// the first true statement is for Gas Giants
// the second true statement is for generating Fringe Jump Points
Code
runcode Random rndm = new Random;
                StarSystemAPI starSystem = Global.getSector().getPlayerFleet().getStarSystem();
                JumpPointAPI newJumpPoint = Global.getFactory().createJumpPoint("console_added_jumppoint" + rndm.nextInt(), "Hyperspace Jump Point " + starSystem.getJumpPoints().size());
                float distance = MathUtils.getDistance(Global.getSector().getPlayerFleet().getLocation(), starSystem.getStar().getLocation());
                OrbitAPI newJumpPointOrbitAroundStar = Global.getFactory().createCircularOrbit(starSystem.getStar(), 0, distance, distance / 10);
                newJumpPoint.setOrbit(newJumpPointOrbitAroundStar);
                newJumpPoint.setStandardWormholeToHyperspaceVisual();

This command is erroring out for Jump Point generation at the player and the command before only adds fringe points in non Gas Giant sectors.
Spoiler
[close]

The odd thing is the syntax all looks fine.

Can the Stable location spawn command be retailored for Jump points?
Spoiler
runcode SectorEntityToken fleet = Global.getSector().getPlayerFleet();
    StarSystemAPI sys = (StarSystemAPI)fleet.getContainingLocation();
    SectorEntityToken stable = fleet.getContainingLocation().addCustomEntity(null, null, "stable_location", "neutral");
    float orbitRadius = com.fs.starfarer.api.util.Misc.getDistance(fleet, sys.getCenter());
    float orbitDays = orbitRadius / (20f + new Random().nextFloat() * 5f);
    float angle = com.fs.starfarer.api.util.Misc.getAngleInDegrees(sys.getCenter().getLocation(), fleet.getLocation());
    stable.setCircularOrbit(sys.getCenter(), angle, orbitRadius, orbitDays);
[close]

Pages: [1]