Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 595 596 [597] 598 599 ... 710

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1727537 times)

Liral

  • Admiral
  • *****
  • Posts: 718
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8940 on: July 15, 2022, 01:14:39 PM »

You could do it - either by providing a custom implementation of OrbitAPI (which *might* run into some problems, potentially, if some vanilla code makes some assumptions that are broken by this) or by just having a script move the entity around however you choose. You could even have a rectangular orbit if you like :)

Whether that works well will depend on the specifics of your use case - with non-circular orbits you'd generally have a harder time making sure that the object doesn't occasionally overlap some of its neighbors in a visually awkward way.

(The spiral ringband doesn't have anything to do with orbits, iirc; it's just a visual for filling in the inside of a circular band, more or less.)

I have now written a patched-conic OrbitAPI implementation that accepts the initial conditions of the semi-major and semi-minor axes, period, and time at pericenter of a 2-body system, alongside the current time, and dynamically updates the position of the orbiting body by applying a Newton-Raphson approximation of Kepler's laws.  I would gladly see this implementation, or a similar one, added to the collection of factories in the settings.
« Last Edit: July 15, 2022, 03:29:50 PM by Liral »
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8941 on: July 15, 2022, 03:11:39 PM »

It spawns a full wing. I think your best bet might be to spawn those fighters as "ships", but I'm not sure if it's actually possible to add them to an existing wing - wing.getWingMembers().add() wouldn't work because getWingMembers() returns a copy of the list. Someone with more experience modding this stuff might have a better idea, though.

hmm, I could work with spawning the ships - I wanted to spawn the wings & give them to the initial carrier so that the targeting / general grouping stuff would be done automatically, though I guess I could replicate some of it by spawning the individual ships & setting their target to the mothership / initial fighter's (whichever one has the correct target) every frame.

thanks for the clarification anyway!

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8942 on: July 15, 2022, 05:06:33 PM »

how does using spawnShipOrWing() work for wings specifically?
say that I wanted a fighter to spawn a copy of itself (and for those copies to be able to spawn copies, with a limit), would spawning the extras as individual ships & adding them to the first ship's wing work (and go over the 6 fighter-per-wing limit), or would I have to do something else?

I've tried looking at the shardSpawner code but it's franky incomprehensible to me, I can't really tell where the aspects actually get spawned / get anything assigned to them

Piggybacking off this spawnShipOrWing() question, is there any way to keep ships spawned like this from appear in the deployment screen (when pressing G during combat)
Logged

AccuracyThruVolume

  • Commander
  • ***
  • Posts: 135
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8943 on: July 16, 2022, 03:41:25 AM »

I have a 4 barreled ballistic cannon that each shot is replaced with one of 3 random shell types using an EveryFrameWeaponEffectPlugin.

So far I've gotten the shells to replace correctly, but they all spawn from the same Y location (Y center of the sprite).  I need to capture the location of each muzzle.  Is there a way to detect the muzzle offset of the firing weapon so it can be applied to the new projectile?   I use a calculateMuzzle as seen below, it does most of the job but it looks a little odd with all of the projectiles spawning from the same place.


Spoiler
package data.scripts.weapons;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.*;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lwjgl.util.vector.Vector2f;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.lang.String;

