Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

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

Pages: 1 ... 36 37 [38] 39 40 ... 42

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

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #555 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.

THEASD

  • Ensign
  • *
  • Posts: 42
  • *Confused Cat Noise*
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #556 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.
Logged
Also known as AnyIDElse.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #557 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.

Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #558 on: April 06, 2023, 01:08:16 PM »

I think you can check if an AssignmentTargetAPI is an instanceof DeployedFleetMemberAPI and if so, cast.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #559 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.
« Last Edit: April 06, 2023, 07:23:58 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #560 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!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #561 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!
Logged

theDragn

  • Captain
  • ****
  • Posts: 305
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #562 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.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #563 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.
« Last Edit: April 11, 2023, 05:57:56 PM by Alex »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #564 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!)
Logged

PureTilt

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #565 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
Logged




Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #566 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.

theDragn

  • Captain
  • ****
  • Posts: 305
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #567 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.)

THEASD

  • Ensign
  • *
  • Posts: 42
  • *Confused Cat Noise*
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #568 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.
« Last Edit: April 17, 2023, 02:09:51 PM by THEASD »
Logged
Also known as AnyIDElse.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #569 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().)
Logged
Pages: 1 ... 36 37 [38] 39 40 ... 42