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 ... 32 33 [34] 35 36 ... 42

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

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #495 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.

sphr

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



Logged

Harmful Mechanic

  • Admiral
  • *****
  • Posts: 1340
  • On break.
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #497 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.)
Logged

Jaghaimo

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

Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #499 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.
Logged
 

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #500 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).
« Last Edit: January 23, 2022, 12:39:56 AM by Jaghaimo »
Logged

Sundog

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

lyravega

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

Jaghaimo

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

[close]
« Last Edit: February 15, 2022, 04:16:22 AM by Jaghaimo »
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #504 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...

WalrusJJones

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #505 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.
« Last Edit: February 15, 2022, 01:05:33 PM by WalrusJJones »
Logged

Sutopia

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


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

lyravega

  • Commander
  • ***
  • Posts: 140
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #507 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 =)
« Last Edit: February 19, 2022, 11:26:52 AM by lyravega »
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #508 on: February 20, 2022, 07:07:06 PM »

Not new API but how existing API work:
  • Make SettingsAPI.putSpec work with unobfuscated types (wings, weapons, hull variants) - it currently cannot do anything for a modder
  • Make com.fs.starfarer.api.util.Misc.isSpecialMod(ShipVariantAPI, HullModSpecAPI) not check hidden - is it necessary?
« Last Edit: February 20, 2022, 07:08:48 PM by Sutopia »
Logged


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

Schaf-Unschaf

  • Ensign
  • *
  • Posts: 8
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #509 on: February 21, 2022, 02:54:35 AM »

I've got two suggestions for the API:
  • a way to display a CustomPanelAPI during combat
  • a way to make your own ButtonListener and register custom panels with it
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 :-/
Logged
Pages: 1 ... 32 33 [34] 35 36 ... 42