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 ... 35 36 [37] 38 39 ... 42

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

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #540 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.
« Last Edit: December 12, 2022, 08:08:10 AM by Ontheheavens »
Logged
   

THEASD

  • Ensign
  • *
  • Posts: 42
  • *Confused Cat Noise*
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #541 on: December 08, 2022, 05:17:44 AM »

please add:
float getGuidanceBonus();
for MissileAPI

Useful for custom missile AI
Logged
Also known as AnyIDElse.

Lukas04

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

Logged
My Mods

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #543 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
[close]
My requests:
  • Some way to prevent calls to IntelUIAPI.updateIntelList from deselecting the currently selected intel, as long as it is still part of the list. It would be nice if the scroll position wasn't reset either. My current workaround is an automated click to re-select the filter intel after updateIntelList is called, which brings me much anxiety and shame.
  • Some way to change the max number of intel icons shown at once. The current limit is 100, which I think is prudent, but overly restrictive for unconventional applications of the intel map. In my case, I'd like to be able to show up to about 500.
  • A TooltipMakerAPI method for displaying planets. Not particularly important, but it could be neat even for a few vanilla intel items.
  • A way to adjust the fuel range indicator. Part of this mod increases fuel consumption under certain dynamic conditions that can make the default range very misleading. My current solution is to adjust fuel consumption only while the map is open in order to manipulate the range indicator, but that results in the "real" range being shown briefly while the map is closing.
  • Some way to flag ship engines to prevent their flames from being seen in the campaign view. Maneuvering thrusters do this, but have other characteristics that aren't always desired.
Sorry if I've overlooked existing solutions, and please let me know if any clarification is needed. Thanks for considering, as always  :)
« Last Edit: April 10, 2023, 06:21:59 AM by Sundog »
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #544 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?
« Last Edit: April 10, 2023, 06:52:34 AM by Sundog »
Logged

NikoTheGuyDude

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

BaBosa

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

Zsar

  • Captain
  • ****
  • Posts: 279
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #547 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.
« Last Edit: February 06, 2023, 12:04:27 PM by Zsar »
Logged

tomatopaste

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

Zsar

  • Captain
  • ****
  • Posts: 279
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #549 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.
« Last Edit: February 10, 2023, 09:18:25 PM by Zsar »
Logged

SafariJohn

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

Princess_of_Evil

  • Captain
  • ****
  • Posts: 459
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #551 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.
Logged
Proof that you don't need to know any languages to translate, you just need to care.

Beowulf9150

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #552 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:
  • Could you please add something like ButtonAPI.setPassthroughInput(boolean), to set whether input events should reach CustomUIPanelPlugin.processInput(), like it does for an AreaCheckbox or does not, like for buttons.
  • More options to set the button font, ideally a TooltipMakerAPI.setButtonFont(String fontID) function.
  • 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.)



Logged

SafariJohn

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

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: API request thread (please read OP before posting!)
« Reply #554 on: March 27, 2023, 03:07:54 PM »

May I request:

CommoditySpecAPI.setName(...)

and

CommoditySpecAPI.setSpriteName(...)

Thank you!
Logged
Pages: 1 ... 35 36 [37] 38 39 ... 42