public class BarrageKannon_EveryFrameEffect implements EveryFrameWeaponEffectPlugin
{
    public static final float SPREAD = 8f;

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
   {

      // Removes dummy shot
      for (DamagingProjectileAPI p : engine.getProjectiles())
      {
         if(p == null || p.getProjectileSpecId() == null || !p.getProjectileSpecId().equalsIgnoreCase("battlefleets_ork_barrage_kannon_shell"))
            continue; // Skip projectiles we don't care about
         
         if(p == null || !p.getWeapon().equals(weapon))
            continue; // Skip projectiles that were not fired by this weapon

         engine.removeEntity(p);
         
         // Random number 0-5
         int RndShotType = (int)Math.round(Math.random() * 5);
         if (RndShotType == 0 || RndShotType == 1 || RndShotType == 2)    // HE shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
            float angle = weapon.getCurrAngle() + offset;
            String weaponId = "battlefleets_ork_barrage_kannon_he";
            Vector2f muzzleLocation = calculateMuzzle(weapon);
            DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
            float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
            proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 3 || RndShotType == 4)    // Kinetic shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
            float angle = weapon.getCurrAngle() + offset;
            String weaponId = "battlefleets_ork_barrage_kannon_kinetic";
            Vector2f muzzleLocation = calculateMuzzle(weapon);
            DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
            float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
            proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 5)    // Frag shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
            float angle = weapon.getCurrAngle() + offset;
            String weaponId = "battlefleets_ork_barrage_kannon_frag";
            Vector2f muzzleLocation = calculateMuzzle(weapon);
            DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
            float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
            proj.getVelocity().scale(randomSpeed);   
         }
      }

   }
   
   private Vector2f calculateMuzzle(WeaponAPI weapon)
   {
        float muzzle = 50;
        double angle = Math.toRadians(weapon.getCurrAngle());
        Vector2f dir = new Vector2f((float)Math.cos(angle),(float)Math.sin(angle));
        if (dir.lengthSquared() > 0f) dir.normalise();
        dir.scale(muzzle);
        Vector2f loc = new Vector2f(weapon.getLocation());
        return Vector2f.add(loc,dir,new Vector2f());

    }
}

[close]
« Last Edit: July 16, 2022, 07:53:53 AM by AccuracyThruVolume »
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8944 on: July 16, 2022, 03:57:42 AM »

I have a 4 barreled ballistic cannon that each shot is replaced with one of 3 random shell types using an EveryFrameWeaponEffectPlugin.

can't you use an onFireEffectPlugin for this? I'm not sure how the actual code would work but it'd probably be pretty similar - it gives you the projectile that was just fired, you could delete that and spawn your own one at the position of the now-gone projectile (with the rest probably being about the same).

AccuracyThruVolume

  • Commander
  • ***
  • Posts: 135
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8945 on: July 16, 2022, 05:44:18 AM »

I have a 4 barreled ballistic cannon that each shot is replaced with one of 3 random shell types using an EveryFrameWeaponEffectPlugin.

can't you use an onFireEffectPlugin for this? I'm not sure how the actual code would work but it'd probably be pretty similar - it gives you the projectile that was just fired, you could delete that and spawn your own one at the position of the now-gone projectile (with the rest probably being about the same).


Indeed I tried the similar:

Spoiler
package data.scripts.weapons;

import java.awt.Color;
import java.util.Iterator;

import org.lwjgl.util.vector.Vector2f;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.*;
import com.fs.starfarer.api.impl.campaign.ids.Stats;
import com.fs.starfarer.api.util.Misc;
import org.lwjgl.util.vector.Vector2f;

import com.fs.starfarer.api.util.IntervalUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BarrageKannonOnFireEffect implements OnFireEffectPlugin
{

    public static final float SPREAD = 8f;   
   
   public void onFire(DamagingProjectileAPI projectile, WeaponAPI weapon, CombatEngineAPI engine)
   {

       // Removes dummy shot
      for (DamagingProjectileAPI p : engine.getProjectiles())
      {
         if (p.getWeapon() == weapon && p.getProjectileSpecId().equalsIgnoreCase("battlefleets_ork_barrage_kannon_shell"))
            engine.removeEntity(p);
      }
      
         // Random number 0-5
         int RndShotType = (int)Math.round(Math.random() * 5);
         if (RndShotType == 0 )    // HE shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
                float angle = weapon.getCurrAngle() + offset;
                String weaponId = "battlefleets_ork_barrage_kannon_he";
                Vector2f muzzleLocation = calculateMuzzle(weapon);
                DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
                float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
                proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 1 )    // HE shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
                float angle = weapon.getCurrAngle() + offset;
                String weaponId = "battlefleets_ork_barrage_kannon_he";
                Vector2f muzzleLocation = calculateMuzzle(weapon);
                DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
                float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
                proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 2 )    // HE shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
                float angle = weapon.getCurrAngle() + offset;
                String weaponId = "battlefleets_ork_barrage_kannon_he";
                Vector2f muzzleLocation = calculateMuzzle(weapon);
                DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
                float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
                proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 3)    // Kinetic shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
                float angle = weapon.getCurrAngle() + offset;
                String weaponId = "battlefleets_ork_barrage_kannon_kinetic";
                Vector2f muzzleLocation = calculateMuzzle(weapon);
                DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
                float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
                proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 4)    // Kinetic shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
                float angle = weapon.getCurrAngle() + offset;
                String weaponId = "battlefleets_ork_barrage_kannon_kinetic";
                Vector2f muzzleLocation = calculateMuzzle(weapon);
                DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
                float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
                proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 5)    // Frag shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
                float angle = weapon.getCurrAngle() + offset;
                String weaponId = "battlefleets_ork_barrage_kannon_frag";
                Vector2f muzzleLocation = calculateMuzzle(weapon);
                DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,muzzleLocation,angle,weapon.getShip().getVelocity());
                float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
                proj.getVelocity().scale(randomSpeed);   
         }

   }
   
   private Vector2f calculateMuzzle(WeaponAPI weapon)
   {
        float muzzle = 30;
        double angle = Math.toRadians(weapon.getCurrAngle());
        Vector2f dir = new Vector2f((float)Math.cos(angle),(float)Math.sin(angle));
        if (dir.lengthSquared() > 0f) dir.normalise();
        dir.scale(muzzle);
        Vector2f loc = new Vector2f(weapon.getLocation());
        return Vector2f.add(loc,dir,new Vector2f());

    }
}



