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 ... 633 634 [635] 636 637 ... 706

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1700094 times)

bananana

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9510 on: January 23, 2023, 06:42:03 PM »

question
does .setDamageAmount() actually function as intended when applied to proximity fuze mines? does it affect the explosion damage? and the amount of danger enemy AI feels when inside explosion range?
testing results are inconclusive and ambiguous in the extreme
some clarification?
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9511 on: January 23, 2023, 11:00:54 PM »

Oh, yikes - thank you! Turns out this was a general issue affecting mouseover events inside *nested* scrollable areas, specifically. Fixed this up and verified the issue (and the fix) with both the test code and the large-fleet case.
... yes, it actually already is, I think. There's a new TooltipMakerAPI.addLabelledValue() method.
Ahh, ok - this'll be fixed for the next release, then; the fix I thought I'd made didn't cover the glow case.

Absolutely glorious, thank you sir. Ecstatic for the release, just can't bear the wait!

Wanted to make some more less pressing inquiries in the mean time:

1. There are relationship bars (can be added by method in TooltipMakerAPI), percentage bars in the fleet tab for hull and CR, and also bars with sliders in settings window. From what I've gathered, relationship bars are hardly suitable for anything but relationships themselves as they are not customizable and always show status string like ("Welcoming"), while proper bars and sliders are outside of reach of modders completely.

While I am able to worm my way around this with use of buttons, checkboxes and text fields (sadly, result looks nothing like vanilla), and other modders employed section headings for the same purpose, kinda wanted to ask you: are there any plans to give us proper, vanilla-looking bars and sliders?

2. It seems that addShipIcons() in TooltipMakerAPI is not quite ideal for the many purposes modders have come to use it for. For example, it is ill-suited for displaying ship images bigger than 128x128, and also does not render weaponry. Is there any way for me to display ships in custom panels (or, ideally, in tooltip instance) the way fleet or refit tab does them?

3. What kind of interactable buttons ship list in refit tab and hull list in blueprint tab use for entry items? Currently using area checkboxes (which can be made borderless only through color shenanigans, and that introduces its own problems), but it seems like there are proper method for borders in obfuscated code. Would it be possible for me, given the current API, to emulate vanilla ship lists precisely?
« Last Edit: January 23, 2023, 11:15:27 PM by Ontheheavens »
Logged
   

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9512 on: January 25, 2023, 06:27:12 AM »

Is it possible to swap out built-in fighter wing for another? There doesn't seem to be any method akin to ShipVariantAPI's addWeapon (though imagine changing this would involve HullSpecAPI anyway)

I guess swapping to another hull with the alternate built-in fighter would be feasible..?
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9513 on: January 25, 2023, 10:34:41 AM »

Is it possible to swap out built-in fighter wing for another? There doesn't seem to be any method akin to ShipVariantAPI's addWeapon (though imagine changing this would involve HullSpecAPI anyway)

I guess swapping to another hull with the alternate built-in fighter would be feasible..?

you can use setWingId(), something like this should work? (though I've not tested it)

Code
        for (String wingId : variant.getWings()) {
            if (wingId.equals("wingToReplace")) {
                variant.setWingId(variant.getWings().indexOf(wingId), "otherWingID");
            }
        }

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9514 on: January 25, 2023, 05:31:36 PM »

variant.setWingId() doesn't seem to do anything,
but             
variant.getWing(variant.getWings().indexOf(wingId)).setId("otherWingID");
changes the wing..however, there is some odd behavior.

1.) Wing data in refit screen isn't updated - Ex. If original wing was terminator, and I swap to talons, mousing over the wing still displays info for terminator

2.) Wing doesnt seem to deploy fully if there is a discrepancy between the two wings sizes - this seems to occur when the original wing has less members than the wing swapped to. Going off the above example w/ terminators and talons, the first 2 members deploy immediately but others goes through normal refit process before launching

I tried to use variant.refreshBuiltInWings() to see if it would resolve the above two, but doesn't seem to have any visible effect..

3.) If there are multiple built-in wings, all of them are swapped, irregardless of wing index used

Code
    private final int WING1_INT = 0;
    @Override
    public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id)
{
            stats.getVariant().getWing(WING1_INT).setId("talon_wing");
stats.getVariant().setWingId(WING1_INT,"talon_wing");
stats.getVariant().refreshBuiltInWings();
       
    }

is there something im overlooking?
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9515 on: January 25, 2023, 05:53:14 PM »

Is it possible to swap out built-in fighter wing for another? There doesn't seem to be any method akin to ShipVariantAPI's addWeapon (though imagine changing this would involve HullSpecAPI anyway)

I guess swapping to another hull with the alternate built-in fighter would be feasible..?

See Roider Union's MIDAS and Tracker Swap hullmods.

Tracker Swap is what the player sees, but the actual switching code must be in MIDAS (which is built in) because Tracker Swap can't switch back to the original wing.
Logged

ctuncks

  • Commander
  • ***
  • Posts: 115
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9516 on: January 26, 2023, 03:37:09 AM »

