Fractal Softworks Forum

Starsector => Suggestions => Topic started by: LazyWizard on November 28, 2012, 08:52:12 AM

Title: API request thread (please read OP before posting!)
Post by: LazyWizard on November 28, 2012, 08:52:12 AM
Important notice: This is not a general suggestion thread. It is meant for requesting API hooks into existing features - in other words, access to things the game already keeps track of. If you want to suggest an entirely new feature, you should start a separate thread in the Suggestions sub-forum (http://fractalsoftworks.com/forum/index.php?board=5.0) so your idea can be properly discussed without cluttering this thread.

You should also avoid overly broad requests. For example, posts like "give us access to NPC character creation" aren't very helpful. "Could we have a method createPerson() in FactoryAPI that returns a PersonAPI?", on the other hand, describes exactly what you're looking for.

There's a bit of gray area regarding the above, but as a general rule-of-thumb: if you can't reduce it down to a self-descriptive method signature, it's probably out of scope for this thread.
Title: Re: API request
Post by: xenoargh on November 28, 2012, 09:14:39 AM
It'd also be nice to have:

WeaponAPI
string getWeaponName() - not the display name, but the internal name, since display names can be the same but internal names must be unique.

FleetSide
Does not have a NEUTRAL and HOSTILE designation;  it'd be nice to have, so that we can spawn NEUTRAL objects (not attacked by anybody, doesn't attack anybody) and HOSTILE objects (attacks and is attacked by everybody).  This would provide for a .junk alternative and allow for gameplay stuff.

SectorAPI
boolean isBattleOccurring(true)
List currentBattles(for each entry, fleet1.id, fleet2.id)
callback BattleEnded(fleet1.id,fleet2.id,faction1.id,faction2.id,winnerfaction.id)

Basically, stuff for keeping a better eye on what's happening throughout the System, which right now is a bit of a pain.

Lastly, it'd be nice to have a script that runs when entering a Station; then we could implement profitable trading relatively easily.

Title: Re: API request
Post by: Alex on November 28, 2012, 09:16:15 AM
MutableShipStatsAPI
  • ShipAPI getOwner()

Curious - where are you getting a MutableShipStatsAPI that you don't also have access to the ShipAPI? There may be a good reason for that.

ShipAPI
  • ShipAPI getTarget() (or a way to get the currently selected target outside of ShipSystemAIScript's advance())
ShipVariantAPI
  • String getVariantName()
WeaponAPI
  • float getBaseDamage()
  • boolean isDisabled()
  • float getDisabledDuration()

Added, except for getBaseDamage(), which is actually quite a pain. Hmm. Looks like the variant API could use a lot more attention, too. I'll note both of these down for later. Thanks for making the suggestions, I really appreciate it.
Title: Re: API request
Post by: Alex on November 28, 2012, 09:25:16 AM
It'd also be nice to have:

WeaponAPI
string getWeaponName() - not the display name, but the internal name, since display names can be the same but internal names must be unique.

There's WeaponAPI.getId() which does exactly that.

FleetSide
Does not have a NEUTRAL and HOSTILE designation;  it'd be nice to have, so that we can spawn NEUTRAL objects (not attacked by anybody, doesn't attack anybody) and HOSTILE objects (attacks and is attacked by everybody).  This would provide for a .junk alternative and allow for gameplay stuff.

SectorAPI
isBattleOccurring(true,fleet1.id,fleet2.id)
BattleEnded(fleet1.id,fleet2.id,faction1.id,faction2.id,winnerfaction.id)

Both would allow for a lot more context-sensitive battlefield control.

Lastly, it'd be nice to have a script that runs when entering a Station; then we could implement profitable trading relatively easily.

Ah yes, asking for features under the guise of API additions. I see what you did there :) Btw, where you see the "owner" id as an int (rather than a FleetSide), 0 is player, 1 is enemy, and 100 is neutral. Though setting a ship to neutral would make it fire on everyone, I think.

Added CombatEntityAPI.setOwner(int owner) - that should take care of spawning neutral stuff, I think.
Title: Re: API request
Post by: LazyWizard on November 28, 2012, 09:32:23 AM
MutableShipStatsAPI
  • ShipAPI getOwner()

Curious - where are you getting a MutableShipStatsAPI that you don't also have access to the ShipAPI? There may be a good reason for that.

ShipSystemStatsScript.

Added, except for getBaseDamage(), which is actually quite a pain. Hmm. Looks like the variant API could use a lot more attention, too. I'll note both of these down for later. Thanks for making the suggestions, I really appreciate it.

Thank you for adding those in. Hmm, is the problem with getBaseDamage() due to the MutableStats? If so, would a getDamage() method suffer the same difficulties? Sorry to bother you about this, but I'm trying to write helper classes that calculate the threat generated by nearby enemies, and damage is fairly important to the equation. ;)

And thank you for putting in so much effort on the modding side of things. I've been modding for 12 years, and Starfarer is (by far!) the most enjoyable of all the games I've ever modded. :)

Oh, and if you're noting things that need attention, ShipAPI's getPhaseCloak() still returns a placeholder Object. ;)
Title: Re: API request
Post by: xenoargh on November 28, 2012, 09:44:09 AM
Quote
There's WeaponAPI.getId() which does exactly that.
Oops, thought that returned something else, guess I didn't have enough coffee this morning...

Quote
Btw, where you see the "owner" id as an int (rather than a FleetSide), 0 is player, 1 is enemy, and 100 is neutral. Though setting a ship to neutral would make it fire on everyone, I think.

Added CombatEntityAPI.setOwner(int owner) - that should take care of spawning neutral stuff, I think.
Aha.  Well, I guess that takes care of spawning neutral, unarmed "ships" that are actually just playing the role of space junk, yay!  Now I just have to make the art assets and write the code, cool!

I hope that the "can I fire at this" team-check's all in one place; it should be straightforward to do "not my team, but not team 100" to keep AI from shooting NEUTRAL stuff and "team 100 does not fire".  Request that team 666 be designated HOSTILE, lol.

Quote
Ah yes, asking for features under the guise of API additions. I see what you did there :)
Well, maybe, lol.  

I want to be able to see stuff that's going on in the strategic map a little less clunkily.  My diplomatic system, for example, just goes off of changes over time and is potentially exploitable (for example, you can attack X, drop Relations .1, then attack Y and Z before the next update and avoid the "you just attacked an ally" condition I wrote).  Having a callback when a battle ends on the strategic map would be a huge benefit there, as well as allowing for a bunch of other stuff to be made possible such as writing some basic strategic-level AI.  Right now it's very clunky getting information about what's going on, but it's gotta be there already, because the engine's clearly acting on it.


Oh and on getDamage(), I'd rather just see the current true damage; that's very complex because of flux bonuses, character bonuses, system bonuses, bonuses for your bonuses, etc.
Title: Re: API request
Post by: Alex on November 28, 2012, 10:25:23 AM
ShipSystemStatsScript.

Added CombatEntityAPI MutableShipStatsAPI.getEntity(). You can cast it to ShipAPI in that particular case (sometimes, it may be a MissileAPI).

And thank you for putting in so much effort on the modding side of things. I've been modding for 12 years, and Starfarer is (by far!) the most enjoyable of all the games I've ever modded. :)

Thank you, it's my pleasure :)

Oh, and if you're noting things that need attention, ShipAPI's getPhaseCloak() still returns a placeholder Object. ;)

Changed to ShipSystemAPI. That's what it already returned, just hadn't changed the method signature.

Hmm, is the problem with getBaseDamage() due to the MutableStats? If so, would a getDamage() method suffer the same difficulties? Sorry to bother you about this, but I'm trying to write helper classes that calculate the threat generated by nearby enemies, and damage is fairly important to the equation. ;)
Oh and on getDamage(), I'd rather just see the current true damage; that's very complex because of flux bonuses, character bonuses, system bonuses, bonuses for your bonuses, etc.

Yeah, that's part of the problem. But all that doesn't get figured out until a projectile is actually created. Which you can get access to once they're flying, which can be a bit late for certain things.

Added WeaponAPI.isFiring(), btw. That may come in handy for determining how much of a threat something is.

Let me just expose something that's used internally. It's not taking skills or damage bonuses into account, but are the baseline weapon stats, in a more immediately useful form:

Code
public static interface DerivedWeaponStatsAPI {
float getBurstFireDuration();
float getSustainedDps();
float getEmpPerSecond();
float getDamageOver30Sec();
float getDps();
float getBurstDamage();
float getFluxPerDam();
float getRoF();
float getFluxPerSecond();
float getSustainedFluxPerSecond();
}
.

Also added WeaponAPI.getDerivedStats().


I hope that the "can I fire at this" team-check's all in one place; it should be straightforward to do "not my team, but not team 100" to keep AI from shooting NEUTRAL stuff and "team 100 does not fire".  Request that team 666 be designated HOSTILE, lol.

It's not, actually. Which could pose a bit of a problem :)

I want to be able to see stuff that's going on in the strategic map a little less clunkily.  My diplomatic system, for example, just goes off of changes over time and is potentially exploitable (for example, you can attack X, drop Relations .1, then attack Y and Z before the next update and avoid the "you just attacked an ally" condition I wrote).  Having a callback when a battle ends on the strategic map would be a huge benefit there, as well as allowing for a bunch of other stuff to be made possible such as writing some basic strategic-level AI.  Right now it's very clunky getting information about what's going on, but it's gotta be there already, because the engine's clearly acting on it.

Yeah, I understand. I just don't want to go expanding the campaign API until a few versions from now.


Now then, I should really go back to working on some design docs - been doing nothing but posting here since this morning. Well, and fixing/adding things in response, so I guess that counts as "real work" :)
Title: Re: API request
Post by: xenoargh on November 28, 2012, 10:41:11 AM
Quote
Yeah, I understand. I just don't want to go expanding the campaign API until a few versions from now.
NP, I'm sure I can keep myself occupied until then :) Just would get rid of a lot of hassles and provide a good way to make a lot of stuff possible-if-ugly until the Shiny Version is available.
Title: Re: API request
Post by: LazyWizard on November 29, 2012, 08:58:46 AM
Ran into a few more:

ShipAPI:

WeaponAPI:

enum DefenseType (HULL, ARMOR, SHIELD, PHASE)
Title: Re: API request
Post by: Alex on November 29, 2012, 09:34:29 AM
Added:
WeaponAPI.getShip()
CombatEntityAPI.getAngularVelocity() (you can use the sign to figure out the direction - follows convention, ccw is positive)


enum DefenseType (HULL, ARMOR, SHIELD, PHASE)

Huh? :)
Title: Re: API request
Post by: LazyWizard on November 29, 2012, 09:38:51 AM
enum DefenseType (HULL, ARMOR, SHIELD, PHASE)

Huh? :)

I noticed we have one for DamageType. I'm writing a library to help modders with combat AI, and I didn't want to force them to use any 'unofficial' additions to the API. ;)

But yeah, sorry, that was kind of random.
Title: Re: API request
Post by: Alex on November 29, 2012, 09:41:25 AM
Well, no, what I meant was "why/where/what" etc - since there's nothing like that in the core game code :)
Title: Re: API request
Post by: LazyWizard on November 29, 2012, 09:48:02 AM
I know, I was just asking for a standardized way for our code to refer to the various defense types. But I know how you feel about adding things that will only be used by mods. ;)
Title: Re: API request
Post by: Alex on November 29, 2012, 10:00:24 AM
Well, you can add that in your library, right? Since your request for a new enum didn't come accompanied with API methods that would actually use it... :)

Heheh, this is turning into a very confusing conversation. Yay for talking past each other.
Title: Re: API request
Post by: Sproginator on November 29, 2012, 10:10:33 AM
Lazy, it seems you are a very helpful member of the community In regards to advanced modding, why not do some tutorials?
Title: Re: API request
Post by: LazyWizard on November 29, 2012, 10:38:30 AM
Well, you can add that in your library, right? Since your request for a new enum didn't come accompanied with API methods that would actually use it... :)

Heheh, this is turning into a very confusing conversation. Yay for talking past each other.

Hah, you can ignore half of what I say, especially before caffeine. ;)

Also, WeaponAPI lacks a Vector2f getProjectileOrigin().


Lazy, it seems you are a very helpful member of the community In regards to advanced modding, why not do some tutorials?

I tried once, but I don't know what sort of things other modders have trouble with. If there's something you or others need help with, feel free to request a tutorial. Preferably somewhere outside the Suggestions subforum, though. ;)
Title: Re: API request
Post by: Alex on November 29, 2012, 10:51:34 AM
Added WeaponAPI.getLocation() - returns the pivot point.
Title: Re: API request
Post by: LazyWizard on December 11, 2012, 04:18:27 PM
CombatEntityAPI

ShipAPI

Will the new setOwner() in CombatEntityAPI allow projectiles to harm the one who fired them if used on a DamagingProjectileAPI? I've noticed that redirected projectiles just pass harmlessly through their source ship at the moment.

Edit: Also, would it be possible to create a way to hide a ship using FogOfWarAPI?
Title: Re: API request
Post by: Alex on December 11, 2012, 04:36:36 PM
CombatEntityAPI
  • setFacing(float angle)

ShipAPI
  • ShipSystemAPI getSystem()
  • ShipAPI getWingLeader()
  • boolean isWingLeader()

Thank you - noted, will add.

Will the new setOwner() in CombatEntityAPI allow projectiles to harm the one who fired them if used on a DamagingProjectileAPI? I've noticed that redirected projectiles just pass harmlessly through their source ship at the moment.

Edit: Also, would it be possible to create a way to hide a ship using FogOfWarAPI?

Hmm, that's a good point. I'll add a "setSource()" method to DamagingProjectileAPI - right now, projectiles - except for flamed-out missiles - can't hit the launching ship.

Re: fog of war - probably not. Just not set up for it.
Title: Re: API request
Post by: LazyWizard on December 12, 2012, 09:02:09 PM
CombatEngineAPI:

WeaponAPI:

Edit: could our combat plugins have a method called when the battle ends?
Title: Re: API request
Post by: xenoargh on December 12, 2012, 09:12:00 PM
Oh, yes, please let me spawn beams.  Lightning-guns of Stunning +10, for great justice!
Title: Re: API request
Post by: Sproginator on December 13, 2012, 01:57:46 AM
CombatEngineAPI:
  • spawnBeam(ShipAPI ship, WeaponAPI weapon, String beamId, Vector2f start, Vector2f towards) (or something similar)

WeaponAPI:
  • setAmmo(int amount)

Edit: could our combat plugins have a method called when the battle ends?

+1 to both, especially the Weapon API one, That way it would be possible to make a support vessel that regens ammo in a specific radius, If it worked like:

setAmmo(int amount)
setAmmoAura(ShipAPI ship, decimal radius, int amount/s)
Title: Re: API request
Post by: Alex on December 13, 2012, 10:12:12 AM
Beam spawning isn't an option due to how the engine works. A beam requires a ship and a weapon and all that, and you can't just pass in some weapon and have it work.

Ultimately, the way to do it would be to spawn an invisible ship armed with a hidden beam weapon fire it, but that requires being able to code up a custom ship AI, which you can't yet.



I'll add setAmmo(), though.
Title: Re: API request
Post by: Sproginator on December 13, 2012, 10:23:44 AM
Beam spawning isn't an option due to how the engine works. A beam requires a ship and a weapon and all that, and you can't just pass in some weapon and have it work.

Ultimately, the way to do it would be to spawn an invisible ship armed with a hidden beam weapon fire it, but that requires being able to code up a custom ship AI, which you can't yet.



I'll add setAmmo(), though.
I believe next release will be a massive moddable pack, which I say is epic
Title: Re: API request
Post by: LazyWizard on December 13, 2012, 12:42:58 PM
Beam spawning isn't an option due to how the engine works. A beam requires a ship and a weapon and all that, and you can't just pass in some weapon and have it work.

Ultimately, the way to do it would be to spawn an invisible ship armed with a hidden beam weapon fire it, but that requires being able to code up a custom ship AI, which you can't yet.

Hmm, what about just spawning the beam effect? You would just specify the start and end points, along with the weapon ID so it can grab the appearance and (if possible) the collision tags, and the engine draws a beam between those points. Something like addBeamEffect(Vector2f startPoint, Vector2f endPoint, String beamSpecId, boolean noCollide). Even if it's non-damaging, it would be useful as special effects for some shipsystem ideas I've been working on.
Title: Re: API request
Post by: Alex on December 13, 2012, 01:26:48 PM
Right, that's possible... but would not be reusing much of what's already there - rather, it'd be an entirely new feature. I'll keep it in mind, though - has some cool possibilities, especially if the beams could be collidable (yet another new feature...)
Title: Re: API request
Post by: Wyvern on December 13, 2012, 01:49:20 PM
Collideable beams?  Ooh, we could make Tron lightcycles with that!
Title: Re: API request
Post by: Alex on December 13, 2012, 01:55:02 PM
Well, in theory, I think you could already do something like that.

Create some invisible hulls for use as the "lines", deploy them where you want, and have some code run continuously to keep them in place, and spawn some particle effects to make them visible.

The "lines as ships" part may cause some side effects, such as them showing up in the post-battle report or perhaps even being boardable. Still, could work out for missions.

Hmm. I'll see about adding a "spawnShipOrWing" method where it won't do that.
Title: Re: API request
Post by: Hyph_K31 on December 13, 2012, 02:00:36 PM
Huh, the idea of light trails reminds me of something I had suggested a long while ago:

With regards to missiles, would a new contrail type similar to a tracer trail be possible? It's not exactly on topic, but I was reminded and I think it would be a rather cool thing to have.
Title: Re: API request
Post by: Sproginator on December 13, 2012, 02:02:40 PM
Well, in theory, I think you could already do something like that.

Create some invisible hulls for use as the "lines", deploy them where you want, and have some code run continuously to keep them in place, and spawn some particle effects to make them visible.

The "lines as ships" part may cause some side effects, such as them showing up in the post-battle report or perhaps even being boardable. Still, could work out for missions.

Hmm. I'll see about adding a "spawnShipOrWing" method where it won't do that.

Could you implement a GrabObject method?

For instance a ship could bump an asteroid and equip it as ammo, then fire it as a weapon
Title: Re: API request
Post by: Thaago on December 13, 2012, 02:03:01 PM
CombatEntityApi
-SetLocation
-setVelocity


I was thinking of making objectives which teleport nearby units when captured, then resets ownership. Another idea that would use this is a carrier that can teleport fighter squadrons forward.

Then again I can see this causing some problems if illegal values (on top of other ships or outside the map bounds) are entered.
Title: Re: API request
Post by: LazyWizard on December 13, 2012, 02:24:22 PM
CombatEntityApi
-SetLocation
-setVelocity

Not necessary - getLocation() and getVelocity() return an Object, not a primitive type, so you can modify the returned Vector2f and have your effects show up in game (as long as you use location.set(x,y) instead of location = new Vector2f(x, y), since the latter will create a new object and lose the reference - argh, I explained that terribly).
Title: Re: API request
Post by: Sproginator on December 13, 2012, 02:33:59 PM
CombatEntityApi
-SetLocation
-setVelocity

Not necessary - getLocation() and getVelocity() return an Object, not a primitive type, so you can modify the returned Vector2f and have your effects show up in game (as long as you use location.set(x,y) instead of location = new Vector2f(x, y), since the latter will create a new object and lose the reference - argh, I explained that terribly).

Actually, that was rather good
Title: Re: API request
Post by: Alex on December 13, 2012, 02:52:07 PM
For instance a ship could bump an asteroid and equip it as ammo, then fire it as a weapon

You should already be able to do this with the API as it is now.

With regards to missiles, would a new contrail type similar to a tracer trail be possible? It's not exactly on topic, but I was reminded and I think it would be a rather cool thing to have.

No. Tried that a long time ago, couldn't get it to look good given the highly varied paths missiles can take.


Title: Re: API request
Post by: Sproginator on December 13, 2012, 02:57:00 PM
For instance a ship could bump an asteroid and equip it as ammo, then fire it as a weapon

You should already be able to do this with the API as it is now.

With regards to missiles, would a new contrail type similar to a tracer trail be possible? It's not exactly on topic, but I was reminded and I think it would be a rather cool thing to have.

No. Tried that a long time ago, couldn't get it to look good given the highly varied paths missiles can take.




Ah cool, now I got to learn to mod weapons, great -_-
Title: Re: API request
Post by: Thaago on December 13, 2012, 03:16:10 PM
CombatEntityApi
-SetLocation
-setVelocity

Not necessary - getLocation() and getVelocity() return an Object, not a primitive type, so you can modify the returned Vector2f and have your effects show up in game (as long as you use location.set(x,y) instead of location = new Vector2f(x, y), since the latter will create a new object and lose the reference - argh, I explained that terribly).

You explained it well enough for me! For some reason I assumed that the get methods would return a new copy of the Vector2f rather than a reference to the actual instance. I think thats a convention that got burned into my brain a while back...
Title: Re: API request
Post by: Sproginator on December 14, 2012, 04:59:06 AM
Can you please modify the SetAmmo API one?

For instance:

SetWeaponAmmo(string Weapon ID, int amount)

and

SetAmmoofType(string weapon_Type( I.E ballistic/missile) int amount)
Title: Re: API request
Post by: LazyWizard on December 15, 2012, 07:53:22 PM
SectorAPI

This would make creating universally compatible utility mods much, much easier. :)


Spoiler
Can you please modify the SetAmmo API one?

For instance:

SetWeaponAmmo(string Weapon ID, int amount)

and

SetAmmoofType(string weapon_Type( I.E ballistic/missile) int amount)
[close]

Weapons don't really work that way. I'm not sure what you're looking to do here, but feel free to PM me if you need help with it. :)
Title: Re: API request
Post by: Sproginator on December 16, 2012, 09:02:46 AM
SectorAPI
  • List<StarSystemAPI> getStarSystems()

This would make creating universally compatible utility mods much, much easier. :)


Spoiler
Can you please modify the SetAmmo API one?

For instance:

SetWeaponAmmo(string Weapon ID, int amount)

and

SetAmmoofType(string weapon_Type( I.E ballistic/missile) int amount)
[close]

Weapons don't really work that way. I'm not sure what you're looking to do here, but feel free to PM me if you need help with it. :)
As in, would the SetAmmo method work to do individual weapon ammo or increase all ammo for a weapon type?
Title: Re: API request
Post by: LazyWizard on December 18, 2012, 01:20:59 AM
CombatEngineAPI

Also, just checking that you saw this:

SectorAPI
  • List<StarSystemAPI> getStarSystems()

This would make creating universally compatible utility mods much, much easier. :)

Title: Re: API request
Post by: ValkyriaL on December 18, 2012, 01:23:51 AM
Doesn't that one exist already? Pretty sure I've seen it somewhere.
Title: Re: API request
Post by: LazyWizard on December 18, 2012, 01:36:12 AM
There's a getStarSystem(String name), which only helps if you know what system the mod is using already.

Plus, it will be necessary someday anyway, once the multi-system update arrives. ;)
Title: Re: API request
Post by: Alex on December 18, 2012, 09:45:17 AM
CombatEngineAPI
  • float getMapHeight()
  • float getMapWidth()

Also, just checking that you saw this:

SectorAPI
  • List<StarSystemAPI> getStarSystems()

This would make creating universally compatible utility mods much, much easier. :)

Yep, saw that too. I'll add it - like you said, probably likely to be necessary in any event.

On a related note, I expect to have to break some parts of the API horribly after the 0.54.1a release...
Title: Re: API request
Post by: Psiyon on December 23, 2012, 04:15:36 PM
Figure I'd just use this thread instead of making a new one:

Any chance of a method that lets us mess around with the supply consumption amount on a fleet-wide scale? I saw a getFuelUseMod() mutable stat in MutableShipStats, but none for supplies.

Something like:
MutableStat getFleetSupplyUse();

would be wonderful. Thanks in advance.
Title: Re: API request
Post by: Alex on December 25, 2012, 10:28:47 AM
Any chance of a method that lets us mess around with the supply consumption amount on a fleet-wide scale? I saw a getFuelUseMod() mutable stat in MutableShipStats, but none for supplies.

Not quite yet - sorry. It's getting a bit too far into "tweak things that are likely to change wholesale" territory...
Title: Re: API request
Post by: LazyWizard on December 26, 2012, 03:55:27 AM
SectorEntityToken:

FactoryAPI:

That would allow us to create temporary/hidden cargo containers without creating fleets or faraway stations. :)

Can weapons exist without a ship? If so, could FactoryAPI get a createWeapon() so we can analyse the properties of weapon stacks (things like weapon size, etc)?

Also, could CargoAPI, CargoStackAPI, and FleetDataAPI get hashCode() implementations based on their contents? It would help when checking if they have been modified (right now we need to keep a copy of their prior contents around to diff against).

On a related note, I expect to have to break some parts of the API horribly after the 0.54.1a release...

Is there any part of the API in particular we should avoid relying on, or can you not tell us without revealing the next planned feature?
Title: Re: API request
Post by: Alex on December 26, 2012, 10:17:52 AM
SectorEntityToken:
  • LocationAPI getContainingLocation()

Added. Let me see about the other ones... might not get to them for this release, though.

Also, could CargoAPI, CargoStackAPI, and FleetDataAPI get hashCode() implementations based on their contents? It would help when checking if they have been modified (right now we need to keep a copy of their prior contents around to diff against).

o1.hashCode() == o2.hashCode() does not imply o1.equals(o2). Am I missing something about how you intended to use it?

On a related note, I expect to have to break some parts of the API horribly after the 0.54.1a release...

Is there any part of the API in particular we should avoid relying on, or can you not tell us without revealing the next planned feature?

'fraid not :) Well, I can "narrow it down" to campaign stuff.
Title: Re: API request
Post by: LazyWizard on December 26, 2012, 10:31:34 AM
Also, could CargoAPI, CargoStackAPI, and FleetDataAPI get hashCode() implementations based on their contents? It would help when checking if they have been modified (right now we need to keep a copy of their prior contents around to diff against).

o1.hashCode() == o2.hashCode() does not imply o1.equals(o2). Am I missing something about how you intended to use it?

A hash should change if the contents change, correct? So instead of iterating through every stack and comparing them against a reference copy to see if they have changed, we could just use
Code
if (cargo.hashCode() != lastHash)
{
   lastHash = cargo.hashCode();
   // Do stuff
}
Title: Re: API request
Post by: Wyvern on December 26, 2012, 10:35:39 AM
Not quite; the contract for hashcode is that, if object1.equals(object2), then object1.hashcode() == object2.hashcode().

So, a perfectly valid (if ridiculously suboptimal) hashcode implementation might be something like { return 1; }

Now, the code you suggested should usually work (assuming a mostly-sane hashcode implementation & a .equals method based on contents), but it's not guaranteed.

It sounds like what you want is a .equals method implemented based on contents (which would necessitate a hashcode based on same), and perhaps also a copy constructor.
Title: Re: API request
Post by: Alex on December 26, 2012, 10:49:54 AM
(hashCode() javadoc (http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#hashCode()), for reference...)
Title: Re: API request
Post by: Zhentar on December 29, 2012, 05:26:53 PM
It sounds like what you want is a .equals method implemented based on contents (which would necessitate a hashcode based on same), and perhaps also a copy constructor.

What he wants is to be able to tell if the contents have been mutated with a single comparison. The easiest way to accomplish this is not by implementing equals/hashCode (I dunno about Java, but in .NET land making either of those depend on mutable state is considered a bad idea), but instead by exposing a "version" counter that gets incremented whenever the contents are modified.
Title: Re: API request
Post by: Wyvern on January 01, 2013, 08:18:55 AM
Could we get a getHullType method?  At the moment, we're limited to something like:
Code
	 private static String getHullType( FleetMemberAPI ship ) {
if (ship.isFighterWing()) {
return ship.getSpecId();
}
int lastIndex = ship.getSpecId().lastIndexOf("_");

if (lastIndex > 0) {
return ship.getSpecId().substring(0, lastIndex);
}

return ship.getSpecId();
}
Which works fine most of the time, but fails if, for example, someone made a default variant with a name like "liao-freighter-standard" instead of "liao-freighter_standard".
Title: Re: API request
Post by: LazyWizard on January 01, 2013, 08:30:10 AM
I'm wondering, does FleetMemberAPI have an underlying ShipAPI object for bonus calculation and display? If so, could FleetMemberAPI have a getShip() method?
Title: Re: API request
Post by: Alex on January 01, 2013, 12:39:39 PM
Could we get a getHullType method?  At the moment, we're limited to something like:
Code
	 private static String getHullType( FleetMemberAPI ship ) {
if (ship.isFighterWing()) {
return ship.getSpecId();
}
int lastIndex = ship.getSpecId().lastIndexOf("_");

if (lastIndex > 0) {
return ship.getSpecId().substring(0, lastIndex);
}

return ship.getSpecId();
}
Which works fine most of the time, but fails if, for example, someone made a default variant with a name like "liao-freighter-standard" instead of "liao-freighter_standard".

Added FleetMemberAPI.getHullId(). Returns the hull (*not* wing) id for fighters, btw.

I'm wondering, does FleetMemberAPI have an underlying ShipAPI object for bonus calculation and display? If so, could FleetMemberAPI have a getShip() method?

It doesn't. (new Ship objects get created all over the place - for the tooltip, for the duration of a battle, every time anything about the loadout changes on the refit screen, etc), but it does have a MutableShipStats object stats for what you've said. Added MutableShipStatsAPI getStats(); to FleetMemberAPI.
Title: Re: API request
Post by: LazyWizard on January 02, 2013, 08:15:40 AM
I'm wondering, does FleetMemberAPI have an underlying ShipAPI object for bonus calculation and display? If so, could FleetMemberAPI have a getShip() method?

It doesn't. (new Ship objects get created all over the place - for the tooltip, for the duration of a battle, every time anything about the loadout changes on the refit screen, etc), but it does have a MutableShipStats object stats for what you've said. Added MutableShipStatsAPI getStats(); to FleetMemberAPI.

Just to check: we could then use getStats().getEntity() to get at the currently generated ShipAPI, or would it return null in this case?

Also, DamagingProjectileAPI and BeamAPI both have a getDamageTarget(), but BeamAPI's returns a ShipAPI and DamagingProjectileAPI returns an Object. Shouldn't both of these return a CombatEntityAPI?
Title: Re: API request
Post by: LazyWizard on January 02, 2013, 09:31:05 AM
CargoStackAPI:
Title: Re: API request
Post by: Alex on January 02, 2013, 11:22:08 AM
Added.

Re: getEntity() - right, that'll return null.

getDamageTarget() - both return a CombatEntityAPI now.
Title: Re: API request
Post by: LazyWizard on January 04, 2013, 10:56:08 AM
ShipAPI:

I think we are missing something like the above two methods for dealing with drones.

Sprog's suggestion thread makes me think a get/setOutlivesSource(boolean) would be useful for drones as well.
Title: Re: API request
Post by: Wyvern on January 04, 2013, 11:03:12 AM
Another useful parameter would be something like setNoCorpse(boolean) - important for when you have drones that launch drones.
Say we've got ship A launches drones D1 which launch drones D2.  Recalling D1 pulls them back in - but doesn't make the D1 drones recall their D2 drones, resulting in dead D2 drones, typically hovering right over ship A and causing massive damage, similar to what happens when you spawn with a collection of asteroids inside your ship.

If we could set the D2 drones to leave no corpse, this would be a non-issue; as it is, recalling the D1 drones is almost always a really bad idea.
Title: Re: API request
Post by: LazyWizard on January 04, 2013, 11:08:48 AM
A getIndex() for drones would also be useful if we want to code special effects for certain drones in a formation.
Title: Re: API request
Post by: Sproginator on January 04, 2013, 11:35:36 AM
ShipAPI:
  • List getDrones()
  • ShipAPI getDroneSource()

I think we are missing something like the above two methods for dealing with drones.

Sprog's suggestion thread makes me think a get/setOutlivesSource(boolean) would be useful for drones as well.
And a DroneAPI getDroneSpeed()
And DroneAPI setDroneSpeed()

This would also be useful in weapons API  to create launchable mines that hold position after a certain time
Title: Re: API request
Post by: Alex on January 04, 2013, 01:08:24 PM
Cherry-picked the easy stuff:

List<ShipAPI> getDeployedDrones();
ShipAPI getDroneSource();

getIndex() is the same as doing getDeployedDrones().indexOf(drone). Yes, this means the index of a drone could change during its lifetime.


(@sproginator: you can already do all this with the MutableShipStatsAPI)
Title: Re: API request
Post by: Sproginator on January 04, 2013, 02:37:21 PM
Cherry-picked the easy stuff:

List<ShipAPI> getDeployedDrones();
ShipAPI getDroneSource();

getIndex() is the same as doing getDeployedDrones().indexOf(drone). Yes, this means the index of a drone could change during its lifetime.


(@sproginator: you can already do all this with the MutableShipStatsAPI)
Okay, very many thanks, gonna have to see about implementing this into a mod :)
Title: Re: API request
Post by: Sproginator on January 04, 2013, 02:42:29 PM
Lazy, do you mind mentoring me in integrating Apis from starfarer into JavaScript code, when I get a pc that is
Title: Re: API request
Post by: LazyWizard on January 15, 2013, 06:35:02 PM
LocationAPI:

It would also be nice if there was an equivalent to EveryFrameCombatPlugin for campaigns instead of being limited to using spawn points. This would allow us to create utility mods that don't cause problems when untagged in the launcher. :)

Lazy, do you mind mentoring me in integrating Apis from starfarer into JavaScript code, when I get a pc that is

Sorry, I didn't notice your reply. JavaScript has very little to do with Java other than the name, so creating mods in it wouldn't be possible. Sorry again. :)
Title: Re: API request
Post by: Sproginator on January 16, 2013, 02:21:55 AM
Ah well, Guess it's another language to learn then :)
Title: Re: API request
Post by: LazyWizard on January 16, 2013, 08:37:25 AM
StarSystemAPI:
Title: Re: API request
Post by: EnderNerdcore on January 16, 2013, 10:41:17 AM
MutableShipStatsAPI getCrew() would be nice (returns an int)

Along with setCrew(int) (or another way to change how many crew are active on the ship)


Also some sort of setTarget(entity) would be very handy for AI scripting.

MutableShipStatsAPI getSightRange() also handy.

Title: Re: API request
Post by: LazyWizard on January 19, 2013, 11:23:18 PM
I think the following would be very helpful for procedural sector generation:

SectorEntityToken:

OrbitAPI:
Title: Re: API request
Post by: Alex on January 20, 2013, 09:24:53 AM
Just wanted to say I'm still keeping an eye on this thread and haven't forgotten about it. Thank you for the suggestions (really, pointing out things that are missing!). I'll definitely go through this thread in detail before the next release, or perhaps sooner.
Title: Re: API request
Post by: Wyvern on January 20, 2013, 10:27:35 PM
I'd like to request some way to programatically get at the details of a given variant or otherwise edit the loadout of an individual ship.  My current project - a mod that introduces a single onslaught that scales up in power every time it's killed - has so far required me to generate 23 distinct onslaught variants, start work on a program to extract variants from save files (because that's the only practical way to make sure I have variants that are legal at an arbitrary skill level), and I'm only just now getting to the really interesting ones.

I'd much prefer if I could simply deal with this in code; in addition to being easier to work with, this would also allow me to somewhat randomize the ship's weapons, so you wouldn't know, for example, that the third time you fight the onslaught, it will always mount Sabot SRM Pods.

(As an aside, if this isn't coming soon, does anyone happen to know if there's a way to make a variant not show up in the codex?  I'd rather the player not be able to just browse through all the individual possibilities.)
Title: Re: API request
Post by: Sproginator on January 21, 2013, 12:29:30 AM
I'd like to request some way to programatically get at the details of a given variant or otherwise edit the loadout of an individual ship.  My current project - a mod that introduces a single onslaught that scales up in power every time it's killed - has so far required me to generate 23 distinct onslaught variants, start work on a program to extract variants from save files (because that's the only practical way to make sure I have variants that are legal at an arbitrary skill level), and I'm only just now getting to the really interesting ones.

I'd much prefer if I could simply deal with this in code; in addition to being easier to work with, this would also allow me to somewhat randomize the ship's weapons, so you wouldn't know, for example, that the third time you fight the onslaught, it will always mount Sabot SRM Pods.

(As an aside, if this isn't coming soon, does anyone happen to know if there's a way to make a variant not show up in the codex?  I'd rather the player not be able to just browse through all the individual possibilities.)
This concept sounds intriguing indeed, keep me posted :D
Title: Re: API request
Post by: LazyWizard on February 02, 2013, 02:01:53 PM
SectorEntityToken:
Title: Re: API request
Post by: LazyWizard on February 07, 2013, 11:39:01 AM
MutableCharacterStatsAPI:
Title: Re: API request
Post by: LazyWizard on February 07, 2013, 01:47:58 PM
We could also use a class that allows us to retrieve the various one-implementation-only plugins. Something like this:

PluginData:
Title: Re: API request
Post by: PCCL on February 20, 2013, 11:35:29 PM
seems like we can use hullmods to enable and disable the PD flag on weapons, but not other AI hints. Can that support be added?

not the best with these codes so forgive me if it's already in and I just missed it
Title: Re: API request
Post by: LazyWizard on February 26, 2013, 10:00:59 PM
Could we have something like a HasLocation interface that defines the getLocation() method, and have those API types that have the method extend it? It would help cut out a lot of almost-identical code dealing with CombatEntityAPIs, SectorEntityTokens, and BattleObjectiveAPIs separately.
Title: Re: API request
Post by: Alex on February 27, 2013, 09:29:38 AM
Made BattleObjectiveAPI extend CombatEntityAPI. Don't want to make it a common interface across campaign and combat entities, since even though the method signature is the same, it's still different conceptually.

If you really want to treat them the same, though, you could write a utility method that uses instanceof, no?


(Will take a detailed look at the other stuff at some point, btw.)
Title: Re: API request
Post by: Apophis on March 19, 2013, 09:56:46 AM
Add an API to refit ships from code
Title: Re: API request
Post by: ValkyriaL on March 21, 2013, 05:54:10 AM
I was thinking something like the get.entity.by.name,  but for ship designations, so it would be get.ship.designation.by.name. this way you could make voice acting for things like "Battleship lost/destroyed" or perhaps other funny things i'm not to familiar with.
Title: Re: API request
Post by: Sproginator on March 21, 2013, 02:47:11 PM
I was thinking something like the get.entity.by.name,  but for ship designations, so it would be get.ship.designation.by.name. this way you could make voice acting for things like "Battleship lost/destroyed" or perhaps other funny things i'm not to familiar with.

That sounds like fun!
Title: Re: API request
Post by: Wyvern on March 26, 2013, 03:04:46 PM
As discussed here (http://fractalsoftworks.com/forum/index.php?topic=5887.msg93721#msg93721), I'd like the ability to hook new UI into the ship refitting screen - perhaps having a hull mod that lets the user set some parameters when it's selected, or perhaps allowing a plugin to overwrite, for example, the weapon group selection screen.

This would also require API for a hullmod to store information per ship/variant it's installed on.

And, of course, in order to actually implement the mod I want this for, we'd also need hull mods to be able to mess around with autofire targeting priorities in much greater detail than just the current "make it function as PD" option we've got.

...Speaking of UI, is there going to be some straightforward way to replicate the look & feel of the game's normal UI?
Title: Re: API request
Post by: Alex on March 26, 2013, 03:27:24 PM
The UI as a whole isn't customizable, and it's not ever likely to be - only a few carefully selected elements will be, and they have to be designed from the start for it. The only one right now is the dialog that comes up when interacting with campaign entities.

That one does also allow a fully-customizable panel to be inserted in a specific location, but it's not the kind of thing you could just do anywhere.

...Speaking of UI, is there going to be some straightforward way to replicate the look & feel of the game's normal UI?

Good question. I'd like to add some way to get text out there, because it's such a pain to do otherwise. Buttons might be good, too, but I really don't want to go down the path of providing a full-featured UI creation API. I mean, the game already has this stuff internally, but there's a world of difference between "works" and "exposed effectively via API".

Will probably end up adding things here and there as it goes, but I wouldn't count on anything beyond text and maybe buttons. Buttons wouldn't be that difficult to do in an entirely custom way, either, though...
Title: Re: API request
Post by: Wyvern on March 27, 2013, 07:05:35 PM
Two requests:

HullModEffect.isUnlocked( ShipAPI ship, MutableCharacterStatsAPI admiral ) - with the note that admiral may be null, if you're in the context of a mission rather than the campaign.
 - the default implementation would return "true" for hullmods that start the game unlocked, true if admiral is null (all unlocked in missions), or true if you have the appropriate skill at the appropriate level to have unlocked that hullmod.  This would be particularly useful for reducing clutter when you've got ship-specific hull mods; it would be nice if they'd only even show up on the list if the ship in question could install them.  It would also come in handy for hull mods that go obsolete - once you have Integrated Targeting Unit unlocked, there's no point in showing Dedicated Targeting Core.

Skill Effect Type: ALL_FIGHTERS_IN_FLEET (instead of all ships in fleet, or just the player ship, or character stats) - we don't actually need this to make the effect, but, we've got no other way to impact the paranthetical note at the end of the skill / perk description.  I.E., right now if we make a skill that only affects fighters, we have to use ALL_SHIPS_IN_FLEET, and it gets displayed to the player as something like: "+5% armor for fighters (all ships in fleet, +5% per skill level)", when I'd really rather have something that reads "+5% armor (all fighters in fleet, +5% per skill level)"
Title: Re: API request
Post by: JT on March 28, 2013, 01:39:51 PM
"+5% armor for fighters (all ships in fleet, +5% per skill level)"

"+5% armor (all fighters in fleet, +5% per skill level)"

To me, those seem synonymous. "For all of the ships in the fleet, if any of them are fighters they get a +5% bonus", in other words.
Title: Re: API request
Post by: Okim on March 28, 2013, 11:56:46 PM
I`d like to request these new mutables:

- energy damage received
- kinetic damage received
- explosive damage received
- beam damage received
- missile damage received
- projectile damage received

I have some hull mods in my mind that would suck some percentage of one of the listed damage types making the other types do some extra damage. Those are mainly for larger ships, for Rock Fly and for 'AI' faction in Ironclads.

For example - energy absorbing coating that reduces energy damage taken by 25%, but makes explosive and kinetic weapons do extra 10% damage.

Or reactive armour that shrugs off 25% of missile and projectile damage, but is vulnerable to beam weapons. Etc.
Title: Re: API request
Post by: Thaago on March 29, 2013, 11:21:46 AM
I've been thinking of making a battle recorder/playback mod, and after talking with LazyWizard I think I'd need to do a few things that the API doesn't have yet:

Set armor values
Set weapon disabled status
Spawn beams
Reset ship system timers (not needed if the AI can be turned off).

Some sort of setting for completely turning off the ai (admiral, piloting, and autofire - the works) would also be helpful because the 'playback' part wouldn't have to clean up extra fired projectiles and undo ship system activations.

Its not essential, but being able to get/set the admiral ai orders would be nice because the player could see in the playback what orders they issued.
Title: Re: API request
Post by: silentstormpt on April 07, 2013, 06:30:24 AM
With the new UI, may we have different font on the when you start a conversation box with a specific faction, this sound obvious for both mods im working on, but it does give out a different feeling and makes factions unique on their own:

InteractionDialogPlugin:


...

BattleCreationPlugin:

Title: Re: API request
Post by: bbf on April 07, 2013, 09:38:11 AM

While I eagerly await 0.6 and com.fs.starfarer.api.ModPlugin, I've been checking out the current API.
And if we are to support dynamic mod attaching with other mods, there are some methods that will be critical.
For starters, I cannot dynamically set the relationship of my faction with other modded factions:

SectorAPI

With that, I could iterate them and set the relation ship stats.

Also, I would like to create a dynamic faction, that can change their ship designs.
I haven't seen any API so far that allows that.
Would I have to save every every design with a new random name, or does the engine support running a nameless design?
For example, the player can have the "Custom" design, but does that behind the scenes create a temporary design for each custom design?

Something else that would really help, would be some parameters for the StarfarerLauncher's main method.
I've been launching the game from Eclipse so I can debug stuff, and if there was a way to skip the launcher, or even the title screen, it would be great.
I suggest the following params:


Resolution parameters aren't really required since you can just use resolutionOverride in settings.json.
I tried peeking to implement these myself, but obfuscation was just too annoying to dig through.
I wasn't really sure if you are passing an ActionListener to StarfarerLauncherUI, or if it's bootstraping the game itself.



Title: Re: API request
Post by: LazyWizard on April 09, 2013, 12:30:09 AM
EngineAPI:

ShipAPI:

MissileAPI:


Also, certain enums like CollisionClass and WeaponType are exposed in the current API, but others are not. Could the remaining enums like TextureType, BarrelMode, RenderHints, AnimationType and other weapon/ship tags be included in the API as well?
Title: Re: API request
Post by: MShadowy on April 09, 2013, 08:06:47 PM
If this is already possible through some other method, I apologize, but it seems like it might be kinda handy for certain purposes.

DamagingProjectileAPI and MissileAPI:

Additionally, would it be possible to set up an API allowing modders to create some custom effects, such as different explosions?
Title: Re: API request
Post by: ValkyriaL on April 10, 2013, 06:58:33 AM
I would love some way to increase the image size for portraits beyond 128x128, i have some juicy images that gets ruined if i scale them down that much.
Title: Re: API request
Post by: LazyWizard on April 10, 2013, 07:20:15 AM
CombatFleetManagerAPI:
Title: Re: API request
Post by: Alex on April 10, 2013, 08:48:27 AM
EngineAPI:
  • boolean isActive()
  • float getThrustLevel() // Current thrust level, normalized between 0 and 1
  • boolean isDisabled()
  • float getDisabledTime()
  • boolean isSpecialEngine() // For things like maneuvering jets

ShipAPI:
  • List<EngineAPI> getEngines()

MissileAPI:
  • EngineAPI getEngine()


Also, certain enums like CollisionClass and WeaponType are exposed in the current API, but others are not. Could the remaining enums like TextureType, BarrelMode, RenderHints, AnimationType and other weapon/ship tags be included in the API as well?

These ought to be simple enough.


If this is already possible through some other method, I apologize, but it seems like it might be kinda handy for certain purposes.

DamagingProjectileAPI and MissileAPI:
  • AnimationAPI getAnimation()

Additionally, would it be possible to set up an API allowing modders to create some custom effects, such as different explosions?

Well - animated projectiles aren't supported by the engine, and it's not something I could just hack in easily. About the only way I'd really give it a go is if something new in the base game required it; adding features for mod-use-only tends to be a pretty big pain because it's hard to adequately test them and ensure they keep working going forward.


As for custom effects, that should already be possible. You just have to use the OnHitPlugin to spawn whatever you like, at least to the extent that the CombatEngineAPI allows it (addHitParticle, addSmokeParticle, spawnExplosion, etc).


I would love some way to increase the image size for portraits beyond 128x128, i have some juicy images that gets ruined if i scale them down that much.

I'm pretty sure portraits can already be any size. The game will scale them to whatever size they need to be used at.


CombatFleetManagerAPI:
  • AssignmentTargetAPI createAssignmentTarget(Object target)
  • AssignmentInfo createAssignment(CombatAssignmentType type, AssignmentTargetAPI target)
  • void setAssignmentFor(ShipAPI ship, AssignmentInfo assignment)

The fleet AI will likely get totally overhauled at some point. I'll take a look, though.


General note:
This thread is intended for requests to expose via API things the game already does, not for adding new features. In other words, for things that are missing from the API itself, not for things that are not in the game to begin with. Those should go in the suggestion forum, not in this thread.
Title: Re: API request
Post by: silentstormpt on April 17, 2013, 07:50:36 AM
AnimationAPI

List setFrameList<> (example, i got 40 frames, but by using a pluggin, i can set only the first 10 frames to .play() and .reset()
Title: Re: API request
Post by: PCCL on April 18, 2013, 09:52:52 PM
CombatEntityAPI:
      void setVelocity(vector2f velocity);
Title: Re: API request
Post by: LazyWizard on April 19, 2013, 12:29:20 AM
CombatEntityApi
-SetLocation
-setVelocity

Not necessary - getLocation() and getVelocity() return an Object, not a primitive type, so you can modify the returned Vector2f and have your effects show up in game (as long as you use location.set(x,y) instead of location = new Vector2f(x, y), since the latter will create a new object and lose the reference).
Title: Re: API request
Post by: PCCL on April 19, 2013, 12:44:06 AM
ooh....

well then, I gotta try that

thanks LW ;D
Title: Re: API request
Post by: Okim on April 19, 2013, 01:00:23 AM
I`d like to request these new mutables:

- energy damage received
- kinetic damage received
- explosive damage received
- beam damage received
- missile damage received
- projectile damage received

I have some hull mods in my mind that would suck some percentage of one of the listed damage types making the other types do some extra damage. Those are mainly for larger ships, for Rock Fly and for 'AI' faction in Ironclads.

For example - energy absorbing coating that reduces energy damage taken by 25%, but makes explosive and kinetic weapons do extra 10% damage.

Or reactive armour that shrugs off 25% of missile and projectile damage, but is vulnerable to beam weapons. Etc.

What about these? They seem to be the 'things that are missing from the API itself'. At least first three about damage types.
Title: Re: API request
Post by: LazyWizard on April 19, 2013, 11:30:14 AM
CombatEngineAPI:

Just a simple one this time. :)
Title: Re: API request
Post by: LazyWizard on April 21, 2013, 12:32:58 PM
CombatEngineAPI:

This would be useful for the situations where the interface you're working with doesn't have an advance(float amount) method, such as when making custom shipsystems.
Title: Re: API request
Post by: PCCL on April 23, 2013, 10:41:15 PM
can we have something of an EngineAPI? (actual engines, like, the thrusters on the ships)

some functions could include (the ones I would find useful)
-getLocation
-getType (midline, hightech, lowtech)
-setType (could be pretty useful, not sure if that's easy to do though)
-boolean isDisabled
-boolean isActive
-setState (boolean active) so setState(true) will turn the engine on etc.

again, sorry if this is already in, can't find it anywhere though
Title: Re: API request
Post by: LazyWizard on April 26, 2013, 05:15:17 PM
DamagingProjectileAPI:
Title: Re: API request
Post by: Zaphide on May 03, 2013, 06:40:29 PM
Not sure if these have been asked (or are available already in some form) but:

SectorEntityToken
 - String getOwner()
 - void setOwner() // Exists already but could it also change the owner color ring of a station? At the moment the color only seems to change on save/reload

FactionAPI
 - String getFullName()

MutableShipStatsAPI
 - int getTotalOrdanancePoints()
 - int getUsedOrdanancePoints()

Thanks :)
Title: Re: API request
Post by: MShadowy on May 04, 2013, 06:20:31 PM
Would this be possible to add?

IntervalUtil:

Thanks for your time.
Title: Re: API request
Post by: PCCL on May 06, 2013, 09:13:35 PM
a few more, possible from ship systems

ShipAPI:
-boolean allowVenting
-boolean allowDissipation
-boolean allowFiring
-boolean allowAcceleration
-boolean allowDeceleration
-boolean allowTurning
-boolean allowStrafing
Title: Re: API request
Post by: Psiyon on May 12, 2013, 10:22:56 PM
For DamagingProjectileAPI, I think a boolean method "didHullDamage()" would be great to have. That way, it's possible to figure out whether or not a shot impacted the hull or armor of a ship.

Additionally, another boolean method, like "startedFadeout()" would be nice too, so we can know if a weapon has started to fade away, and is thus doing sub-optimal damage.

I'm interested in these mainly for a critical-hit system--I don't want crippling injuries to be inflicted on a ship from a tiny kinetic ping off the armor.
Title: Re: API request
Post by: phyrex on May 13, 2013, 11:15:25 AM
sorry for the off-topic comment but i just really wanted to say this :

i wish i understood what people are talking about here  ???
sounds so interesting  ;D
Title: Re: API request
Post by: Psiyon on May 13, 2013, 01:54:39 PM
A few more, for MutableShipStatsAPI:

   public MutableStat getBallisticDamageTakenMult();
   public MutableStat getEnergyDamageTakenMult();
   public MutableStat getHighExplosiveDamageTakenMult();
   public MutableStat getFragmentationDamageTakenMult();


I mainly just want them for different armor-related hullmods, but I can see a lot of use coming from these for other purposes.

Edit: Also,

   public MutableStat getDamageToTargetArmorMult();
   public MutableStat getDamageToTargetHullMult();
Title: Re: API request
Post by: Zaphide on May 30, 2013, 02:45:22 AM
In case you feel inclined to work on FactionAPI (I realise it's a low priority) :)

FactionAPI
 - SetColor(Color color)
 - SetFullName(String name)

if they are simple. Only really for messing around at runtime.

Thanks :)

Also, [question for anyone] are there any restrictions on starting/killing threads in Janino?
Title: Re: API request
Post by: LazyWizard on May 30, 2013, 09:58:33 AM
Also, [question for anyone] are there any restrictions on starting/killing threads in Janino?

(should probably be in modding)

Janino is just a compiler, the classes are loaded into the JVM after compilation and are treated the same as regular classes. Besides the language features Janino doesn't support (http://docs.codehaus.org/display/JANINO/Home#Home-limitations), the only real restriction is that mod scripts are loaded through a custom classloader that blocks certain classes for security reasons (java.io.File, etc). Since the console mod spawns extra Threads without problem, you should be good. :)
Title: Re: API request
Post by: Zaphide on May 30, 2013, 02:20:05 PM
--- Helpful Stuff ---

Thanks, that page is handy :)

[Sorry for derail, one track mind!]
Title: Re: API request
Post by: LazyWizard on June 10, 2013, 05:16:52 PM
ShipAPI:
Title: Re: API request
Post by: LazyWizard on July 02, 2013, 01:33:37 PM
WeaponAPI:

When combined with DamagingProjectileAPI's getWeapon() this would help with custom projectiles that should rely on their parent weapon (for example: tracker darts). Right now there's no easy way of finding a specific plugin, and having one global plugin handling every weapon on the field can get confusing at times.
Title: Re: API request
Post by: LazyWizard on July 08, 2013, 08:37:28 PM
ArmorGridAPI:

Without a method like this, ArmorGridAPI's getArmorFraction() and getArmorValue() are kind of unusable. ;)
Title: Re: API request
Post by: xenoargh on July 08, 2013, 08:47:51 PM
We can't just iterate through the cells?  Oh, wait, the cells don't give their world-space or ship coordinate-space xy do they?  Yeah, that could make things tricky.
Title: Re: API request
Post by: Ravendarke on July 21, 2013, 04:29:21 PM
I would be really thankful for more control over beam weapons (charge up similar to projectile weapons..). Also some extra control over glow effect animation or way how to control blend effect of custom animation (ingame glow seems to behave as a "screen" blend mode).
Title: Re: API request
Post by: xenoargh on August 02, 2013, 01:27:59 PM
Part-feature, part API request.

Hulks aren't returning isFighter() / isFrigate() / etc. properly, and aren't returning their Hull Points either.  I presume they use another (hidden) hitpoint value when they switch states.  Can they pass along those values when they're converted to Hulks? 

I know that probably requires some refactor if isHulk()'s boolean is used a lot internally, so perhaps wasFighter() / etc. would pull the required data using a new boolean state would be the time-saving way to go about it?
Title: Re: API request
Post by: Ravendarke on August 08, 2013, 03:30:00 PM
On Fire Effect...
we have On hit, one fire could be really useful for both beam and projectile weapons. Btw I know that it is possible to create work around using everyFrameEffect, but I do believe onfireEffect would be little more effective.
Title: Re: API request
Post by: xenoargh on August 08, 2013, 05:20:59 PM
That could probably be just added to the inputs for EveryFrameWeaponEffectPlugin; just include an int hasBeenFiringFrames for the number of frame(s) the weapon has been in a firing state for (would cover 1-shots, which would be 0/1 or beams- 0/2,147,483,647 which works out at 60FPS sim, to 414 days of real time).  Anyhow, just a thought- I don't think we need a new callin there, just an expansion of the data we have direct access to in a useful way :)
Title: Re: API request
Post by: silentstormpt on August 12, 2013, 12:41:59 PM
WeaponAPI:

void setCustomDPS(float DPS)

This is very useful when the actual damage is made from scripted plugins on the weapon itself, this is extremely common when a beam with no opacity is used to trigger some type of damage while having 0 DPS on the weapon info.

CombatEngineAPI:

void removeEntity(CombatEntityAPI target, boolean explode)

Again very useful when you want to remove hulk ships with the actual explosion without applying an insane damage that can be seen by the player.

void removeEntity(CombatEntityAPI target, ExplosionAPI custom_explosion)

Custom explosions anyone? The ExplosionAPI is figurative since i have no idea if it exists but again, it would be very useful.

Is there anyway to get hold of events happening in the engine (CombatEngineAPI), like a ship being hit, weapons are fired, etc, without needing to going thro all the projectiles/ships?
Title: Re: API request
Post by: silentstormpt on August 22, 2013, 10:12:05 AM
http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/OnHitEffectPlugin.html for MissileAPI too
Title: Re: API request
Post by: xenoargh on August 22, 2013, 10:21:08 AM
Already on Alex's schedule :)
Title: Re: API request
Post by: Alex on August 22, 2013, 10:30:39 AM
Actually, already done and in the patch notes :)
Title: Re: API request
Post by: LazyWizard on August 24, 2013, 09:10:17 AM
SectorAPI:

As I notice it now has a setPaused() (http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/campaign/SectorAPI.html#setPaused(boolean)). :)
Title: Re: API request
Post by: Wyvern on August 25, 2013, 12:56:17 PM
MutableShipStatsAPI:

...Or something along those lines; was trying to make a system that would reduce flux costs of energy weapons when active, to encourage the use of energy weapons in a particular ship's universal slots without directly increasing their damage output.  And, err, apparently I can't do that right now?
Title: Re: API request
Post by: silentstormpt on August 30, 2013, 10:12:55 AM
WeaponAPI:

This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)
Title: Re: API request
Post by: silentstormpt on September 03, 2013, 09:25:56 AM
Ive searched on the API for methods i could use to merge fleets or refill them with supplies, fuel and crew to no avail, i always need to create a new CampaignFleetAPI from the
*.faction file data.

CampaignFleetAPI:

CampaignFleetAPI sector.createFleet(List<FleetMemberAPI> fleetMembers);
Dont forget that these fleetmembers already have their cargo set when we call this method or else returns null.
This also allows me to create a mergeFleet method by grabing their fleetMembers and combine them into a new List<>


FleetMemberAPI:

setSupplies(float quantity);
setCrew(float quantity, CargoAPI.CrewXPLevel CrewXPLevel);
setFuel(float quantity);
(add methods instead of set, would also be nice to have but we can make those ourselves)
Title: Re: API request
Post by: Alex on September 03, 2013, 09:34:47 AM
Adding functionality to creating a fleet via the API is probably a good idea. Regarding cargo management, though, that's done on a fleet level, not on a fleet member level. Individual ships don't carry cargo or fuel, they just contribute capacity to do so to the fleet.

WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

SectorAPI:
  • boolean getPaused()

As I notice it now has a setPaused() (http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/campaign/SectorAPI.html#setPaused(boolean)). :)

Oops, added.


MutableShipStatsAPI:
  • MutableStat getBeamWeaponFluxCostMult()
  • MutableStat getEnergyWeaponFluxCostMult()
  • MutableStat getBallisticWeaponFluxCostMult()
  • MutableStat getMissileWeaponFluxCostMult()

...Or something along those lines; was trying to make a system that would reduce flux costs of energy weapons when active, to encourage the use of energy weapons in a particular ship's universal slots without directly increasing their damage output.  And, err, apparently I can't do that right now?

See:
public StatBonus getEnergyWeaponFluxCostMod();
public StatBonus getBallisticWeaponFluxCostMod();
public StatBonus getMissileWeaponFluxCostMod();
public MutableStat getBeamWeaponFluxCostMult();

Unless they aren't in 0.54.1a? I think they are, but I'm not 100% sure.
Title: Re: API request
Post by: Wyvern on September 03, 2013, 09:42:20 AM
MutableShipStatsAPI:
  • MutableStat getBeamWeaponFluxCostMult()
  • MutableStat getEnergyWeaponFluxCostMult()
  • MutableStat getBallisticWeaponFluxCostMult()
  • MutableStat getMissileWeaponFluxCostMult()

...Or something along those lines; was trying to make a system that would reduce flux costs of energy weapons when active, to encourage the use of energy weapons in a particular ship's universal slots without directly increasing their damage output.  And, err, apparently I can't do that right now?

See:
public StatBonus getEnergyWeaponFluxCostMod();
public StatBonus getBallisticWeaponFluxCostMod();
public StatBonus getMissileWeaponFluxCostMod();
public MutableStat getBeamWeaponFluxCostMult();

Unless they aren't in 0.54.1a? I think they are, but I'm not 100% sure.
Hm... Apparently I forgot to update my API reference files; would explain why I couldn't see those methods.  Oops.  And thanks.
Title: Re: API request
Post by: silentstormpt on September 03, 2013, 09:46:45 AM
WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

On the UI (refit/cargo screen), that image used when you buy/sell that weapon
Title: Re: API request
Post by: LazyWizard on September 03, 2013, 10:24:49 AM
WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

On the UI (refit/cargo screen), that image used when you buy/sell that weapon

I've done this by setting frame 0 to the appearance I want a weapon to have in the campaign, then using a custom animation plugin (https://bitbucket.org/LazyWizard/sinistar/src/default/src/data/scripts/weapons/SinistarAnimation.java) that only iterates through frames 1-max. This allows your weapon to have completely different appearances in campaign and combat mode.
Title: Re: API request
Post by: silentstormpt on September 03, 2013, 10:40:36 AM
WeaponAPI:
  • setCustomWeaponImage(String url);
This allows to set a image in cases the weapon is just a cannon when mounted on the ship (for example the actual weapon is meant to be "inside" the hull)

You can already use the AnimationAPI to do this, this seems redundant.

On the UI (refit/cargo screen), that image used when you buy/sell that weapon

I've done this by setting frame 0 to the appearance I want a weapon to have in the campaign, then using a custom animation plugin (https://bitbucket.org/LazyWizard/sinistar/src/default/src/data/scripts/weapons/SinistarAnimation.java) that only iterates through frames 1-max. This allows your weapon to have completely different appearances in campaign and combat mode.

Sorry, i know exactly how you managed that, let me try a more clear way what i meant.
If i went with the animationAPI, the turret would be fine on the cargo screen but if i applied to the ship (in the refit screen) it would still be the turret and not just the cannon (because the AnimationAPI is only used when in combat). Unless i completely mistaken how the AnimationAPI works tho.

This would allow us to set images that could be a 3D profile of the weapon, but when you applied said weapon on the refit or see it on combat, this weapon would ofc a 2D sprite.

Another possible solution would be, a extra line on the *.wpn file like, "weaponSprite" that would only take effect if its used, else, it uses the default "turretSprite" / "hardpointSprite" as the Cargo image.
Title: Re: API request
Post by: LazyWizard on September 16, 2013, 07:43:15 PM
ShipSystemAPI:

Also, stickied this thread since it's so long-lived and has a singular purpose (requesting exposure of existing features to the API).
Title: Re: API request
Post by: xenoargh on September 17, 2013, 01:04:39 PM
ShipAPI:  setCR(float CR):  would set Combat Rating values to float value.
WingAPI: setReplacements(float replacements), would set how many chassis a Wing currently has to float value.

Basically, I ran into issues with spawnShipOrWing(); I think those things are just a bug, but they more or less expose issues underlying the CR system atm. 

Setting CR in a Mission should just require a valid ShipAPI, not a FleetAPI.  Same with setting the number of chassis available; we should just get the ShipAPI and the WingAPI and be able to set it. 

Why?  Because it's really clunky to work back to FleetMemberAPI and if they've just spawned, they might not even be there yet, so null.
Title: Re: API request
Post by: silentstormpt on September 18, 2013, 10:22:47 AM
VisualPanelAPI.showImagePortion(String imageDIR,
                     float w, float h,
                     float xOffset, float yOffset,
                     float displayWidth, float displayHeight);

Instead of going for the json info in the settings.json we can get the location of the image ourselves

Checks if the ship is currently docking, should work on fighters and drones.
ShipAPI.isDocking();

Sometimes fighters dock on the nearest ship that they can dock, get this ship on this case.
ShipAPI.getDockingShipAPI(); return ShipAPI

Checks if the ship is leaving (undocking), should work on fighters and drones.
ShipAPI.isUndocking();
Title: Re: API request
Post by: Darloth on September 22, 2013, 03:33:43 AM
ShipAPI:  setCR(float CR):  would set Combat Rating values to float value.
WingAPI: setReplacements(float replacements), would set how many chassis a Wing currently has to float value.

Setting CR in a Mission should just require a valid ShipAPI, not a FleetAPI.  Same with setting the number of chassis available; we should just get the ShipAPI and the WingAPI and be able to set it. 

does void setCurrentCR(float cr); not work?
Title: Re: API request
Post by: Zaphide on September 22, 2013, 06:56:15 PM
FactionAPI.getColor()
 - I guess returns the color definition stuff from java.awt? (sorry I know so little Java :()

FactionAPI.setColor(Color color)
 - (If it is not too difficult, this may be hard as you may have to update the redraw for the UI? Dunno)

Also, I think FactionAPI.getRelationship() appears to return 0.0 when you pass in it's own factionId. I think it should return 1 (at least). I realise it seems a dumb thing to ask a faction what it thinks of itself, but when writing faction-agnostic stuff it becomes a bit painful to have to write to checks (is it the same faction: if not return getRelationship(), else return 1).

Thanks :)
Title: Re: API request
Post by: Darloth on September 28, 2013, 03:53:51 PM
Would it be possible to get the methods/fields from the various Impl classes (OrbitalStationInteractionDialogPluginImpl being the most obvious) set as Protected rather than Private please?

This would make implementing new versions of them which are very close to the vanilla interactions (typically, a station with a single extra option) much easier, as you'd only have to override the methods you actually wanted to change and could just call up to the superclass for the rest.

(Of course, there might be an easy way and I'm just doing it wrong... Please let me know if that's the case instead.)
Title: Re: API request
Post by: silentstormpt on October 06, 2013, 09:54:58 AM
Global.getSoundPlayer().stopMusic();

Stops Music.

Global.getSoundPlayer().pauseMusic(int milliseconds);

Pauses music for x amount of milliseconds

Global.getSoundPlayer().playMusic(String music_id, boolean fade);

Plays a new music with a set id (on the music JSONArray) on the Sounds.json, the fade option would be used to do a slow pass from the old music to the new one
Title: Re: API request
Post by: Zaphide on October 14, 2013, 01:43:51 PM
ModPlugin.AfterGameExit
 - Triggers on Save+Quit (fired after AfterSaveGame) or Quit

You have most others but this could be handy if there is any clean-up to be done by a mod.

I guess perhaps clean-up shouldn't have to be done by a mod so maybe that's why it is not there already... :D
Title: Re: API request
Post by: Zaphide on October 16, 2013, 12:30:53 AM
SectorEntityToken.SetName(String name) :)
Title: Re: API request
Post by: dmaiski on October 18, 2013, 08:27:16 PM
one that i really want for convenience

CombatEntityAPI setTarget (CombatEntityAPI or vector2f)
-for guided weapons and such it would be great, curently there is a workaround, but needs math



and just cause it would make emp arks far easier to code (although ill probably still stick to my method using randoms)

CombatEngineAPI getEmpArcEnd (vector2f)
-to allow you to store vector2f locations of where an ark hit
--would make doins stuff with missiles and lightning much easier (curently i can do this, but its all done manualy)


on a similar line, instead of that one:
CombatEngineAPI projectile/missile/ray/EmpArk.getDamageLocation (Vector2f)
-gets the vector2f location of where a projectile hit
--alows all sorts of thing to be applied to the point
---posibly if you do ShipAPI.getDamageLocation make it run a reverse script that gets the last place the ship was hit by any form of damage

Title: Re: API request
Post by: dmaiski on October 21, 2013, 09:43:50 AM
one that i really want...

make
spawnProjectile() consistent with spawnEmpArk()

atm you need to make a dummy weapon for spawnProjectile() to work

what i want wish and desire:

Code: java
spawnProjectile(ShipAPI ship,          //same as
                                WeaponAPI weapon,          //same as
                                DamageType damageType,  //from emp arc
                                float damAmount,                 //from emp arc
                                float empDamAmount,             //from emp ark
                                float maxRange,                    /from emp ark
                                java.lang.String projectileId,  //what projectile wprite will be used
                                Vector2f point,         //same as
                                float angle,              //same as
                                Vector2f projectileVelocity)      //not weliant on what is in weapon.csv  

this would make cripting much easier, since you wouldnt need to fiddle around with many files, or write massive workarounds
Title: Re: API request
Post by: Trylobot on October 21, 2013, 12:41:15 PM
Code: java
// New API request, came up while I was writing some mod or other. Damaging Projectile API already has this:
String DamagingProjectileAPI.getProjectileSpecId();

// So it would be nice if it also had this:
ProjectileSpecAPI DamagingProjectileAPI.getProjectileSpec();
// Or this (which it looks like you might have added, or plan to add already, if so, disregard this):
ProjectileSpecAPI DataAPI.getProjectileSpec( String projectileSpecId );

Title: Re: API request
Post by: Zaphide on October 28, 2013, 04:10:10 PM
PlanetAPI.setSpec(String SpecKey)

It appears you can change a lot of things with various set methods but I think that switching to a predefined spec would also be useful.
Title: Re: API request
Post by: dmaiski on October 29, 2013, 02:05:36 PM
would it be posible to make engine.spawnEmpArc use purely Vector2f points, there are some things I would love to do but just cant because the end point of the ark has to e a CombatEntityAPI...
Title: Re: API request
Post by: Uomoz on November 18, 2013, 11:58:36 PM
FleetMemberAPI.getHullSpec().getBaseValue() returns some weird numbers if it's a fighter wing, while it returns the ship credits value if it's not.
Title: Re: API request
Post by: Zaphide on December 10, 2013, 05:08:41 PM
Something to retrieve a list of possible pre-defined variants for a hull:

e.g.
ShipHullSpecAPI.getPossibleVariants()
ShipAPI.getPossibleVariantsForHull()
SectorAPI.getVariantsForHullId(String hullId)

:)
Title: Re: API request
Post by: xenoargh on December 11, 2013, 11:49:27 AM
WeaponAPI.fire()

Fires the weapon this frame, using the weapon's projectile.
Title: Re: API request
Post by: LazyWizard on December 12, 2013, 11:42:51 AM
FleetDataAPI:

This is needed for a complete chain from a ShipAPI in combat to its fleet's CampaignFleetAPI on the map (using DeployedFleetMemberAPI).
Title: Re: API request
Post by: LazyWizard on December 20, 2013, 07:02:18 PM
SectorAPI:

CombatEngineAPI:
Title: Re: API request
Post by: xenoargh on December 20, 2013, 07:13:13 PM
Wouldn't it be nicer to have isPlayerInMenu return the object of the Menu, so that we'd know the context?
Title: Re: API request
Post by: xenoargh on January 08, 2014, 10:40:00 PM
It'd be nice to be able to get world positions for barrels in the API.  I just figured out how to do it with JSON and a line segment rotation, but I think it'd be pretty helpful to have that in the API.

WeaponAPI WeaponFirePoint getCurrFirePoint()

WeaponFirePointAPI Vector2f getLocation();
WeaponFirePointAPI int getBarrelNumber();
WeaponFirePointAPI boolean isRecoiling(int barrelNumber);
Title: Re: API request
Post by: LazyWizard on January 08, 2014, 11:18:51 PM
CombatEngineAPI:

CombatFleetManagerAPI:

SectorAPI:

I've been looking into making a utility mod that automatically adds all ships to refit battles, and I think that's all that's missing. The CombatFleetManagerAPI ones would also be useful if we want to implement the 'nearby fleets join battle after set time' idea that's been floating around the forum.
Title: Re: API request
Post by: xenoargh on January 08, 2014, 11:34:08 PM
Basically, I'd like a way to get the game context of whatever area of the game a given Object is being displayed in.  For example, if a WeaponAPI is being displayed in the Context of the Fleet display and I don't want them to draw their sprite, because they're Decoratives that are supposed to be hidden unless an EveryFrameScript says it's OK to draw, it'd be nice to be able to catch that and kill it.

getContext() would pull that value and return it.  This would be so handy for so many things, where we want things to operate here but not there, and right now, determining here and there is either difficult or just plain impossible.  IDK whether the game's mature enough to add this feature yet, but I figured I'd request it now, since it's something people are going to want for a lot of situations.

Code: java
public interface ContextAPI {

  public static enum Context {
     RADAR_VIEW,
     STRATEGIC_VIEW,
     BATTLE,
     SIMULATOR,
     DIALOG,
     REFIT,
     TRADE,
     FLEET,
     SKILLS,
     START,
     START,
     OTHER STUFF I FORGOT,
  }

  Context getContext();
}
Title: Re: API request
Post by: Sundog on January 10, 2014, 03:53:59 PM
I hereby humbly request these two additions to the API:

public interface MutableShipStatsAPI {
   public MutableStat getCollisionDamageTakenMult();
   public MutableStat getShipExplosionDamageTakenMult();
}

'ShipExplosion' refers to the blast caused by a ship being disabled.
Title: Re: API request
Post by: LazyWizard on January 11, 2014, 07:42:35 AM
AnimationAPI:
Title: Re: API request
Post by: xenoargh on January 14, 2014, 10:59:14 AM
DamagingProjectileAPI getSprite()

Same functionality as access to other SpriteAPI sprites (weapons, ships).

I think I can speed up the game up in Battle (and be able to do some pretty spectacular SFX) about 2-3 times by being able to cycle sprites instead of bothering with procedural animation, trading a little RAM for a lot of framerate.
Title: Re: API request
Post by: JT on January 22, 2014, 10:41:07 PM
Requesting a new API type, ResourceAPI, along with basic functions -- at the moment, getValue() and setValue().

I was conceiving of a way of introducing some civil gameplay instead of combat-oriented gameplay in the form of cargo deliveries accessed on the trade screen, but unfortunately bumped against the problem that we presently have no way of re-pricing resources (such as Fuel, Elite Crew, Supplies, etc.) on space stations.

My original proposal (for my own use as a design document) was:

Spoiler
Perhaps one way of implementing a civilian economy at the moment, prior to any full-on scripted mission system, is simply to have passengers and cargo destined for local trading hubs.  More to the point, the game would add the following:

Commuter Passenger to [X]
Travelling Passenger to [X]
Migrant Passenger to [X]

multiplied by the maximum number of trading hubs in the game -- so if there are 50 possible hubs, then there are 150 different new "crew" types added to the game.

Each of the different passenger types would be configured to correspond to one destination hub, and then from 1 to 20 of each passenger type would be scattered at each of a number of hubs within the specified range band.  Commuter Passengers would appear on other trading hubs within the same system, Travelling Passengers would appear on trading hubs in adjacent systems, and Migrant Passengers would appear on trading hubs in non-adjacent systems.  Periodic update scripts would remove the corresponding passenger types who are in the cargo of the appropriate hub, and would periodically add from 0 to 5 new passengers for that hub to random stations in the corresponding range bands.  Periodic scripts would also check to see the number of passengers waiting at every station and would subtract from 0 to 10% of all passengers waiting -- this is to reflect other companies scooping up these passengers, or the passengers getting fed up of waiting and hiring their own shuttle instead of waiting for a liner.

Each passenger is "free" to "buy".  When you dock with the designated trading hub, the "selling" price of all corresponding passengers is then set accordingly -- commuter passengers would pay a commuter fee (25 credits), travelling passengers would pay a intersystem hop fee (125 credits), and migrant passengers would pay a hyperflight fee (625 credits).  The cost of supplies and hyperfuel combined will make single hops inefficient for bulk transports, but very, very efficient when large numbers of passengers are transported.  Shuttles, on the other hand, can turn a profit running commuter service only, since their daily supply costs are low and no fuel is needed for in-system travel.

A similar behaviour would apply to cargo:

Delivery Cargo to [X]
Intersystem Cargo to [X]
Long-Range Cargo to [X]

TODO: Balance "selling" prices subject to testing -- how long does a typical commuter shuttle trip take (and therefore how many daily supplies -- no more than 7 days?), and what personnel capacity is involved (and therefore how many life support supplies -- 0.1/passenger/day?)
TODO: Dropping off passengers at places other than their destination works fine as designed -- they'll just have zero value -- but how to criminalise jettisoning passengers?
[close]

Aside from the inability to add new crew types at the moment -- they seem to be fairly hard-coded ;-) -- which in itself makes the idea unfeasible for passengers but still feasible for cargo deliveries, the main lacking feature is the ability to price commodities via the campaign or sector updates.

I could of course go the hard route and implement commodity exchanges and passenger pickups as dialogue plugins and then assign the cargos themselves as zero-value commodities, but that's a brutal path to follow for something that was intended to be ultimately simple.

I would also have to represent passengers as cargo rather than as crew, owing to the aforementioned hard-coding, which would mean I'd have to apply a scripted drain on supplies rather than having it behave emergently as part of the existing personnel capacity system, which would have a number of undesirable side effects, such as not being represented properly on the UI, and creating the unintuitive scenario that a troopship cannot be used as a passenger ferry.  However, allowing the creation of new crew types seems like it would be rather difficult to implement on the engine side, so that particular request will have to wait for another day, I suppose.
Title: Re: API request
Post by: LazyWizard on January 25, 2014, 12:48:11 PM
A minor one, but could getName() be pushed up a level from StarSystemAPI to LocationAPI?
Title: Re: API request
Post by: Debido on February 01, 2014, 11:48:20 PM
Regarding shields.

Requesting an addition to the ShieldAPI.
void setFacing(float angle)