[close]


But couldn't get it to delete the original shell.   Still unsure how to capture the proper muzzle offset with either function.
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8946 on: July 16, 2022, 06:40:59 AM »

note : I've not tested this in game so idk if it actually works, but I'd do something like this.

 code
Code
    @Override
    public void onFire(DamagingProjectileAPI projectile, WeaponAPI weapon, CombatEngineAPI engine) {

        Vector2f spawnLoc = projectile.getSpawnLocation();
        float facing = projectile.getFacing();
        float randomSpeed = (float) (Math.random() * 0.4f + 0.8f);

        WeightedRandomPicker<String> weapPicker = new WeightedRandomPicker<>();

        weapPicker.add("battlefleets_ork_barrage_kannon_he", 3f);
        weapPicker.add("battlefleets_ork_barrage_kannon_ke", 2f);
        weapPicker.add("battlefleets_ork_barrage_kannon_frag",1f);

        DamagingProjectileAPI newProj = (DamagingProjectileAPI) engine.spawnProjectile(
                weapon.getShip(),
                weapon,
                weapPicker.pick(),
                spawnLoc,
                facing,
                weapon.getShip().getVelocity()
        );
       
        newProj.getVelocity().scale(randomSpeed);

        engine.removeEntity(projectile);
    }
[close]
« Last Edit: July 16, 2022, 06:45:29 AM by Ruddygreat »
Logged

AccuracyThruVolume

  • Commander
  • ***
  • Posts: 135
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8947 on: July 16, 2022, 05:18:05 PM »

note : I've not tested this in game so idk if it actually works, but I'd do something like this.

 code
Code
    @Override
    public void onFire(DamagingProjectileAPI projectile, WeaponAPI weapon, CombatEngineAPI engine) {

        Vector2f spawnLoc = projectile.getSpawnLocation();
        float facing = projectile.getFacing();
        float randomSpeed = (float) (Math.random() * 0.4f + 0.8f);

        WeightedRandomPicker<String> weapPicker = new WeightedRandomPicker<>();

        weapPicker.add("battlefleets_ork_barrage_kannon_he", 3f);
        weapPicker.add("battlefleets_ork_barrage_kannon_ke", 2f);
        weapPicker.add("battlefleets_ork_barrage_kannon_frag",1f);

        DamagingProjectileAPI newProj = (DamagingProjectileAPI) engine.spawnProjectile(
                weapon.getShip(),
                weapon,
                weapPicker.pick(),
                spawnLoc,
                facing,
                weapon.getShip().getVelocity()
        );
       
        newProj.getVelocity().scale(randomSpeed);

        engine.removeEntity(projectile);
    }
[close]


Ok, tried as is and it hung up on the randomSpeed  declaration, so I tweaked it and it got past that to get hung up on WeightedRandomPicker declaration.