Just wondering, what's the official stance on using edited in game assets (Assets originating from the default game)? For example palette swapping a hullmod icon to use for a new hullmod.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9517 on: January 26, 2023, 11:26:55 AM »

Absolutely glorious, thank you sir. Ecstatic for the release, just can't bear the wait!

:)

1. There are relationship bars (can be added by method in TooltipMakerAPI), percentage bars in the fleet tab for hull and CR, and also bars with sliders in settings window. From what I've gathered, relationship bars are hardly suitable for anything but relationships themselves as they are not customizable and always show status string like ("Welcoming"), while proper bars and sliders are outside of reach of modders completely.

While I am able to worm my way around this with use of buttons, checkboxes and text fields (sadly, result looks nothing like vanilla), and other modders employed section headings for the same purpose, kinda wanted to ask you: are there any plans to give us proper, vanilla-looking bars and sliders?

Nothing like plans, maybe at some point? There's a lot of UI bits to potentially make API accessible. The "Event" bars will be addable, though, and I think possible to repurpose.

2. It seems that addShipIcons() in TooltipMakerAPI is not quite ideal for the many purposes modders have come to use it for. For example, it is ill-suited for displaying ship images bigger than 128x128, and also does not render weaponry. Is there any way for me to display ships in custom panels (or, ideally, in tooltip instance) the way fleet or refit tab does them?

Yeah, the ship icons are not meant to be displayed at a large size, hence "icon". I don't think the custom ship view is available via the API; wouldn't be a bad thing to add... at some point.

3. What kind of interactable buttons ship list in refit tab and hull list in blueprint tab use for entry items? Currently using area checkboxes (which can be made borderless only through color shenanigans, and that introduces its own problems), but it seems like there are proper method for borders in obfuscated code. Would it be possible for me, given the current API, to emulate vanilla ship lists precisely?

I don't think it can be easily emulated; it's using some stuff that's not exposed.


Just wondering, what's the official stance on using edited in game assets (Assets originating from the default game)? For example palette swapping a hullmod icon to use for a new hullmod.

This isn't a problem at all. For example, people use bits of vanilla ships etc all the time.
Logged

rogerbacon

  • Commander
  • ***
  • Posts: 142
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9518 on: January 26, 2023, 07:02:23 PM »

Where would I find a good example of adding a timed effect to a ship?

For example, I want to make a weapon that, when it hits shields, decreases the max shield coverage on that ship by ten degrees for 10 seconds. Multiple hits would stack, each with their own timer.

Bonus question: will there be a problem if the above method reduces the shield arc to 0 or negative?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9519 on: January 28, 2023, 10:29:00 AM »

Where would I find a good example of adding a timed effect to a ship?

For example, I want to make a weapon that, when it hits shields, decreases the max shield coverage on that ship by ten degrees for 10 seconds. Multiple hits would stack, each with their own timer.

Hmm - DisintegratorEffect in vanilla, perhaps? It's the effect for the special Disintegrator weapon. There's some extra stuff for particle effects but it's still a timed effect.

Bonus question: will there be a problem if the above method reduces the shield arc to 0 or negative?

Probably not but I'm not 100% on that.
Logged

SteelSirokos

  • Ensign
  • *
  • Posts: 30
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9520 on: January 28, 2023, 10:00:18 PM »

Is it possible to close a CustomDialogDelegate via code? I created a fancy custom panel that allows the player to easily select a weapon or fighter wing from their cargo, and it works entirely as it should, but I haven't found a single way to close the panel without the player pressing Confirm or Cancel. As the item selection is handled via buttons, I'd like to have a way to close the custom panel when the button is pressed (without closing the parent interaction dialog).

SteelSirokos

  • Ensign
  • *
  • Posts: 30
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9521 on: January 28, 2023, 10:38:35 PM »

Is it possible to close a CustomDialogDelegate via code? I created a fancy custom panel that allows the player to easily select a weapon or fighter wing from their cargo, and it works entirely as it should, but I haven't found a single way to close the panel without the player pressing Confirm or Cancel. As the item selection is handled via buttons, I'd like to have a way to close the custom panel when the button is pressed (without closing the parent interaction dialog).

In addition, please add a getBarrelSpriteName() function to the WeaponSpecAPI. It's currently impossible to render the barrels of weapons in a custom panel without manually entering the ID (which is infeasible if you're dealing with thousands of modded weapons).

Edit: a way to render missiles in their launchers would be nice too.
« Last Edit: January 29, 2023, 05:36:03 PM by SteelSirokos »
Logged

WhisperDSP

  • Commander
  • ***
  • Posts: 148
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9522 on: January 29, 2023, 06:50:19 PM »

It looks like the upkeep for a Size 3 colony with Vast Ruins is half what it should be. Here's what I've been looking at.