Only valid when set to 'Front' type shield in use. Otherwise I guess if it were omni it would default to the normal behaviour of following the mouse cursor. This would allow me to setup some...interesting shield behaviours such as a high speed rotating one, one that chooses the closest target first and possibly try my hand at some other crazy shield AI such as closest object first. Not that there is anything wrong with the current shield AI, frankly I doubt I will ever be able to make shield AI as good as the current one.

Also maybe a toggleOff() would be nice to try some things, I was faffing with isOn() and isOff() until I realised they were booleans.

A nice to have would be to be able to have more than one shield as previously mentioned in

I've previously mentioned adding shield petals and being able to rotate them in  http://fractalsoftworks.com/forum/index.php?topic=7517.0.

I guess you could leave the default shield as is, but new shields are in in AdditionalShield[] array, and you access with their index and manipulate them with the normal ShieldAPI.

You could also add a SetLocation(Vector2f point) if you wanted to be able to place additional shields beyond the centre of the ship, or project shields in other locations but that's a bit beyond what I can imagine being useful right now.

EDIT: I think I'm ok with using the setActiveArc method to create a unique shield.
Title: Re: API request
Post by: Sundog on February 08, 2014, 10:14:19 AM
WeaponAPI:
    Edit: also -
Title: Re: API request
Post by: LazyWizard on February 08, 2014, 10:27:35 PM
ShieldAPI:
Title: Re: API request
Post by: Dark.Revenant on February 19, 2014, 07:43:15 PM
GenericObjectAPI extends CombatEntityAPI

(asteroids would be an example)

CombatEngineAPI

With these, modders can do almost anything.
Title: Re: API request
Post by: Zaphide on February 21, 2014, 01:44:28 AM
CampaignFleetAPI:
Title: Re: API request
Post by: Alex on February 21, 2014, 06:32:43 PM
CampaignFleetAPI:
  • setLocation(LocationAPI)

Already possible, in two ways:
1) LocationAPI.addEntity()/removeEntity() to do it immediately
2) SectorAPI.doHyperspaceTransition() to do it with the jump animation
Title: Re: API request
Post by: Zaphide on February 23, 2014, 01:54:47 AM
CampaignFleetAPI:
  • setLocation(LocationAPI)

Already possible, in two ways:
1) LocationAPI.addEntity()/removeEntity() to do it immediately
2) SectorAPI.doHyperspaceTransition() to do it with the jump animation

Great! Thanks :)
Title: Re: API request
Post by: xenoargh on March 19, 2014, 08:54:36 PM
weaponAPI flipX()

Fancy version of this (http://fractalsoftworks.com/forum/index.php?topic=6452.msg131073#msg131073). 

Would flip a weapon on the X axis, while also flipping the positions of the weapon barrels and the Glows.  Not sure there are any major gotchas with this, but I don't think so; at worst, the AIs might not have quite the right positions for the barrel positions.  IIRC I already made an API request for that feature.

It'd also be neat to have an optional JSON value for centerturretSprite, blah blah, so that even the centerline weapons would always look right.

Yes, I know how OCD that is, lol.  We've had comments about it before here and I just wanted to see if it could be done without too much hassle, and it's all right, so long as the weapon is symmetrical in barrel positions on the X axis and is centered on the X or is centered on the X with just one barrel.
Title: Re: API request
Post by: silentstormpt on April 01, 2014, 06:37:02 AM

beforeHit() it returns that projectile before making any changes to it, like calculating the damage it will do in that ship for both EveryFrame and OnHitEffectPlugin

getLatestProjectileSpawned() that returns a DamagingProjectileAPI or a MissileAPI if the last frame a weapon spawned one of those (it allows a much easier way to grab any new projectiles without cycling to every single one of them, it also allows doing changes to that projectile and effects before it "travels" and its alot less CPU intensive) for EveryFrame
Title: Re: API request
Post by: Debido on April 04, 2014, 10:16:20 PM
So...hm, the basic problem is that if I want a custom defense system other than a PhaseCloak or a Shield I have to do a lot of hackery using the 'PhaseCloak' system as a means to have my own custom Defense System.

At the moment I've proven you can have a Defense system that can be toggled, and have timers. So far so good. However there is no status text indicating that the system is active.

There are only two ways to add/remove vanilla status text that I'm aware of, through the ShipSystemStatsScript and the BaseBattleObjectiveEffect - neither of which I can use.

So I would ask for an API that would allow me to add/remove buff status information in combat to ships.

This would also be useful for times when you have a 'Mother Ship' that gives a buff to nearby ships, and you are aware that the buff is active and know it's caused by the mother ship.

So an API that allows adding/remove buffs? I suppose it would need to be a sort of every frame script as you would need to check for status information such as time remaining on the buff.
Title: Re: API request
Post by: Debido on April 10, 2014, 10:46:46 AM
defaultOnHitAPI - scripts of this type occur for every single projectile and beam class. Instead of needing to inject code into other peoples onHit scripts, or changing every projectile script to point to your script. This type of script runs first, then then the normal onHit script will run after.

If the here are different defaultOnHitScripts in different mods, they all still apply but apply either in alphabetical order or mod loading order.

That said if you can give us a beforeHit API it would be even better, but if it isn't easy enough in the short term I'd still take this one.

A ShipAPI getTrueHealth, or getNegativeHullHealth for the case of ships that are hulks would also be good.
Title: Re: API request
Post by: xenoargh on April 10, 2014, 11:29:14 AM
You can do the above right now through EveryFrameCombatScript.
Title: Re: API request
Post by: Debido on April 10, 2014, 11:43:01 AM
You can do the above right now through EveryFrameCombatScript.

True, but i avoid EveryFrameCombatPlugin where I have to loop through large lists unless I absolutely positively have to.
Title: Re: API request
Post by: xenoargh on April 10, 2014, 11:49:08 AM
Like Alex has pointed out, merely iterating through a list is actually pretty cheap :) 

What makes it expensive is whatever you're doing as you loop.  If all you're doing is checking whether a projectile / beam is currently doing damage to something (i.e., no checks against hull bounds and all that), that's very cheap; a boolean and a couple of instanceof checks at most.  See the Acanthus's shield code for a practical example :)
Title: Re: API request
Post by: Debido on April 10, 2014, 01:43:30 PM
Thank you Xeno, that is very helpful.

Although retrieving the hull value of a hulk would still be useful.
Title: Re: API request
Post by: LazyWizard on April 15, 2014, 07:13:40 PM
ViewportAPI:
(or)

These would be useful for scripts like camera shake, automatically keeping a target in sight, stuff like that. :)
Title: Re: API request
Post by: Debido on April 15, 2014, 07:56:40 PM
CombatEngineAPI.setPlayerShip(ShipAPI ship);

As it sounds, let's you change the ship the player controls. At the moment this can already be achieved in dev mode by simply use the modifier key + left click. However there are some interesting game mechanics that can be used if you can programmatically and instantaneously move the player from one ship to the other without using the boarding shuttle.

If there is another way of doing this already I would love to hear from Alex on how it's actually achieved in the background.
Title: Re: API request
Post by: Dark.Revenant on April 17, 2014, 04:45:13 AM
I would like some method to get damage done to an entity; preferably, this would be accessible from the CombatEntityAPI and would return a collection containing the amount of damage, the damage source, the type of damage that occurred, the damage location, if it did soft/hard flux, and if it bypasses shields, in the current frame.  Preferably this would return the raw damage, unmodified by stats, but having options to see both the raw and modified damage would be nifty.  This is vital for creating damage-response systems, such as shields, damage effects, etc.

Currently, there is no way to ubiquitously scan for damage attempted to be done to an object until the object has already taken the damage somewhere, which causes all sorts of presentation issues and logic problems.
Title: Re: API request
Post by: Sundog on April 17, 2014, 09:40:34 PM
I agree. A way to get information about damage would be very usefull. Perhaps it could be implemented and instantiated similarly to EveryFrameCombatPlugin, calling an 'onHit' method whenever an entity is hit. Additionally, onHit could return a boolean indicating whether or not the hit should actually deal damage and destroy the projectile.

We could do some crazy stuff with that, like make projectiles ricochet off armor if it hits the bounds at an acute angle  :D
Title: Re: API request
Post by: LazyWizard on April 17, 2014, 10:17:16 PM
EveryFrameCombatPlugin:

A lot of current combat plugins have static variables and clear them in init(). Adding this method would allow those scripts to clean up after themselves and prevent those objects from being held in memory between battles. It'd also allow us to have custom battle end events that execute before the back from engagement results are calculated.
Title: Re: API request
Post by: Debido on April 23, 2014, 01:56:52 AM
EveryFrameCombatPlugin:
  • void end()

A lot of current combat plugins have static variables and clear them in init(). Adding this method would allow those scripts to clean up after themselves and prevent those objects from being held in memory between battles. It'd also allow us to have custom battle end events that execute before the back from engagement results are calculated.

That is fairly essential to some really interesting things I we need to do with modding.

Here are some other things from the ShipAPI as well I'd like to see:
getName() - String name variable
getSinceLastDamageTaken()
getSinceLastShieldDamageTaken()
getAimAccuracy()
getTimeDeployed()
getFullTimeDeployed
getCrMalfunctionThreashold()
setCrMalfucntionTreshold()
getCrCriticalMalfunctionDamage()
setCrCriticalMalfunctionDamage()
getBaseCriticalMalfunctionDamage()
setBaseCriticalMalfunctionDamage()
getEngineFractionPermanentlyDisabled()
setEngineFractionPermanentlyDisabled()
getSinceLaunch()
getEngineLocations() ArrayList
Title: Re: API request
Post by: Sundog on April 23, 2014, 01:14:37 PM
getName() - String name variable
Would this do the trick? ship.getHullSpec().getHullName()

Perhaps it would be a good idea to wrap* that though, if only to make it easier to find.
*Is 'wrap' the right word? I meant doing this:

public class ShipAPI {
    String getName() {
        return this.getHullSpec().getHullName();
    }
}

getEngineFractionPermanentlyDisabled()
Already exists.

getEngineLocations() ArrayList
You can get this information by iterating over ship.getEngineController().getShipEngines() and calling ShipEngineAPI.getLocation().


Speaking of ship engines, we could do some pretty neat stuff if ShipEngineAPI was more flexible (e.g. setAngle, setLocation, setWidth, setLength, setColor)
Title: Re: API request
Post by: Dark.Revenant on April 23, 2014, 01:51:34 PM
getName() - String name variable
Would this do the trick? ship.getHullSpec().getHullName()

Perhaps it would be a good idea to wrap* that though, if only to make it easier to find.
*Is 'wrap' the right word? I meant doing this:

public class ShipAPI {
    String getName() {
        return this.getHullSpec().getHullName();
    }
}

That gets the name of the hull.  Like Onslaught or Apogee.
Title: Re: API request
Post by: Sundog on April 23, 2014, 02:21:34 PM
Oh, silly me. I thought that's what he was requesting.

The name of a specific ship could be retrieved like this:
Global.getCombatEngine().getFleetManager(ship.getOwner()).getDeployedFleetMember(ship).getMember().getShipName()

So, yeah. I'm thinking ship.getName() would be a tad more elegant.
Title: Re: API request
Post by: Debido on April 23, 2014, 04:45:28 PM
Also ShipAPI setName() to change the name of a ship in combat

At the moment the way I get the ship name is cross reference it's fleet Id with FleetMemberAPI then grab it's name from there, but I have to iterate that list to get it.
Title: Re: API request
Post by: Debido on April 28, 2014, 11:18:11 PM
CombatEngineAPI

boolean isPlayerRetreating()
boolean isEnemyRetreating()
Title: Re: API request
Post by: Debido on May 07, 2014, 05:51:39 PM
This is a strange one, not really sure on the namespace for this one, but it is a very special request.

I'm looking at making a 'Ship Grinder', a mission that doesn't end, and the player is not involved, it would be nice if I could automate the camera so it randomly follows different ships.

Potentially I can see an API for the camera being useful for people who want to have in-combat mini-movies or little encounters with some pop-up text or audio or what not.
Title: Re: API request
Post by: Debido on May 09, 2014, 05:05:43 AM
WeaponAPI.MutableStat or WeaponAPI.StatBonus.

Essentially allow certain attributes of a particular or weapon type to be altered

Also with Beam weapons a DO_NOT_FADE_IN hint makes it so that during the charge sequence, there is no 'beam, so that the laser only fires at full intensity during main firing sequence. This allows for effects/sounds to be created during the 'charge' time without any damage being done.
Title: Re: API request
Post by: Debido on May 11, 2014, 10:33:56 PM
A SpawnShipOrWing method or any of the other derivitives that allows you to spawn in the normal 'location' at the bottom of the map. That is, I can ask for 10 Astrals to be deployed in a single frame and I needn't worry about the location, that is automatically handled by the normal deployment process.
Title: Re: API request
Post by: Debido on May 13, 2014, 09:24:57 PM
AnimationAPI MissileAPI.getAnimation() to allow use to make VLMS without a whole ton of hacky missile replacement crap.

Also set/getFuseDistance(), set/getMIRVDistance, set/getCollisionClass, set/getSize, set/getCollisionRadius, set/getExplosionColor,set/getEngineSpec, set/getMissileType.

Also boolean Global.isAlexAwesome() which always returns true.
Title: Re: API request
Post by: Cycerin on May 14, 2014, 08:12:34 AM
Two small requests that aren't technically API-related, but:
- The ability to set a sound when a MIRV splits in the .proj file (I assume this is something you'll want for the core game anyway down the road)
- The ability to flag a ship as uncapturable without having to change the entire encounter dialog
Title: Re: API request
Post by: Uomoz on May 14, 2014, 11:53:21 AM
FactionAPI.getColour();

For even fancier dialogues :)
Title: Re: API request
Post by: silentstormpt on May 20, 2014, 03:11:02 AM
We needs someway to get access to the Options menu, so we can add toggle-able options for mods like ShaderLib
Title: Re: API request
Post by: Debido on May 24, 2014, 01:41:13 AM
engine.spawnDamagingExplosion() - exactly like the spawnExplosion but does damage.
Title: Re: API request
Post by: Debido on May 24, 2014, 01:55:45 AM
ArmourAPI.getGridCoordinates() returns List<Vector2f>

or

class AmourCell{
getArmourFraction()
getCoordinate()

private
float fraction
Vector2f coordinates
}
etc. as an interface


return List<ArmourCell>
Title: Re: API request
Post by: Sundog on May 24, 2014, 12:01:18 PM
I've been using this to get the absolute location of an armor cell:
Spoiler
Code: java
    public static Vector2f getCellLocation(ShipAPI ship, float x, float y) {
        x -= ship.getArmorGrid().getGrid().length / 2f;
        y -= ship.getArmorGrid().getGrid()[0].length / 2f;
        float cellSize = ship.getArmorGrid().getCellSize();
        Vector2f cellLoc = new Vector2f();
        float theta = (float)(((ship.getFacing() - 90) / 360f) * (Math.PI * 2));
        cellLoc.x = (float)(x * Math.cos(theta) - y * Math.sin(theta)) * cellSize + ship.getLocation().x;
        cellLoc.y = (float)(x * Math.sin(theta) + y * Math.cos(theta)) * cellSize + ship.getLocation().y;

        return cellLoc;
    }
[close]
Not exactly clean or efficient, but it works. I'm sure matrix transformation would be better. It would be nice if the API provided this functionality though.
Title: Re: API request
Post by: TJJ on May 24, 2014, 12:07:51 PM
I've been using this to get the absolute location of an armor cell:
Spoiler
Code: java
    public static Vector2f getCellLocation(ShipAPI ship, float x, float y) {
        x -= ship.getArmorGrid().getGrid().length / 2f;
        y -= ship.getArmorGrid().getGrid()[0].length / 2f;
        float cellSize = ship.getArmorGrid().getCellSize();
        Vector2f cellLoc = new Vector2f();
        float theta = (float)(((ship.getFacing() - 90) / 350f) * (Math.PI * 2));
        cellLoc.x = (float)(x * Math.cos(theta) - y * Math.sin(theta)) * cellSize + ship.getLocation().x;
        cellLoc.y = (float)(x * Math.sin(theta) + y * Math.cos(theta)) * cellSize + ship.getLocation().y;

        return cellLoc;
    }
[close]
Not exactly clean or efficient, but it works. I'm sure matrix transformation would be better. It would be nice if the API provided this functionality though.

350 seems like an odd number to use for converting degrees into radians?
Title: Re: API request
Post by: Sundog on May 24, 2014, 12:10:32 PM
Dear god! How did that happen...
Good catch TJJ. Edited my post to remove that... embarrassment.
Title: Re: API request
Post by: Debido on May 24, 2014, 12:35:26 PM
I've been using this to get the absolute location of an armor cell:
Spoiler
Code: java
    public static Vector2f getCellLocation(ShipAPI ship, float x, float y) {
        x -= ship.getArmorGrid().getGrid().length / 2f;
        y -= ship.getArmorGrid().getGrid()[0].length / 2f;
        float cellSize = ship.getArmorGrid().getCellSize();
        Vector2f cellLoc = new Vector2f();
        float theta = (float)(((ship.getFacing() - 90) / 360f) * (Math.PI * 2));
        cellLoc.x = (float)(x * Math.cos(theta) - y * Math.sin(theta)) * cellSize + ship.getLocation().x;
        cellLoc.y = (float)(x * Math.sin(theta) + y * Math.cos(theta)) * cellSize + ship.getLocation().y;

        return cellLoc;
    }
[close]
Not exactly clean or efficient, but it works. I'm sure matrix transformation would be better. It would be nice if the API provided this functionality though.

Nice! This makes life easier. So I pass each cell from the getGrid(), I should be able to give myself a list of all the armour cell Vector2f point locations?

EDIT: Hm, ok. Nope...can't do that with it.
Title: Re: API request
Post by: TJJ on May 24, 2014, 02:52:24 PM
Dear god! How did that happen...
Good catch TJJ. Edited my post to remove that... embarrassment.

Np.
Classic example of why you should use the API methods where available (http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#toRadians(double)) :)
Title: Re: API request
Post by: Debido on May 24, 2014, 03:27:49 PM
CombatFleetManagerAPI.holdTheLine() prevents the enemy AI from calling a retreat. They fight to the death and the very last ship...including ships the are generated from spawnShipOrWing.
Title: Re: API request
Post by: xenoargh on May 24, 2014, 08:21:53 PM
A couple of requests:

DamagingProjectileAPI / .proj boolean doNotCreateParticles - No missile explosion graphics get generated via Vanilla code, including the automagic death explosions when missiles are killed (which are quite expensive, btw, but I cannot determine why without seeing the function- I'd really like to be able to replace them entirely).

CombatEntityAPI setPosition() - I'm not quite sure what's up, but it appears that using Vector2f setX() / setY() on the Vector2f generated by getLocation() isn't always as reliable as I'd like. 

I tried writing code strictly limiting the flight of ships that aren't using TravelDrive to the game arena, but it's not working terribly well when ships are being spawned (if they leave TravelDrive outside the arena, they're ending up in the corners) and when they attempt to leave via Retreat, even though they have TravelDrive on, they're still having issues.  Nothing I can't live with but I'd like to be able to fix it properly and I have a feeling that attempting to set the positions is getting ignored / overridden.
Title: Re: API request
Post by: Alex on May 24, 2014, 09:16:59 PM
CombatEntityAPI setPosition() - I'm not quite sure what's up, but it appears that using Vector2f setX() / setY() on the Vector2f generated by getLocation() isn't always as reliable as I'd like. 

I tried writing code strictly limiting the flight of ships that aren't using TravelDrive to the game arena, but it's not working terribly well when ships are being spawned (if they leave TravelDrive outside the arena, they're ending up in the corners) and when they attempt to leave via Retreat, even though they have TravelDrive on, they're still having issues.  Nothing I can't live with but I'd like to be able to fix it properly and I have a feeling that attempting to set the positions is getting ignored / overridden.

(Pretty sure something else is going on there, getLocation().x = <whatever> should work. That's what the core game uses for things like the teleporter.)
Title: Re: API request
Post by: xenoargh on May 24, 2014, 09:59:35 PM
Yeah, it's some weird issues with top / bottom of the battlefield related to handling of Retreat, I think.  IDK quite what's causing stuff to suddenly teleport to corners, though.  I'll look at this again :)
Title: Re: API request
Post by: Sundog on May 25, 2014, 12:06:16 AM
Classic example of why you should use the API methods where available (http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#toRadians(double)) :)
Forsooth  :)

So I pass each cell from the getGrid(), I should be able to give myself a list of all the armour cell Vector2f point locations?

EDIT: Hm, ok. Nope...can't do that with it.
I should have mentioned; the float x/float y parameters of the function are meant to be the index coordinates (in the 2d array returned by getGrid()) of the cell you want the location of. I can't remember why I used floats rather than ints. Anyway, if I understand what you need correctly, it should be something like this:
Spoiler
Disclaimer - Untested

Code: java
    public static List getCellLocations(ShipAPI ship) {
        int width = ship.getArmorGrid().getGrid().length;
        int height = ship.getArmorGrid().getGrid()[0].length;
        //List cellLocations = new ArrayList(width * height);
        // Not sure if above works the way I think it does.
        List cellLocations = new ArrayList();
       
        for(int x = 0; x < width; ++x) {
            for(int y = 0; y < height; ++y) {
                cellLocations.add(getCellLocation(ship, x, y));
            }           
        }
       
        return cellLocations;
    }
[close]
Title: Re: API request
Post by: Debido on May 25, 2014, 12:58:10 PM
MissionDefinitionAPI

api.addEveryFrameCombatPlugin(org.blah.missions.plugins, myMissionScript);

When the mission loads, it will call the init and advance sections of this script - but ONLY during the mission. The script is otherwise inactive and does nothing.

This allows us to have a custom mission script that is only active for the duration of the mission. After the mission ends you no longer call the script.

For instance, lets say you wanted to have a mission where you spawned in enemies in waves, or is event driven, condition driven etc. but you don't want to have to do elaborate checks within the EveryFrameCombatPlugin to ensure that it is never otherwise activated under any other circumstances.
Title: Re: API request
Post by: xenoargh on May 25, 2014, 01:02:36 PM
You can already do all that by defining a custom missile AI :)
Title: Re: API request
Post by: Debido on May 25, 2014, 01:21:50 PM
You can already do all that by defining a custom missile AI :)

Was that about the mission specific EveryFrameCombatPlugin?
Title: Re: API request
Post by: Alex on May 25, 2014, 01:34:59 PM
MissionDefinitionAPI

api.addEveryFrameCombatPlugin(org.blah.missions.plugins, myMissionScript);

I'm confused. There's already:
MissionDefinitionAPI.addPlugin(EveryFrameCombatPlugin plugin);
Am I missing something here?


On a general note: this thread is turning a bit into "questions about how to do stuff", in part, because some of the stuff being asked for is already possible. This is going to make it much more time-consuming to go through later and figure out what actually needs to be added. If you're not sure whether something can already be done or not, please ask about it in the Modding section first.

It's also not about requesting new features (the Suggestions forum is there for that), but rather about exposing functionality - via the API - that's already in the game. There's some gray area there, of course, but still. If feature suggestions were to go in this thread, it'd be completely unmanageable, and it's going into that territory. A good rule of thumb is that if the core game doesn't already do what you're asking for or something very close to it, then it doesn't belong here.


CombatFleetManagerAPI.holdTheLine() prevents the enemy AI from calling a retreat. They fight to the death and the very last ship...including ships the are generated from spawnShipOrWing.

For example - absolutely not to single you out personally - this kind of thing definitely belongs in Suggestions and not here.


I'd like to keep this thread clean and focused. Thanks! :)
Title: Re: API request
Post by: Debido on May 25, 2014, 02:18:09 PM
MissionDefinitionAPI

api.addEveryFrameCombatPlugin(org.blah.missions.plugins, myMissionScript);

I'm confused. There's already:
MissionDefinitionAPI.addPlugin(EveryFrameCombatPlugin plugin);
Am I missing something here?


Documentation? Neither in the source code or the JavaDoc do you state that *that* is what that plugin does specifically. Thank you for clarifying that. I suggest that you might get less questions with more detailed API documentation. The JavaDoc is my proverbial bible when looking for how to do things. Though the comments you have at the moment are fairly good in most areas, in others no such documentation exists or it is spread out over multiple posts. The forum board/threads is a very inefficient method of having a KB article system, and the search results are often ... erroneous.

At the moment there are only a handful of people that really have an idea about undocumented features - such as that post on how to get the EveryFrameCombatPlugin loaded - there are something like 5 methods of which I only ever knew of one, and LazyWizard was the only other person on the entire planet that knew the other 4.



On a general note: this thread is turning a bit into "questions about how to do stuff", in part, because some of the stuff being asked for is already possible. This is going to make it much more time-consuming to go through later and figure out what actually needs to be added. If you're not sure whether something can already be done or not, please ask about it in the Modding section first.

It's also not about requesting new features (the Suggestions forum is there for that), but rather about exposing functionality - via the API - that's already in the game. There's some gray area there, of course, but still. If feature suggestions were to go in this thread, it'd be completely unmanageable, and it's going into that territory. A good rule of thumb is that if the core game doesn't already do what you're asking for or something very close to it, then it doesn't belong here.


CombatFleetManagerAPI.holdTheLine() prevents the enemy AI from calling a retreat. They fight to the death and the very last ship...including ships the are generated from spawnShipOrWing.

For example - absolutely not to single you out personally - this kind of thing definitely belongs in Suggestions and not here.


I'd like to keep this thread clean and focused. Thanks! :)


Well fair enough to single me out, I do post a large number of requests - and that one was admittedly not the best one I've had and was a reference to Mass Effect humor...but anyway I think another way to get a similar effect is to enumerate all FleetMembers and set them to suicidal - in theory.

Anyway I'll try to have less frivolous requests and hope that the handful of people who know the undocumented API functions are around when I need to ask them.

That said is boolean Global.isAlexAwesome() which always returns true such a bad suggestion?
Title: Re: API request
Post by: Alex on May 25, 2014, 02:39:10 PM
Spoiler
Documentation? Neither in the source code or the JavaDoc do you state that *that* is what that plugin does specifically. Thank you for clarifying that. I suggest that you might get less questions with more detailed API documentation. The JavaDoc is my proverbial bible when looking for how to do things. Though the comments you have at the moment are fairly good in most areas, in others no such documentation exists or it is spread out over multiple posts. The forum board/threads is a very inefficient method of having a KB article system, and the search results are often ... erroneous.

At the moment there are only a handful of people that really have an idea about undocumented features - such as that post on how to get the EveryFrameCombatPlugin loaded - there are something like 5 methods of which I only ever knew of one, and LazyWizard was the only other person on the entire planet that knew the other 4.
[close]

Fair enough re: documentation. The plugins are also the part where stuff gets a little too arcane. Just, you know, a method with that exact signature already exists, so I don't think it's unfair to consider it, ah, "due diligence" to look at whether it already does what you want :) There's also an example of it being used (BattleCreationPluginImpl, this line: loader.addPlugin(new EscapeRevealPlugin(context))).

Anyway, again, not trying to single you out or jump on you. This isn't a big deal, and stuff like that is bound to come up due to aforementioned deficiencies in documentation. I just want to keep this thread a little more on track, that's all. Not putting feature requests here is the much bigger point; a "can you add this/it's already there" exchange is easy enough to skim through.

That said is boolean Global.isAlexAwesome() which always returns true such a bad suggestion?

Terrible - too much pressure :)
Title: Re: API request
Post by: Debido on May 25, 2014, 03:01:43 PM
That's the thing, I actually looked at several missions and I found addPlugin(new EscapeRevealPlugin(context)) so I thought it had to do with some EscapeRevealPlugin which didn't seem relevant to what I was trying to achieve.

However if I'd just had a look at a few more missions, and I'd opened the Bismarck mission it probably would have twigged at about line 94:

Code: java
		api.addPlugin(new EveryFrameCombatPlugin() {
public void init(CombatEngineAPI engine) {
engine.getContext().setStandoffRange(10000f);
}
public void advance(float amount, List events) {
}
});


That makes sense to me.

I have a bit of a concern though with this method of adding a plugin. Normally when I do a plugin, I either clear out lists in the Init or in advance section from the previous engine.

However if the plugin is not run again in another instance of combat, those lists/hashmaps etc. might remain there in memory until the application closes. So if the use case is the user plays the mission with the script X that stores various ship data, they then complete the mission, then go off and play the campaign I'm not certain that the GC would cleanup my lists/hashmaps properly, potentially leading to a crash due to lack of memory on 32-bit systems.

Anyway aside from the GC of mission EveryFrameCombatPlugin scripts lists, I think it seems fairly straight forward after looking at the bismarck mission.
Title: Re: API request
Post by: Debido on May 27, 2014, 05:36:16 AM
CombatEngineAPI.endCombat(float delay, Fleetside enum)

At the moment when I end combat using the endCombat method it will default to the player losing, but I may want them to win according to my specifications. So if I can say *who* won...we can have some fun arcade missions ^_^.
Title: Re: API request
Post by: Debido on May 30, 2014, 06:25:46 PM
Global.getShipVariants() return List<ShipVariantAPI> of all variants across all vanilla and all loaded mods

I guess what I'm trying to do is to be able to randomly grab variants of ships to spawn them, or having to always rely on certain mods being loaded. I can request a list of all variants, interrogate various attributes and pick them accordingly to spawn them.

Title: Re: API request
Post by: xenoargh on May 30, 2014, 06:29:48 PM
You can do this already.  See how the Random Battle code in Vacuum works.
Title: Re: API request
Post by: Debido on May 30, 2014, 10:30:38 PM
It's a rather inventive way of achieving it, it's not portable though, you still rely on there being a .faction file available and that has to be inside your own mod directory, it doesn't traverse across all mods loaded?
Title: Re: API request
Post by: xenoargh on May 30, 2014, 11:19:46 PM
Well, I didn't write it for portability; you need to figure stuff like that out :)

That said... it's pretty straightforward, I think.
Code: java
File dir = new File("data/world/factions/");
File[] files = dir.listFiles(new FilenameFilter() {
    public boolean accept(File dir, String name) {
        return name.toLowerCase().endsWith(".faction");
    }
});

...gets you every single .faction file.  Read into JSON.  Do whatever analysis thing you want once you have the data set.  Should be straightforward to push it all to a string table, eliminate all matches, etc.
Title: Re: API request
Post by: Debido on June 04, 2014, 08:26:42 PM
Well, I didn't write it for portability; you need to figure stuff like that out :)

That said... it's pretty straightforward, I think.
Code: java
File dir = new File("data/world/factions/");
File[] files = dir.listFiles(new FilenameFilter() {
    public boolean accept(File dir, String name) {
        return name.toLowerCase().endsWith(".faction");
    }
});

...gets you every single .faction file.  Read into JSON.  Do whatever analysis thing you want once you have the data set.  Should be straightforward to push it all to a string table, eliminate all matches, etc.

Without even trying I'm fairly sure that Starsector would block me from doing anything with the File object or anything in the java.util.io or java.util.file would be prevented from doing anything meaningful. Going to do a post about that.
Title: Re: API request
Post by: xenoargh on June 05, 2014, 12:24:47 AM
Ah, yeah.  I keep forgetting about that, because I've really not had any serious problems with it thus far.

Anyhow, you can do it via loadJSON() using all of the known faction names; it's not like there are that many factions out there.  Exceptions could be handled without serious problems.  You're dealing with a very finite search space and a small amount of data entry, so, no biggie, just do some data entry.


Title: Re: API request
Post by: Dark.Revenant on June 17, 2014, 03:19:03 AM
SoundPlayerAPI.playMusic()

Please.  Many mods really need something like this.
Title: Re: API request
Post by: xenoargh on June 27, 2014, 09:21:17 PM
ShipAPI boolean isGroupAutofire(int group)
ShipAPI void setGroupAutoFireOn(int group)

We can't get direct access to the states of Autofire for a Group atm via ShipAPI. 

Would be nice to just go in and change the booleans for that Group without having to use giveShipCommand(), since it has some issues with taking a bunch of toggle orders per frame and we can't query the state of the boolean's current value at all.
Title: Re: API request
Post by: xenoargh on June 30, 2014, 07:07:33 PM
CombatEngineAPI endCombat(float) should take an additional parameter, a boolean for whether the Player has won or not. 

Using this currently always results that the player has lost the battle when the EngagementResultAPI is read later on in the post-battle process atm :)
Title: Re: API request
Post by: Debido on July 30, 2014, 10:23:15 AM
engine.spawnDamagingExplosion() - exactly like the spawnExplosion but does damage.

No longer require an AOE/Flak type damage API. This is quite doable with LazyLib, and failing that just a bit of fudge work.

Though I am curious as to what the damage level is outside the 'core' radius in a proximity fuse weapon?
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on July 30, 2014, 02:44:22 PM
I updated the OP with a list of current requests and their status, as well as some guidelines for posting in this thread. These are the same guidelines that have been mentioned in this thread before; it's just slightly more useful for them to actually be written down somewhere. ;)

Let me know if I missed anything while collating the previous 15 pages. I should note I deliberately excluded a few suggestions that were closer to feature requests - those should have their own threads so they can be discussed without cluttering this thread - as well as requests that already had a negative reply from Alex (here or elsewhere on the forum).

I should also apologize for renaming a few suggested methods. I just couldn't help myself. :)
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on August 10, 2014, 10:04:49 PM
CombatEngineAPI:

FighterWingAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on August 25, 2014, 12:10:29 AM
DerivedWeaponStatsAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on August 30, 2014, 03:33:35 PM
SettingsAPI:

Sometimes you really want the exact .json data from a mod's folder.

That this would allow Version Checker to use mod_info.json is purely coincidental, I assure you. ;)
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on September 04, 2014, 12:16:07 PM
MissileAPI
float getFlightTime()
float getMaxFLightTime()
float maxSpeed()
float getSpeed()
float getElapsed()
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on September 04, 2014, 02:49:48 PM
MissileAPI
[...]
float getSpeed()
float getElapsed()

You should be able to get missile speed with getVelocity().length().

What do you mean by getElapsed()?
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on September 04, 2014, 06:52:54 PM
Max flight time would be maximum time the object can exist, including time the missile is flying without power before fade out. Flight time would be the time the engine is active and is able to avoid friendlies. Ie. before it fizzles.
Elapsed would be the current time it has spent flying.

Come to think of of it a setter for the elapsed time may also be useful.
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on September 07, 2014, 06:23:47 AM
WeaponAPI
setHealth(float)

or some means of damaging the weapon directly weapon itself.

Basically need the ability to directly damage a weapon and not have to damage the ship at the same time. Or maybe a addDamage or notifyDamage so as to let the game engine determine if the weapon is damaged enough to go offline and for the damage glow on the weapon to take effect.
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on September 26, 2014, 12:17:26 AM
ShipSystemAPI:

TextPanelAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on September 26, 2014, 05:28:17 AM
Seeing as Alex will soon be digging into the API requests, here are some more. Most of these are requested from the Starsector Skype Channel that has almost every major mod author and contributor.

+Collision API (per previous discussion)
(unsure of existing inputs/outputs)

+DamagingProjectileAPI
float elapsed()
float getDamageMult()
void setDamageMult(float)
void setHitPoints(float)
float getMoveSpeed()
void setDamageAmount(float)

+MissileAPI
void setHitPoints(float)

+ShipEngineControllerAPI.ShipEngineAPI
float getHealth()
void setHealth(float)
setStyleID(string)
setEngineColor(Color)
setContrailParticleSizeMult(float)
setContrailParticleDuration(float)
setContrailParticleFinalSizeMult(float)
setContrailMaxSpeedMult(float)
setContrailAngularVelocityMult(float)
setContrailColor(Color)
setType(GLOW/SMOKE)
void setEngineFlameSprite(SpriteAPI sprite)
void setEngineGlowSprite(SpriteAPI sprite)
void setEngineGlowSecondarySprite(SpriteAPI sprite)
void setContrailParticleSprite(SpriteAPI sprite)

string getStyleID()
Color getEngineColor()
float getContrailParticleSizeMult()
float getContrailParticleDuration()
float getContrailParticleFinalSizeMult()
float getContrailMaxSpeedMult()
float getContrailAngularVelocityMult()
float getContrailColor()
TYPE getType()

+ShipSystemAPI
void setAmmo(float)
void setCooldownRemaining(float)
float getCooldownMax()
void setCooldownMax(float)
float getFluxPerUse()
void setFluxPerUse(float)
float getFluxPerSecond()
void setFluxPerSecond(float)

+ShieldAPI
void setShieldRingColor(Color)
Color getShieldRingColor()
void setShieldInnerColor(Color)
Color getShieldInnerColor()
void setArc(float)
void setFacing(float)
void setRadius(float)
void setRadius(float, SpriteAPI sprite) where sprite is the desired shield texture.


+ShipAPI
void setVentCoreColor(Color)
Color getVentCoreColor()
void setVentFringeColor(Color)
Color getVentFringeColor()
void setVentTexture(SpriteAPI sprite)
void setVentTexture(String spriteID)
getHullStyleID()
setHullStyleID(string)
boolean getHoldFire()
void setHoldFire(boolean)
boolean isPhased()
void addJitterCopy(Vector2f location, float duration)
float timeSinceLaunch() (for fighters?)

+CombatEntityAPI
void setCollisionRadius(float)

+WeaponAPI
Color getGlowColor()
void setGlowColor(Color)
MuzzleFlashAPI getMuzzleFlash
float getDamage()
void setDamage(float)
WeaponGlowJitterAPI getWeaponJitter()

+MuzzleFlashAPI
float getLength()
float getSpread()
float getParticleSizeMin()
float getParticleSizeRange()
float getParticleDuration()
float getParticleCount()
Color getParticleColor()

void getLength(float)
void getSpread(float)
void getParticleSizeMin(float)
void getParticleSizeRange(float)
void getParticleDuration(float)
void getParticleCount(float)
void getParticleColor(Color)

+WeaponGlowJitterAPI
void setDuration(float)
float getDuration()
float setJitterX(float)
float getJitterX()
float setJitterY(float)
float getJitterY()

+BattleObjectiveAPI
SpriteAPI getSprite()
void setSprite(SpriteAPI sprite)

+BeamAPI
void setHitGlow(SpriteAPI sprite)
SpriteAPI getHitGlow()
float getHitGlowBrightness
float getWidth()
void setWidth(float)
float getPixelsPerTexel()
void setPixelsPerTexel(float)
Color getCoreColor()
void setCoreColor(Color)
Color getFringeColor()
void setFringeColor(Color)
Title: Re: API request thread (please read OP before posting!)
Post by: silentstormpt on September 26, 2014, 08:32:41 AM
We're also in need of a way to get the DamagingProjectileAPI objects before the core sends the damage amount to the
Code
public O0OO.o notifyDealtDamage(Vector2f paramVector2f, G paramG, com.fs.starfarer.combat.o0OO.H paramH)

This allows to perform changes in these projectiles before any calculation is done. You can only imagine how much magic this would allow us in creating defensive and offensive systems without resorting to very heavy iterations on all projectiles on the game and other highly volatile coding to get said systems done.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on October 01, 2014, 08:45:16 AM
@Debido:

(I meant to respond here a while back, but I forgot.)

While I appreciate you taking the time to put this together, it kind of looks like a method dump from a bunch of interfaces. Aside from the fact that this probably involved decompiling core code (but let's leave that aside for now), it's... well, it doesn't exactly line up with the idea here. I mean, I already know what methods are in the core classes, right? Telling me again isn't exactly providing new information :)

From my perspective, what's really helpful about this thread is that when I see something here, I know that someone specifically wants it, and gave some thought to using it in a real scenario (vs "it might come in handy at some point, so why not?"). That, in turn, makes it worth it for me to look at more closely and figure out whether it belongs in the API - it saves me some of the work in deciding what's important and what's not, and at least some of the work of deciding whether something really belongs in the API, or doesn't. A shotgun approach takes these benefits away. It's an "if everything is important, then nothing is important" sort of thing. I don't know if I'm being very clear here, hopefully it makes some sort of sense.
Title: Re: API request thread (please read OP before posting!)
Post by: silentstormpt on October 01, 2014, 09:52:57 AM
While it was directed to Debido, we're (most of the mod community) been on the same Skype channel doing/creating mods/scripts and all those suggestions are a compilation of what we felt needed and its just not possible without using black magic (or long endless scripts to get something a single return method could solve it) and looks simple enough to be un-blocked on the API. Blame the long time we had before this patch cames in  ;)
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 01, 2014, 11:38:34 AM
Thank you for replying Alex. Though I can see how one might initially see that it is grabbing everything in sight, but there are lots of interfaces in the campaign and the engine which are not there as they are not requested at this time.

As silentstormpt mentioned, this was done in collaboration with quite a number of community members, many of which have been contributing to mods and wanting these features since before I delved into modding.

You're more than welcome to join the Skype channel Alex! We would love to have you you there to discuss these requests and chat with you about the game when you have some time from your busy schedule!

+Collision API (per previous discussion)
CollisionAPI would be exceedingly useful in the case of a multi-ship, or cases where you wanted to build a ship with 'armour' parts that overlap the host ship. We discussed this in PM, I'm just documenting this for the list.

+DamagingProjectileAPI
float elapsed(): Find the most recently fired projectile from a WeaponAPI, or the oldest one fired, or possibly figure out in what sequence each were fired. Knowing the most recently fired projectile you can perform replacements based upon rules such as 1 in 4 are fragmentation rounds.
float getDamageMult(): Find the current damage multiplier

void setDamageMult(float): You could do a per-projectile damage increase or decrease. You could have a weapon that increases or decreases in damage with more bullets fired in a burst, you could nurf damage or increase damage of a projectile that is scripted to do additional onHit damage. Or you could have a value in the weapoon_data.csv that is used by the autresolve, then use this to set in combat damage with scripting.

void setHitPoints(float): Dynamically assign hitpoints to a projectile or manually apply without the need for an applyDamage. Manually perform collision damage etc.

float getMoveSpeed(): Get the speed of the projectile without referring to the CSV values. This should really have a setter, not sure if it's per instance of the projectile, if it is you can have a projectile with dynamic speed. Say a projectile that gets faster the further away it is or slower the further away it is.

void setDamageAmount(float): Similar purpose to get/setDamageMult

+MissileAPI
void setHitPoints(float): Manual collisions and/or damage modifiers, scripted AOE damage to missiles, missiles with regenerative health.

+ShipEngineControllerAPI.ShipEngineAPI

A highly requested section for customisation and dynamic engines. Want an engine that changes colour when engaging 'super' mode? Done! Want an engine that gets 'hotter' on the kelvin scale? Done. By having on the fly customisable engines you can create unique visual styles under many scripted situations.

In particular being able to set our own contrail particles, engine flames and glow sprites would make for some unique faction engines never seen before, and using scripts to make it dynamic would allow certain looks under various situations that the mod author decides upon.


+ShipSystemAPI

Another highly requested section as there are missing setters for this API, but allowing more access to the attributes and setters would be very helpful. Being able to recharge the ammunition in a scripted fashion is useful. You could have the Cool down related to the ship flux, or have the flux per use increase with each use of the system, or change the flux per second based upon some other derived formula that is related to a special shield that absorbs damage. Lots of possibilities.

+ShieldAPI
Changing the shield colour on the fly would be great, but the main and most important request here is for custom shield textures. People really want custom shield textures to differentiate their faction, or to show a system is active etc.

The other aspects such as setting the arc, I think we can already do as I already have a mod that does that, but setting the facing angle or the radius could be really helpful. Having a dynamically expanding shield that can cover a greater area could be a great area denial system and setting the facing angle would let you have a rapidly rotating omni shield.


+ShipAPI
Dynamic venting colour would be requested a bit below the ship engines, dynamic vent colouring that could be related to the vent rate or the amout of flux being vented per second, or maybe even the colour changes as it 'cools down' dynamically.

The vent texture change is fairly high on the priority list, I don't personally see the uniqueness in having a vent texture for your faction, but people really love to do these things.

Anyway there is also requests for changing the HullStyle (all the styles for the ship) on the fly. Ship systems that change the shields and engines styles on the fly would be possible. Customisation of colour and styles in the use of and unique systems are a popular request.

Smaller things like finding if the ship is holding fire, or forcing a ship to hold fire can be used in some AI coding situation, as is the 'isPhased()' method. You can find if a ship is phased already, but the code is longer than it needs to be. Shouldn't it be simpler?

Jitter copies of a ship are something a few people have been wanting to get a hold of for some ship systems, and perform special effects beyond what is provided by the PhaseTeleporter system. You could create some truly unique systems, or create a ship 'blur' effect as it is moving very quickly or through phase. Or possibly create a unique scripted system that makes your one ship appear as 3 or 4 copies, confusing the player (the AI is another issue we'd need to take care of). I think the interface would need more controls, like those listed in the Phase Teleporter system.

float timeSinceLaunch() could be used to find the most recently launched fighter and apply scripted buffs or modifiers based upon

+CombatEntityAPI
void setCollisionRadius(float) - for certain aspects of a mult-part ship collision, and dealing with AI.

+WeaponAPI
Lots of customisation in the WeaponAPI. being able to set and get the damage on the weapon allows for certain scripted circumstances, and getting around the issue of auto-resolve damage and combat onHitEffect damage. Dynamically changing or changing aspects of the Weapon Glow has also been requested by the community.


+MuzzleFlashAPI
A sub-interface of a weapon for dynamically changing aspects of a Weapon as it fires. You could have a system like the Ammo Feeder that changes the look of Ballistic Weapons when firing, or changing the colour of the particles with greater number of projectiles fired as if it is getting hotter, or some kind of charging effect.


+WeaponGlowJitterAPI
Another sub-interface for a energy weapon, allows the mod author to control the vibration/jitter as the vanilla jitter is sometimes too much or too little

Control on the glow could allow to make custom muzzle flashes (that last only a couple of frames) or weapons that heat up without jittering. Right now it necessitate lengthy animations while it could be done with one single layer.

+BattleObjectiveAPI
Want a custom Battle Objective sprite? Maybe make it a sprite of a Starbase or something altogether different, many possibilities.


+BeamAPI
At the moment Beams are statically set in the proj file, and that is it. Being able to dynamically change the colour, width and other attributes can make for some scripted beams that take it to the next level of customisation. A beam that gets 'hotter' or gets wider as it charges up? Would now be possible. Community members also desire the ability to have a custom hit glow sprite to reflect more about the special attributes or lore of the weapon.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on October 01, 2014, 11:45:02 AM
Thank you - I really appreciate the breakdown, it'll help prioritize things. (It's a reality that I won't be able to get to *everything*...)
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 01, 2014, 11:57:40 AM
Thank you Alex!
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on October 01, 2014, 11:57:54 AM
Thanks a lot for all your efforts!

 *yay, new ways to break the gameplay incoming!* ;D
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on October 01, 2014, 04:59:04 PM
Of possible interest:
http://fractalsoftworks.com/forum/index.php?topic=7885.msg141462#msg141462
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 01, 2014, 09:48:27 PM
Of possible interest:
http://fractalsoftworks.com/forum/index.php?topic=7885.msg141462#msg141462

Very much interest.
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 01, 2014, 10:04:01 PM
I'm a little confused on DamageAPI.getStats() returning a MutableShipStatsAPI. Is this a per-weapon mutable stats like requested here: http://fractalsoftworks.com/forum/index.php?topic=8239.0

Or is this MutableShipStatsAPI being returned for the ShipAPI of the host ship?
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 02, 2014, 01:34:42 AM
Ok Alex, this is a REALLY strange API request. You don't have to do it, but we were recently discussing complete asshats who pirate the game. We were wondering if there could be say a

boolean Global.isPirated()

And so modders can troll the heck out of people pirating the game, and force them to ask for you mercy, and pay you for the game. We were thinking of spawning the Alexander Mosolov fleet with a 1000 pirate ships to hunt their little fleet down and crush them.

Please?
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on October 02, 2014, 08:48:24 AM
I'm a little confused on DamageAPI.getStats() returning a MutableShipStatsAPI. Is this a per-weapon mutable stats like requested here: http://fractalsoftworks.com/forum/index.php?topic=8239.0

Or is this MutableShipStatsAPI being returned for the ShipAPI of the host ship?

It's the ship's stats. I did see that request, but I think it could be a bit heavy performance wise, never mind not simple at all since that's not how the engine is set up.


Ok Alex, this is a REALLY strange API request. You don't have to do it, but we were recently discussing complete asshats who pirate the game. We were wondering if there could be say a

boolean Global.isPirated()

And so modders can troll the heck out of people pirating the game, and force them to ask for you mercy, and pay you for the game. We were thinking of spawning the Alexander Mosolov fleet with a 1000 pirate ships to hunt their little fleet down and crush them.

Please?

Erm... this would be the fastest way to get whoever hacks the game to also fix the "isPirated" method. All in all, I'd rather not even discuss it in any detail.
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 02, 2014, 09:17:05 AM
Ah ok, fair enough Alex. I can understand why it might be a bit performance heavy to have mutablestats per weapon, I did discuss that possibility with a couple of the other guys that something like that might be the case.

As for the other request, we just wanted to support you and fight the good fight against those insidious pirates!
Title: Re: API request thread (please read OP before posting!)
Post by: ValkyriaL on October 02, 2014, 09:23:37 AM
ask for production key the first time the game starts..but that would probably be fairly easy to remove..
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 05, 2014, 08:53:46 AM
A couple of other requests for the Weapon API

void WeaponAPI.setTurnRate(float)
void WeaponAPI.setFluxToFire(float)

This will be used to give penalties or a boost to a weapon if, for instance, an Exigency weapon is mounted on a Black Rock ship.
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 25, 2014, 05:19:56 AM
List< FleetAssignmentDataAPI> CampaignFleetAPI.getFleetAssignments (plural, all of them)

also

CampaignFleetAPI.prependAssignment(...)

prepends the intended assignment so that it is executed before others.
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on October 26, 2014, 11:30:46 AM
float BeamAPI.getDamagePerSecond()
void BeamAPI.setDamagePerSecond(float)
float BeamAPI.getEMPDamagePerSecond()
void BeamAPI.setEMPDamagePerSecond(float)

use cases:
Dynamic beam weapon damage based upon other values, such as...number of X attributes on Tartiflette's next mining ship he really wants this feature on.
A work around for the autoresolve damage to scripted damage option/issues.

Also an addendum to the Damaging projectile get/set damage for the EMP which was left out
float DamagingProjectileAPI.getEmpDamage()
void DamagingProjectileAPI.setEmpDamage()

Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on October 26, 2014, 12:15:21 PM
Actually I have several beams that could use the BeamAPI additions:
- the Deconstruction beam that ignore armor and directly damage the hull
- the Focus Beam that deal additional damage if the target is near the merging point of it's three beams
- the Minigun that is in fact a beam: it deal very few damage but the impact spawn splinters that can hit the target or very close ships
- the Gamma Ray Radiation Reactor that use 6 fake weapons to enhance it's destructive power, as long as they don't get disabled.

All those weapons works very well in combat but are almost worthless in autoresolve.
Title: Re: API request thread (please read OP before posting!)
Post by: celestis on October 30, 2014, 02:47:05 AM
Is it possible to add more information about entity to HullModEffect.apply method? Currently it has stats parameter, but it returns null for getEntity() since the ship has not yet been created, so we only have ship hull size enum to apply effect.
But I suppose it is not very difficult to pass ShipVariantAPI or at least ShipHullSpecAPI parameter to this method. This will make the script much more flexible. Is it possible?
Proposed method isgnature:

void HullModEffect.applyEffectsBeforeShipCreation(ShipAPI.HullSize hullSize, MutableShipStatsAPI stats, java.lang.String id)
->
void HullModEffect.applyEffectsBeforeShipCreation(ShipAPI.HullSize hullSize, ShipVariantAPI variant, MutableShipStatsAPI stats, java.lang.String id)
Title: Re: API request thread (please read OP before posting!)
Post by: Darloth on November 01, 2014, 09:58:35 AM
Would it be possible to have the FleetEncounterContextPlugin overridable like the other Plugin types please?  

Presumably this would also require BattleAutoresolverPluginImpl and FleetInteractionDialogPluginImpl to call a factory method to get their instances of the FleetEncounterContext (or overriding plugin) rather than just newing a concrete instance.

(I'm trying to change what happens immediately after a battle, without changing any of the other stuff.)
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on November 01, 2014, 01:30:26 PM
WeaponAPI.setAutoFireAI(AutofireAIPlugin) so in combat under certain circumstances you can change the AI used.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 01, 2014, 01:59:30 PM
@celestis: I'm a bit hesitant to do that b/c it'll break backwards compatibility pretty badly. (I realize this probably sounds a bit funny given that 0.65a broke everything, but...)

Would it be possible to have the FleetEncounterContextPlugin overridable like the other Plugin types please? 

Presumably this would also require BattleAutoresolverPluginImpl and FleetInteractionDialogPluginImpl to call a factory method to get their instances of the FleetEncounterContext (or overriding plugin) rather than just newing a concrete instance.

(I'm trying to change what happens immediately after a battle, without changing any of the other stuff.)

Hmm. FleetEncounterContext isn't something the core of the game is aware of, it's *only* used from code that's already moddable. Basically, it's an implementation detail of FIDPI and BAPI. FleetEncounterContext has many methods that both FIDPI and BAPI use that are not in the plugin interface, b/c the core doesn't need to be aware of them.

(Have you looked at CampaignEnginePlugin.reportBattleOccurred()? Guessing you have and it's enough for what you want, but wanted to mention it just in case. Otherwise, you'd probably want to provide custom implementations of the fleet encounter dialog and the battle autoresolver.)
Title: Re: API request thread (please read OP before posting!)
Post by: Darloth on November 01, 2014, 02:46:17 PM
I eventually did notice that FleetEncounterContext actually had a LOT more going on than its corresponding Plugin, yes.

reportBattleOccurred (part of the CampaignEventListener system, not the CampaignPlugin? I'm not sure what CampaignEnginePlugin is, is that new?) doesn't seem to have any hooks into the respective cargo of the fleets before it gets discarded after a battle.

At the moment I can get what I want by copy-pasting the entirety of FIDPI and BAPI and changing one line in each, so I'm doing that, but it feels... well, wrong :)

(Specifically, I'm changing them to have
Code
FleetEncounterContext context = new PersistantDebrisFleetEncounterContext();
which is a subclass with slightly expanded autoLoot and afterBattleBlah calls.)

That's why I hoped they'd call out to a factory class instead, and why I wanted FleetEncounterContext to be more moddable.  I'm aware it is completely moddable right now, but because it's only used as a private instance variable in both cases, you can't change it without also changing FIDPI and BAPI, so I suppose that's my request, I'd like to be able to change it separately without all this copy-pasting.  Any ideas?

Edit: It's not that copying FIDPI and BAPI isn't working, it's just going to be bad for inter-mod compatibility unless I provide instructions on how anyone else modifying FIDPI and/or BAPI can selectively use my new FleetEncounterContext subclass, which on second thought is an amazing position to be in, and I commend you on your mod structure that my only REAL complaint is "I'm changing something really deep in the implementation code, could it please be easier for other mods to automatically pick that up". I know I've mentioned it before, but you really deserve praise for your game+engine's moddability, it is the best.

Edit2: Looting doesn't remove stuff from the cargo in question... *bleeeeeerrrrgh*
Edit3!: CargoAPI.getStacksCopy() isn't guaranteed to actually be a -separate- copy of every stack... double*blergh*
Title: Re: API request thread (please read OP before posting!)
Post by: Talkie Toaster on November 01, 2014, 06:45:13 PM
Hmm. FleetEncounterContext isn't something the core of the game is aware of, it's *only* used from code that's already moddable. Basically, it's an implementation detail of FIDPI and BAPI. FleetEncounterContext has many methods that both FIDPI and BAPI use that are not in the plugin interface, b/c the core doesn't need to be aware of them.

(Have you looked at CampaignEnginePlugin.reportBattleOccurred()? Guessing you have and it's enough for what you want, but wanted to mention it just in case. Otherwise, you'd probably want to provide custom implementations of the fleet encounter dialog and the battle autoresolver.)
It would be convenient to have. I haven't had a chance to look at the new combat dialogues but in the last version I got stumped trying to write custom encounters with a few minor alterations to them. As it stood, I ended up having to duplicate a lot of code. That's certainly a solution, but it's not a great one for compatibility and whilst it might not technically need to be core it's something that's going to be wanted for a lot of mods (and even for core potentially if/when we get stuff like dialogue-triggered missions during escort runs or whatever).
Though I may just be confused here as I gave up a few months ago.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 02, 2014, 08:28:28 PM
reportBattleOccurred (part of the CampaignEventListener system, not the CampaignPlugin?

CampaignEventListener, I misspoke.

That's why I hoped they'd call out to a factory class instead, and why I wanted FleetEncounterContext to be more moddable.  I'm aware it is completely moddable right now, but because it's only used as a private instance variable in both cases, you can't change it without also changing FIDPI and BAPI, so I suppose that's my request, I'd like to be able to change it separately without all this copy-pasting.  Any ideas?

No ideas, unfortunately - copy/pasting seems to be the only way to go here. Which is hardly ideal, of course.

Edit: It's not that copying FIDPI and BAPI isn't working, it's just going to be bad for inter-mod compatibility unless I provide instructions on how anyone else modifying FIDPI and/or BAPI can selectively use my new FleetEncounterContext subclass,
Also @Talkie Toaster:

Yeah, I get what you're saying. The thing is if I do this, it kind of feels like making FIDPI etc part of the API rather than part of the implementation. Where would this config go? Into settings.json? Into a picker method in ModPlugin? It doesn't belong in either of those places because FIDPI is just an implementation detail... plus this would involve extracting another interface out of FleetEncounterContext, which would involve rather more thought than I really want to give it - it's nice to be able to say "this is an implementation class, let's just make it work" instead of "let's make it generic and extensible". It's especially convenient for classes that have the potential to mutate a whole lot down the line.

Edit2: Looting doesn't remove stuff from the cargo in question... *bleeeeeerrrrgh*
Edit3!: CargoAPI.getStacksCopy() isn't guaranteed to actually be a -separate- copy of every stack... double*blergh*

It returns a shallow copy of the stacks ArrayList.
Title: Re: API request thread (please read OP before posting!)
Post by: Talkie Toaster on November 03, 2014, 10:48:49 AM
Edit: It's not that copying FIDPI and BAPI isn't working, it's just going to be bad for inter-mod compatibility unless I provide instructions on how anyone else modifying FIDPI and/or BAPI can selectively use my new FleetEncounterContext subclass,
Also @Talkie Toaster:

Yeah, I get what you're saying. The thing is if I do this, it kind of feels like making FIDPI etc part of the API rather than part of the implementation. Where would this config go? Into settings.json? Into a picker method in ModPlugin? It doesn't belong in either of those places because FIDPI is just an implementation detail... plus this would involve extracting another interface out of FleetEncounterContext, which would involve rather more thought than I really want to give it - it's nice to be able to say "this is an implementation class, let's just make it work" instead of "let's make it generic and extensible". It's especially convenient for classes that have the potential to mutate a whole lot down the line.
That seems fair enough; making the functions in the implementation public so we can extend it, rather than just copying it, would be nice instead?
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on November 05, 2014, 02:36:36 AM
CombatEngineAPI:

These are needed to have custom HUD elements that perfectly match vanilla. The vanilla UI fades out when you enter the map tab, and it's jarring when custom elements don't.
Title: Re: API request thread (please read OP before posting!)
Post by: Darloth on November 05, 2014, 06:31:18 AM
That seems fair enough; making the functions in the implementation public so we can extend it, rather than just copying it, would be nice instead?

Hmm, yes, this.

If you make everything in FIDPI and BAPI public, I think the problem mostly goes away - we can override only the functions we need, and even better if we only want to add stuff we can override it to be almost a tail call like:
Code: java
@override
public SomethingAPI IUsedToBePrivate(FleetContextThing thing)
{
    SomethingAPI firstReturn = super.IUsedToBePrivate(thing);
    return myNewMethod(thing, firstReturn);
}

That would be great, because then anyone who can see our source can -easily- integrate the mod just by calling that method.  Which we should also make public, of course.

Basically I think modders (and you when it comes to Impl classes) shouldn't be too worried about encapsulation given that people might very well want to mess with the internals.  Maybe just Protected would be good enough, I haven't given it a huge amount of thought, but either would be a great easing of the difficulty in changing what happens in these Impl classes at the moment!
Title: Re: API request thread (please read OP before posting!)
Post by: celestis on November 08, 2014, 06:29:07 AM
I have a suggestion to extend WeaponAPI.WeaponType enum, so that modders can restrict some slots to be fitted with only particular weapon class. Probably named CUSTOM_1, 2, etc. Currently we have hardcoded ENERGY/MISSILE/BALLISTIC/UNIVERSAL as weapon types, which may be still be not enough.
I mean, what if your ship has a special "utility" weapon slot, which should not allow conventional weapons, but it is still not a SYSTEM slot (can be fitted with several weapons of some "mod-specific" class)? It will be easy to implement if you just add a couple of additional values to enum and a bit of code to ship fit code - I suppose this is not very difficuly?
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on November 08, 2014, 06:58:27 AM
In that case better why not makes it work both ways and have "UNIVERSAL" weapons that can be mounted anywhere... Like support modules, drones launchers or external hull-mods that occupy a weapon slot instead of costing OP.
Title: Re: API request thread (please read OP before posting!)
Post by: celestis on November 08, 2014, 10:24:26 AM
Tartiflette, not exactly. It will not solve the problem that I don't want any OTHER weapons be mounted there.
Here is the example of what it is needed for:
Assume we have a support ship.
Apart from that let it be designed for 3 purposes:
- generic fire support (any common weapon) - slot 1
- aid friendly ships (for which we have for example: armor repairer or hull repairer weapons) - slot 2
- electronic warfare of some kind (for example: jammer or tracking disruptor or target painter weapons) - slot 3
So, here on the ship we have 3 groups of slots, which are not compatible with each other. Neither we can fit the common weapon to EWar slot nor EWar weapon to aid slot.
Currently such combination is not possible. But it can be made pretty easy if slots (weapon groups) 2 and 3 have different enum value (CUSTOM_1 and CUSTOM_2). This was just an example from the mod I'm developing, but I suppose other modders will benefit from such change too (allow only weapons of particular faction, for example).
Solution with enum may seem not very "neat" because we still will limit the number of such groups (not more than entries in enum), but I don't think people will need more than 10 or so...

P.S. Damn, I forgot that this thread is only about existing features. My bad. Shall I delete posts from this thread and move to separate one?
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on November 08, 2014, 11:57:36 AM
I very well understood what you wanted, but I was proposing to also allow weapon types that can be mounted in more than one type of weapon mount.
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on November 10, 2014, 04:50:01 PM
void FluxTrackerAPI.stopVenting() for times when you need to stop a multiship UNICHILD type segment stop venting when the ROOT or CHILDHOST segment is NOT venting.
Title: Re: API request thread (please read OP before posting!)
Post by: celestis on November 10, 2014, 08:10:48 PM
I've got two suggestions.
1.
Extend com.fs.starfarer.api.combat.ShipEngineControllerAPI.ShipEngineAPI with the method
void enable() which will (obviously) enable the disabled engine.
OR
void setDisabledTime(float time) to modify the time directly with possibility to set it to zero

2.
extend BeamEffectPlugin interface to have methods related to hit start and hit end:
void hitStart(BeamAPI beam)
void hitEnd(BeamAPI beam)
which should be executed once when the beam is hitting a new target and once it is no longer hitting previous target, respectively.
The reason that it would help a lot in making some weapons affect target stats: first method can apply stats and the second - unapply. Currently this needs some cludges to be implemented, since the advance() method is the only thing the interface has.
Title: Re: API request thread (please read OP before posting!)
Post by: silentstormpt on November 19, 2014, 03:05:30 AM
JSONArray   SettingsAPI.loadJSON(java.lang.String filename)

Right now we can only get a JSONObject formatted json but it should be possible to get JSONArray formatted json. Just need that constructor added in there.
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on November 29, 2014, 04:03:18 PM
WeaponAPI
boolean isInterruptibleBurst() <-- certain conditional statements that cannot catch weapons such as thumper/storm needler.

Also as an aside IF it is at all possible
void interruptWeapon() <- to interrupt a weapon mid-fire in much the same way that flux venting will interrupt a weapon firing. I'm not sure how you interrupt weapons when venting, but THAT method that you use there.

Title: Re: API request thread (please read OP before posting!)
Post by: celestis on December 07, 2014, 08:00:08 AM
Please, could you add the method
setLocation(Vector2f v)
to
com.fs.starfarer.api.combat.ShipEngineControllerAPI.ShipEngineAPI
and
com.fs.starfarer.api.combat.WeaponAPI?

This may seem not to make sense, but it will help in my modding task a lot.
Title: Re: API request thread (please read OP before posting!)
Post by: celestis on December 08, 2014, 09:14:35 PM
And another suggestion:

boolean SettingsAPI.fileExists(String fileName)

which will, obviously, check is the specified file exists on the disk. For security reasons it may be good to restrict this to the child paths of starsector root folder.
Title: Re: API request thread (please read OP before posting!)
Post by: Dark.Revenant on February 01, 2015, 03:27:05 PM
float HullSpecAPI.getShieldArc()
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on September 26, 2015, 10:09:17 AM
SectorAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on October 28, 2015, 07:25:39 PM
SettingsAPI:

Currently we can retrieve the game version through Display.getTitle(), but a more official, permanent solution would be nice.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on October 28, 2015, 10:32:01 PM
Did a pass over the OP and added a bunch of stuff; thank you for keeping it so nicely organized! Makes my life *so* much easier. Question:

EveryFrameCombatPlugin.end()
ShipAPI.addJitterCopy(Vector2f location, float duration)

What are these meant to do?
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on October 28, 2015, 10:41:39 PM
Did a pass over the OP and added a bunch of stuff; thank you for keeping it so nicely organized! Makes my life *so* much easier. Question:

EveryFrameCombatPlugin.end()
ShipAPI.addJitterCopy(Vector2f location, float duration)
What are these meant to do?

end() would be called at the end of a battle so we could clean things up properly. It's not as necessary these days now that getCustomData() allows us to avoid using static variables to share data (and thus avoid most memory leaks), but it might still be useful in a few cases.

The jitter copy was Debido's request (http://fractalsoftworks.com/forum/index.php?topic=4900.msg141097#msg141097). I believe he meant a method to mimic the effect created when you're in the middle of a phase teleport?

And thanks again for taking the time to add our requests in. :)
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on October 28, 2015, 10:47:55 PM
Ah, thanks - makes sense now, on both counts.

Re: end(), I think I won't add it, then - it's the sort of thing where I'd have to very carefully make sure that it covers all the cases when a plugin might get removed. If that wasn't working 100%, that'd be worse than not adding the method in the first place, given that there's a workaround that avoids memory leaks reliably.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on October 30, 2015, 01:54:06 AM
EveryFrameCombatPlugin:
void combatEntityPreDamaged(CombatEntityAPI entity, DamageAPI damage, WeaponAPI weapon, DamagingProjectileAPI proj)
void combatEntityPreDamaged(CombatEntityAPI entity, DamageAPI damage, WeaponAPI weapon, BeamAPI beam)

void combatEntityDamaged(CombatEntityAPI entity, DamageAPI damage, WeaponAPI weapon, DamagingProjectileAPI proj)
void combatEntityDamaged(CombatEntityAPI entity, DamageAPI damage, WeaponAPI weapon, BeamAPI beam)

combatEntityPreDamaged should allow changing the DamageAPI argument (or perhaps it should be a return value) to e.g. change the amount of damage it does.

Use case: anytime where you would otherwise have to do an onHitEffect/beamEffect plugin for a whole lot of weapons. In particular this would eliminate the need for hacks like Templars' "compare current hull/armor state to the one in the immediately prior frame and extrapolate for real damage" thing.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on November 04, 2015, 04:27:50 AM
FactionAPI.getRandomShipName(boolean addPrefix)

Would be useful to easily make sure ships have the "right" names in missions.
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on November 06, 2015, 07:13:30 PM
WeaponSpecAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on November 07, 2015, 03:05:04 PM
SectorEntityToken:
Title: Re: API request thread (please read OP before posting!)
Post by: Debido on November 07, 2015, 11:41:21 PM
I would still like to be able to silently spawn ships.

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

You know, because twigs? Also to silently spawn ships as orbital or planets side weapons firing beams.

Also still waiting on Boolean Global.AlexIsAwesome() which always returns true.
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on November 14, 2015, 08:52:16 PM
SectorAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on December 02, 2015, 05:24:20 PM
ShipVariantAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard 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.
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette 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.
Title: Re: API request thread (please read OP before posting!)
Post by: Shedovv 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.
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on December 24, 2015, 01:05:40 AM
Campaign nebulae are already retrievable, I just haven't released an update for the radar yet (https://i.imgur.com/hdmLtUB.png).

I'll second the request for some way to retrieve nebulae in combat, though.
Title: Re: API request thread (please read OP before posting!)
Post by: Ranakastrasz on December 31, 2015, 02:38:42 PM
I would like a method to get FleetMemberAPI from ShipAPI.
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard 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;
    }
Title: Re: API request thread (please read OP before posting!)
Post by: Zaphide 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:
Title: Re: API request thread (please read OP before posting!)
Post by: Snrasha 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.

Title: Re: API request thread (please read OP before posting!)
Post by: joe130794 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
Title: Re: API request thread (please read OP before posting!)
Post by: MesoTroniK 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.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex 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();
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on February 24, 2016, 11:37:42 PM

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

THANKYOU!!!!!!!!
Title: Re: API request thread (please read OP before posting!)
Post by: Debido 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.
Title: Re: API request thread (please read OP before posting!)
Post by: Snrasha on February 25, 2016, 12:30:27 AM
WeaponAPI
   void setMaxAmmo(int maxAmmo);

Thank you.
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard 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"?
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on February 25, 2016, 06:04:59 PM
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"?

It's converted to tiles under the hood, yeah. The location + radius methods do some randomization of the brightness (perlin noise, iirc? probably overkill if it is) etc when generating the tiles.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on February 25, 2016, 06:08:05 PM
Added:
void setHasNebula(int cellX, int cellY, float brightness);
Title: Re: API request thread (please read OP before posting!)
Post by: Deathfly on February 26, 2016, 03:10:37 AM
Could we have this methods to modify the center of shield in combat?

com.fs.starfarer.api.ShieldAPI

    void setCenterX(float X);

    void setCenterY(float Y);
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on February 26, 2016, 03:30:11 AM
ShieldAPI.setCollisionClass(CollisionClass collisionClass)
ShieldAPI.getCollisionClass()

(as in yeah, it could be handy if a shield could have a different collision class from the ship having it)
Title: Re: API request thread (please read OP before posting!)
Post by: Snrasha on February 26, 2016, 03:39:34 AM
We have multiple method in combat for nebula, we can have for campaign? Thank

com.fs.starfarer.api.fleet.FleetMemberAPI

         boolean isInsideNebula();
         boolean isAffectedByNebula();
         void  setAffectedByNebula(boolean affectedByNebula);
         void setInsideNebula(boolean isInsideNebula);


This is maybe not correctly method because we have, except if i have wrong, two levels of nebula, normal and hard nebula where hard , you lose very more burnlevel. So maybe:

        boolean isAffectedByNebula(); =>  int isAffectedByNebula(); who give 0,1 or 2. (0 , you are not affected, 1, normal effect and 2, this is hard effect)
        void  setAffectedByNebula(boolean affectedByNebula); => void  setAffectedByNebula(int affectedByNebula);   (Same thing for int value)

This method can be usefull for qew too rare thing, i think, so i can understand why you refuse. (After, maybe for a better IA, for later... actually who can go inside without problems because he have not need fuel or supplies[Just for very very very big fleet, because pirates fleets, this is a protected area for them])

Title: Re: API request thread (please read OP before posting!)
Post by: Deathfly on March 12, 2016, 12:44:47 AM
In some cases we realy needs to make armor regen.

ShipAPI.syncWithArmorGridState();
ShipAPI.syncWeaponDecalsWithArmorDamage();
Title: Re: API request thread (please read OP before posting!)
Post by: hqz on March 15, 2016, 07:34:17 AM
Could ShipAPI extend AssignmentTargetAPI? I might be doing something wrong but it seems like it would be convenient to use ships as assignment targets directly. Especially since the ShipAPI already has all the required method AFAICT (through the CombatEntityAPI interface).

http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/ShipAPI.html (http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/ShipAPI.html)
http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/AssignmentTargetAPI.html (http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/AssignmentTargetAPI.html)
Title: Re: API request thread (please read OP before posting!)
Post by: Zaphide on March 15, 2016, 08:33:16 PM
Could ShipAPI extend AssignmentTargetAPI? I might be doing something wrong but it seems like it would be convenient to use ships as assignment targets directly. Especially since the ShipAPI already has all the required method AFAICT (through the CombatEntityAPI interface).

http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/ShipAPI.html (http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/ShipAPI.html)
http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/AssignmentTargetAPI.html (http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/AssignmentTargetAPI.html)

You can do this with a DeployedFleetMemberAPI object if you explicit cast it, but I can't remember if it works with ShipAPI or FleetMemberAPI:

Code
// Get combat fleet manager for the deployed ship's fleet side
CombatFleetManagerAPI combatFleetManagerAPI = Global.getCombatEngine().getFleetManager(shipAPI.getOwner());

// Create an escort assignment on the deployed ship
CombatFleetManagerAPI.AssignmentInfo assignmentInfo = combatFleetManagerAPI.getTaskManager(false).createAssignment(CombatAssignmentType.LIGHT_ESCORT, (AssignmentTargetAPI)this.getDeployedFleetMemberAPI(shipAPI), false);

// Give the escort assigned to another ship
combatFleetManagerAPI.getTaskManager(false).giveAssignment(this.getDeployedFleetMemberAPI(otherShipAPI), assignmentInfo, false);

Supporting code (I think a duplicate of this might exist in LazyLib):
Code
private DeployedFleetMemberAPI getDeployedFleetMemberAPI(ShipAPI shipAPI) {

        CombatFleetManagerAPI fm = Global.getCombatEngine().getFleetManager(shipAPI.getOriginalOwner());
        return fm.getDeployedFleetMember(shipAPI);
    }
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on March 20, 2016, 10:19:00 AM
I'd like:

DestroyEntity(CombatEntityAPI entity)

Where:

1.  Whatever it has its hitpoints set to zero, does whatever death animations it's supposed to, etc.
2.  If a ShipAPI, it's destroyed immediately and is removed, not converted into a Hulk (even this frame).
3.  Its "I'm dead" flag (or equivalent) is set.

This would replace some workaround methods I've had to use to get the same things done, like moving ships I need destroyed immediately thousands of SUs off the battlefield, etc.

Title: Re: API request thread (please read OP before posting!)
Post by: isaacssv552 on April 03, 2016, 12:54:55 PM
I'd like to be able to modify stats access through WeaponAPI.getStat. For example, (with Weapon as an instance of WeaponAPI.) weapon.getRange.modifyPercent(id, 10f); doesn't work.
Title: Re: API request thread (please read OP before posting!)
Post by: Morrokain on September 10, 2016, 01:45:14 PM
Briefly checked and didn't see this and think it could be useful:

method: FleetMemberAPI.getPlayerHullAccess(CAPITAL, false);

Sorry if any syntax errors I'm still learning basic programming, but the idea here is a method to access what hull types the player has access to and returns a boolean shutting them on/off from purchasing or acquiring that ship type.

I'd like it to be accessible to skills so you can put sill points to unlock access to hull classes. It provides another way to limit player ship progression with a variable other than credits and reputation (the latter is a lighter limit anyway since right now you can theoretically board enemy ships).

Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on November 18, 2016, 11:58:41 PM
List<Float> WeaponAPI.getHardpointAngleOffsets()
List<Float[]> WeaponAPI.getHardpointOffsets()
and corresponding methods for turrets.

enum WeaponAPI.getBarrelMode()
Title: Re: API request thread (please read OP before posting!)
Post by: Nick XR on February 01, 2017, 01:07:49 PM
ShipAPI.getShipAI() returns a Ship.ShipAIWrapper object which isn't available in the API so there's nothing that can really be done with the wrapper (like getting at a custom AI inside the wrapper)

Perhaps either make the ShipAIWrapper class public in the API or have the ShipsAPI.getShipAI return the actual AI
Title: Re: API request thread (please read OP before posting!)
Post by: Wyvern on March 11, 2017, 09:48:14 AM
It's already in the initial post, but I'd like to second the requests for setLocation() methods on ShipEngineAPI and WeaponAPI; I'm looking to do some semi-fancy things with moving parts, and it'd be much lighter-weight to use decorative weapons than decorative station-style modules.  (...Though now that I think about it, I'm assuming I can make those move relative to the base hull, aren't I?)
Title: Re: API request thread (please read OP before posting!)
Post by: Morrokain on March 31, 2017, 01:07:10 PM
Honestly surprised its not in there considering there is getAmmoBonus(), but after a double check I could use:

Code
com.fs.starfarer.api.combat.MutableShipStatsAPI.getMissileAmmoRegenBonus();

and

Code
com.fs.starfarer.api.combat.MutableShipStatsAPI.getEnergyAmmoRegenBonus();

Need these for a built-in hullmod for my fighters to lessen the strike capabilities of their weapons.
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on April 05, 2017, 09:36:59 PM
Just an off-hand suggestion/query regarding the fleet creation API for single missions. Specifically, I discovered today that the only options within
   
Code
api.addToFleet(FleetSide.[FLEET SIDE], ......)

are "PLAYER" and "ENEMY". Would it be possible to also have "ALLY" be an option?

My thinking behind this would be to match the circumstance in the campaign where you join an existing battle between two fleets, or a friendly fleet supports your forces when you engage in combat. Under these circumstances you still have control over your ships, but the "ally", while fighting on your side, will give their own orders independent to you.

I reckon it would be nice to have "ALLY" be an option for single missions with similar effects, so you can create a mission that matches a storyline where you are assisting/being assisted by another friendly fleet with its own commander. Off the top of my head I can't think of any problems with this (although you could possibly abuse it by creating a mission where all the friendly ships are "allies" and the player has no control of anything).

Thoughts?
Title: Re: API request thread (please read OP before posting!)
Post by: Morrokain on April 07, 2017, 12:29:19 PM
Just an off-hand suggestion/query regarding the fleet creation API for single missions. Specifically, I discovered today that the only options within
   
Code
api.addToFleet(FleetSide.[FLEET SIDE], ......)

are "PLAYER" and "ENEMY". Would it be possible to also have "ALLY" be an option?

My thinking behind this would be to match the circumstance in the campaign where you join an existing battle between two fleets, or a friendly fleet supports your forces when you engage in combat. Under these circumstances you still have control over your ships, but the "ally", while fighting on your side, will give their own orders independent to you.

I reckon it would be nice to have "ALLY" be an option for single missions with similar effects, so you can create a mission that matches a storyline where you are assisting/being assisted by another friendly fleet with its own commander. Off the top of my head I can't think of any problems with this (although you could possibly abuse it by creating a mission where all the friendly ships are "allies" and the player has no control of anything).

Thoughts?

I'm of two minds on this. On the one hand I could see it as an "easy" way for modders to get some story/mission content into a mod considering how complex putting stuff into the campaign is getting.

On the other hand, I have felt for a while now that missions are a deprecated feature entirely and could possibly do with a removal.  :P  They were originally designed to give players a way to sink their teeth into combat while the game was still fairly early in development. To provide scenarios that would happen in the context of the real game, the campaign.

They were revised a while back to include more depth of story and characters, but even there I think that it was more of a band-aide to make an old feature more attractive and to give us a bit more backstory to the sector at a large. As much as I love stuff like this, (I requested a blog post on the lore of a faction after all XD ) I would rather see these types of missions actually dynamically take place in the campaign with rewards and rippling impacts to the sector's stability/politics.

A more continual story arc, so to speak, even if more focused on the players exploits with only bits and pieces of lore/story/background thrown in from time to time.

This alone wouldn't be enough to warrant a removal, but they also do (or.. at least used to haven't checked in a bit) weird things like give you access to all hullmods (even built ins) and weapons in the refit screen. Something I personally don't want in my mod for REDACTED reasons.  :)
Title: Re: API request thread (please read OP before posting!)
Post by: Toxcity on April 07, 2017, 01:01:33 PM
I do agree that letting you create allies for a mission could be nice to create a certain feel.

As for missions themselves, I think they are a worthy addition. The backstory/description of missions is only one aspect of what makes missions a good feature.

Putting the player in a scenario they would not enter in the campaign (the mission Predator or Prey? for example) is a great way of learning how to pilot a ship well. Not having to worry about skills or losing a ship when doing so is also nice.

They're also a great way to let the player test out a ship (Sinking the Bismar). As for modding, missions are also a great place for a modder to let the player try out their ships without needing campaign integration. This is especially important considering that campaign integration gets more complicated with each version.
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on April 07, 2017, 02:51:55 PM

On the other hand, I have felt for a while now that missions are a deprecated feature entirely and could possibly do with a removal.  :P  They were originally designed to give players a way to sink their teeth into combat while the game was still fairly early in development. To provide scenarios that would happen in the context of the real game, the campaign.


Ah, see I adore missions. I think they still do an excellent job at easing a player into the game, and they also introduce you to key points of the lore as well, which I love. And honestly, the way each mission's independent story is written is just beautiful to me. :) Something I try very hard to match when modding, but highly doubt I manage it, even as an amateur writer.



As for missions themselves, I think they are a worthy addition. The backstory/description of missions is only one aspect of what makes missions a good feature.

Putting the player in a scenario they would not enter in the campaign (the mission Predator or Prey? for example) is a great way of learning how to pilot a ship well. Not having to worry about skills or losing a ship when doing so is also nice.

They're also a great way to let the player test out a ship (Sinking the Bismar). As for modding, missions are also a great place for a modder to let the player try out their ships without needing campaign integration. This is especially important considering that campaign integration gets more complicated with each version.

Yeah, that's about my opinion of missions, although the specifics might be a little different. Nontheless, Sinking The Bismar might be my favourite mission just because of the context and what actually goes on in the battle. I mean, you have two extremely high-tech frigates, two high-tech interceptor wings and a carrier, against a single, outdated, armour-tank, guns-a-blazing battleship. Tons of chaos, tons of fun, every time I play that missions.  ;D
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on April 08, 2017, 02:21:15 AM
Would it be possible to also have "ALLY" be an option?
Use public void setAlly(boolean isAlly)

On the other hand, I have felt for a while now that missions are a deprecated feature entirely and could possibly do with a removal.
Somehow I get the feeling that you never watched the Fleet Building Tournament, or tried Starsector Arcade, or the Stampede Challenge, or the Customizable Battle mission...
Title: Re: API request thread (please read OP before posting!)
Post by: MesoTroniK on April 08, 2017, 02:24:40 AM
In addition, just working on mod content would be infinitely more time consuming without missions...
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on April 08, 2017, 02:30:13 AM
In addition, just working on mod content would be infinitely more time consuming without missions...

Damn right.  ;D
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on April 08, 2017, 02:30:59 AM
Would it be possible to also have "ALLY" be an option?
Use public void setAlly(boolean isAlly)

... Umm. Where? XD In the mission definition?
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on May 08, 2017, 09:36:17 PM
I'd like a ShieldType OTHER, that can be set via ShipAPI.setShield()

This ShieldType would be treated like the SS AI and player controls like any other Shield, in terms of control states (isOn() would return true if turned on) but would otherwise behave as ShieldType NONE, other than coded behavior provided by the modder.

This would fix a bunch of issues relating to building things that use the Shield control state to do <stuff>, freeing modders from having to use Systems to do alternative Shield behaviors or other complicated workarounds.

Alternatively, simply let us use ShipAPI.setShield(ShieldType.FRONT, 0f, 0f, 0f) where that doesn't come with a minimum Arc; it would effectively like NONE but the AI would think it had a 360 shield.

I'm saying all of this because I got true skin-shield behaviors working in the engine, even better than what I did with the Acanthus back in the day, except for the control issues; essentially, if I try ShipAPI.setShield(ShieldType.FRONT, 0f, 0f, 0f), there's some tiny wedge of Shield in front of the ship and the rest of the ship doesn't register hits properly, to boot (and attempting to get around this by moving the Shield's center far away or setting the shield's Radius to a small number resulted in a ship that didn't register collisions, which I feel is a straight-up bug). 

And of course the SS AI doesn't really respond well to this situation; I want it to think it has a 360 shield, ideally.
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on May 28, 2017, 07:56:57 AM
AOE weapons that generate a hit do so through some black-box code; I'm guessing they simply:

1.  Fulfill detonation requirements.
2.  See if a ray of distance <radius> from them to (potential target) intercepts the collision circle.
3.  Checks if the ray intersects the hull's collision box if 2 is true (since that's way more expensive).
4.  Then does damage at that location, via CombatEngineAPI.applyDamage() (or maybe even more-ancient code; I know AOE got added super-early).