Spoiler
public class BarrageKannonOnFireEffect2 implements OnFireEffectPlugin
{

   public void onFire(DamagingProjectileAPI projectile, WeaponAPI weapon, CombatEngineAPI engine)
   {

      Vector2f spawnLoc = projectile.getSpawnLocation();
      float facing = projectile.getFacing();
      //float randomSpeed = (float) (Math.random() * 0.4f + 0.8f);
      float randomSpeed = (float)Math.random() * 0.4f + 0.8f;

      WeightedRandomPicker<String> weapPicker = new WeightedRandomPicker<>();

      weapPicker.add("battlefleets_ork_barrage_kannon_he", 3f);
      weapPicker.add("battlefleets_ork_barrage_kannon_ke", 2f);
      weapPicker.add("battlefleets_ork_barrage_kannon_frag",1f);

      DamagingProjectileAPI newProj = (DamagingProjectileAPI) engine.spawnProjectile(
            weapon.getShip(),
            weapon,
            weapPicker.pick(),
            spawnLoc,
            facing,
            weapon.getShip().getVelocity()
      );

      newProj.getVelocity().scale(randomSpeed);

      engine.removeEntity(projectile);
    }
}
[close]


However, I did insert the spawnLoc and Facing statements and put them in my EveryFrameWeaponEffectPlugin and it works like a charm!   Your solution seems to be much cleaner though.    I'm not sure how to make the WeightedRandomPicker line play nice.  Does it want something in between the <>    ???



Spoiler
public class BarrageKannon_EveryFrameEffect2 implements EveryFrameWeaponEffectPlugin
{
    public static final float SPREAD = 8f;
    private int RndShotType = 0;

    @Override
    public void advance(float amount, CombatEngineAPI engine, WeaponAPI weapon)
   {

      // Removes dummy shot
      for (DamagingProjectileAPI p : engine.getProjectiles())
      {
         if(p == null || p.getProjectileSpecId() == null || !p.getProjectileSpecId().equalsIgnoreCase("battlefleets_ork_barrage_kannon_shell"))
            continue; // Skip projectiles we don't care about
         
         if(p == null || !p.getWeapon().equals(weapon))
            continue; // Skip projectiles that were not fired by this weapon
         
         Vector2f spawnLoc = p.getSpawnLocation();
         float facing = p.getFacing();

         engine.removeEntity(p);
         
         // Random number 0-5
         RndShotType = (int)Math.round(Math.random() * 5);
         if (RndShotType == 0 || RndShotType == 1 || RndShotType == 2)    // HE shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
            String weaponId = "battlefleets_ork_barrage_kannon_he";
            DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,spawnLoc,facing,weapon.getShip().getVelocity());
            float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
            proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 3 || RndShotType == 4)    // Kinetic shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
            String weaponId = "battlefleets_ork_barrage_kannon_kinetic";
            DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,spawnLoc,facing,weapon.getShip().getVelocity());
            float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
            proj.getVelocity().scale(randomSpeed);   
         }
         
         if (RndShotType == 5)    // Frag shot
         {
            float offset = ((float)Math.random() * SPREAD) - (SPREAD * 0.5f);
            String weaponId = "battlefleets_ork_barrage_kannon_frag";
            DamagingProjectileAPI proj = (DamagingProjectileAPI)engine.spawnProjectile(weapon.getShip(),weapon,weaponId,spawnLoc,facing,weapon.getShip().getVelocity());
            float randomSpeed = (float)Math.random() * 0.4f + 0.8f;
            proj.getVelocity().scale(randomSpeed);   
         }
      }

   }

}
[close]

Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8948 on: July 16, 2022, 05:30:54 PM »

Piggybacking off this spawnShipOrWing() question, is there any way to keep ships spawned like this from appear in the deployment screen (when pressing G during combat)

An easy way I think would be .setAlly(true). Others with more modding experience might have a better idea, though.

So far I've gotten the shells to replace correctly, but they all spawn from the same Y location (Y center of the sprite).  I need to capture the location of each muzzle.  Is there a way to detect the muzzle offset of the firing weapon so it can be applied to the new projectile?

Dumb question: wouldn't the muzzle location be the same as the location of the projectile you're replacing?