I've been digging into the TechMining code and have been looking at the upkeep. The basegame TechMining.java has the following:
Code: java
public void apply() {
  super.apply(false);

  int size = market.getSize();

  int max = 0;
  if (market.hasCondition(Conditions.RUINS_VAST)) {
    max = 4;
  } else if (market.hasCondition(Conditions.RUINS_EXTENSIVE)) {
    max = 3;
  } else if (market.hasCondition(Conditions.RUINS_WIDESPREAD)) {
    max = 2;
  } else if (market.hasCondition(Conditions.RUINS_SCATTERED)) {
    max = 1;
  }

  size = Math.min(size, max);

  applyIncomeAndUpkeep(size);

  if (!isFunctional()) {
    supply.clear();
  }

  market.addTransientImmigrationModifier(this);
}
According to the wiki the TechMining building should have an upkeep of (ruins size - 2) * 500cr. In the above code the "size = Math.min(size, max);" line produces values of the following for a Size 3 colony:

1 - Scattered Ruins
2 - Widespread Ruins
3 - Extensive Ruins
3 - Vast Ruins

Going further, the "applyIncomeAndUpkeep(size);" function in the "BaseIndustry.java" file then gets a sizeOverride = 1/2/3/3, which would:
Code
protected void applyIncomeAndUpkeep(float sizeOverride) {
  float size = market.getSize();
  if (sizeOverride >= 0) size = sizeOverride;
  float sizeMult = getSizeMult(size);
  sizeMult = Math.max(1, sizeMult - 2);

...

  int upkeep = (int) (getSpec().getUpkeep() * sizeMult);

...

}
This means that sizeMult becomes: 1/1/1/1, or 500/500/500/500cr upkeep costs for a Size 3 colony.

When following the chain through with a Size 4+ colony, this becomes: 1/2/3/4 > 1/1/1/2 > 500/500/500/1000cr upkeep costs for the colony.

It just looks like the upkeep for a Size 3 colony with Vast Ruins is half what it should be (according to the Wiki). Am I correct? Is this intended?

(I know I know, it seems weird that I'm asking about this minor thing. I'm trying to understand the TechMining code and this looked odd to me - trying to be sure that I'm translating it correctly.)

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9523 on: January 30, 2023, 12:11:17 AM »

Is it possible to swap out built-in fighter wing for another? There doesn't seem to be any method akin to ShipVariantAPI's addWeapon (though imagine changing this would involve HullSpecAPI anyway)

I guess swapping to another hull with the alternate built-in fighter would be feasible..?

See Roider Union's MIDAS and Tracker Swap hullmods.

Tracker Swap is what the player sees, but the actual switching code must be in MIDAS (which is built in) because Tracker Swap can't switch back to the original wing.
ohoho, thanks!
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9524 on: January 30, 2023, 02:30:18 AM »

It's currently impossible to render the barrels of weapons in a custom panel without manually entering the ID (which is infeasible if you're dealing with thousands of modded weapons).

Spoiler
Code
        ShipVariantAPI variant = module.getParentFleetMember().getVariant();
        List<String> slots = variant.getNonBuiltInWeaponSlots();
        if (slots.size() == 0) return;
        WeaponSpecAPI firstSlotWeapon = variant.getWeaponSpec(slots.get(0));
        Object spriteGunName;
        Class<?> weaponClass = firstSlotWeapon.getClass();
        MethodHandles.Lookup lookup = MethodHandles.lookup();
        Class<?> methodClass = Class.forName("java.lang.reflect.Method", false, Class.class.getClassLoader());
        MethodHandle getMethodName = lookup.findVirtual(methodClass, "getName", MethodType.methodType(String.class));
        MethodHandle unreflect = lookup.findVirtual(lookup.getClass(), "unreflect", MethodType.methodType(MethodHandle.class, methodClass));
        Object getSpriteMethod = null;
        for (Object method : weaponClass.getDeclaredMethods()) {
            String checkedMethodName = (String) getMethodName.invoke(method);
            if (checkedMethodName.equals("getTurretGunSpriteName")) {
                getSpriteMethod = method;
                break;
            }
        }
        MethodHandle spriteGetterMH = null;
        if (getSpriteMethod != null) {
            spriteGetterMH = (MethodHandle) unreflect.invoke(lookup, getSpriteMethod);
            spriteGunName = spriteGetterMH.invoke(firstSlotWeapon);
        } else {
            return;
        }
        String weaponSprite = firstSlotWeapon.getTurretSpriteName();
        String weaponSpriteUnder = (String) spriteGunName;
        modulePanel.addImage(weaponSprite, 0f);
        UIComponentAPI main = modulePanel.getPrev();
        main.getPosition().setXAlignOffset(150f);
        main.getPosition().setYAlignOffset(20f);
        float mainWidth = main.getPosition().getWidth();
        modulePanel.addImage(weaponSpriteUnder, 0f);
        UIComponentAPI under = modulePanel.getPrev();
        under.getPosition().rightOfMid(main, -(mainWidth));
        modulePanel.addImage(weaponSprite, 0f);
        UIComponentAPI test = modulePanel.getPrev();
        test.getPosition().rightOfMid(under, 10f);
[close]

[attachment deleted by admin]
Logged
   
Pages: 1 ... 633 634 [635] 636 637 ... 706