Unfortunately, this means that nowhere is that hit registered in a way that modders can access for <purposes>; to get access, we'd have to check a lot of things about a Projectile right now, which would be very expensive.  

When something uses applyDamage(), can we get a list of  "hitEvents" in EveryFrameCombatPlugin, perhaps? 

This would deal with AOE weapons, modded weapons that are dealing damage by <insert weird thing> etc.; if applyDamage() had a boolean to handle whether a hit effects Armor, it would cover all of the major cases, too. 

I'm not sure what the performance hit would be, but I doubt it would be significant.  It would also mean that my weird, weird, workaround for Missiles wouldn't be necessary, because we'd see a hitEvent, etc.
Title: Re: API request thread (please read OP before posting!)
Post by: isaacssv552 on June 04, 2017, 07:58:37 PM
Request:
com.fs.starfarer.api.loading.WeaponSpecAPI:
Code
String getSpriteName()
Reason:
The WeaponAPI's getSprite method cannot be accessed from a WeaponSpecAPI. This would allow the rendering of weapon sprites outside of combat.
Title: Re: API request thread (please read OP before posting!)
Post by: Sutopia on June 17, 2017, 07:50:43 PM
Is it possible to change the hullmod API ?
Code
public boolean isApplicableToShip(ShipAPI ship)
I dislike how mods have to just remove the vanilla hullmods for conflicting rather than not showing conflicting vanilla ones in first place.
Maybe add a conflict group tag to hullmod themselves?
when existed any of hullmod in a group, other hullmods in same group return false.
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on July 17, 2017, 10:05:44 AM
I'd like a method in ShipAPI where last frame's damage events can be seen (ideally, where, what WeaponAPI, how much).  Both modded methods through causing damage and AOE weapons' AOE damage effect aren't detectable readily otherwise.  This makes implementing a bunch of things harder than I'd like.

It'd be nice to have a generic way for Weird Mod Gun Damage to be registered, too, but that can probably be best handled through a data structure in LazyLib or something.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on July 20, 2017, 05:53:04 AM
boolean CombatEngineAPI.isSideDefeated(FleetSide side)
Returns true if that side has lost all its ships or is in full retreat. When called with FleetSide.ENEMY, should return true if and only if the player can now use the End Battle option in the escape menu (assuming no devmode).

Currently I'm checking CombatTaskManagerAPI.isInFullRetreat() && !CombatTaskManagerAPI.isPreventFullRetreat() to detect victory, but it seems to sometimes trigger prematurely for the enemy side.
Title: Re: API request thread (please read OP before posting!)
Post by: isaacssv552 on July 23, 2017, 07:19:36 PM
Is it possible to change the hullmod API ?
Code
public boolean isApplicableToShip(ShipAPI ship)
I dislike how mods have to just remove the vanilla hullmods for conflicting rather than not showing conflicting vanilla ones in first place.
Maybe add a conflict group tag to hullmod themselves?
when existed any of hullmod in a group, other hullmods in same group return false.
I'd like for ships to have an isHullmodApplicable method which calls a dynamic array of methods passed via e.g. getHullmodApplicable().add((HullModAPI hullmod) -> hullmod.getId() != "flux_shunt").
Title: Re: API request thread (please read OP before posting!)
Post by: pegwymonie on August 23, 2017, 06:17:19 PM
I would like to be able to write an event that can react to reputation change, but only for specific reasons.

Currently the api is:

Code
public void reportPlayerReputationChange(String faction, float delta) 

I would like to see something like this:

Code
public void reportPlayerReputationChange(String faction, RepActions action, float delta) 
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on August 25, 2017, 09:04:44 AM
WeaponAPI --> getProjectileSpecAPI(). Returns the MissileAPI / DamagingProjectileAPI the weapon fires, or null if it's a Beam.  

Also...

MissileAPI getEngineSpecs() should return whether a MissileAPI is guided, and the engine's thrust / turn specs.  Right now it's not easy to determine whether a Missile is guided without doing JSON correlations.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on August 25, 2017, 09:32:21 AM
Right now it's not easy to determine whether a Missile is guided without doing JSON correlations.

(You can do: missile.getMissileAI() instanceof GuidedMissileAI)
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on September 16, 2017, 11:11:30 PM
Requesting change to existing API function: Make FactionAPI.setRelationship() with self a no-op.
I haven't encountered a case where this does anything other than introduce weird bugs when a faction is accidentally made hostile to itself.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on November 02, 2017, 09:38:49 PM
void FleetMemberStatusAPI.getHullFraction(int index)

Currently you can set the hull fraction of a module, but not get it.
Title: Re: API request thread (please read OP before posting!)
Post by: Techhead on December 28, 2017, 04:07:38 PM
A request for a change to hullmods' getUnapplicableReason(): Split off hullmod incompatibility so that hullmods can be made mutually exclusive without needing to modify both files.
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on December 28, 2017, 06:34:20 PM
Just been working on a "recon" type hullmod to make scout/espionage ships, and realised that what would be ideal is a ship stat that affected the time it takes to capture an objective.

Something that I'd hope would be easy enough to stick in the MutableShipStatsAPI file:
Code
getObjectiveCaptureTimeMod()
or similar perhaps?

I reckon it would be perfect for a recon ship that can dash out and capture objectives at an increased rate.
Title: Re: API request thread (please read OP before posting!)
Post by: Ranakastrasz on January 05, 2018, 05:38:49 PM
Its been a while, so I am not sure exactly which part it is, but..

Take a beam weapon prototype and determine how many beams it generates when it fires. Currently, if you want to calculate the damage a beam weapon does, there is no way to get it accurately for, say, the guardian PD turret.
Title: Re: API request thread (please read OP before posting!)
Post by: NightKev on January 09, 2018, 04:14:52 AM
A method to do stuff when a hullmod is removed, something like `BaseHullMod.onRemoval(ShipAPI ship)` perhaps?

Edit: More reasonable method name suggestion.
Title: Re: API request thread (please read OP before posting!)
Post by: FreedomFighter on January 19, 2018, 11:37:59 PM
Alex hinted me about getting 3 skill choices per officer level but i have no idea how should i write up or compile it into working API.

Code
"officerLevelUp":"com.fs.starfarer.api.impl.campaign.OfficerLevelupPluginImpl"

Been told that this is the one that controlling it but he also hasn't test that if it will work.

http://fractalsoftworks.com/forum/index.php?topic=13222.0

Thread in question.
Title: Re: API request thread (please read OP before posting!)
Post by: TaLaR on April 07, 2018, 10:53:55 PM
com.fs.starfarer.api.combat.ShipSystemAPI

Made a mod to visualize ship system ranges only to find out that I have no reasonable way to get range values.
Title: Re: API request thread (please read OP before posting!)
Post by: Snrasha on April 08, 2018, 09:33:26 PM
com.fs.starfarer.api.combat.ShipSystemAPI
  • float getRange()

Made a mod to visualize ship system ranges only to find out that I have no reasonable way to get range values.

They have so many without a range, so, this is not very usefull, no? :x
Title: Re: API request thread (please read OP before posting!)
Post by: TaLaR on April 08, 2018, 10:06:15 PM
They have so many without a range, so, this is not very usefull, no? :x

Some sensible default (0) or extra method boolean hasRange().
Otherwise systemAPI is just not a useful source for info on systems, and makes me look for less desirable workarounds.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 09, 2018, 03:20:22 PM
com.fs.starfarer.api.combat.ShipSystemAPI
  • float getRange()

(Added a getRange() method to ShipSystemSpecAPI.)
Title: Re: API request thread (please read OP before posting!)
Post by: TaLaR on April 10, 2018, 05:52:57 AM
(Added a getRange() method to ShipSystemSpecAPI.)

Thanks :)
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on April 11, 2018, 11:29:34 AM
MissileAPI hasMIRVed;  boolean; returns whether a MissileAPI has converted itself when reaching the detection distance.

Vanilla MIRVs have given me huge trouble on multiple occasions, because there appears to be nothing at all that can be used in mod code to detect when this has happened.  The MIRVs aren't being destroyed, aren't giving false on isArmed() after conversion, etc., etc., apparently.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on August 26, 2018, 12:42:59 AM
SubmarketAPI:

float getPrice(String commodityId, TransferAction action, float basePrice)
float getPrice(CargoStackAPI stack, TransferAction action, float basePrice)
float getPrice(FleetMemberAPI member, TransferAction action, float basePrice)

Base price is what the commodity or ship would normally cost without tariffs. The method looks at the base price and does whatever calculations it needs (or ignores it entirely, like a literal dollar store or such) and returns the desired final pre-tariff price.

The idea is to allow a submarket to set arbitrary prices for specific things (unlike tariffs, which affect everything). This desired for a feature in a particular mod.
Title: Re: API request thread (please read OP before posting!)
Post by: Nicke535 on August 28, 2018, 09:01:14 AM
BaseHullMod.isApplicableToShip(ShipAPI ship, MarketAPI market)
BaseHullMod.getUnapplicableReason(ShipAPI ship, MarketAPI market)

So alternate versions of the existing functions, this is for getting which MarketAPI a hullmod is being mounted at, if any (inspired by this twitter post (https://twitter.com/amosolov/status/1034266263697219585), since it confirms that certain hullmods needing a drydock is going to be a vanilla feature). Alternatively, these functions could give the SectorEntityToken where the hullmod is installed, if that is easier (since that would allow getting the market via SectorEntityToken.getMarket, and would not need to return Null for in-flight hullmod mounting)


This would allow some special structures/markets which allows special hullmods to be mounted.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on August 28, 2018, 10:31:59 AM
Yep, how it works already, with the addition of CoreUITradeMode as a parameter :)


Side note: I'm planning to look through this thread in the near future, but if there's something of particular import, I'd appreciate someone letting me know so I can be sure to take a close look at it.
Title: Re: API request thread (please read OP before posting!)
Post by: Nicke535 on August 29, 2018, 03:54:30 AM
Yep, how it works already, with the addition of CoreUITradeMode as a parameter :)
Nice, good to hear.
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on September 05, 2018, 03:44:54 AM
Could we have something along the lines of
engine.getWidth()

I'm making custom vernier engines and it would be nice to have a single script that automatically scale the deco weapon to the size of the hidden engine underneath (so that they can still be flamed out and hit by EMP/salamanders).
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on November 27, 2018, 10:34:39 PM
SettingsAPI:

Global.getSettings().getAllSpecs(MarketConditionSpecAPI.class) returns an empty Collection. It appears that the only way to retrieve the list of condition IDs right now is to load and parse market_conditions.csv ourselves.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on November 28, 2018, 04:39:26 AM
rulescmd.MarketCMD:

EDIT: already done for 0.9.1
Title: Re: API request thread (please read OP before posting!)
Post by: LazyWizard on December 02, 2018, 10:20:35 PM
SettingsAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: Obsidian Actual on December 07, 2018, 10:22:27 PM
WeaponAPI:

void powerOff()


void powerOn()

Title: Re: API request thread (please read OP before posting!)
Post by: Obsidian Actual on December 08, 2018, 02:18:36 PM
Actually, seeing as there are already a few void setXXXX() methods in WeaponAPI, would something along the lines of void setFluxCostToFire() be possible?

Would give us more individual control over weapons than the "change this for all energy/ballistic/missile weapons" methods from MutableShipStatsAPI.
Title: Re: API request thread (please read OP before posting!)
Post by: Clockwork Owl on December 13, 2018, 07:05:37 AM
Alex: can you move AI Core and Survey Data items from commodities to special items? for...stuff. :D
Title: Re: API request thread (please read OP before posting!)
Post by: Gwyvern on December 16, 2018, 04:06:20 AM
Let me preface this with: This is not an API request exactly but: ALEX SPECIFICALLY REQUESTED THAT I POST THIS HERE for his own benefit.

Two requests for features to be added to weapons.CSV

1: A tag that prevents weapons from appearing in loot drops like research stations, weapons caches and tech mining. Currently such lootboxes draw from ALL available weapons, and the only way to stop a weapon from appearing in them is to give a weapon a SYSTEM tag, which prevents it from being modular mounted altogether.

2: A hint for weapons that tells the AI to ignore a weapon's ammo completely. Weapons that try to use fast-reload limited-ammo setups are hampered by the fact that even with a DO_NOT_CONSERVE hint, the AI is still somewhat stingy with the weapon's ammo, cutting the weapon's effective DPS. While there are currently other ways to set a weapon up to achieve a similar result, there is no means to achieve the exact result specified here.
Title: Re: API request thread (please read OP before posting!)
Post by: Vayra on December 20, 2018, 01:05:55 AM
TooltipMakerAPI doesn't support the same highlight-text methods (specifically highlightInLastPara() to hightlight different strings in one para in different colors) as TextPanelAPI, and it tripped me up today. Would be cool to get that in, and maybe the other related ones too.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on December 20, 2018, 03:24:14 AM
TooltipMakerAPI doesn't support the same highlight-text methods (specifically highlightInLastPara() to hightlight different strings in one para in different colors) as TextPanelAPI, and it tripped me up today. Would be cool to get that in, and maybe the other related ones too.
TooltipMakerAPI.addPara returns a LabelAPI, you can add the highlights to that.

(yeah this took me a while to notice too)
Title: Re: API request thread (please read OP before posting!)
Post by: Vayra on December 20, 2018, 09:23:01 AM
TooltipMakerAPI doesn't support the same highlight-text methods (specifically highlightInLastPara() to hightlight different strings in one para in different colors) as TextPanelAPI, and it tripped me up today. Would be cool to get that in, and maybe the other related ones too.
TooltipMakerAPI.addPara returns a LabelAPI, you can add the highlights to that.

(yeah this took me a while to notice too)

Could have sworn I tried that and it overwrote the previous highlights... I'll give it another shot, thank you.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on January 04, 2019, 07:43:15 AM
OptionPanelAPI.addOption(String text, Object data, int index);
(and overloads thereof)

Currently there's no good way to add a dialog panel option anywhere but the very end.
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on January 20, 2019, 07:15:22 PM
(Not really sure where to put this, but it's part query, part complaint and part suggestion, so I guess here will do.)

It seems that a shieldless ship returns "null" under ship.getShield(). How come "NONE" is a valid type in the ShieldAPI.ShieldType enum list then? ??? Seemed logical to me that to check if a ship was unshielded, I should just use:

Code
if (ship.getShield().getType() == ShieldType.NONE) {...}

As you may guess, that crashed the game with a NPE upon inserting a shieldless ship into the equation. :-\ What I needed to do was use:

Code
if (ship.getShield()== null) {...}

... which works perfectly fine.

I'm not really sure what to suggest in regard to this, since I don't know what the reasons are for it being the way it is right now, but it was definitely confusing to me, especially since I'm so used to just writing "NONE" under shield type in ship_data.csv for shieldless ships. Just thought it should be noted down that it's a potential pitfall for a newbie modder and it isn't immediately obvious what should be done.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on February 02, 2019, 07:17:42 AM
MarketAPI:


I want to be able to apply a profit tax to markets.
Title: Re: API request thread (please read OP before posting!)
Post by: Originem on February 02, 2019, 10:47:02 PM
ShipEngineAPI:
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on April 25, 2019, 01:34:38 PM
Requesting that the following methods be supported at the time of ModPlugin.onGameLoad

NPE stack trace:
Spoiler
848390 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.ui.while.show(Unknown Source)
   at com.fs.starfarer.ui.impl.float.show(Unknown Source)
   at com.fs.starfarer.campaign.CampaignState.showConfirmDialog(Unknown Source)
   at com.fs.starfarer.campaign.CampaignState.showConfirmDialog(Unknown Source)
   at starship_legends.ModPlugin.onGameLoad(ModPlugin.java:50)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.menuItemSelected(Unknown Source)
   at com.fs.starfarer.title.C.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.OoO0.buttonPressed(Unknown Source)
   at com.fs.starfarer.ui.oooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.?0000(Unknown Source)
   at com.fs.starfarer.ui.oooOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO.processInput(Unknown Source)
   at com.fs.starfarer.ui.V.super(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
[close]
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 25, 2019, 03:44:57 PM
Hmm - this is not really possible the way things are structured. If you load a game from the title screen, the game loading code finishes and then the game transitions to the campaign state - so at the point where the loading code finishes, the UI that would show the dialog/messages/etc doesn't exist.
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on April 25, 2019, 04:43:57 PM
Yeah, I figured it must be something like that. Would it cause any complications to move the invocation of onGameLoad until just after the campaign state transition? I think that (like me) a lot of people would expect campaign features to exist at that point. Alternately, could we get something like ModPlugin.onCampaignLoad?
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 25, 2019, 05:08:26 PM
Yeah, it would likely cause complications. I mean, it's *possible*, but it's for sure more chance of breaking things in an obscure way than I want to risk at this point, if that makes sense - too much chance of me missing some kind of possible state transition.

For your specific case, would adding a campaign script that waits a few frames before running work? That's... more or less what I'd end up doing anyway, if I were to add something like an onCampaignLoad() method.
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on April 25, 2019, 05:44:06 PM
That's how LazyWizard did it for Version Checker, but in my case that won't work well. I'm trying to set things up so I can let players know about errors in a more useful way. One of the types of errors I'm most concerned with are json read errors that may happen if a user (or another mod) introduces a syntax error into any of the files my mods read on game load. Waiting to read those files could easily cause instability. It shouldn't be too much trouble to delay the error message though, so no biggie. I was just hoping it would be an easy fix.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 25, 2019, 05:53:29 PM
Right, gotcha.
Title: Re: API request thread (please read OP before posting!)
Post by: Vayra on May 31, 2019, 12:27:15 AM
Any chance we could get a MutableShipStatsAPI.get<SIZE>WeaponRangeBonus, i.e. MutableShipStatsAPI.getSmallWeaponRangeBonus?  :)

There are a couple things where you can only tweak certain weapons by type, and others by size, and some by PD tag or projectile/beam, etc. and I bumped into this one recently.

EDIT: Or alternatively/maybe even better, something to modify individual weapon ranges on WeaponAPI or WeaponSpecAPI?
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on May 31, 2019, 01:06:03 AM
Any chance we could get a MutableShipStatsAPI.get<SIZE>WeaponRangeBonus, i.e. MutableShipStatsAPI.getSmallWeaponRangeBonus?  :)

There are a couple things where you can only tweak certain weapons by type, and others by size, and some by PD tag or projectile/beam, etc. and I bumped into this one recently.

What if you want to start mixing weapon size and weapon type stat changes though? I feel like this would get clunky very fast. I love the flexibility that stats affecting certain sizes gives, but imagine having all the mutable stats a weapon can take multiplied by three for the different weapon sizes.

I suggest a potential extension of Vayra's request: for weapon-affecting stats that are applied to a whole ship (such as, say, weapon range), the stat change method ".get_WeaponRangeBonus()" could have an optional field before the modifier method that allows you to specify a size - either as an enum "SMALL / MEDIUM / LARGE", or just an integer from 0 to 2. So, to give a range buff to all of a ship's small-sized ballistic weapons, you could do this:

Code
...
stats.getBallisticWeaponRange(WeaponSize.SMALL).modifyPercent(id, someRangeBonus);
...

This could extend to all sorts of ship-wide, weapon-affecting stats - weapon flux cost, weapon damage, weapon rate of fire, etc. - in much the same way, keeping everything nice and tidy without MutableShipStatsAPI becoming a bit of a labyrinth (even if it already is ;) ). Would such a setup be possible, or even sane?
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on June 22, 2019, 02:36:37 AM
int FleetParamsV3.maxSize

More control over max AI fleet size, so it doesn't have to be either "config value" (i.e. 30) or "unlimited" (which with a sufficiently large fleet can lead to the bad old days of having to kill 100 frigates).
Title: Re: API request thread (please read OP before posting!)
Post by: Nicke535 on July 02, 2019, 03:33:42 AM
A method, of some sort, to adjust built-in weapons on a ship post-generation. Ideally, it would work in one of two ways: either ShipAPI.getVariant().addWeapon() would allow built-in weapon slots to be modified (which might not be ideal, or even possible), or some similar hook specifically for modifying built-in weapons could be added. This second hook could either be something similar to how built-in fighters can currently be modified (via list reference modification):
Code
java
ShipAPI.getHullSpec().getBuiltInWeapons(); /* Returns a List<Pair<String, String>>, with first element being weapon slot ID and second being weapon spec ID */
This has the added benefit of matching the existing getBuiltInFighters() and getBuiltInHullmods() functions. Or, if it's for some reason preferable, an entirely different endpoint could be used. Something like this:
Code
java
ShipAPI.getVariant().addBuiltinWeaponOverride(String slotID, String newWeaponID) /* Adds an override, making the variant replace the hullspec's built-in weapon */
ShipAPI.getVariant().removeBuiltinWeaponOverride(String slotID) /* Removes an override, giving control back to the hullspec */
Either of these solutions (or an equivalent solution) would allow for some more interesting weapons and hullmods to be coded, without messing with the autofit or fleetmember instantiators (which current attempts at "semi-builtin" weapons do), and several modders have already expressed desire to use the functionality this would allow.


Also, unrelated for the suggestion but related to the thread: the OP seems to be outdated, as several of its entries that now exist in the game are not marked as such.
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on July 04, 2019, 12:16:29 AM
A method, of some sort, to adjust built-in weapons on a ship post-generation...

Oh my goodness all of my yes.  :D
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on July 12, 2019, 11:15:59 PM
DamagingProjectileAPIs should always return their ShipAPIs via getSource().   They don't when they have certain values enabled, like BALLISTIC_AS_BEAM, RAY_FIGHTER (not sure which interferes). 

Took me forever to backtrack through "this old stuff worked fine, why doesn't it work now" things to finally find this.
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on July 13, 2019, 01:37:27 PM
DamagingProjectileAPI setDamageAmount() doesn't appear to function as expected.  The values I'm getting are absurdly high.  Like, order-of-magnitude larger than I'm expecting. 

This also appears to happen with spawned projectiles who've had it set via MIRV splits; when we get their damage values through code, it's wrong.  The expected in-game behaviors (vs. shields, Armor, etc.) all work correctly, though.
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on July 13, 2019, 04:39:17 PM
The above appears to be related. 

Also, MIRV'd projectiles get their hitpoint variable from their parents; there's no such thing as an "armored MIRV" with weak, PD-able shots.  I guess it's time to (finally) rewrite my old custom MIRV stuff into a generic system, lol.
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on July 13, 2019, 07:39:17 PM
Also, MIRV'd projectiles get their hitpoint variable from their parents; there's no such thing as an "armored MIRV" with weak, PD-able shots.

Umm. What?

From Hurricane MIRV projectile file:

Code
...
"behaviorSpec":{"behavior":"MIRV",
   "splitRange":1000,
   "minTimeToSplit":2,
   "canSplitEarly":true,
   "splitSound":"hurricane_mirv_fire",
   "numShots":11,
   "damage":500,
   "impact":5,
   "emp":0,
   "damageType":HIGH_EXPLOSIVE,
-->"hitpoints":250,
   "arc":180,
   "arcOffset":180,
   "evenSpread":true,
   "spreadSpeed":200,
   "spreadSpeedRange":50,
   "projectileSpec":"mirv_warhead",
   ...
"hitpoints":250
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on July 14, 2019, 12:18:30 AM
Oh, dear, I wasn't using that version of it, figures ::)

I'll have to test whether populating that field in the JSON fixes the other observed oddness, too.

[EDIT]Hitpoints appears to work, damage, nope.[/EDIT]
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on July 19, 2019, 06:29:28 PM
Just a couple of quick responses to a few cherry-picked items:

ShipEngineAPI:
  • float getAngle()
  • float getBaseLength()

You can use ShipEngineAPI.getEngineSlot() to get access to this data.


int FleetParamsV3.maxSize

More control over max AI fleet size, so it doesn't have to be either "config value" (i.e. 30) or "unlimited" (which with a sufficiently large fleet can lead to the bad old days of having to kill 100 frigates).

Added this in.


[EDIT]Hitpoints appears to work, damage, nope.[/EDIT]

Damage seems to work for me, but that's getting a bit off-topic to this thread.
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on July 21, 2019, 12:50:18 PM
Request: a way to get a collection of the FleetMembers selected for deployment in the deployment window. Something like one of these:
Code
Global.getCombatEngine().getSelectedForDeployment()
myCombatFleetManager.getSelectedForDeployment()
Admittedly the use cases are limited, but this information is currently very difficult to obtain.
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on August 15, 2019, 08:29:45 PM
I'd like to disable the player's ability to construct/upgrade/downgrade/scrap structures/industries in certain circumstances. I think I really just need it to disable the UIs. I guess that would go in MarketAPI?

Code: java
boolean canBuildUpgrade()
setCanBuildUpgrade(boolean)

boolean canDowngradeShutDown()
setCanDowngradeShutDown(boolean)
EDIT
Realized build/upgrade and downgrade/shut down should be separate toggles.
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on September 11, 2019, 01:40:15 PM
I could really use something along the lines of
public SoundAPI playSound(String id, float pitch, float volume, Vector2f loc, Vector2f vel, float fadeIn, float fadeOut)
when making miniguns for example, because the current full second fade in and out are quite disrupting.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on September 11, 2019, 02:15:41 PM
I could really use something along the lines of
public SoundAPI playSound(String id, float pitch, float volume, Vector2f loc, Vector2f vel, float fadeIn, float fadeOut)
when making miniguns for example, because the current full second fade in and out are quite disrupting.

Hmm? That seems strange, afaik there's no fade in/out for playSound() sounds, though there's a half-second fade in/out for playLoop(). playSound() also returns a SoundAPI, so you can manage the volume directly via SoundAPI.setVolume().
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on September 11, 2019, 02:23:24 PM
my bad, copied the wrong line, I was indeed talking about the loop
public void playLoop(String id, Object playingEntity, float pitch, float volume, Vector2f loc, Vector2f vel, float fadeIn, float fadeOut)
I'll try cutting the sound if that works for loops too.
[edit]
Yeah that doesn't seems to be possible. I tried to lower the volume, to move the loop, to replace it with a silence without success
[edit2]
HA! I found a way to cut a loop using a "SimpleEntity" from LazyLib as a source. Still, a custom fadeIn and Fadeout would be best. I'm also noticing that playSound and playLoop have very different spatialisation while using the same location.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on September 11, 2019, 02:51:01 PM
Yeah, the loop will always take a half a second to fade in/out...

Added to SoundPlayerAPI:
void playLoop(String id, Object playingEntity, float pitch, float volume, Vector2f loc, Vector2f vel, float fadeIn, float fadeOut);


The vanilla approach is to play the loop in combination with another sound so there's a "hit" in response to whatever in-game action starting, and then the loop takes over. That generally seems like it might work better? Since it seems like it'd be trickier to have a loop that 1) loops nicely and 2) has a nice-feeling "hit" on startup, but, in any case, adding the above method wasn't particularly involved.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on September 13, 2019, 07:45:38 AM
CargoPickerListener:
I want to be able to disable items in a cargo picker listener, while still showing them with an explanation.
Title: Re: API request thread (please read OP before posting!)
Post by: Vayra on September 13, 2019, 11:23:33 AM
MutableShipStatsAPI:

Dunno if this is already a planned thing or not, but it'd be real useful.  :)
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on September 23, 2019, 10:44:42 PM
When is zero not zero?  When using setShield on a ShipAPI:

ship.setShield(ShieldAPI.ShieldType.FRONT, 0f, 1f, 0f);

...this results in a non-zero-arc shield.  It's tiny, but it's still there.

Can we just have a ShieldType.OTHER, that is a "shield" but doesn't actually do anything, other than be raiseable / droppable?
Title: Re: API request thread (please read OP before posting!)
Post by: MesoTroniK on September 23, 2019, 11:42:05 PM
Every frame...

setActiveArc and setArc to 0.0f to beat the rounding function or whatever is going on under the hood.
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on September 23, 2019, 11:54:32 PM
Oh, that's ... weird.  I'll give it a go, thank you!
Title: Re: API request thread (please read OP before posting!)
Post by: AnyIDElse on November 07, 2019, 08:08:08 PM
something like:
      stats.getCargoMod().modifyFlat(id, ship.getVariant().getNumFluxCapacitors());
won't work.

Actually, almost every campaign-related MutableShipStatsAPI modifications with dynamic values like:
      stats.getFuelMod().modifyFlat(id, dynamicValueA);
      stats.getMaxCrewMod().modifyFlat(id, dynamicValueB);
      stats.getSensorProfile().modifyFlat(id, dynamicValueC);
      stats.getSuppliesPerMonth().modifyFlat(id, dynamicValueD);
won't work.

I hope these issues can be fixed or changed in next updates...
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on November 07, 2019, 11:34:23 PM
something like:
      stats.getCargoMod().modifyFlat(id, ship.getVariant().getNumFluxCapacitors());
won't work.

Actually, almost every campaign-related MutableShipStatsAPI modifications with dynamic values like:
      stats.getFuelMod().modifyFlat(id, dynamicValueA);
      stats.getMaxCrewMod().modifyFlat(id, dynamicValueB);
      stats.getSensorProfile().modifyFlat(id, dynamicValueC);
      stats.getSuppliesPerMonth().modifyFlat(id, dynamicValueD);
won't work.

I hope these issues can be fixed or changed in next updates...

... Until you have to account for the case where a modder tries to modify a mutable stat by itself, and the game crashes with an infinity error of some kind.

Spoiler

If you're trying to adjust stat X based on stat Y (specifically within a hullmod), you can actually get some information by translating ship stats backwards from the applyEffectsAfterShipCreation() method into the applyEffectsBeforeShipCreation() method. Disassemble Reassemble has a hullmod that exploits just that, letting you replace a ship's fighter bays with cargo capacity, and the cargo bonus scales with the number of bays the ship has.

[close]
Title: Re: API request thread (please read OP before posting!)
Post by: Zaphide on November 09, 2019, 03:06:45 PM
Hi Alex!

I would be interested in a way to set either a wing as builtin or as UI-locked.

Use case is a hull mod to add a dedicated launch bay for a particular wing.

Example usage (in hull mod):
Code
public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
        stats.getNumFighterBays().modifyFlat(id, 1f);

        boolean isUILocked_Or_BuiltIn = true;

        int wingIndex = stats.getNumFighterBays().getModifiedInt() - 1;
        stats.getVariant().setWingId(this.wingIndex, wingId, isUILocked_Or_BuiltIn);
}

I couldn't work out a way to do it in the existing API but someone let me know if it is possible :)

Cheers,
Zaphide
Title: Re: API request thread (please read OP before posting!)
Post by: Yunru on November 09, 2019, 03:26:15 PM
It'd be fantastic if the DModMult (I don't remember the exact name) used by Safety Procedures could be un-hardcoded. For what I've seen it's all set up to be variable, but its defined as a final so we can't change it.
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on November 09, 2019, 05:00:46 PM
Hi Alex!

I would be interested in a way to set either a wing as builtin or as UI-locked.

Use case is a hull mod to add a dedicated launch bay for a particular wing.

Example usage (in hull mod)...

I couldn't work out a way to do it in the existing API but someone let me know if it is possible :)

Cheers,
Zaphide

Simplest advice: You also need to tell the game that the ship has a built-in wing of that type.  You start as you have with "ship.getVariant().setWingId(...)", and immediately follow it with "ship.getHullSpec().getBuiltInWings().add(WING_ID)". It doesn't add a new wing, but instead does the equivalent of what you're asking for: it locks that wing you set in as a built-in.

If you want a more detailed look at a working setup, I've got a hullmod kicking around that does exactly that (which I'm quite proud of ;) ). It's much like Converted Hangar, but it adds a built-in wing instead of just a free bay. But beyond that, it's compatible with Converted Hangar, and for that reason is a bit more complex and consists of two independent hullmods.

