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)

Pages: 1 ... 18 19 [20] 21 22 ... 42

Author Topic: API request thread (please read OP before posting!)  (Read 217591 times)

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request thread (please read OP before posting!)
« Reply #285 on: December 03, 2015, 05:34:57 PM »

There is already an equivalent, take a look at com.fs.starfarer.api.EveryFrameScript. These scripts are added through SectorAPI or LocationAPI's addScript(). Scripts added to the sector always run once per frame, whereas adding it to a location will have it run once per frame if the player is present, or once every several frames if they are elsewhere.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #286 on: December 12, 2015, 11:35:38 AM »

Would it be possible to have the equivalent of getWeaponRangeMultPastThreshold() but for the range below the threshold?

That would allow for ship-systems that raise the weapons range without getting ridiculous values for already long range weapons, or Hullmods that try to bring all weapons ranges toward the same value for optimized engagements range. Currently the only way I found to do that is to change the range of all weapons types one way, then the weapons past the threshold the other way. That's a very convoluted and imprecise solution I think.
Logged
 

Shedovv

  • Lieutenant
  • **
  • Posts: 61
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #287 on: December 24, 2015, 12:55:12 AM »

I do not really know WHAT EXACTLY I am asking for.
But I would like to request the support of what ever is necessary for LazyWizard to make Common Radar display Nebulae/Terrain in Combat AND ESPECIALLY CAMPAIGN.
« Last Edit: December 24, 2015, 12:57:28 AM by Shedovv »
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request thread (please read OP before posting!)
« Reply #288 on: December 24, 2015, 01:05:40 AM »

Campaign nebulae are already retrievable, I just haven't released an update for the radar yet.

I'll second the request for some way to retrieve nebulae in combat, though.
Logged

Ranakastrasz

  • Admiral
  • *****
  • Posts: 702
  • Prince Corwin of Amber
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #289 on: December 31, 2015, 02:38:42 PM »

I would like a method to get FleetMemberAPI from ShipAPI.
Logged
I think is easy for Simba and Mufasa sing the Circle of Life when they're on the top of the food chain, I bet the zebras hate that song.

Cigarettes are a lot like hamsters. Perfectly harmless, until you put one in your mouth and light it on fire

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request thread (please read OP before posting!)
« Reply #290 on: December 31, 2015, 02:53:43 PM »

I would like a method to get FleetMemberAPI from ShipAPI.

You can already do this, though there are a few edge cases you have to work around. If you use LazyLib you can just use CombatUtils.getFleetMember(ShipAPI ship). Otherwise, feel free to borrow the code that method uses:

Code: java
    public static FleetMemberAPI getFleetMember(ShipAPI ship)
    {
        final CombatFleetManagerAPI fm = Global.getCombatEngine()
                .getFleetManager(ship.getOriginalOwner());
        final DeployedFleetMemberAPI dfm = fm.getDeployedFleetMemberEvenIfDisabled(ship);

        // In almost all cases this method will return here
        if (dfm != null && dfm.getMember() != null)
        {
            return dfm.getMember();
        }

        // Directly spawned ships won't have a fleet member assigned
        final String id = ship.getFleetMemberId();
        if (id == null)
        {
            return null;
        }

        // Not deployed? Check reserves
        for (FleetMemberAPI member : fm.getReservesCopy())
        {
            if (id.equals(member.getId()))
            {
                return member;
            }
        }

        // No match was found
        return null;
    }
Logged

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #291 on: January 06, 2016, 04:07:18 PM »

I would still like to be able to silently spawn ships.

ShipAPI spawnFleetMember(FleetMemberAPI member,
                         Vector2f location,
                         float facing,
                         float initialBurnDur,
                         Boolean suppressNotification)

Just like to second this but also for spawnShipOrWing (which according to the API skips a bunch of the CampaignFleet stuff that I assume spawnFleetMember (in conjunction with FactoryAPI.createFleetMember) takes care of).

CombatFleetManagerAPI:
  • spawnShipOrWing(String specId, Vector2f location, float facing, float initialBurnDur, Boolean suppressNotification)
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #292 on: February 09, 2016, 02:41:12 PM »

I have idea of weapon but, i have just a get, not a set, so i request:

Quote
com.fs.starfarer.api.combat.WeaponAPI:
-setMaxAmmo(int i)     :  void
-fire()     : void