Alternatively, if you're looking for the location of *all* the muzzles, you could get the offsets via WeaponSpecAPI.getTurretFireOffsets() and getHardpointFireOffsets(). There are methods to get barrel angle offsets, too.
Logged

AccuracyThruVolume

  • Commander
  • ***
  • Posts: 135
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8949 on: July 16, 2022, 07:48:10 PM »

Piggybacking off this spawnShipOrWing() question, is there any way to keep ships spawned like this from appear in the deployment screen (when pressing G during combat)

An easy way I think would be .setAlly(true). Others with more modding experience might have a better idea, though.

So far I've gotten the shells to replace correctly, but they all spawn from the same Y location (Y center of the sprite).  I need to capture the location of each muzzle.  Is there a way to detect the muzzle offset of the firing weapon so it can be applied to the new projectile?

Dumb question: wouldn't the muzzle location be the same as the location of the projectile you're replacing?

Alternatively, if you're looking for the location of *all* the muzzles, you could get the offsets via WeaponSpecAPI.getTurretFireOffsets() and getHardpointFireOffsets(). There are methods to get barrel angle offsets, too.


Not dumb at all.  More like my dumb as java is something I'm slowly figuring out and learning the functions here for mod purposes.

getSpawnLocation()   and getFacing() of the projectile seems to do the job nicely.     Get the data from the projectile, delete projectile, use data for new projectile.       I'll take a look at those other functions you mentioned as well,  thanks as always Alex!  :-)
« Last Edit: July 17, 2022, 06:44:42 AM by AccuracyThruVolume »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8950 on: July 16, 2022, 07:54:34 PM »

Nice, glad that did the job!
Logged

NEmergix

  • Ensign
  • *
  • Posts: 11
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8951 on: July 18, 2022, 05:17:50 PM »


Modding newb here, trying to modify the historian bar event so it appears more frequently and whatnot.

I think i might have found what i need; its in a file named "starsector.api.zip" but it seems the .jar with the same name is just a duplicate.

The path goes : com > fs > starfarer > api > impl> campaign > intel > bar > events > historian.

Couple questions :

- Although i might figure it out on my own, what file is the most interesting for my needs ?

- More importantly : how do i compile the code so it applies in game ? I don't think the "starsector.api.zip" will do anything to my game. So where is the proper file i need to tamper in order to change in game stuff ?

Thanks !
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8952 on: July 20, 2022, 07:46:51 AM »

Evenin',

I'm looking for a way to get the local nebula colour in a star system.
Doesn't appear to be as straightforward as I thought, since getRenderColor() on the nebula terrain plugin only returns white and there isn't a readily apparent way to see where the nebula gets its colour at all (in that class).

any pointers?
thanks!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8953 on: July 20, 2022, 07:59:44 AM »

Evenin',

I'm looking for a way to get the local nebula colour in a star system.
Doesn't appear to be as straightforward as I thought, since getRenderColor() on the nebula terrain plugin only returns white and there isn't a readily apparent way to see where the nebula gets its colour at all (in that class).

any pointers?
thanks!

The actual *color* isn't anywhere in-game other than the nebula sprites that have the color baked into them.

You might do:
String nebulaType = StarSystemGenerator.nebulaTypes.get(system.getAge());

To get a string that represents the type of nebula it is. The strings are defined in StarSystemGenerator.java:
public static final String NEBULA_DEFAULT = "nebula"; // (this is the purple one)
public static final String NEBULA_AMBER = "nebula_amber";
public static final String NEBULA_BLUE = "nebula_blue";
public static final String NEBULA_NONE = "no_nebula";

- Although i might figure it out on my own, what file is the most interesting for my needs ?

That would heavily depend on what you want to do. But you're in the right area!

- More importantly : how do i compile the code so it applies in game ? I don't think the "starsector.api.zip" will do anything to my game. So where is the proper file i need to tamper in order to change in game stuff ?

There ought to be a guide on setting up an IDE on the forum somewhere, but I can't find it right now, hmm.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8954 on: July 20, 2022, 08:22:43 AM »

Much appreciated, thank you!
Logged
Pages: 1 ... 595 596 [597] 598 599 ... 710