Take a look at these two hullmod scripts for the full reference:
https://bitbucket.org/AxleMC131/starsector_modding/downloads/DroneHullmod.java (https://bitbucket.org/AxleMC131/starsector_modding/downloads/DroneHullmod.java)
https://bitbucket.org/AxleMC131/starsector_modding/downloads/DroneHullmodManager.java (https://bitbucket.org/AxleMC131/starsector_modding/downloads/DroneHullmodManager.java)
The first one is the actual hullmod the player installs, and the second one is an invisible auto-install hullmod that allows the first one to work alongside Converted Hangar without breaking anything. They're heavily annotated so you should be able to make sense of them, but if you have any questions feel free to ask in PM.
Title: Re: API request thread (please read OP before posting!)
Post by: Zaphide on November 09, 2019, 08:29:06 PM
Hi Alex!

I would be interested in a way to set either a wing as builtin or as UI-locked.

<snip>

Simplest advice: You also need to tell the game that the ship has a built-in wing of that type.  You start as you have with "ship.getVariant().setWingId(...)", and immediately follow it with "ship.getHullSpec().getBuiltInWings().add(WING_ID)". It doesn't add a new wing, but instead does the equivalent of what you're asking for: it locks that wing you set in as a built-in.
<snip>

Thanks Axle! Didn't realise I could add it to the built-in's List directly (and also set the wing index). I used your example (tyvm) to do a bit of exploring.

This seems to be something that kind of works but is not exactly directly supported by the API:
- I can't seem to add a fighter bay to a ship if it has an existing built-in wing (the hullmod just doesn't get added at all, no error in log or anything)
   - EDIT: Actually I was wrong about this, seems to work fine :P
 - If I use getHullSpec().getBuiltInWings.add("my_wing_id"), any existing wings also become locked (can get around this by shuffling things around like your example)
- This basically means only using one of these add-built-in-wing type hull mods at any given time
   - EDIT: I think this should be OK if a seperate second hull-mod to manage the removal of the built-in wing is used for each hull-mod type that adds a built-in wing

Given this, I suspect built-in wings are handled a little differently than normal wings and so perhaps it is not so straight-forward an API request :P

EDIT: Actually, it seems fine to add and remove built-in wings if there are already built in wings. Not sure how I was getting that issue. So, only really need to work with the shuffling around of non-built-in wings, which is possible with another hull mod to track (as per your neat example) :)

@Alex, probably OK to not worry about this now :D
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 09, 2019, 08:31:43 PM
(Hmm, this might be a better fit for the misc modding questions thread or a separate thread in modding? Haven't really had a chance to dig into it, though; will see if I can check it out tomorrow. If I get sidetracked and don't, please feel free to poke me via PM in a day or so.)
Title: Re: API request thread (please read OP before posting!)
Post by: Armithaig on November 21, 2019, 03:36:19 PM
com.fs.starfarer.api.combat.ShipSystemSpecAPI

Moved from DroneLauncherShipSystemAPI to allow for easy access of custom fields in .system files.
Realise's possible to do as much with generic JSON read functions, but if the game's already holding a json spec in memory which the DroneLauncher'd hint at, wasteful to load up the same file twice.