setMaxAmmo:
Quote
this is for create a weapon who can more projectile when ship source have very too flux for no cost. And mutableshipstats > [type]bonusammo upgrade all weapons(i think)  (and for me, he give a nullpointerexception, i do not understand, but, same, it is not good for my idea)

This is maybe impossible for multiple reasons. ><

fire():
Quote
If setMaxAmmo impossible, fire() can maybe replace, juste a method who is called, he shoot like if you shoot you with left clic or autofire. And more, he can be very usefull , maybe, for others idea of weapon.


PS: setAmmo with resetAmmo give me a Array error 5 ( yes, i have loose log AND backup of my script, so, i cannot give more). And put setAmmo(5) when you have a maxAmmo of 2 Ammo, this is maybe not very good.


Thank you.

Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

joe130794

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #293 on: February 17, 2016, 01:19:03 PM »

Could we possibly get a couple of in game weapons that can bypass shields. I have seen a mod that managed it but I can't put something like it in my own mod, however I might be able to edit a vanilla weapon if there was one. I think that is done with API's
Logged

MesoTroniK

  • Admiral
  • *****
  • Posts: 1731
  • I am going to destroy your ships
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #294 on: February 17, 2016, 01:38:48 PM »

Could we possibly get a couple of in game weapons that can bypass shields. I have seen a mod that managed it but I can't put something like it in my own mod, however I might be able to edit a vanilla weapon if there was one. I think that is done with API's

This is not really the place to ask for such a thing, and it can be done relatively easily already and has been in at least two mods.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #295 on: February 24, 2016, 07:16:52 PM »

Went through this; added some new methods:


CombatFleetManagerAPI:
   boolean isSuppressDeploymentMessages();
   void setSuppressDeploymentMessages(boolean suppressDeploymentMessages);
WeaponAPI
   void setMaxAmmo(int maxAmmo);
CombatEngineAPI
   CombatNebulaAPI getNebula();
CombatNebulaAPI
   int getTilesWide();
   int getTilesHigh();
   float getTileSizeInPixels();
   boolean tileHasNebula(int cellX, int cellY);
   boolean locationHasNebula(float x, float y);
   int getLeftOf();
   int getBelow();
   int getRightOf();
   int getAbove();
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #296 on: February 24, 2016, 11:37:42 PM »


CombatFleetManagerAPI:
   boolean isSuppressDeploymentMessages();
   void setSuppressDeploymentMessages(boolean suppressDeploymentMessages);

THANKYOU!!!!!!!!
Logged
 

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #297 on: February 25, 2016, 12:07:43 AM »

Went through this; added some new methods:


CombatFleetManagerAPI:
   boolean isSuppressDeploymentMessages();
   void setSuppressDeploymentMessages(boolean suppressDeploymentMessages);
WeaponAPI
   void setMaxAmmo(int maxAmmo);
CombatEngineAPI
   CombatNebulaAPI getNebula();
CombatNebulaAPI
   int getTilesWide();
   int getTilesHigh();
   float getTileSizeInPixels();
   boolean tileHasNebula(int cellX, int cellY);
   boolean locationHasNebula(float x, float y);
   int getLeftOf();
   int getBelow();
   int getRightOf();
   int getAbove();


Thank you Alex.
Logged

Snrasha

  • Admiral
  • *****
  • Posts: 705
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #298 on: February 25, 2016, 12:30:27 AM »

WeaponAPI
   void setMaxAmmo(int maxAmmo);

Thank you.
Logged
I am pretty bad on english. So, sorry in advance.

Gladiator Society
Add battle options on Com Relay/ Framework for modders for add their own bounty.

Sanguinary Autonomist Defectors A fan-mod of Shadowyard.

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1363
    • View Profile
    • GitHub Profile
Re: API request thread (please read OP before posting!)
« Reply #299 on: February 25, 2016, 06:00:49 PM »

Went through this; added some new methods:

[...]

CombatEngineAPI
   CombatNebulaAPI getNebula();
CombatNebulaAPI
   int getTilesWide();
   int getTilesHigh();
   float getTileSizeInPixels();
   boolean tileHasNebula(int cellX, int cellY);
   boolean locationHasNebula(float x, float y);
   int getLeftOf();
   int getBelow();
   int getRightOf();
   int getAbove();


Awesome, thank you!

In MissionDefinitionAPI nebulae are currently added using a location and a radius. Is that converted to tiles under the hood, or is the tile system more along the lines of "there's a nebula somewhere within this square"?
Logged
Pages: 1 ... 18 19 [20] 21 22 ... 42