If top-level custom fields in system files're undesirable, perhaps like factions/terrain under a { "custom": { } } matched with
Title: Re: API request thread (please read OP before posting!)
Post by: tomatopaste on December 09, 2019, 07:07:36 PM
This request is prompted by a weapon I recently scripted with custom projectile velocities and motion.
Demonstration
(https://i.imgur.com/GOSqamz.gif)
[close]
As you can see the range indicator as defined by the weapon .csv is misleading due to the range calculation being messed up by the non-linear velocity.

My request is DamagingProjectileAPI.setIsFading(boolean fading) or DamagingProjectileAPI.forceStartFading() to be able to make the projectile fade manually without having to mess around with weapon settings, ultimately creating a range indicator that is misleading to the player and the ai  :D
Title: Re: API request thread (please read OP before posting!)
Post by: boggled on December 13, 2019, 04:09:10 PM
I've been working on a terraforming mod and station construction mod, and there's a few minor API changes that would greatly improve the user experience for these types of mods:

-Function to change the type ID of a planet (ex. from water to terran). Doesn't even need to change the graphics, textures, industries, etc. in any way; only the planet type that gets returned for getTypeId() in PlanetAPI.

-Function for getting the OrbitAPI of an asteroid field (so stations and/or other structures can be built in it and maintain the same orbit so as to stay within it over time).

-Function to disable installing AI cores in an industry. There are many mods with industries that remove themselves after they finish building, or where it doesn't make sense to have AI core bonuses.

The planet type ID change in particular seems very easy to implement and would remove a major barrier discouraging people from creating mods that interact with planet types (ex. terraforming mods). Thank you for considering these suggestions!

Title: Re: API request thread (please read OP before posting!)
Post by: Alex on December 13, 2019, 04:29:45 PM
-Function to change the type ID of a planet (ex. from water to terran). Doesn't even need to change the graphics, textures, industries, etc. in any way; only the planet type that gets returned for getTypeId() in PlanetAPI.

-Function to disable installing AI cores in an industry. There are many mods with industries that remove themselves after they finish building, or where it doesn't make sense to have AI core bonuses.

Figured I might as well add these while I was thinking about it.

Industry.boolean canInstallAICores()
PlanetAPI.setTypeId() -> just sets the string, doesn't do anything else like updating the actual visuals etc.


-Function for getting the OrbitAPI of an asteroid field (so stations and/or other structures can be built in it and maintain the same orbit so as to stay within it over time).

This should already be doable, no? Via AsteroidFieldTerrainPlugin.getEntity().getOrbit()?
Title: Re: API request thread (please read OP before posting!)
Post by: boggled on December 14, 2019, 06:30:13 AM
-Function to change the type ID of a planet (ex. from water to terran). Doesn't even need to change the graphics, textures, industries, etc. in any way; only the planet type that gets returned for getTypeId() in PlanetAPI.

-Function to disable installing AI cores in an industry. There are many mods with industries that remove themselves after they finish building, or where it doesn't make sense to have AI core bonuses.

Figured I might as well add these while I was thinking about it.

Industry.boolean canInstallAICores()
PlanetAPI.setTypeId() -> just sets the string, doesn't do anything else like updating the actual visuals etc.


-Function for getting the OrbitAPI of an asteroid field (so stations and/or other structures can be built in it and maintain the same orbit so as to stay within it over time).

This should already be doable, no? Via AsteroidFieldTerrainPlugin.getEntity().getOrbit()?

That worked! I kept getting a null pointer exception until I cast the CampaignTerrainPlugin as an AsteroidFieldTerrainPlugin. Thanks for all your help!
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on January 22, 2020, 05:35:26 PM
OptionsPanelAPI.setSortOrder(Object data, int order) would be handy for mixing options set in code with options from the rules.csv.

EDIT: It would be nice if we could set an option's color in the csv. Whether by a command or inline when the option is created.
Title: Re: API request thread (please read OP before posting!)
Post by: tomatopaste on February 10, 2020, 05:05:39 AM
boolean DroneLauncherShipSystemAPI.isInHoldingPattern() would be really useful to avoid a workaround I've been using for the DRONE_LAUNCHER shipsystem type (this is even displayed as a status for player ship on the HUD so it's annoying that it can't be gotten in code...) thanks :)
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on February 10, 2020, 09:09:09 PM
boolean DroneLauncherShipSystemAPI.isInHoldingPattern() would be really useful to avoid a workaround I've been using for the DRONE_LAUNCHER shipsystem type (this is even displayed as a status for player ship on the HUD so it's annoying that it can't be gotten in code...) thanks :)

I think you're looking for something too specific. Look in DroneLauncherShipSystemAPI.java again and you'll see exactly what you need already there.

Code
	public static enum DroneOrders {
RECALL,
DEPLOY,
ATTACK,
}

        ...

DroneLauncherShipSystemAPI.DroneOrders getDroneOrders();
Title: Re: API request thread (please read OP before posting!)
Post by: Originem on February 25, 2020, 07:44:42 AM
There is no weaponSpec.setWeaponName()...
Also needs setString(catogory,id)
setSetting...
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on March 07, 2020, 06:42:30 AM
Naming constellations is difficult to figure out because NamePick is convoluted. Also, it would be nice if we had more control over the name and label. I'd like to see:

setNameOverride(String) // Set the constellation's name directly, bypassing the NamePick stuff and blocking addition of "constellation"/"nebula" in various places
setColorOverride(Color) // The color of the name label
setAngleOverride(float) // The angle of the name label
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on April 16, 2020, 10:12:48 PM
This isn't so much a suggestion and more of a query.

In an unrelated discussion in the Unofficial Discord, it came to my knowledge that the Ion Beam and Tachyon Lance have slightly different on-hit beam effects. Fine, they're different weapon formats, but while playing "spot the difference" I noticed something odd:

Code
float emp = beam.getDamage().getFluxComponent() * 1f;
float dam = beam.getDamage().getDamage() * 1f;
Code
float emp = beam.getWeapon().getDamage().getFluxComponent() * 0.5f;
float dam = beam.getWeapon().getDamage().getDamage() * 0.25f;
These are the bits that choose the damage values for the EMP arcs both weapons can generate (Ion Beam above, Tachyon Lance below). Fine, the multipliers are different, but what is the difference between these?

Code
beam.getWeapon().getDamage()...
beam.getDamage()...
I looked in the API, and both the WeaponAPI and BeamAPI have this "getDamage()" method to the DamageAPI, while BeamAPI also has the "getWeapon()" method to get a WeaponAPI. Here, the Ion Beam goes straight from the BeamAPI to the damage instance, but the Tachyon Lance takes a detour through its WeaponAPI to achieve the same thing.

What is the significance of this? Is there any reason to use one format over the other? All I can think of is that one is a burst beam and one is a sustained beam, does that cause a difference in what is handled by the DamageAPI?
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on April 28, 2020, 04:46:16 AM
I'd like to request a public method in BaseIndustry that allows for modification of the current build progress via
Code
protected float buildProgress
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on April 28, 2020, 06:13:01 AM
You mean you want to be able to modify it from an outside script? Because you can already modify it in a subclass a la PopulationAndInfrastructure.

If you do want to use an outside script and only want to affect your own industries, then you can expose buildProgress yourself in your subclasses.
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on April 28, 2020, 01:10:11 PM
You mean you want to be able to modify it from an outside script? Because you can already modify it in a subclass a la PopulationAndInfrastructure.

If you do want to use an outside script and only want to affect your own industries, then you can expose buildProgress yourself in your subclasses.

I would like to modify the build progress of vanilla baseIndustry subclasses without adjusting code in them - not currently possible as I'd have to add a method to modify buildProgress, as you correctly noted, in the subclass itself.
What I am asking for is essentially a public method to modify build progress in any baseIndustry subclass.

(I can't accelerate the build progress of Light Industry by 10 days if a special condition is met without implementing my own LI industry class)
Title: Re: API request thread (please read OP before posting!)
Post by: SonnaBanana on May 27, 2020, 04:59:17 AM
Will there be a method for acquiring the number of purchased skills in an aptitude, next release?
Title: Re: API request thread (please read OP before posting!)
Post by: bananana on May 31, 2020, 02:58:48 AM
would be nice to
Code
weapon.getGlowSprite();
like we can do with main and barrel sprites. for consistency sake, if nothing else.
Title: Re: API request thread (please read OP before posting!)
Post by: Caymon Joestar on June 08, 2020, 01:13:20 AM
Not sure if this is technically api related but can the no sell tag be made to be useable on ships in the ship_data csv? Feels something that would be present with unboardable ships. Also allows for modders to be able to add ships that they don't want the player to get their hands on through the market.
Title: Re: API request thread (please read OP before posting!)
Post by: Morrokain on July 15, 2020, 08:44:38 PM
Some nice to haves:

Decouple fighter refit times and replacement rate regen time:

-MutableShipStatsAPI.getFighterRefitTime() (no longer increases the rate that replacement rate replenishes - purely affects fighter replacement times)

-MutableShipStatsAPI.getReplacementRateRefillMult() (modifies the replenishment rate of the fighter replacement rate for carriers)

and:

-MutableShipStatsAPI.getReplacementRateCap()

-MutableShipStatsAPI.getReplacementRateMin()
Title: Re: API request thread (please read OP before posting!)
Post by: MesoTroniK on July 16, 2020, 02:39:19 AM
Some nice to haves for advanced scripted sound player ***:
- getSoundVolume()
- getMusicVolume()
- setSoundVolume()
- setMusicVolume()
- getMaxSoundChannels()
- getMaxUISoundChannels()
- getCurrentUsedSoundChannels()
- getCurrentUsedUISoundChannels()
- Anything I am overlooking?

Possible use case contexts:
- Direct playing very special sounds with OpenAL skipping the middle man (SS itself) for custom effects like doppler.
- Temporarily suppressing music and other sounds for things like scripted "cutscenes" during quests.
- God knows what else...
Title: Re: API request thread (please read OP before posting!)
Post by: MShadowy on July 16, 2020, 10:43:18 AM
I believe it's come up before but it would be pretty handy for WeaponAPI to have:

- setAmmoPerSecond()

Also potentially useful, though not specifically for anything I'd need:

- getReloadSize()
- setReloadSize()
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on July 20, 2020, 10:36:37 PM
There are several mods that add special hullmods that don't strictly meet the criteria of a proper hull modification. In my case it's Starship Legends, which adds a hullmod that represents the ship's reputation, but there's also Commissioned Crews (faction-trained crew), Automatic Orders (AI modification flags), and Extended Hullmods (sub-systems that boost other hullmods). I'm sure there are others. The special hullmods added by these mods are represented the same way as any other hullmod by the GUI, which seems pretty janky to me. It would be nice if such hullmods had a way of visually distinguishing themselves from actual hullmods. To that end, I would greatly appreciate the following additions to BaseHullMod:
Thanks for your consideration, Alex!
Title: Re: API request thread (please read OP before posting!)
Post by: bananana on August 31, 2020, 05:27:21 AM
any chance we'll ever get access to the visual part of spawnEmpArc ?
i mean, without all the targeting and damage dealing and so on, just renderEmpArc from point A to point B. because that's what it's generally used for in most cases outside of vanilla, except currently it also requires setting up a fake combat entity because emp arc can't just be cast at point.
i'd suspect both spawnEmpArc and spawnEmpArcPierceShields are already using something like that under the hood, and it is sad that it is not callable directly
Title: Re: API request thread (please read OP before posting!)
Post by: AxleMC131 on September 02, 2020, 01:45:07 AM
... currently it also requires setting up a fake combat entity because emp arc can't just be cast at point...

(Assuming you are spawning an arc with one end at an existing entity, and not from a random point to a random point)

Have you tried swapping the target and origin points for the arc? Because the TARGET needs to be a CombatEntityAPI and the ORIGIN is a Vector2f coordinate location... If you aren't dealing damage and just want a visual arc, you just flip them, so the origin is your "random point in space" and the target is the thing that's actually generating the arc.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on September 07, 2020, 08:34:19 AM
I was trying to add some counter-intel (bounties countering something presented in an intel) and found it impossible. My idea was to offer another type of missions to the player, e.g.In all 3 cases, the bounty would be paid if player destroyed fleets associated with the initial intel. Could we please get a "CampaignFleetAPI getMainFleet()" and "List<CampaignFleetAPI> getFleets()" methods on intel objects that involve fleets (formalized via an interface)? This would allow to register own FleetEventListener (thus succeeding the bounty when initial one failed and vice versa) and check some other bits (to decide on bounty payout and to be able to generate sensible intel descriptions).
Thanks!
Title: Re: API request thread (please read OP before posting!)
Post by: bananana on September 10, 2020, 06:29:13 AM
will we ever get the weapon.setLocation(); or weapon.getSlot.setLocation(); ? we can set location of ships, and set location of fireOffsets within each weapon, and set weapon slot arc, but not set location of weapons. unfortunate.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on October 17, 2020, 03:54:52 AM
FactionAPI.getShipNamePrefix()
Conspicuously missing from the API.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on October 17, 2020, 07:32:24 AM
Could we get a method in IntelUIAPI to refresh the list of intels (left side), ideally without redrawing the currently selected one?
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on October 22, 2020, 07:15:02 AM
It would be really nice if ShipAPI.getParentStation() and ShipAPI.getChildModulesCopy() were usable in the refit screen.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on October 29, 2020, 03:24:00 AM
I've just noticed game can render select boxes (e.g. Codex, Weapons, Small/Medium/Large and Energy/Ballistic/Missile) - could we have this exposed in TooltipMakerAPI? Example:

Same description as addButton:
Code
SelectBoxAPI addSelectBox(java.lang.String text, java.lang.Object data, java.awt.Color base, java.awt.Color bg, float width, float height, float pad) 
SelectBoxAPI addSelectBox(java.lang.String text, java.lang.Object data, float width, float height, float pad)
For simplicity, SelectBoxAPI extends ButtonAPI plus:
Code
void setSelected(boolean isSelected);
boolean getSelected();
And an event handler function in IntelInfoPlugin:
Code
void selectBoxChanged(java.lang.Object selectBoxId, boolean isSelected, IntelUIAPI ui)
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 08, 2020, 01:58:18 PM
I remember seeing something regarding officer/admin skills - I think it was regarding dialog box for recruitment.

Could you add `showSkills(PersonAPI person, ...)` to TooltipMakerAPI?

Possible descriptions:
Code
void showSkills(PersonAPI person);// shows all non-zero skills
void showSkills(PersonAPI person, boolean sorted);// like showCargo, sort based on level
void showSkills(PersonAPI person, int max);// show up to max, then "and X other skills"
Title: Re: API request thread (please read OP before posting!)
Post by: Tuv0x on December 21, 2020, 04:28:52 PM
It would be nice to have access to more stuff in com.fs.starfarer.api.ui,

I will preface this with: I have no idea what any of the classes/methods are so this will sound super generic.
A way to create tri-pad like menus akin to the intel and command menus. Currently mod authors are utilizing the intel tab to add menu functionality to their mods.
Code: java
com.fs.starfarer.api.ui.TriPadAPI
The "would be nice" features would include:

For ToolTipMakerAPI:
Code: java
void addCheckbox(String id, boolean checked)
boolean getChecked(String id)
void addTextInput(String id, String placeholder)
void addTextBox(String id, String placeholder, int height) /* height could be number of lines, or pixel height I guess */
String getTextInput(java.lang.string id)
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on December 22, 2020, 10:35:33 AM
I'd like to ask for a method to block the availability of buildings on a market-to-market basis.
For example:
Code: java
com.fs.starfarer.api.campaign.econ.MarketAPI
void blacklistIndustry(industryId)
void whitelistIndustry(industryId)
to disallow building that specific building on a market unless removed from the blacklist via a similar method.

Edit - Apologies for posting in the wrong thread - it's been a while since I read the OP. Feel free to delete it, I'll repost it as new subject sometime if it's gone.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on December 22, 2020, 10:54:48 AM
Re: last two posts here - please take a look at the OP! This thread is not for suggesting new features; those should go in the suggestions subforum. This thread is purely for "things that already exist in the core code but aren't accessible via the API".
Title: Re: API request thread (please read OP before posting!)
Post by: Tuv0x on December 25, 2020, 10:54:52 PM
Re: last two posts here - please take a look at the OP! This thread is not for suggesting new features; those should go in the suggestions sub-forum. This thread is purely for "things that already exist in the core code but aren't accessible via the API".

I'm not entirely sure which part of my post is a new feature. The game already has tri-pad menus that have scrollable tabs and side menus (intel and command screens). I'm mainly asking that we can call up the drawing of the tri-pad window, as well as whatever functionality is in the actual content window.

The checkboxes (settings/help tips), and text inputs (character creation text boxes, faction creation text boxes) are also in the game, we just can't make them without doing all the LWJGL work to emulate them. I'll admit, multi-line text boxes don't exist currently, from what I can remember.

I don't mean to argue, just think I didn't communicate it properly.
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on December 30, 2020, 08:16:00 AM
request to change
Code: java
protected void demand()
in com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry to public.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on January 05, 2021, 04:02:43 PM
I'm not entirely sure which part of my post is a new feature. The game already has tri-pad menus that have scrollable tabs and side menus (intel and command screens). I'm mainly asking that we can call up the drawing of the tri-pad window, as well as whatever functionality is in the actual content window.

The checkboxes (settings/help tips), and text inputs (character creation text boxes, faction creation text boxes) are also in the game, we just can't make them without doing all the LWJGL work to emulate them. I'll admit, multi-line text boxes don't exist currently, from what I can remember.

I don't mean to argue, just think I didn't communicate it properly.

Ah - basically this thread is for things where "this method already probably exists in the core class and fulfilling the request is likely just a matter of adding it to the interface exposed in the API". Anything beyond that is outside the scope for this thread.

So for example something like making a core widget usable by mods requires more work/thought/design/etc than that. This is meant to be a simple gathering place for... basically, stuff that could be trivially exposed, and that someone needs. A collection of extremely low-hanging fruit, if you will.

(Edit: I should say, most of the stuff mentioned here ends up being a bit more involved than just adding a method. So I generally go through it and pick out the things that are still quick and easy to add in.)
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on January 05, 2021, 04:50:09 PM
There are several mods that add special hullmods that don't strictly meet the criteria of a proper hull modification. In my case it's Starship Legends, which adds a hullmod that represents the ship's reputation, but there's also Commissioned Crews (faction-trained crew), Automatic Orders (AI modification flags), and Extended Hullmods (sub-systems that boost other hullmods). I'm sure there are others. The special hullmods added by these mods are represented the same way as any other hullmod by the GUI, which seems pretty janky to me. It would be nice if such hullmods had a way of visually distinguishing themselves from actual hullmods. To that end, I would greatly appreciate the following additions to BaseHullMod:
  • getBorderColor
  • getNameColor
  • getDisplayOrder
Thanks for your consideration, Alex!

Did all these! Well, in some form.


any chance we'll ever get access to the visual part of spawnEmpArc ?
i mean, without all the targeting and damage dealing and so on, just renderEmpArc from point A to point B. because that's what it's generally used for in most cases outside of vanilla, except currently it also requires setting up a fake combat entity because emp arc can't just be cast at point.
i'd suspect both spawnEmpArc and spawnEmpArcPierceShields are already using something like that under the hood, and it is sad that it is not callable directly

There'll be a CombatEngineAPI.spawnEmpArcVisual method in the next release.


FactionAPI.getShipNamePrefix()
Conspicuously missing from the API.

Added.


I've just noticed game can render select boxes (e.g. Codex, Weapons, Small/Medium/Large and Energy/Ballistic/Missile) - could we have this exposed in TooltipMakerAPI? Example:

You mean functionally a checkbox, right? That's actually added for the next release! Via:
ButtonAPI.addAreaCheckbox(); ButtonAPI has isChecked()/setChecked()


Could we get a method in IntelUIAPI to refresh the list of intels (left side), ideally without redrawing the currently selected one?

Done.


I was trying to add some counter-intel (bounties countering something presented in an intel) and found it impossible. My idea was to offer another type of missions to the player, e.g.
  • Stop Smuggler - prevent the smuggler from reaching initial market, or making trip back
  • Stop Pirate Raid - fight and break the pirate raid before it reaches return (after successful raid) stage
  • Stop Trade Fleet - similar to Stop Smuggler, make sure the fleet never arrives at the destination
In all 3 cases, the bounty would be paid if player destroyed fleets associated with the initial intel. Could we please get a "CampaignFleetAPI getMainFleet()" and "List<CampaignFleetAPI> getFleets()" methods on intel objects that involve fleets (formalized via an interface)? This would allow to register own FleetEventListener (thus succeeding the bounty when initial one failed and vice versa) and check some other bits (to decide on bounty payout and to be able to generate sensible intel descriptions).
Thanks!

This isn't really possible - for example, for pirate raids, the fleets don't even exist much of the time, except as a "RouteData" (see: RouteManager) that resolves into an actual fleet only when the player is nearby.  Likewise for smugglers and trade fleets.

Hmm. Let me add TradeFleetDepartureIntel.getRouteData().

For RaidIntel, you can use getRouteSourceId() and cross-reference that with RouteManager to see the status of the fleets (or not-yet-fleets) involved - I think all the needed methods should be in place.


Naming constellations is difficult to figure out because NamePick is convoluted. Also, it would be nice if we had more control over the name and label. I'd like to see:

setNameOverride(String) // Set the constellation's name directly, bypassing the NamePick stuff and blocking addition of "constellation"/"nebula" in various places
setColorOverride(Color) // The color of the name label
setAngleOverride(float) // The angle of the name label

Added the name override method.


I looked in the API, and both the WeaponAPI and BeamAPI have this "getDamage()" method to the DamageAPI, while BeamAPI also has the "getWeapon()" method to get a WeaponAPI. Here, the Ion Beam goes straight from the BeamAPI to the damage instance, but the Tachyon Lance takes a detour through its WeaponAPI to achieve the same thing.

What is the significance of this? Is there any reason to use one format over the other? All I can think of is that one is a burst beam and one is a sustained beam, does that cause a difference in what is handled by the DamageAPI?

Ah, hmm - looking into it, they should both be using beam.getDamage(), this looks like a bug. It wouldn't have a major effect but I think a few things - such as the damage mutliplier based on the beam brightness, that sort of thing - would not get applied when getting damage from the WeaponAPI rather than the beam. Thank you!


I'd like to request a public method in BaseIndustry that allows for modification of the current build progress via
Code
protected float buildProgress

Done.


would be nice to
Code
weapon.getGlowSprite();
like we can do with main and barrel sprites. for consistency sake, if nothing else.

Done.


Not sure if this is technically api related but can the no sell tag be made to be useable on ships in the ship_data csv? Feels something that would be present with unboardable ships. Also allows for modders to be able to add ships that they don't want the player to get their hands on through the market.

Done.


I believe it's come up before but it would be pretty handy for WeaponAPI to have:

- setAmmoPerSecond()

Also potentially useful, though not specifically for anything I'd need:

- getReloadSize()
- setReloadSize()

Added AmmoTrackerAPI, retrieved via WeaponAPI.getAmmoTracker(), has ... a bunch of methods in it, including these.


com.fs.starfarer.api.combat.ShipSystemSpecAPI
  • JSONObject getSpecJson()

Done.
Title: Re: API request thread (please read OP before posting!)
Post by: Arcvale on January 05, 2021, 06:03:00 PM
I hate to make another request hot on the heels of a wave of excellent additions, but there's a number of extra levers that it would be nice to have for weapon-related applications of MutableShipStatsAPI.



 - getBeamRoFMult()

Continuous beams don't have a fire rate to affect, but burst beams do. Currently, when writing a ship system or hullmod that would modify weapon rate of fire, you need to decide whether to leave continuous beam damage unaffected, or attempt to compensate with getBeamWeaponDamageMult() and alter burst beam RoF and damage. Being able to alter beam RoF specifically would help a lot here.



 - getBeamAmmoBonus()

On the topic of beam-related edge cases, this would also be helpful to correct for burst-beam-related jank.



 - getBallisticMaxRecoilMult()
 - getBallisticRecoilPerShotMult()
 - getBallisticRecoilDecayMult()
 - getEnergyMaxRecoilMult()
 - getEnergyRecoilPerShotMult()
 - getEnergyRecoilDecayMult()
 - getMissileMaxRecoilMult()
 - getMissileRecoilPerShotMult()
 - getMissileRecoilDecayMult()

Weapon-type-specific recoil modifiers would be nice to use as a balancing factor alongside other modifiers. Something like lower-damage, lower-recoil ballistic projectiles, for example.



 - getBallisticProjectileSpeedMult()
 - getEnergyProjectileSpeedMult()
 - getMissileProjectileSpeedMult()

Same deal here - more tools to modify specifically one type of projectile velocity would be great.



Thank you, and my apologies if any of these are already set to be implemented and I've just missed them somehow  :)
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on January 05, 2021, 06:53:41 PM
Hi, and welcome to the forum!

Ah, these are more along the lines of "additions" rather than "exposing existing stuff via the API". I'll keep 'em in mind, but they're not the sort of thing I can just knock out super quick (and, importantly, not need to test much/at all) like the batch of stuff above.
Title: Re: API request thread (please read OP before posting!)
Post by: Arcvale on January 05, 2021, 07:07:33 PM
Hi, and welcome to the forum!

Ah, these are more along the lines of "additions" rather than "exposing existing stuff via the API". I'll keep 'em in mind, but they're not the sort of thing I can just knock out super quick (and, importantly, not need to test much/at all) like the batch of stuff above.

Ah, that's a shame, but thank you very much!
Title: Re: API request thread (please read OP before posting!)
Post by: theDragn on January 28, 2021, 12:30:50 PM
Two requests:

com.fs.starfarer.api.combat.MutableShipStatsAPI:

com.fs.starfarer.api.combat.WeaponAPI

Being able to access and modify beam velocity is definitely an edge case, but it would be useful.
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on February 08, 2021, 12:36:29 AM
Small request, could we have something along the lines of:

public void onDevModeReload() added to BaseModPlugin ?

That way mods would be able to reload their settings files easily instead of each having their everyFrame plugins running at once to detect a key press, or reload everything on every battle start (or restarting the whole game).
Title: Re: API request thread (please read OP before posting!)
Post by: RustyCabbage on February 12, 2021, 08:24:54 AM
Is it possible to get a

public void setHidden(boolean hidden) method in Industry, the way LionsGuardHQ is hidden if Sindria is not owned by the Diktat?
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on February 12, 2021, 08:27:48 AM
Small request, could we have something along the lines of:

public void onDevModeReload() added to BaseModPlugin ?

Just to make sure - specifically when would you like this to be called?
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on February 12, 2021, 08:38:19 AM
Right after using F8 to reload all the vanilla data files in dev mode. I can add a plugin that track button presses to MagicLib, but I figured the game does it already, so why not have it done the proper way.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on February 12, 2021, 09:17:59 AM
Right after using F8 to reload all the vanilla data files in dev mode. I can add a plugin that track button presses to MagicLib, but I figured the game does it already, so why not have it done the proper way.

Thank you! For some reason I was thinking in terms of the campaign and it wasn't quite clicking.

Added:

/**
 * Called after F8 is pressed in combat while in devMode.
 * Note: the game becomes potentially unstable after an F8-dev mode reload. That is,
 * crashes may occur that would not have occured otherwise and are not indicative of bugs.
 */
void onDevModeF8Reload();



Is it possible to get a

public void setHidden(boolean hidden) method in Industry, the way LionsGuardHQ is hidden if Sindria is not owned by the Diktat?

Did that.
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on February 12, 2021, 10:32:08 AM
Thank you very much!
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on February 12, 2021, 04:50:24 PM
No problem! (Bit off-topic, but I like your idea with the modSettings file, I hope it goes places.)
Title: Re: API request thread (please read OP before posting!)
Post by: RustyCabbage on February 21, 2021, 05:57:30 PM
Is it possible to get a

public void setHidden(boolean hidden) method in Industry, the way LionsGuardHQ is hidden if Sindria is not owned by the Diktat?

Did that.
Thanks a lot! Another request: I don't know how feasible this is on the back end, but would you be able to add

String getExtendedShipFilePath() to ShipHullSpecAPI and String getExtendedVariantFilePath() to ShipVariantAPI?
For example, using getShipFilePath() on a vanilla hullSpec provides the full ".../Fractal Softworks/Starsector/starsector-core/data/hulls/..." path, but the same method on a modded hullSpec only gives the "/data/hulls/..." portion.

Alternatively, some other method for determining what mod a given hullSpec/variant came from would work, but that's probably outside of the scope of this thread.
Title: Re: API request thread (please read OP before posting!)
Post by: devurandom on March 01, 2021, 05:03:10 PM
ShipHullSpecAPI.setNoCRLossSeconds(float)
BaseWeaponSpec.setOrdnancePointCost(float)

RuleAPI.getScript()
RuleScriptAPI.newInstance(String)

An API to control which markets contribute to the export market value would also be nice. e.g. Remove an isolationist faction from the global market or allow player colonies to contribute to market size.
Title: Re: API request thread (please read OP before posting!)
Post by: Carabus on April 08, 2021, 12:56:39 PM
Can I make a request to have the generation of the d-mod and s-mod bars on ship icon (see below) abstracted and made accessible to the modding API?

I mean these:

In Fleet screen: (here the bars even have tooltips)
(https://i.imgur.com/N5rnrpX.png)

In Refit screen:
(https://i.imgur.com/ehyw5p1.png)

The bars are also visible on ships icons in the encounter dialogs, and in fleet tooltips in campaign, no idea if elsewhere.

What I request is some way for a mod to decide how many and what color of bars it wants display on a ship icon, to possibly add extra types for some special hullmods in addition to the default green and red ones.
Right now they are hardcoded in the obfuscated part of the code (sorry to dig there, I wanted to check how hardcoded or moddable it is).
The hardcoded logic gets the number of d-mods and displays correct number of red bars with corresponsing tooltips, and then gets the number of built-in mods and displays green bars with corresponding tooltip, which is exactly what we see. What I request is to have this logic to be abstracted and fully or partially overridable by custom implementation.

Simple way - allow full replacement of default bars:

- overridable method getShipIconHullModBars() -> returns list of objects, each object representing one group of colored bars, with fields like this:

class HullModBarsGroup {
   Color barColor;
   int numberOfBars;
   String tooltipText;
}


More advanced way (not exclusive with simple way) - allow adding of new bars at specified place, without removing exisitng ones (would provide better compatibility between mods that all want to add their own special groups):

- overridable method getShipIconExtraHullModBars() -> returns list of objects, each object representing one group of colored bars, and its ordering, with fields like this:

class HullModBarsGroup {
   float order;
   Color barColor;
   int numberOfBars;
   String tooltipText;
}


The default implementation of getShipIconHullModBars() to match the current logic would look like this:

Code
public List<HullModBarsGroup> getShipIconHullModBars(ShipVariantAPI shipVariantAPI) {
   HullModBarsGroup dmodBars = new HullModBarsGroup(
       Color.red,
       DModManager.getNumDMods(shipVariantAPI),
       "Number of d-mods this ship has."
   );
   HullModBarsGroup storyModBars = new HullModBarsGroup(
       Misc.getStoryOptionColor(),
       Misc.getCurrSpecialMods(shipVariantAPI),
       "Number of built in mods this ship has. Only counts mods custom built in after the ship was produced."
   );

   return Arrays.asList(dmodBars, storyModBars);  // assuming they are added right-to-left, which seems to be the case
}
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on April 08, 2021, 02:19:26 PM
Can EMP become a DamageType, please?

It's the only kind of damage that doesn't have a type, can't be seen explicitly via DamageListener so far as I could tell, etc., etc.
Title: Re: API request thread (please read OP before posting!)
Post by: RustyCabbage on April 12, 2021, 06:03:19 AM
In HullModSpecAPI, could we get a setManufacturer(String manufacturer) method? Seems like you can change almost everything else.
Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on April 12, 2021, 11:55:49 AM
Could we get access to whatever script is determining if a skill is unlocked? The skill tree change has proven quite controversial to say the least and having a hundred modders trying to come up with a better system might yield interesting results. I have an idea myself I'd love to implement.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on April 13, 2021, 02:39:55 AM
1. Could we get some input taking UI elements added to the API? You can type your character name, so it does exist. Input box, text area...

2. Also renewing my ask from 0.9.1a for checkboxes - those also exists (codex for example) in core.

3. While I am sharing my wishlist... Could we get cargo / fleet member pickers to work outside of dialogs? Might be affected by the one below...

4. ... And finally renewing my ask for the ability to create UI elements (custom panels) on top of an existing screen. Hope this is not a huge change though (functionality exists, but I get it if it's highly coupled with other code). Ideally I'd love to create a smaller (blocking) panel on top of intel UI (or campaign UI), with an X button and custom content (kinda like you can view commodity demand/availability on top of current market screen).
Title: Re: API request thread (please read OP before posting!)
Post by: Nick XR on April 21, 2021, 11:03:58 PM
Would you please add a getter for the member DamagingExplosion.damagedAlready ?

Simply:
Code
    public List<Ship> getDamagedAlready() {
        return this.damagedAlready;
    }

Need this in the Detailed Combat Results mod to watch for doom damages.

Thanks!!!
Title: Re: API request thread (please read OP before posting!)
Post by: Wyvern on May 08, 2021, 08:53:07 AM
It'd be useful if BoostIndustryInstallableItemEffect had at least getters for its protected values; right now, if I want to determine if a thing to be installed in a non-player market is better or worse than what's already installed, I have to:
1: Register my own campaign event listener, because the vanilla implementation in CoreScript just uses Industry.wantsToUseSpecialItem(), which (for vanilla industries) will never allow item upgrades outside of the one corrupted-to-pristine-nanoforge case.
2: Use Industry.getSupplyBonus().getFlatStatMod() with the special item's ID to see if the industry's existing special item provides a bonus - and whether that bonus is larger or smaller than the one offered by the mod item I'm adding.

This is all a bit inconvenient. Honestly, what I'd really like is a 'priority' value in special_items.csv that could then be read by the default implementation of Industry.wantsToUseSpecialItem(), allowing multiple mod-added installable items to co-exist without everyone involved needing their own workaround code.
(Though, even there, I'd still need my own CampaignEventListener, as the default CoreScript implementation assumes that there are no installable items that can apply to multiple industry types - so if you sell a stack of two-or-more such items, it will install exactly one of them.)
Title: Re: API request thread (please read OP before posting!)
Post by: Sutopia on May 17, 2021, 11:19:54 AM
Fighters deserve a separate interface altogether.
I mean a class implementing ShipAPI.
Especially regarding AI of fighters, I only want to override the behavior when carrier is set to engage but currently can’t; or maybe someone would want to override only the regroup behavior.

Or at very least add the setEngageAI() and setRegroupAI() to ShipAPI.
Title: Re: API request thread (please read OP before posting!)
Post by: Sutopia on June 03, 2021, 10:03:02 AM
For BaseHullmodAPI, I think it would be reasonable to have a method ConditionalRequired that returns a map of hullmod id and a condition interface that has a single method returning boolean.

The main purpose is addressing the assault package exploit where you build the package in then remove the militarized subsystem. With this method added it can hook an additional not-removable check for the required hullmod to mitigate the exploit.
Title: Re: API request thread (please read OP before posting!)
Post by: Yunru on July 10, 2021, 01:26:29 AM
I would very much like a way to add (and remove) AIHints for ships.

(For example, an installable Missile Autoforge would make great use of adding the ALWAYS_PANIC hint, so the AI actually makes use of its infinite missiles.)
Title: Re: API request thread (please read OP before posting!)
Post by: Mira Lendin on August 14, 2021, 03:55:42 AM
As if right now there is no way to get the Original Weapon id for any projectile on the map, you can only get the id for the weapon that was assigned to the projectile the moment it was created (example:"engine.spawnProjectile(...etc") if you try to get the id of the Damaging Projectile weapon it will return the id of it's assigned weapon and not it's original weapon as mentioned in the Excel file, this can cause some catastrophic crashes if you try to replicate a projectile that was created by a beam weapon via a script since the engine will try to spawn projectiles based on the responsible beam weapon instead.
(in short, plz give us the ability to obtain WeaponSpecId from ProjectileSpecAPI)
Title: Re: API request thread (please read OP before posting!)
Post by: theDragn on August 22, 2021, 07:40:17 PM
Can we get MissileAPI.setSprite()? MissileAPI lets us get the sprite, but not change it for an existing missile.
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on August 28, 2021, 05:42:31 AM
Can I get 'no_autofit' tag but for .variant files or at least in the form of a boolean? Basically don't sanitize this variant if this variant gets picked for this hull, but sanitize every other variant that doesn't have the no_autofit.
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on August 31, 2021, 08:56:10 PM
Can I get a request for TextPanelAPI.addSkillPanel(PersonAPI person, boolean admin) to list skills that aren't admins or combat-only skills? It's for a quest that grants a random skill for the player to keep as a reward.
Title: Re: API request thread (please read OP before posting!)
Post by: Ruddygreat on September 09, 2021, 12:43:03 PM
can we get removeSMod and addSMod, the same as add/removeMod and add/removePermaMod?

I'd like it for some faction-specific hullmod replacements, so they override autofitted smods properly (and it just kinda seems weird that it isnt a thing already) 
Title: Re: API request thread (please read OP before posting!)
Post by: IonDragonX on October 01, 2021, 07:16:48 AM
Finally, a new UI component - rich table - is still needed. It will have clickable headers (sorting) and allow for variable cell content like button, image, or text. Yes, we have it in Starsector, but it is not exposed via API so need to build it myself (Alex plz).
Title: Re: API request thread (please read OP before posting!)
Post by: RustyCabbage on October 02, 2021, 07:09:42 PM
I'd like a ShipHullSpecAPI.getDeploymentPoints() or some equivalent. Currently I think the only way to obtain it is either loading the ship_data.csv or grabbing it from FleetMemberAPI.getStats().getSuppliesToRecover().getBaseValue() or something to that effect.
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on October 10, 2021, 03:18:50 PM
Would it be possible to change the behavior of ShipAPI.getFleetMember() and MutableShipStatsAPI.getFleetMember() to more reliably return real fleet members instead of dummy fleet members?

Currently, the "stats" and "ship" arguments passed to the various BaseHullMod methods will return dummy fleet members if the hullmod is attached to a module, instead of returning the actual fleet member the module is attached to. Furthermore, modules in this context will present as if they're not modules for other reasons, returning false with isStationModule and null with getParentStation. This makes it very difficult to determine what fleet member the module is attached to.

I realize this might not be feasible if vanilla code relies on the existing behavior of getFleetMember, but I figured I might as well ask. Thanks for considering!
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on October 13, 2021, 08:58:18 PM
The ship system WEAPON_BOOST AI only activates against fighters for frigates. Could we get a way to trigger this behavior for certain larger ships?

An ANTI_FTR ship tag or WEAPON_BOOST_ANTI_FTR AI would do.
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on October 16, 2021, 06:44:18 PM
Code
	public static boolean isUnboardable(FleetMemberAPI member) {
return isUnboardable(member.getHullSpec());
}

public static boolean isUnboardable(ShipHullSpecAPI hullSpec) {
if (hullSpec.getHints().contains(ShipTypeHints.UNBOARDABLE)) {
for (String tag : getAllowedRecoveryTags()) {
if (hullSpec.hasTag(tag)) return false;
}
if (hullSpec.isDefaultDHull()) {
ShipHullSpecAPI parent = hullSpec.getDParentHull();
for (String tag : getAllowedRecoveryTags()) {
if (parent.hasTag(tag)) return false;
}
}
return true;
}
return false;
}
Would it be possible for the Misc.IsUnboardable to check for the variant's tag of this fleet member as well? It is slightly annoying to duplicate a ship and make it unrecoverable when a variant's tag could do :(
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on October 27, 2021, 03:21:10 AM
Can there be something like "OfficerPickerListener" and "SkillPickerListener", that can be called by something like "void showOfficerPickerListener(...)" in InteractionDialogAPI, just like existing CampaignEntityPickerListener or so?

I'm expecting something like existing officer picker that displays when selecting officer for a ship, or existing skill picker that displays when selecting skills for officers when they got a level up
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 05, 2021, 01:23:07 PM
Thank you for the suggestions/requests, everyone! A reminder that this thread is for things that already exist but aren't exposed in the API, not new features. I don't particularly mind if stuff crosses over into that territory, but given that I generally go through this thread late in the release cycle, anything that requires substantial effort is not likely to get done.

With that out of the way, did a bunch of these!
Added SettingsAPI.computeStringWidth(String in, String font)
Added TooltipMakerAPI.computeStringWidth(String in)
Added HullModSpecAPI.setManufacturer()
Added DamagingProjectileAPI.List<CombatEntityAPI> getDamagedAlready()
   Returns null for everything other than explosions
   Added getters and setters to BoostIndustryInstallableItemEffect
"no_autofit" tag now also works when applied to variants
Added "unboardable" tag to variants
Added TextFieldAPI
Added to TooltipMakerAPI:
   TextFieldAPI addTextField(float width, float pad);
   TextFieldAPI addTextField(float width, String font, float pad);
   TextFieldAPI addTextField(float width, float height, String font, float pad);
ButtonAPI addCheckbox(float width, float height, String text, UICheckboxSize size, float pad);
   ButtonAPI addCheckbox(float width, float height, String text, String font, Color checkColor, UICheckboxSize size, float pad);
Added to SettingsAPI:
   TextFieldAPI createTextField(String text, String font);
ButtonAPI createCheckbox(String text, UICheckboxSize size);
ButtonAPI createCheckbox(String text, String font, Color checkColor, UICheckboxSize size);
Added to InteractionDialogAPI:
   Version of showCargoPickerDialog() that takes a custom dialog size as a parameter
Added to WeaponSpecAPI:
   void setOrdnancePointCost(float armamentCapacity);



3. While I am sharing my wishlist... Could we get cargo / fleet member pickers to work outside of dialogs? Might be affected by the one below...

4. ... And finally renewing my ask for the ability to create UI elements (custom panels) on top of an existing screen. Hope this is not a huge change though (functionality exists, but I get it if it's highly coupled with other code). Ideally I'd love to create a smaller (blocking) panel on top of intel UI (or campaign UI), with an X button and custom content (kinda like you can view commodity demand/availability on top of current market screen).

That's unfortunately a bit complicated, yeah. Sorry!


can we get removeSMod and addSMod, the same as add/removeMod and add/removePermaMod?

I'd like it for some faction-specific hullmod replacements, so they override autofitted smods properly (and it just kinda seems weird that it isnt a thing already)

It's a thing - addPermaMod() has a boolean parameter that sets whether it's an s-mod that's being added.

I'd like a ShipHullSpecAPI.getDeploymentPoints() or some equivalent. Currently I think the only way to obtain it is either loading the ship_data.csv or grabbing it from FleetMemberAPI.getStats().getSuppliesToRecover().getBaseValue() or something to that effect.

That already exists - ShipHullSpecAPI.getSuppliesToRecover()


The ship system WEAPON_BOOST AI only activates against fighters for frigates. Could we get a way to trigger this behavior for certain larger ships?

Hmm - Accelerated Ammo Feeder uses that AI, so I suspect this isn't actually the case?

Would it be possible to change the behavior of ShipAPI.getFleetMember() and MutableShipStatsAPI.getFleetMember() to more reliably return real fleet members instead of dummy fleet members?

Currently, the "stats" and "ship" arguments passed to the various BaseHullMod methods will return dummy fleet members if the hullmod is attached to a module, instead of returning the actual fleet member the module is attached to. Furthermore, modules in this context will present as if they're not modules for other reasons, returning false with isStationModule and null with getParentStation. This makes it very difficult to determine what fleet member the module is attached to.

I realize this might not be feasible if vanilla code relies on the existing behavior of getFleetMember, but I figured I might as well ask. Thanks for considering!

Ahh, this is... let's call it "code that's potentially very sensitive/error prone" and I don't want to touch it unless I absolutely have to. My apologies!
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on November 06, 2021, 08:22:51 PM
The ship system WEAPON_BOOST AI only activates against fighters for frigates. Could we get a way to trigger this behavior for certain larger ships?

Hmm - Accelerated Ammo Feeder uses that AI, so I suspect this isn't actually the case?

Huh, tested Hammerhead and Roider Union's Firestorm and they do use their AAF vs fighters in 0.95a. They did not in 0.9.1a (tested that too) and I don't recall seeing any patch note mentioning a change in behavior.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 07, 2021, 01:40:55 AM
Quote
    4. ... And finally renewing my ask for the ability to create UI elements (custom panels) on top of an existing screen. Hope this is not a huge change though (functionality exists, but I get it if it's highly coupled with other code). Ideally I'd love to create a smaller (blocking) panel on top of intel UI (or campaign UI), with an X button and custom content (kinda like you can view commodity demand/availability on top of current market screen).

What if this was rephrased into the ability to hide more parts of interaction dialog API? Right now you can hide text or visual panels, but I'd like to hide text and option panels (and have visual panel extend to take over freed space), thus have one big visual panel to work with.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 07, 2021, 08:29:03 AM
Huh, tested Hammerhead and Roider Union's Firestorm and they do use their AAF vs fighters in 0.95a. They did not in 0.9.1a (tested that too) and I don't recall seeing any patch note mentioning a change in behavior.

Ah, that's entirely possible; the patch notes are definitely not 100% inclusive.


Quote
    4. ... And finally renewing my ask for the ability to create UI elements (custom panels) on top of an existing screen. Hope this is not a huge change though (functionality exists, but I get it if it's highly coupled with other code). Ideally I'd love to create a smaller (blocking) panel on top of intel UI (or campaign UI), with an X button and custom content (kinda like you can view commodity demand/availability on top of current market screen).

What if this was rephrased into the ability to hide more parts of interaction dialog API? Right now you can hide text or visual panels, but I'd like to hide text and option panels (and have visual panel extend to take over freed space), thus have one big visual panel to work with.

I was thinking you needed it in a different context - i.e. the intel screen. For this, actually, there *will* be something in the new release that should cover it:

InteractionDialogAPI.showCustomVisualDialog(float customPanelWidth, float customPanelHeight, CustomVisualDialogDelegate delegate);

Code
public interface CustomVisualDialogDelegate {
public interface DialogCallbacks {
void dismissDialog();
FaderUtil getPanelFader();
}
void init(CustomPanelAPI panel, DialogCallbacks callbacks);
CustomUIPanelPlugin getCustomPanelPlugin();
float getNoiseAlpha();
void advance(float amount);
void reportDismissed(int option);
}

Basically you get a custom dialog that's *entirely* a CustomPanelAPI, aside from the border decorating it. So it needs to handle being dismissed etc, but you get full control over its contents.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 07, 2021, 09:00:10 AM
This is exactly what I wanted, an ability to have a CustomPanelAPI that is not tied to intel ui or is not a section of interaction dialog plugin.

Can I conjure it in place of interaction dialog plugin? It doesn't implement InteractionDialogPlugin which makes sense, so if not then how do you create one (from where).
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 07, 2021, 10:31:53 AM
Ah - you need to call it from an InteractionDialogAPI, so it's not quite what you're thinking.

InteractionDialogAPI.showCustomVisualDialog(float customPanelWidth, float customPanelHeight, CustomVisualDialogDelegate delegate);
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 07, 2021, 01:54:27 PM
Ah, right. Still, I have this mastered already - dummy InteractionDialogPlugin that calls showCustomVisualDialog in init() and is dismissed from the CustomVisualDialogDelegate that is spawned. Looks decent as long as the InteractionDialogPlugin is empty (no text, no options, no visuals). Should do with my needs :)
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 07, 2021, 02:10:48 PM
Ok, excellent :)
Title: Re: API request thread (please read OP before posting!)
Post by: RustyCabbage on November 07, 2021, 03:00:51 PM
I'd like a ShipHullSpecAPI.getDeploymentPoints() or some equivalent. Currently I think the only way to obtain it is either loading the ship_data.csv or grabbing it from FleetMemberAPI.getStats().getSuppliesToRecover().getBaseValue() or something to that effect.

That already exists - ShipHullSpecAPI.getSuppliesToRecover()
ah, looks like this is a new one, since it doesn't seem to be in the current javadoc and my IDE can't find it. Regardless, thanks!
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 07, 2021, 03:03:54 PM
Ahh, ok!
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 09, 2021, 02:32:26 PM
If it's not too late, could we have an update of Tags constants (com.fs.starfarer.api.impl.campaign.ids)? Didn't see "HIDE_IN_CODEX" or "omega" entries. Could be more missing...

From another thread:
Yeah, the rendering for all of these is done with some internal (and relatively involved) code, it's not as simple as just drawing a sprite. Consider that blueprints are composited from a base image and what they're a blueprint of, and that ship icons have a faint grid overlaid on top of them, that sort of thing.

Would it be possible to get overloaded methods for `beginImageWithText()` instead? One that takes CargoStackAPI and one that takes FleetMemberAPI (or ShipHullSpecAPI if it makes it easier) instead of the sprite string, that ties into that logic? For completeness, it would be great to have `addImage()` accept those as well.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 13, 2021, 04:38:36 AM
Tiny ask for more button cutstyles - NONE, TL_BL, TR_BR, TL, TR, BL, BR.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 22, 2021, 06:24:39 AM
And, how big of an ask would it be to have a showShips / showCargo methods that take "boolean showTooltips" and display regular tooltips when hovering over a ship / item?
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 22, 2021, 09:23:18 AM
I'll keep it in mind! At this point in the release cycle, though, need to focus on playtesting and making any changes/fixes that stem from that - so I don't think I'll be able to work it in for this release.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on November 23, 2021, 01:37:57 AM
Yup, I wasn't expecting any of these for 0.95.1 - either 0.95.2 (if there is any) or later. Lifting the lid off my wish-list jar, there's one more item I would dearly love to see: the ability to manipulate scrollers programmatically.

Currently, if I want to have a button that changes the state of the CustomPanelAPI (either the one it resides in or elsewhere that is displayed as part of the same view) I have to call `ui.updateUIForItem(this)`. This causes the whole thing to recreate the panel (createLargeIntel()), and shows the default state (every scroller that exist in this view is parked at the top). I am happy to do the legwork, e.g. check scroller position for each CustomPanelAPI, store it internally in my structures, and when I create the same panel in the new call - reapply the scroller.

A bare minimum that I would need is thus:
Code
float CustomPanelAPI.getScrollPosition();
void CustomPanelAPI.setScrollPosition(float);

Now, I THINK I could work this around and correct me if I am wrong. I could be keeping references to every CustomPanelAPI that was created as part of my UI (the ones that I allow scrollers at least), and on consecutive calls reusing them instead of creating a new one. Which is ugly, as these will have been created with different CustomPanelAPIs (from previous calls, so things could break). And it would have to be transient, of course, as resolution could have changed between loads affecting element sizes, and thus scroller positions.
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on November 29, 2021, 07:40:29 PM
I would love it if this was possible. I'd like to expand missions and reward players who take the time to do the mission task.

SettingsAPI.getMissionScore(String missionid)

//Replaces the "Your forces achieve a..."
MissionDefinitionAPI.setCustomMinorVictoryMessage(String text)
MissionDefinitionAPI.setCustomMajorVictoryMessage(String text)
MissionDefinitionAPI.setCustomLossMessage(String text)
and.. any other messages I'm forgetting  :-\ if possible.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on November 29, 2021, 08:20:26 PM
Now, I THINK I could work this around and correct me if I am wrong. I could be keeping references to every CustomPanelAPI that was created as part of my UI (the ones that I allow scrollers at least), and on consecutive calls reusing them instead of creating a new one. Which is ugly, as these will have been created with different CustomPanelAPIs (from previous calls, so things could break). And it would have to be transient, of course, as resolution could have changed between loads affecting element sizes, and thus scroller positions.

I *think* that would work, yeah.


I would love it if this was possible. I'd like to expand missions and reward players who take the time to do the mission task.

SettingsAPI.getMissionScore(String missionid)

(Added this one since it was trivial; the other stuff is a bit less so, so, not this time around...)
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on November 30, 2021, 06:09:23 PM
(Added this one since it was trivial; the other stuff is a bit less so, so, not this time around...)

That's okay!

Is it possible to have leader_attack_at_an_angle as well?

I'm using leader_no_swarm and attack_at_an_angle to a surprising degree on certain wings and it seems to work as expected except the wing leader never seems to face the target (just controls the wing formation around). Could the leader be encouraged to face the target and strafe around instead?
Title: Re: API request thread (please read OP before posting!)
Post by: stormbringer951 on December 04, 2021, 09:08:48 AM
Would it be possible to add some method to register programmatically created variants with the methods used by the variant ID lookup so I can call these SettingsAPI methods on some new variant ID that did not exist at startup:

Code
void addDefaultEntryForRole(java.lang.String role, java.lang.String variantId, float weight)
void addEntryForRole(java.lang.String factionId, java.lang.String role, java.lang.String variantId, float weight)

I would like to programmatically create variants, but since they can't be added to the variant id lookup, I can't dynamically create variants, add default roles for them and add them to faction's known ships & doctrines.
Title: Re: API request thread (please read OP before posting!)
Post by: Nick XR on December 04, 2021, 12:47:05 PM
Would it be possible to add some method to register programmatically created variants with the methods used by the variant ID lookup so I can call these SettingsAPI methods on some new variant ID that did not exist at startup:

Code
void addDefaultEntryForRole(java.lang.String role, java.lang.String variantId, float weight)
void addEntryForRole(java.lang.String factionId, java.lang.String role, java.lang.String variantId, float weight)

I would like to programmatically create variants, but since they can't be added to the variant id lookup, I can't dynamically create variants, add default roles for them and add them to faction's known ships & doctrines.

If we're talking about adding things programmatically, being able to do that with weapons would be great too.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on December 17, 2021, 01:54:06 AM
Code
InteractionDialogAPI.hideOptionPanel()
InteractionDialogAPI.showOptionPanel()

We can already toggle visual and text panels, but not the option panel. The only way to draw a custom panel or cargo picker is currently to spawn an empty interaction dialog, and call showXXX on it. Unfortunately, you still see "You decide to..." in the background, even if there are no options to select.

Alternative - just autohide if option list is empty?
Title: Re: API request thread (please read OP before posting!)
Post by: SikeSky on December 23, 2021, 03:45:22 AM
New here! I was told this was the best place to bring this up.

Currently all ship systems will "reset" the colors of the ship's shields upon deactivation, not just ship systems that alter the color of the shields (like Fortress Shields). This causes unintended behavior with ships with hullmods etc. that change the color of ship's shields. A
Code
boolean resetShieldColor()
or something similar would at least allow us to stop that from happening, although given how hard it was to track down I think it'd be best if the behavior was simply isolated to ship systems that change the shield colors. Have them grab the current colors and then go back to that when they're done, maybe?
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on December 29, 2021, 07:03:55 PM
can there be something like setPhase(String id, float phaseUpkeep, float phaseCost), that like setShield() in ShipAPI?

and, then maybe not an API request but some advice..?
In "logistical data", can "Maxium burn" and "Fuel / light year, jump cost" 's number colored red, same with "Fuel capacity"? like all crew-concerned numbers colored cyan.
Title: Re: API request thread (please read OP before posting!)
Post by: tomatopaste on December 30, 2021, 01:38:02 AM
There is currently a problem with making vanilla hullmods incompatible with modded hullmods, so i'm suggesting a solution like this:

public class CoolModPlugin extends BaseModPlugin {

  public boolean pluginCheckHullmodIsCompatible(String installed, String candidate, ShipAPI ship) {
    if (installed.Equals("my_cool_hullmod") && candidate.equals("safetyoverrides") return false;
    return true;
  }
}

When a hullmod is moused over in the selection GUI or any other time a hullmod is applied to a variant, the game could iterate through all modplugins (like it does with plugin pick missile AI) and get a boolean for compatibility, there shouldn't be any cross-mod conflicts with this logic.
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on January 04, 2022, 05:48:11 PM
Code
{"freq":0, "tip":"You can change the frequency of tips by adding a json object instead of a string, like so. For example, this tip has a frequency of 0 and will never show up. The default freq value is 1."},

I'm interested in this type of code... can there be a method in the SettingsAPI that lets modders set frequency of these tips and/or remove tips?

Asking so that tip frequencies can be modified based on mod interactions and compatibility.
Title: Re: API request thread (please read OP before posting!)
Post by: sphr on January 12, 2022, 09:27:45 PM
Class:

Code
com.fs.starfarer.api.combat.HullModEffect:

Request:

Add method :
Code
/*
*  If return true and hullmod is "visible", the hullmod will be displayed normally in the choosing list at the refit screen. 
*  If return false, it will be hidden from the list.
*  No effect on invisible hullmods.
*  default implementation in BaseHullMod (default when not overriden) should return true.
*/
public boolean isDisplayedToShip(com.fs.starfarer.api.combat.ShipAPI arg0);


Use case:
When there are many hullmods created which is only applicable for a small number of ship types, they will appear as non-applicable to all other ships.
This one allows the mod developer of those hull mods to set it such that the hullmods will only appear for the applicable ships and will be hidden from other ships, thus avoiding clogging up the hull mod selection list with a large number of totally irrelevant hullmods for the latter case.



Title: Re: API request thread (please read OP before posting!)
Post by: Harmful Mechanic on January 16, 2022, 07:01:13 PM
Would it be possible to set an individual market to override the base faction file's known blueprints, and populate with ships and weapons from another faction?

I'm trying to create 'localized' independent/pirate worlds that sell mainly local weaponry, but still behave like Independent and Pirate markets.

(This seems like it would have some utility for making independent worlds in vanilla a little more textured, too.)
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on January 16, 2022, 11:55:12 PM
Already doable. One csv file (submarkets.csv) and one class with one method.

Make a new submarket (say my_open_market), write your own plugin for it that extends OpenMarketPlugin, and in it override updateCargoPrePlayerInteraction().

Title: Re: API request thread (please read OP before posting!)
Post by: Tartiflette on January 18, 2022, 11:50:39 PM
Ok this one might be a bit out there, but I was wondering if instead of hardcoded weapons and lcp categories, hullmods could affect a few basic stats of "weaponsWithTag" and "lcpWithTag"?

stats.weaponsWithTag("tag").getRoFMult().modifyMult(id, 1.5f);
stats.lcpWithTag("tag").getOpCost().modifyFlat(id, -5f);


I would definitely be thrilled to be able to affect the OP cost of some special weapons with a built-in hullmod. Like, faction specific weapons get a -2 OP cost on ships of that faction.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on January 20, 2022, 04:14:47 AM
Could we get an explicit mod load order? Keep the current rules, but allow for new field in mod_info.json - priority. By default, all are 0, and the field takes -INT to +INT.

Also, could `TooltipMakerAPI:addSkillPanel()` method get an overloaded version that additionally takes the number of columns. Sometimes you want 1 (small intel, like in here https://fractalsoftworks.com/forum/index.php?topic=23871), sometimes 3 or more (large intel).
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on January 23, 2022, 12:19:18 PM
Can CoreUITabId.OFFICERS be removed? It doesn't seem to serve a purpose other than confusing hapless people like me.

Global.getSector().getCampaignUI().getCurrentCoreTab() returns either REFIT or FLEET when the officer panel is open, and showCoreUITab(CoreUITabId.OFFICERS) doesn't seem to do anything at all.

Also, in case there's no way to do it (still trying to find one...), I suppose I should request a way to find out if the officer panel is open.

Title: Re: API request thread (please read OP before posting!)
Post by: lyravega on February 06, 2022, 09:15:05 AM
A method to do stuff when a hullmod is removed, something like `BaseHullMod.onRemoval(ShipAPI ship)` perhaps?

Edit: More reasonable method name suggestion.

Necro'ing this one! An 'onRemoval' would certainly be useful for some crazy hullmods. If it can also refresh the refit screen with a boolean perhaps, that'd be golden!

'BaseHullMod.onRemoval(ShipAPI ship, boolean refresh)'
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on February 14, 2022, 01:36:08 PM
We have `beginGrid` and `beginGridFlipped`, but only `beginTable`. Could you add `beginTableFlipped`? The first column is the header row, and each "row" is a new column.

Also, the ability to "skip" header row in regular table would be great (so I can create fake header row using areacheckbox which looks the same and have them interactive :rubs_hands_in_glee: ).


Finally, the ability to add buttons to this special reserved space at the bottom (I'd love to put my "Delete" button next to "Show on map" button).
Spoiler
(https://media.discordapp.net/attachments/908476833736060969/943117654527471626/unknown.png)
[close]
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on February 15, 2022, 07:37:18 AM
I would like a data flag for the MissileAPI similar to MissileAPI.isMine() for Terminator Sequence and other fun missile concepts you have been teasing with on Twitter...
Title: Re: API request thread (please read OP before posting!)
Post by: WalrusJJones on February 15, 2022, 01:02:29 PM
A set of companion interfaces to Combat.Listeners.WeaponRangeModifier.

IE: Combat.Listeners.WeaponVelocityModifier, Combat.Listeners.WeaponRecoilModifier, being a few small interface for listeners that allows specific behaviors to be applied to specific subsets of weapons similar to how ballistic range finder targets just small class ballistics (And sometimes mediums.)

#Velocity
float getWeaponVelocityPercentMod(ShipAPI ship, WeaponAPI weapon);
float getWeaponVelocityMultMod(ShipAPI ship, WeaponAPI weapon);
float getWeaponVelocityFlatMod(ShipAPI ship, WeaponAPI weapon);

#Recoil
float getWeaponRecoilPercentMod(ShipAPI ship, WeaponAPI weapon);
float getWeaponRecoilMultMod(ShipAPI ship, WeaponAPI weapon);
float getWeaponRecoilFlatMod(ShipAPI ship, WeaponAPI weapon);

With similar interfaces for base spread, spread recovery, maximum spread.

This is a big opening in the API but it is likely worthwhile: The logic introduced to weapon logic and weapon range in ballistic rangefinder and high scatter amplifier is extremely versatile, but only a tiny subset of stats (Damage, and range,) being reachable in this granular way makes is fairly limiting when it comes to using the existing combat listeners, as we cannot modify related stats to the same degree of detail without workarounds. As the effective result of these mods is that we can do targeted edits of mutable stats at the ship level at the weapon level as needed.

Example: Without this, say we wanted to do make a hullmod that increases velocity and range at the cost of damage for small energy weapons. We would have to apply the damage and velocity effects globally to all energy weapons at the ship scale, but only the small energy weapons would benefit from the range (without very aggressive workarounds.)

The existing combat listener API is extremely exciting, and if it was opened up a little more, a large swath of flavorful, role defining hullmods and ship systems could be made pretty efficiently.
Title: Re: API request thread (please read OP before posting!)
Post by: Sutopia on February 16, 2022, 07:25:16 AM
A method to do stuff when a hullmod is removed, something like `BaseHullMod.onRemoval(ShipAPI ship)` perhaps?

Edit: More reasonable method name suggestion.

Necro'ing this one! An 'onRemoval' would certainly be useful for some crazy hullmods. If it can also refresh the refit screen with a boolean perhaps, that'd be golden!

'BaseHullMod.onRemoval(ShipAPI ship, boolean refresh)'

I think it’s a terrible idea given the ways of removal are inconsistent
For example, remove by undo will simply restore to the initial variant “checkpoint”  and skip pretty much any call, as it should. If your call is counting on this behavior or the other way (call onRemove even on undo), it’s inherently bad design that ignores the interface.
Title: Re: API request thread (please read OP before posting!)
Post by: lyravega on February 19, 2022, 11:24:11 AM
A method to do stuff when a hullmod is removed, something like `BaseHullMod.onRemoval(ShipAPI ship)` perhaps?

Edit: More reasonable method name suggestion.

Necro'ing this one! An 'onRemoval' would certainly be useful for some crazy hullmods. If it can also refresh the refit screen with a boolean perhaps, that'd be golden!

'BaseHullMod.onRemoval(ShipAPI ship, boolean refresh)'

I think it’s a terrible idea given the ways of removal are inconsistent
For example, remove by undo will simply restore to the initial variant “checkpoint”  and skip pretty much any call, as it should. If your call is counting on this behavior or the other way (call onRemove even on undo), it’s inherently bad design that ignores the interface.

I wrote a script to detect hullMod changes. I will share it when I finalize it. It is pretty much finalized, but the rest of the mod is giving me a headache =)
Title: Re: API request thread (please read OP before posting!)
Post by: Sutopia on February 20, 2022, 07:07:06 PM
Not new API but how existing API work:
Title: Re: API request thread (please read OP before posting!)
Post by: Schaf-Unschaf on February 21, 2022, 02:54:35 AM
I've got two suggestions for the API:
We could then use the SS native tools for creating combat prompts, dialogs, menus etc. and not do it the hard and hacky way with lwjgl :-/
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on March 09, 2022, 09:12:46 AM
Please expose "descriptionPrefix" in .ship files.
Title: Re: API request thread (please read OP before posting!)
Post by: tomatopaste on March 13, 2022, 10:53:58 PM
RENDER_OVER_SHIPS layer for combat layered rendering plugins (above ships and below weapons/engines)

Also RENDER_OVER_ENGINES, same as above but above engines instead (still below weapons)
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on March 15, 2022, 03:27:12 AM
I would like a rulecmd implemented in vanilla or an OR operator for Rule Scripting.

It seems rather inconvenient that this never existed in the current rulecmd packages. I see 5 major mods that use a custom rulecmd just use an OR operator for certain conditions.

Code
EitherOr <memkey> <memkey> <memkey> <memkey> ...
return true if any of the memory key return true or something like that really...

Might be really useful for modders when they want a rule check for $player.fuel >= 50 or $player.supplies >= 100
...
 :-[

Title: Re: API request thread (please read OP before posting!)
Post by: shoi on April 01, 2022, 09:03:34 AM
Could we get a tag that'd make ships incapable of capturing points?
Title: Re: API request thread (please read OP before posting!)
Post by: Schaf-Unschaf on April 06, 2022, 05:04:06 AM
Would it be possible to expose a Setter for the field
Code
cargoSpacePerUnit
via
Code
CargoStackAPI
? So we can dynamically change the size of items.
Title: Re: API request thread (please read OP before posting!)
Post by: theDragn on April 25, 2022, 03:31:16 AM
Can we get FluxTrackerAPI's ventflux() method exposed? Use case is currently a "burst vent" system.

Also MissileAPI.setSprite(), if possible. (Or ideally a setSprite() for all projectiles, but I don't know how feasible that is). Use case is missiles that would require animation, and repeated projectile swaps to achieve that is less than ideal.

edit with a third request- is it possible to add a method to manipulate a beam's endpoint? ie, BeamAPI.setTo()? it's for this:
Spoiler
(https://cdn.discordapp.com/attachments/835725831534936104/980767394194653185/Pen.gif)
[close]
Title: Re: API request thread (please read OP before posting!)
Post by: Liral on April 26, 2022, 06:22:42 AM
Move the files and folders in java/com/fs/starfarer/api/impl into the appropriate folders of java/data to let modders easily modify them and unify file storage.

Title: Re: API request thread (please read OP before posting!)
Post by: Timid on May 04, 2022, 12:57:48 AM
I'd like to assume CommandGroup is an int (I'm assuming if that's how the current Starsector's Command Group works) from 0-9.

CombatTaskManagerAPI.getCommandGroupFor(ShipAPI ship) returning a CommandGroup if assigned at all or null if not assigned.
CombatTaskManagerAPI.setCommandGroupFor(ShipAPI ship, int CommandGroup) assigns a CommandGroup or unassigns if CommandGroup is left null to the ship.
CombatTaskManagerAPI.getCommandGroup(int CommandGroup) returning a List of ShipAPI in that CommandGroup or null if there are no ships assigned at all (possibly if dead or retreated).

I'd like to know if these method requests are possible at all or Command Groups aren't even in the CombatTaskManagerAPI to be manipulated at all...

I'd like to do some Main Menu missions where ships arrive in reinforcement when some enemies are defeated and then reinforcement ships are instantly deployed (doable) and assigned orders immediately (without the player's commitment to action, doesn't seem to be doable at the moment). While also if players wanted to see who is part of that reinforcement they could always press a number to see.
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on June 01, 2022, 11:27:10 PM
please expose enum "missileType"(in .proj files,) like MissileType getType() for MissileSpecAPI
and enum "behavior"(in .proj files), like BehaviorType getBehaviorType() for MissileSpecAPI/ProjectileSpecAPI

and please add something like getBehaviorSpec(), setBehaviorSpec(), getProximityExplosionEffect() and setProximityExplosionEffect() for MissileSpecAPI and ProjectileSpecAPI
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on June 11, 2022, 07:22:53 PM
Being able to do custom colors for jump points would be nice. Could you expose a color override for JumpPointAPI?

Color getColorOverride();
void setColorOverride(Color colorOverride);
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on June 14, 2022, 03:09:10 AM
It'd be strange if there are only getProgress and no setProgress, setters are actually useful, so please add:
void setAmmoReloadProgress(float progress); for ShipSystemAPI
void setReloadProgress(float progress); for AmmoTrackerAPI
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on June 24, 2022, 09:43:13 PM
Asking for MarketConditionSpecAPI to have setters as well, they are really useful.

Strange for it to have setDecivRemove and setIcon, but not
Code
void setDesc(string desc); for MarketConditionSpecAPI
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on June 26, 2022, 01:35:22 AM
It'd be strange if there is no getRange/setRange in FighterWingSpecAPI, since there already has getAttackRunRange/setAttackRunRange, and I believe that the core have tracked range. Range getter is useful in Fighter AI, so please add:
float getRange(); for FighterWingSpecAPI
void setRange(float range); for FighterWingSpecAPI
Title: Re: API request thread (please read OP before posting!)
Post by: NuclearStudent on June 28, 2022, 12:18:41 PM
SectorEntityTokens have setCustomDescriptionId as a method.

Would it be possible for ships to have a setCustomDescriptionId for their class, to be renamed dynamically? It's possible to jank one's way having all skins, but that's more awkward than a setCustomDescriptionId equivalent. It'd also be nice if we could write custom strings to a mod's descriptions.csv specifically, but it'd be understandable if file write access can't be loosened in that way. Thank you very much.
Title: Re: API request thread (please read OP before posting!)
Post by: PureTilt on July 12, 2022, 11:09:59 AM
Asking for setReloadProgress() in AmmoTrackerAPI, currently no way to stall reload progress only reset by setting ammoPerSecond to 0
Title: Re: API request thread (please read OP before posting!)
Post by: Timid on July 16, 2022, 08:16:57 PM
I'd like this private static to be public please, so modded Luddic factions can add their majority presence here.  :-[
Code
public class LuddicMajority extends BaseMarketConditionPlugin {

private static String [] luddicFactions = new String [] {
"knights_of_ludd",
"luddic_church",
"luddic_path",
};
public void apply(String id) {
if (Arrays.asList(luddicFactions).contains(market.getFactionId())) {
market.getStability().modifyFlat(id, ConditionData.STABILITY_LUDDIC_MAJORITY_BONUS, "Luddic majority");
} else {
market.getStability().modifyFlat(id, ConditionData.STABILITY_LUDDIC_MAJORITY_PENALTY, "Luddic majority");
}
}

public void unapply(String id) {
market.getStability().unmodify(id);
}

}
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on July 27, 2022, 11:57:27 PM
please add List<SegmentAPI> getOriginalSegments() for BoundsAPI
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on August 04, 2022, 09:28:33 PM
AsteroidAPI for asteroid that extends CombatEntityAPI, and at least a getSpriteAPI() for it? it would be better if with setJitter() etc.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on August 27, 2022, 05:31:39 PM
Could you change the way reapplyCondition() works, to rather than calling unapply() then apply(), it just calls a new method, reapply(), which /itself/ calls unapply() then apply()? I'm trying to make a planetary condition that adds a bunch of satellites in an orbit around a planet, but in order for it to support the removal of the satellites when the condition is removed without resetting the satellites and orbits every time the condition is reapplied (which is a LOT), I need to do an everyframescript to keep track of it. At least I think.
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on August 27, 2022, 06:24:24 PM
Use a single every frame script that tracks all the markets with the condition and all the satellites for them. When a market gains the condition, it adds the satellites around that market. When a market no longer has the condition, it cleans up the satellites. The condition itself doesn't have to do anything.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on August 27, 2022, 06:48:15 PM
Use a single every frame script that tracks all the markets with the condition and all the satellites for them. When a market gains the condition, it adds the satellites around that market. When a market no longer has the condition, it cleans up the satellites. The condition itself doesn't have to do anything.

Actually not a bad idea to have a /global/ script that does this rather than an instance for each planet, and I might end up doing that, but that's besides the point,

I wouldn't need to do this if I had a reapply() method I could override so it didn't keep calling unapply() and apply().
Title: Re: API request thread (please read OP before posting!)
Post by: Liral on September 26, 2022, 06:19:48 PM
1. Replace Indirect Chains of Methods with Instance Methods

Some API object instances lack instance methods to answer questions about their direct relationships to other API object instances, which are returned only by indirect chains of methods that involve repeating the name of the object instance.  I propose that such instance methods as would answer these questions be added to the corresponding API object instances and further, for clarity, the indirect chains be deprecated and later removed.

For example, a WeaponAPI cannot tell you the WeaponGroupAPI to which it belongs,

Code: Instance Method
weapon.getWeaponGroup()

but must instead ask its ship,

Code: Indirect Chain
weapon.getShip().getWeaponGroupFor(weapon)

Getting the AutofireAIPlugin of a WeaponAPI entails an even more indirect and repetitive chain.

Code: Instance Method
weapon.getAutofireAIPlugin()

Code: Indirect Chain
weapon.getShip().getWeaponGroupFor(weapon).getAutofireAIPlugin(weapon)


2. Remove the String source argument from the instance methods of MutableStat and add it to the fields and constructor of that class.
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on September 27, 2022, 02:53:18 AM
please add:
boolean isHyperspaceMode();
void setHyperspaceMode(boolean hyperspaceMode);
for LocationAPI

it would be better if the "BackgroundAndStars" can be modified - such as setBackgroundAndStars() - to render background in different ways.
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on September 28, 2022, 05:49:22 AM
please add
float getFacing();
for ShipEngineAPI(com.fs.starfarer.api.combat.ShipEngineControllerAPI.ShipEngineAPI)
which represents the facing of a single engine's absolute facing.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on October 19, 2022, 01:57:43 PM
I asked about this a while ago but I'm a lot better with my words now,

Please add some way for planetary conditions to tell if they're being unapplied or reapplied on apply() and unapply(). A simple apply() and unapply() boolean arg would do.
Title: Re: API request thread (please read OP before posting!)
Post by: Lukas04 on October 23, 2022, 06:17:15 AM
I would like to request a "getScripts" method for SectorEntityToken that displays all scripts attached to the entity. 
Some subclasses inherit a method like this from another interface (CampaignFleetAPI gets it from FleetOrStubAPI for example) but its something missing if you work with Custom Entities and Planets.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on November 01, 2022, 10:17:09 AM
Please give all terrainplugins some kind of isInActiveFlareArc() method. It's literally impossible to determine, reliably, if a fleet is in the flare or not. THis is important for *** like coronas and magnetic fields.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on November 02, 2022, 10:30:13 AM
Please expose CombatNebulaAPI's internal class a little more in the API. Ideally, so that we could create nebulae dynamically during combat without the need for a battlecreationplugin or casting down to the internal class.

On that note, it'd also be nice if Cloud (the nebula internal class) had an API, even if only for getting it's tiles/cells and location.

And yes this is pretty much just me following your advice to make an API request rather than use internals (lmao).
Title: Re: API request thread (please read OP before posting!)
Post by: tomatopaste on November 26, 2022, 04:24:31 AM
Hi Alex, can the shield and engine render layers be exposed in CombatEngineLayers please?

The engine render layer would be especially nice since my Fast Engine Rendering mod has to re-render weapon sprites since there is no current way to render below weapons.

My second request is a toggle in ShieldAPI to enable/disable rendering. This will allow my HexShields mod to act as a performance enhancer similar to my Fast Engine Rendering mod, rather than setting the colour of the shield to rgba 0, which results in faint black artifacts even at 0 alpha.

If that's possible that would be awesome. Hope you are well, cheers.
Title: Re: API request thread (please read OP before posting!)
Post by: tomatopaste on November 26, 2022, 04:28:10 AM
please add
float getFacing();
for ShipEngineAPI(com.fs.starfarer.api.combat.ShipEngineControllerAPI.ShipEngineAPI)
which represents the facing of a single engine's absolute facing.

                float absoluteAngle = ship.getEngineController().getShipEngines().get(0).getEngineSlot().getAngle() + ship.getFacing();
                if (absoluteAngle >= 360f) absoluteAngle -= 360f;
Title: Re: API request thread (please read OP before posting!)
Post by: Ontheheavens on November 30, 2022, 08:25:47 AM
Expose setAfterCreate() [and consequently getCol()] to be called after addRow() to allow us to emulate this from CargoTooltipFactory:

Code
                                var65.setAfterCreate(new Runnable() {
                                    public void run() {
                                        new var1x = new new(var48.getLocationInHyperspace(), false);
                                        var1x.setSize(var65.getHeight(), var65.getHeight());
                                        var65.getCol(4).add(var1x).inRMid(5.0F);
                                    }

This will, if I understood the code right, allow adding images to specific cells in tables.

Edit: disregard this, turns out combined features of TooltipMakerAPI, LabelAPI and PositionAPI are quite enough for re-creating custom tables in pretty much whatever way one wants.
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on December 08, 2022, 05:17:44 AM
please add:
float getGuidanceBonus();
for MissileAPI

Useful for custom missile AI
Title: Re: API request thread (please read OP before posting!)
Post by: Lukas04 on December 09, 2022, 02:13:34 PM
Hey there, a bit bigger of a request, but would it be possible for us to have a folder within a mods folder, that could be accessed by file io?
Similar to whats been done with saves/commons, but useable witin the mods own folder.

This would be very useful for things where you want to scan through multiple files, without having to set up CSV loading just for that.
Im thinking something along the line of a folder called "io" under data/io, together with some methods in the Starsector API that allows to read and write files towards that folder by giving the method the mods ID.

This would specificly be useful for cases where you need to save data, but when you load it, you arent really sure about how much data there is to load. As an example, a mod that would let you save the variants you made as a json, to load them in to other saves, could save all of them in to different files in this folder, and could just read through all files on game load, and users could just easily drop in variant files that they got from other people, without having to look through a csv and stuff.

Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on December 13, 2022, 08:05:16 PM
I've been making a list of API requests over the last few months of tinkering. Some of this might require some context, so... I've been working on a mod that adds simple "planetary operations" to surveyed planets. It's important for the player to be able to see where these are at a glance, so I create an intel item for each one. There can be quite a few of them, however, so I made an intel item for filtering them (see screenshot). Each time the filtration criteria are changed the list of op intel is updated.
Screenshot
(https://i.imgur.com/5X1myN6.png)
[close]
My requests:
Sorry if I've overlooked existing solutions, and please let me know if any clarification is needed. Thanks for considering, as always  :)
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on December 17, 2022, 04:36:58 PM
Something else that I forgot to mention is that the return value of getMoveDestination for the player fleet is not updated while paused, even when a destination is changed by right clicking the map. This makes it much less useful than it could be for some applications. For example, the GOTO console command uses getMoveDestination when no argument is supplied. So if you pause, set a destination, and use goto, it will not work because getMoveDestination isn't updated. In my case, I'd like to sort planetary operations based on distance from the player's destination, but I don't think there's any viable way to do that given this one limitation. I would be very grateful if the player fleet's move destination could be updated while paused. <3

Edit: A better way to facilitate this might be to add reportDestinationChanged to a listener. Maybe CampaignEventListener or CampaignInputListener?
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on December 21, 2022, 10:44:33 AM
Not sure if this hsa been requested before, but please add a shipDeployed/shipSpawned listener for combat. As it currently stands, the only way to detect if a new ship has been spawned (from what I know) is to use an EFS and iterate through the entire ship list.
Title: Re: API request thread (please read OP before posting!)
Post by: BaBosa on January 04, 2023, 04:59:26 AM
I’m not sure if this is the place to ask but could there be an easy way to make a hullmod that makes the new missile autoloader be able to recharge points? And make it affect medium and large missiles.
I had been planning on trying to modify the guardians missile auto forge but the new one sounds way better if it can be tweaked.
Title: Re: API request thread (please read OP before posting!)
Post by: Zsar on February 06, 2023, 11:15:48 AM
In SettingsAPI, please change
Code
Collection<Object> getAllSpecs(Class c);
to
Code
<SPEC> Collection<SPEC> getAllSpecs(Class<SPEC> c);
Use case:
Code
final Collection<Object> specs = settings.getAllSpecs(DropGroupRow.class);
for (final Object spec : specs) {
final DropGroupRow dropGroupRow = (DropGroupRow) spec;
is simplified to
Code
final Collection<DropGroupRow> specs = settings.getAllSpecs(DropGroupRow.class);
for (final DropGroupRow dropGroupRow : specs) {

Please add a base interface for SpecAPIs that contains e.g. the tag handling methods #hasTag(String), #addTag(String), etc.

Use case: Currently code to process tags has to be duplicated for each SpecAPI interface. Note that starting from Java 8, Method References could be used to circumvent this issue (create method parameter Predicate<String> hasTags and pass WeaponSpecAPI::hasTags into it, etc.), but even there just having a common ancestor would be the tidiest solution.

Please remove magical implicit "no_drop" / "no_dealer" functionality from ShipTypeHints.STATION (and actually add these tags to the derelict mothership, like on the Merlon) - currently I have to check for this hint to filter the Explorarium mothership from unobtainable ship specs, because it magically does not need these tags and thence does not have them.

Please add constant for "package_bp" to Items, e.g.
Code
public static final String TAG_BLUEPRINT_PACKAGE = "package_bp";

Please add constant for the "tags" field to... unsure, presumably Tags, e.g.
Code
/** If something can have tags, they will be found in a field of this name. */
public static final String FIELD_IDENTIFIER = "tags";

Please add outer braces to drop_groups.csv column "commodity" so it can be readily parsed using org.util.JSONObject.
E.g. change
Code
wpn_:{tags:[omega, !no_drop], weaponSize:SMALL}
to
Code
{wpn_:{tags:[omega, !no_drop], weaponSize:SMALL}}

Use case:
Code
final JSONObject json = new JSONObject("{" + dropGroupRow.getCommodity() + "}");
final JSONObject item = json.getJSONObject(DropGroupRow.ITEM_PREFIX);
final JSONArray tags = item.getJSONArray(DROP_GROUP_COMMODITY_TAGS);
for (int i = 0; i < tags.length(); ++i) {
final String tag = tags.getString(i);
if (BLUEPRINT_PACKAGE_TAG.equals(tag)) {
dropGroupRow.setFreq(dropGroupRow.getFreq() / 2.f);
break;
}
}
is simplified to
Code
final JSONObject json = new JSONObject(dropGroupRow.getCommodity());
final JSONObject item = json.getJSONObject(DropGroupRow.ITEM_PREFIX);
final JSONArray tags = item.getJSONArray(DROP_GROUP_COMMODITY_TAGS);
for (int i = 0; i < tags.length(); ++i) {
final String tag = tags.getString(i);
if (BLUEPRINT_PACKAGE_TAG.equals(tag)) {
dropGroupRow.setFreq(dropGroupRow.getFreq() / 2.f);
break;
}
}
It is currently too easy to fall into the trap of trying to parse the commodity manually (source: I did and just now realised how stupid I was being), when it is almost perfectly good JSON. E.g. finding "item_" without also finding "item_modspec" while correctly handling all whitespaces is a challenge manually, but a trivial task using JSONObject.
Title: Re: API request thread (please read OP before posting!)
Post by: tomatopaste on February 10, 2023, 08:18:14 PM
Hi, SettingsAPI getAllWeaponSpecs() does not return a complete list of specs because it ignores weapons with the ai hint AIHints.SYSTEM and the type WeaponType.SYSTEM. Can this be made to include all weapon specs please? My current workaround is calling the obfuscated method "o00O.Object()" to obtain a complete list of spec ids.
Title: Re: API request thread (please read OP before posting!)
Post by: Zsar on February 10, 2023, 09:12:34 PM
Please compile classes implementing DoNotObfuscate with line numbers: The IDEA debugger does not like to do normal breakpoints without them, but field breakpoints are horribly slow.

Please also compile them using
Code
-g:vars
. IDEA claims to be able to do without, but is not.

Once using Java 8+, please also compile them using
Code
-parameters
for better legibility.
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on February 26, 2023, 08:42:06 AM
Can you please add a getter method somewhere for which ship is showing its flux/hull/CR when the mouse hovers over it.
Title: Re: API request thread (please read OP before posting!)
Post by: Princess_of_Evil on March 20, 2023, 12:43:49 AM
Can you please add a getter for FighterLaunchBayAPI's IntervalTracker? Or its getRemaining / getIntervalDuration method returns.
Use case: adding more fighter deployment information.

Also, it would be really nice to have some hooks on StandardTooltipV2/UIPanelAPI that let some plugin type know when one is created.
Use case: you could really do some fancy stuff with UIs in that case, like adding new stat info to every ship or weapon known to man without resorting to unsavory methods like baking them into the description.
Title: Re: API request thread (please read OP before posting!)
Post by: Beowulf9150 on March 25, 2023, 02:50:08 PM
Hi, I'm trying to build a bit of custom UI at the moment and I have a few requests to make buttons a bit more usable:



Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on March 25, 2023, 04:02:01 PM
It would be great to have a way to get the standard colors used in the existing UI. (I fell like this exists already and I'm just to dense to find it.)

Misc.java has the standard colors. Faction colors can be acquired from methods in the respective faction's FactionAPI.
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on March 27, 2023, 03:07:54 PM
May I request:

CommoditySpecAPI.setName(...)

and

CommoditySpecAPI.setSpriteName(...)

Thank you!
Title: Re: API request thread (please read OP before posting!)
Post by: Ruddygreat on April 03, 2023, 09:26:42 AM
can we get a dynamic equivalent of statBonuses?

something like
Code
MutableShipStatsAPI.getDynamic.getStatBonus(String id);
would be v helpful for using dynamic stats to create completely custom stats (e.g, the amount of times a system fires a projectile or the range of those projectiles), rn just having dynamic mutableStats is a bit limiting in that regard.
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on April 05, 2023, 03:04:51 AM
The main propose is about changing player/enemy 's command strategy, trying to find a clear way to disable enemy's default command strategy or replace it with a customized one.

Please expose CombatFleetManager setAdmiralAI and API for AdmiralAI, thanks.
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on April 06, 2023, 01:05:46 PM
I think I've brought this up before, but I don't remember, tbh, so here it is again:

AssignmentTargetAPI doesn't have a method to return the CombatEntityAPI involved (if any). This has semi-blocked several things I've wanted to implement for years, largely because I'm too lazy to write some sort of centralized storage of Orders states and targets.

I think this might be sufficiently general-purpose useful, for people writing basic System AI, where they might want to know about the ship's Orders state and if Escorting, etc. <do things differently>, to justify making the feature request. Apologies if doing it involves staring at the old code in the Tactical Map UI.

Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 06, 2023, 01:08:16 PM
I think you can check if an AssignmentTargetAPI is an instanceof DeployedFleetMemberAPI and if so, cast.
Title: Re: API request thread (please read OP before posting!)
Post by: xenoargh on April 06, 2023, 02:33:07 PM
Ah! I'll try that out tonight.

That totally works, thank you. Beats the heck out the method I was using before.
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on April 07, 2023, 12:10:20 PM
Request for

SpecialItemSpec.setParams()

to be moved from the implementation to the SpecialItemSpecAPI to allow adding additional applicable industries to the special item without overriding the item in general.
(I'd honestly be grateful if more methods were exposed both for special item spec edits and commodity spec edits, as currently, modifying vanilla industry items - and sometimes commodities - almost always results in mod conflicts)

Thank you!
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 07, 2023, 12:15:03 PM
(I'd honestly be grateful if more methods were exposed both for special item spec edits and commodity spec edits, as currently, modifying vanilla industry items - and sometimes commodities - almost always results in mod conflicts)

I'd really appreciate some specifics, to make sure that (if possible) the right stuff gets exposed!
Title: Re: API request thread (please read OP before posting!)
Post by: theDragn on April 10, 2023, 01:29:04 AM
Is it possible to expose the weapon/source entity for DamagingExplosion? When it gets passed to a damage listener, it's an instance of DamagingProjectileAPI with null weapon/source, which can be a bit of a problem if you want to do fancy things with explosions.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 10, 2023, 04:11:52 PM
can we get a dynamic equivalent of statBonuses?

something like
Code
MutableShipStatsAPI.getDynamic.getStatBonus(String id);
would be v helpful for using dynamic stats to create completely custom stats (e.g, the amount of times a system fires a projectile or the range of those projectiles), rn just having dynamic mutableStats is a bit limiting in that regard.

getDynamic().getMod() is the method you're looking for, I think. Unless I'm missing something?

Is it possible to expose the weapon/source entity for DamagingExplosion? When it gets passed to a damage listener, it's an instance of DamagingProjectileAPI with null weapon/source, which can be a bit of a problem if you want to do fancy things with explosions.

Hmm - it looks like getSource() should return non-null unless the explosion was created with a null ShipAPI passed in for a source.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 12, 2023, 11:05:59 AM
Went through about a year's worth of these and made a bunch of API changes/additions, thank you everyone for the suggestions!

A quick reminder that this is a thread for comparatively simple things such as exposing methods or functionality that, generally speaking, already exists. Larger features are a better fit for a separate suggestion - by the time I'm going through this thread, it's late enough in the release cycle that I'm pretty unlikely to tackle something big.



The main propose is about changing player/enemy 's command strategy, trying to find a clear way to disable enemy's default command strategy or replace it with a customized one.

Please expose CombatFleetManager setAdmiralAI and API for AdmiralAI, thanks.

(Thank you for making the suggestions in this "why / what" format, by the way, and for keeping things in the scope for the thread. Made it really easy on me!)
Title: Re: API request thread (please read OP before posting!)
Post by: PureTilt on April 13, 2023, 02:42:27 AM
Was trying to find a way to pause weapon ammo reload, setting AmmoPerSeccond to 0 resets current reload, and there no way to set reload progress back

In WeaponAPI.getAmmoTracker() expose setReloadPorgress
Title: Re: API request thread (please read OP before posting!)
Post by: Ruddygreat on April 13, 2023, 04:10:18 AM
getDynamic().getMod() is the method you're looking for, I think. Unless I'm missing something?

huh, so it is, thanks for pointing it out!
I'm surprised I didn't notice it, though the method name is a little wierd.
Title: Re: API request thread (please read OP before posting!)
Post by: theDragn on April 13, 2023, 01:48:14 PM
Hmm - it looks like getSource() should return non-null unless the explosion was created with a null ShipAPI passed in for a source.
Sorry, my bad- you're right, the ShipAPI does get passed through correctly, but the WeaponAPI does not. (It would still be really helpful if we could get the weapon passed through, though.)
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on April 17, 2023, 02:07:57 PM
In some situation, I may want to get "data" parm from a ButtonAPI passed in some methods like addButton(String text, Object data, ...), which will be convenient for customized data tracking of each button, rather than use another HashMap or some other tricks.

Please expose Object getData() or getCustomData() for ButtonAPI, thanks.
And it would be better if setData() or setCustomData() get exposed too.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 17, 2023, 02:33:55 PM
In some situation, I may want to get "data" parm from a ButtonAPI passed in some methods like addButton(String text, Object data, ...), which will be convenient for customized data tracking of each button, rather than use another HashMap or some other tricks.

Please expose Object getData() or getCustomData() for ButtonAPI, thanks.
And it would be better if setData() or setCustomData() get exposed too.

(It doesn't exist, actually - or rather, it does, but is used for other purposes. I've added
Object getCustomData();
void setCustomData(Object customData);

But it is NOT the same data that's passed in to addButton().)
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on April 18, 2023, 01:48:12 PM
(I'd honestly be grateful if more methods were exposed both for special item spec edits and commodity spec edits, as currently, modifying vanilla industry items - and sometimes commodities - almost always results in mod conflicts)

I'd really appreciate some specifics, to make sure that (if possible) the right stuff gets exposed!
Whoops, missed that - sorry!

For mod compatibility - the most important one there was custom data, which you already exposed, to avoid overwriting the vanilla impl when making an item applicable to a custom industry.

For other stuff I'm trying to do, I'd like to request the following to be exposed via the SpecialItemSpecAPI (it's currently available only in the impl)
setName
setIconName
setBasePrice
setOrder

And for for CommoditySpecAPI:
setIconLargeName
setOrder
setDemandClass

I do hope I'm not too late with these, but since they already exist and only need to be exposed, I'm hopeful.

There's another one I'd love to have: FactionAPI.setIllegalCommodities(List<String> commodityList)
But that does not exist yet, although the list is stored in the Faction impl. and there is a getter.

Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 18, 2023, 02:24:01 PM
Added most of these - as you say, it's just exposing methods.

For CommoditySpecAPI - the large icon is not used anywhere, it's a remnant of an idea that didn't work out.

For FactionAPI.getIllegal() - that returns the actual list, not a copy of it, so you could modify it. FactionAPI also has:
void makeCommodityIllegal(String commodityId);
void makeCommodityLegal(String commodityId);
Title: Re: API request thread (please read OP before posting!)
Post by: SirHartley on April 18, 2023, 02:56:11 PM
Oh, thank you!

As for the Faction thing - I appear to be blind. Thanks :)
Title: Re: API request thread (please read OP before posting!)
Post by: Ruddygreat on April 20, 2023, 01:55:12 PM
I think this has been asked before (and no idea if it's more of a dedicated thread thing, but it's more of an extension of an existing feature) is there any possibility of a "BETWEEN_SHIPS_AND_WEAPONS" combat layer getting added at any point? (not just for the next patch or w/e)
I've been messing with some shield alternative defensive system ideas particularly & it'd be a v nice thing to have to render stuff "on" a ship's armour without obscuring weapon visibility, for one particular usecase.

Title: Re: API request thread (please read OP before posting!)
Post by: Alex on April 20, 2023, 02:29:36 PM
I think this has been asked before (and no idea if it's more of a dedicated thread thing, but it's more of an extension of an existing feature) is there any possibility of a "BETWEEN_SHIPS_AND_WEAPONS" combat layer getting added at any point? (not just for the next patch or w/e)
I've been messing with some shield alternative defensive system ideas particularly & it'd be a v nice thing to have to render stuff "on" a ship's armour without obscuring weapon visibility, for one particular usecase.

(Ah, not very likely - generally speaking, ships and their weapons are rendered on the same layer; the one exception is weapons on the base of a station, iirc.)
Title: Re: API request thread (please read OP before posting!)
Post by: jujuteux on April 23, 2023, 03:19:04 AM
Hi, alex.

i'm currently checking the whole Personality.csv file and trying to add new ones (mainly for changing descriptions and names)
and i bumped on the fact that there's not actually any difference between reckless and aggressive in the csv
(https://i.imgur.com/zwaMrHu.png)
is the whole AI mechanic handled by checking for the name or ID?
that might actually cause some problems since i'm basically duplicating those personalities and just changing names, ID and desc

if it can't be fixed, can you consider making something so you can create your own personalities outside of the csv? like unobfuscating the personality code? right now the bit of code doing all that is so obfuscated that the kind of MethodHandles needed to make it work would break every update.
(https://i.imgur.com/gWAX3al.png)

thanks in advance!
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on April 26, 2023, 07:05:02 PM
Would be nice if these methods' declarations could be moved from BaseIndustry to Industry:

    addPostSupplySection
    addPostDemandSection
    addRightAfterDescriptionSection
    addPostDescriptionSection
    addPostUpkeepSection
    addStabilityPostDemandSection
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on May 01, 2023, 04:45:01 AM
BattleAutoresolverPluginImpl: Please make all the inner data holder classes and their members public.
Title: Re: API request thread (please read OP before posting!)
Post by: Sorrydough on May 04, 2023, 11:59:03 PM
I was trying to make a hullmod that causes beams to fire over allied ships, it turns out I can't modify their collision class how I want because collision class can't be instantiated on a per-weapon basis. So I'd modify the collision class, and then... every weapon of that type would start shooting over allies. LMAO.

It would be nice if it were possible to instantiate weapon collision classes.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on May 05, 2023, 12:28:01 PM
For the newly added CombatNebulaAPI setHasNebula(), please add a 4th arg for "radius", as I find it really difficult to simulate vanilla nebulas without being able to control the size.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on May 05, 2023, 06:17:48 PM
While you're at it, could you find some easier way to expose the actual contents of each "cloud cell"? Aka the clusters of clouds. As it stands you have to brute force it by raytracing in various directions and digging into cloud.flowdir for each instance since it's a linked list. Real annoying.
Title: Re: API request thread (please read OP before posting!)
Post by: Sorrydough on May 06, 2023, 09:28:32 AM
- I'd like to be able to change the OP cost of hullmods using a hullmod, and I'd like to be able to change the ship's OP budget using a hullmod.
- We have to use a janky workaround in the modiverse for hullmod incompatibilities, so it would be nice if hullmods checked for incompatibilities on hullmods that are already installed on the ship. For example if the ship has a hullmod that's incompatible with targeting unit, then targeting unit should prevent itself from being installed even if it doesn't have the incompatibility in its own script. This way we can use the vanilla incompatibility system without editing hullmod scripts. I guess this isn't an API request per se, but I feel like it's directly related.

Title: Re: API request thread (please read OP before posting!)
Post by: Ruddygreat on May 06, 2023, 10:12:20 AM
inspired by a certain new encounter added in the update (absolutely love it btw!); can we get the ability to automate a ship using a tag on the spec / variant instead of being forced to use the hullmod?
I've been wanting to do some "kinda" automated ships & being able to give them no penalty with a tag is most of the way there, though still using the automated hmod feels a little janky & restrictive

(also a potential bug - ships with the NO_AUTOMATED_PENALTY tag still show up as contributing to the auto ship points total, even when they don't (though the final value is calculated correctly regardless))
Title: Re: API request thread (please read OP before posting!)
Post by: Liral on May 10, 2023, 08:45:15 PM
Re-posting what I mentioned on the announcement thread (https://fractalsoftworks.com/forum/index.php?topic=26020.msg394672#msg394672) here so you see it when reading posts for your next API expansion.

Please expose:
Code
BeamWeaponSpec.setDamagePerSecond(float damagePerSecond);
BeamWeaponSpec.setEmpPerSecond(float empPerSecond);

Without equivalent API methods, I must include not only the black magic for them but also the necessary black magic of ReflectionTools and ProxyTools.
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on May 13, 2023, 09:48:48 AM
This is a bit of a pipe dream, but do you think you could change how BattleAPI.getCombined() and related methods work, so that the AI of the fleet it returns isn't hardcoded to be the basic one?

As it stands, MarketCMD has a few methods and things that get a combined fleet with the basic AI. This makes it really hard to ensure fleet A always acts in a certain way when someone interacts with a market. Case in point, MPC where satellites are supposed to always try to HOLD or HOLD_VS_STRONGER and NEVER let someone interact with a market. However, since MarketCMD uses plugin.otherFleetWantsToFight() which uses the COMBINED other fleet, my custom AI doesn't get used, thus they never want to fight against overwhelming odds when a player goes to the military options tab of a market interaction.

It could be as simple as having the combined fleet generation iterate through the AI of each fleet and comparing a "priority" value, like pluginpick. Default AI could return PickPriority.MINIMUM, and my AI could return PickPriority.HIGH. Since my AI has the highest priority, the combined fleet has the custom AI.

Another solution could work, but this is the first and most intuitive option off the top of my head.
Title: Re: API request thread (please read OP before posting!)
Post by: AtlanticAccent on May 21, 2023, 04:51:47 PM
Hi Alex!

I've discovered that you can very effectively abuse StoryPointActionDelegate and OptionPanelAPI.addOptionConfirmation to add new options to dialogs at runtime, circumventing rules.csv and also allowing you to extend FleetInteractionDialogImpl (which afaik is not rules.csv extensible).

May I recommend renaming StoryPointActionDelegate or adding an ancestor interface to really spell out the fact it can be used to add options to OptionPanelAPIs at runtime.

Also, I'll probably figure this out in a bit or not at all, but is there a way to prevent the "Story Points: [num]" element from being added to the subsequent popup/tooltip triggered on clicking an option added as described above? If not, could one be added please?
Title: Re: API request thread (please read OP before posting!)
Post by: RustyCabbage on May 24, 2023, 09:16:23 PM
It seems com.fs.starfarer.api.campaign.SubmarketPlugin has
Code
boolean isBlackMarket();
boolean isOpenMarket();
but does not have
Code
boolean isMilitaryMarket();
Could it be added?
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on May 25, 2023, 03:38:33 AM
Also, I'm trying to display them using tooltip maker but neither addSkillPanel nor addSkillPanelOneColumn seems to work - are these methods hardcoded to just officer skills? Seems different to `printSkills` behaviour used in rules.csv.

Hmm yeah, those methods look hardcoded to print officer skills only.

Is that intentional, or could we expect this to work with admin skills as well? Yes, making a suggestion for the `addSkillPanel` and `addSkillPanelOneColumn` to work for both admins and officers :)
Title: Re: API request thread (please read OP before posting!)
Post by: 123nick on May 25, 2023, 05:02:29 PM
Can FighterLaunchBayAPI.setExtraDeployments be modified to take negative integers to REDUCE the number of active fighters in a wing? or atleast, can there be another method like FighterLaunchBayAPI.setReducedDeployments that does the same thing? i want to make a hullmod that reduces the # of fighters in a wing/LPC/bay/whatever, but afaik it is IMPOSSIBLE with the current methods in the starsector API!!!
Title: Re: API request thread (please read OP before posting!)
Post by: float on May 26, 2023, 10:10:32 AM
Can we have a CustomCampaignEntityAPI.setSalvageRating? Currently it's possible to change just about everything about a salvageable item on a per-item basis (e.g. its radius, name, etc.), so it'd make sense to also be able to set salvage ratings on a per-item basis, rather than needing to have a different custom entity spec for each rating.
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on May 29, 2023, 09:03:59 PM
Code
public MutableStat getBeamSpeedMult();
for MutableShipStatsAPI, thanks
Title: Re: API request thread (please read OP before posting!)
Post by: Maru7 on May 30, 2023, 02:50:16 AM
Need API to modify "maxShipsInFleet" and "suppliesPerShipOverMaxInFleet" defined in config/settings.json,
I want them to be modifiable in the same way as modifyFlat(), modifyMult(), modifyPercent() in MutableShipStatsAPI.
I know these data are not stored in saveddata right now, but maybe we can store them like other data affected by character skill (such as storing them in MutableCharacterStatsAPI or MutableFleetStatsAPI)?
thanks!
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on May 31, 2023, 10:02:59 AM
MutableShipStatsAPI.getFleetMember returns null prior to calculating the max CR of ships in the player fleet*. I believe this is the source of a bug in one of my mods (http://getFleetMember). Could getFleetMember be improved to provide the member in this situation? Thanks for consideration!

*Edit: I'm not certain when exactly the call fails, but it happens prior to opening the fleet screen during one/some of the multiple stat applications.
Title: Re: API request thread (please read OP before posting!)
Post by: Jaghaimo on June 01, 2023, 09:32:34 AM
A simple request - CutStyle.NONE - renders regular button with no cut corners.
Title: Re: API request thread (please read OP before posting!)
Post by: Liral on June 30, 2023, 03:53:12 PM
Make Global.getCombatEngine().isUIShowingHUD() return true when the UI is showing the HUD and false when it is not.  This function is instead inverted, returning false when the UI is showing the HUD and true when it is not.

Edit: My apologies, it finally works as indicated now.  Woo!
Title: Re: API request thread (please read OP before posting!)
Post by: Zsar on July 16, 2023, 08:24:33 AM
Please
Title: Re: API request thread (please read OP before posting!)
Post by: Nia Tahl on August 15, 2023, 11:42:44 PM
EngineControllerAPI or EngineSlotAPI method for controlling or at least disabling the flaring of engines like during strafing or reversing would be much appreciated
Title: Re: API request thread (please read OP before posting!)
Post by: Sorrydough on September 07, 2023, 03:17:40 PM
I'd also like to have an engine feature: I want them to behave like always-active 128 contrail engines. For example, set it to contrail 127 and the engine won't take damage in combat, but will still turn off if the ship gets fully flamed out. Therefore the engine is entirely cosmetic.
Title: Re: API request thread (please read OP before posting!)
Post by: Lukas04 on September 17, 2023, 01:51:01 PM
a "overwriteColor" boolean return method in BaseHullmod that lets you overwrite the build-in gray and storypoint green for a hullmod.
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on October 04, 2023, 11:26:16 AM
For BaseLocation.LocationToken please implement a backing field for getName() and setName().
Title: Re: API request thread (please read OP before posting!)
Post by: SONZ-INA on October 10, 2023, 11:19:32 AM
I don't know if this has been requested, but it would be nice to have some kind of WeaponSlot listener? Something like onInstalled() / onRemoved().

For example, the current problem I have is setting a slot's Arc. I want a weapon I'm modding to always have 360 arc because of it's nature, but when I use the setArc() function, it persists even after uninstalling the weapon. I created a function that would reset that, but the problem is when all weapons get uninstalled, the script gets destroyed and the slot's arc remains at 360. For that exact reason, the setArc() for WeaponSlotAPI isn't very useful.

It would be amazing if we could have onInstalled() / onRemoved() functions for weapons/weaponslots (or even hullmods?).

Also, since we have setUnaffectedBySpeedBonuses() for weapons, we should have setUnaffectedByRangeBonuses() as well.
I want to have a weapon with fixed range, unaffected by range bonuses. Yes you can do it with math and a lot of code, but it isn't a really clean solution.
Title: Re: API request thread (please read OP before posting!)
Post by: Histidine on October 15, 2023, 01:13:46 AM
The transient variables in DefaultFleetInflater should also have protected keyword so a derived class can access them.

(Thing that would also be nice but more work is: split up the inflater's 300-line inflate() method so e.g. populating the known ships/weapons/wings get their own methods; this would mean I have to replace less code when changing some inflater behaviors)
Title: Re: API request thread (please read OP before posting!)
Post by: Originem on October 19, 2023, 02:51:49 AM
need ShipAPI.getFleetCommander()

in afterShipCreation() method, ship.getFleetMember would be null, if ship.getCaptain.isDefault, I can't get the fleet commander.

I could get the commander like this, but it's not elegant:
Code
PersonAPI commander = null;
FleetMemberAPI member = ship.getFleetMember();
if (member == null && ship instanceof Ship) {
    commander = ((Ship) ship).getFleetCommander();
}}
Title: Re: API request thread (please read OP before posting!)
Post by: Liral on December 02, 2023, 05:36:23 PM
Please make the stat card of a beam weapon display the flux-per-second of its BeamWeaponSpec rather than its row of weapon_data.csv.  This change would require adding a getFluxPerSecond method to WeaponSpecAPI or creating a BeamWeaponSpecAPI with that method and then changing the stat card to use the method.
Title: Re: API request thread (please read OP before posting!)
Post by: Sorrydough on December 17, 2023, 06:40:27 AM
1. I'd like to have a way to manipulate engine width in code, similar to how I can use engineController.setFlameLevel to manipulate length.
2. Please add a way to control whether system engines are active, so we can use them for passive vector thrusters etc. Something like engineController.activateSystemThrusters(true/false).
Title: Re: API request thread (please read OP before posting!)
Post by: NikoTheGuyDude on January 08, 2024, 11:53:20 AM
Could we have some method to imply what a given projectile might do on hit to AI?

Example: Some kind of tag that can be applied to a weapon spec, such as DEALS_EXTRA_HE [NUMBER], to communicate that while its a kinetic weapon, it does x amount of HE on hit. This is useful in both spec files and in scripts - if we have a weapon that fires 10 kinetic shots for 300 damage, but adds 200 HE on the final shot, we can add the tag to the final shot to tell the AI of whats coming for them.

Its not perfect, like, the AI wont know the extra threat prior to the final projectile being shot, but it could still be useful.

This could even be applied to breaches, e.g. DEALS_EXTRA_ARMOR [NUMBER].
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on January 12, 2024, 12:45:59 PM
Went through this and made a bunch of additions, thank you all!

(A reminder that this is a thread specifically for API requests, that is, things that already exist (or you think very likely exist) in the core code but are not exposed through the API. This is not the right thread to request new functionality. Of course if it's something trivial I'll probably add it anyway, but some of the stuff here falls well outside of that and into "complicated new feature" territory. Suggestions like that are absolutely welcome, but a thread I go through near the very end of a release cycle is just not the place for them.)
Title: Re: API request thread (please read OP before posting!)
Post by: Princess_of_Evil on January 13, 2024, 09:44:25 AM
You can switch shields between none, normal and omni, but there's no way to make them scripted (or change the script). How much of an annoyance would that really be? I've checked Ship, it doesn't *look* that impossible, but that doesn't mean it isn't, i haven't checked everything.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on January 13, 2024, 10:41:28 AM
Hmm, I have no idea what you're asking. "Scripted"?
Title: Re: API request thread (please read OP before posting!)
Post by: Princess_of_Evil on January 13, 2024, 11:01:21 AM
Every other shield type is hardcoded to be a shield, but PHASE can just be any ability, and there's no API for changing abilities on existing ships.

Use case is a custom version of shield shunt that replaces shield with a custom variant of defense flak from Invictus.
Title: Re: API request thread (please read OP before posting!)
Post by: Alex on January 13, 2024, 11:11:59 AM
Ah, thank you for elaborating! Possibly doable, but yeah, definitely the wrong thread and time for that sort of thing :)
Title: Re: API request thread (please read OP before posting!)
Post by: Princess_of_Evil on January 13, 2024, 11:17:01 AM
Okay, thank you for confirming!
Title: Re: API request thread (please read OP before posting!)
Post by: AtlanticAccent on January 22, 2024, 09:46:33 AM
Hi Alex.

Two linked requests.

Could you please add methods like `public bool hasConfirmationDialog` and `public void onSelected` to StoryPointActionDelegate. The former would, on returning false, prevent the confirmation dialog triggered by story point action delegates currently from appearing, and the latter would allow arbitrary code to be executed when the dialog option the delegate is attached to is selected. As discussed in https://fractalsoftworks.com/forum/index.php?topic=28698.0 (https://fractalsoftworks.com/forum/index.php?topic=28698.0) there are workarounds for these currently, but they are fragile and require multiple (two) frames to execute.

Hybrid bug report/API request - currently `OptionPanelAPI.restoreSavedOptions(List<Object>)` does not restore delegates, confirmation dialogs or hotkeys as expected. Current users likely expect this to fully restore all option selection functionality (ie: [Esc] triggering the common "Leave" option). Again, we discuss workarounds to this in https://fractalsoftworks.com/forum/index.php?topic=28698.0 (https://fractalsoftworks.com/forum/index.php?topic=28698.0)
Title: Re: API request thread (please read OP before posting!)
Post by: Sundog on February 06, 2024, 02:24:15 PM
Could the public statics at the top of FractureJumpAbility be made non-final? FractureJumpAbility.FUEL_USE_MULT is what I need to change specifically, but it seems like CR_COST_MULT and NASCENT_JUMP_DIST might as well not be final either. Thanks for considering!
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on February 07, 2024, 09:02:13 PM
Please add:
    void join(CampaignFleetAPI fleet, BattleSide side);
for:
    com.fs.starfarer.api.campaign.BattleAPI

The point is to add a method to assign a side to a fleet rather than "automaticly" assigned, which is useful configuring a complex battle.
Title: Re: API request thread (please read OP before posting!)
Post by: Ruddygreat on February 10, 2024, 12:26:45 PM
can an overload for CombatEngineAPI.spawnMuzzleFlashOrSmoke() that takes a vector2f for it's location (instead of the weapon slot & barrel index) be added?
would be v helpful for making scripted projectile spawning look better.
Title: Re: API request thread (please read OP before posting!)
Post by: THEASD on March 22, 2024, 06:44:14 AM
Please add:
   String getHardpointGlowSpriteName();
   String getTurretGlowSpriteName();
   String getHardpointRecoilSpriteName();
   String getTurretRecoilSpriteName();
for:
    com.fs.starfarer.api.loading.WeaponSpecAPI

The point is to add some methods to get all sprites around a weapon.
Title: Re: API request thread (please read OP before posting!)
Post by: Genir on March 22, 2024, 08:30:42 AM
Can we have API calls to influence grid drawing in star system map, hyperspace map and possibly combat map? I'm reffering to the rectangular grid that is overlaid over the map view.

Specifically, I wanted to be able to remove the grids, as I think it makes the maps look better. I already managed to remove the grid from star system map by manipulating mapGridWidthOverride.

As a side note, mapGridWidthOverride influences both grid width and height, while mapGridHeightOverride is ignored. Is that intended?
Title: Re: API request thread (please read OP before posting!)
Post by: Kaysaar on April 07, 2024, 02:54:59 PM
Can we have ability for hiding  structure from building menu, without fully making it unavailable to build?
I have runned into issue that by doing this, you also block ability to downgrade industry to that certain one, you want to hide
Title: Re: API request thread (please read OP before posting!)
Post by: SafariJohn on April 07, 2024, 03:06:58 PM
Can we have ability for hiding  structure from building menu, without fully making it unavailable to build?
I have runned into issue that by doing this, you also block ability to downgrade industry to that certain one, you want to hide

I think making it available to build specifically when the upgraded version is present will achieve what you want.
Title: Re: API request thread (please read OP before posting!)
Post by: Kaysaar on April 08, 2024, 01:34:42 AM
Can we have ability for hiding  structure from building menu, without fully making it unavailable to build?
I have runned into issue that by doing this, you also block ability to downgrade industry to that certain one, you want to hide

I think making it available to build specifically when the upgraded version is present will achieve what you want.
Not really, if you wanna make behaviour like i did : industry having multiple upgrades you will run into issue , that if you allow to make it buildable when there is upgrade, you can duplicate industries