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

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9495 on: January 18, 2023, 10:07:38 AM »

I want to make a hull mod that will be built-in only. If I set no_drop in the hull_mods.csv and don't include it in any blueprint will that be enough or is there some other way to do it?

There are a number of hullmods like that in vanilla; you can check hull_mods.csv to see how that's done. (No tags needed, and a value of "TRUE" in the "hidden" column.)

I'm trying to figure out how to make universal mounts capable of mounting any smaller weapon- the json doesn't seem to have anything to fix it, does anyone have any ideas as to how? Did I just blatantly miss something?

as far as I know you just can't, mounts can only mount smaller weapons that are the same type (and only one size down).

Right, it's just how it works.
Logged

SteelSirokos

  • Ensign
  • *
  • Posts: 30
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9496 on: January 18, 2023, 01:13:26 PM »

What could explain a ship.getRepairTracker().getMaxCR() call returning 0.21f?

ship.getRepairTracker().setCR(0.7f) properly sets the ship's CR to 70%, but ship.getRepairTracker().setCR(ship.getRepairTracker().getMaxCR()) sets the ship's CR to 21%, so I have to assume that there's something weird going on with the getMaxCR() function. This has remained true for every ship I have tested.
« Last Edit: January 18, 2023, 01:16:09 PM by SteelSirokos »
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9497 on: January 18, 2023, 01:20:59 PM »

Not having enough crew can reduce max CR.
Logged

SteelSirokos

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

Not having enough crew can reduce max CR.
I consistently end up with 21% CR regardless of how many crew members are in my fleet (I've even added code to add the minimum crew of each ship before running the CR call)

rogerbacon

  • Commander
  • ***
  • Posts: 142
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9499 on: January 19, 2023, 09:50:04 AM »

Is there an event or something I can subscribe to when a ship dies? I'd like to create a big explosion if the ship has something like a self_destruct hull mod I'm planning on making.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9500 on: January 19, 2023, 04:05:21 PM »

What could explain a ship.getRepairTracker().getMaxCR() call returning 0.21f?

ship.getRepairTracker().setCR(0.7f) properly sets the ship's CR to 70%, but ship.getRepairTracker().setCR(ship.getRepairTracker().getMaxCR()) sets the ship's CR to 21%, so I have to assume that there's something weird going on with the getMaxCR() function. This has remained true for every ship I have tested.

Have you looked at the CR tooltip for that fleet member in the fleet view? It should list all the factors currently affecting its maximum CR, iirc.

Is there an event or something I can subscribe to when a ship dies? I'd like to create a big explosion if the ship has something like a self_destruct hull mod I'm planning on making.

Take a look at the implementation of PhaseAnchor; it does something similar (well, minus an explosion).
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9501 on: January 19, 2023, 07:52:23 PM »

Is there a way to keep AI fleet commander from ordering specific ships to retreat ?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9502 on: January 19, 2023, 08:48:23 PM »

Is there a way to keep AI fleet commander from ordering specific ships to retreat ?

Not on a per-ship basis, no. You could have a script catch this and cancel the orders until the AI runs out of command points.

You can also prevent the entire enemy side from retreating by setting Global.getCombatEngine()getContext().aiRetreatAllowed = false
Logged

Helldiver

  • Captain
  • ****
  • Posts: 380
  • space fruit
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9503 on: January 20, 2023, 03:55:01 PM »

A projectile can be made to only have a proximity detonation near missiles by giving vsMissileRange a value other than 0 and giving range a value of 0, but how do you make a projectile detonate on proximity with both missiles and fighters but not ships?
Logged
Afflictor bean plushie that glows purple when you squeeze it
30$

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9504 on: January 21, 2023, 08:37:53 AM »

Can I call showCustomDialog() - which shows a panel - on a same instance of InteractionDialogAPI while already showing a custom panel through showCustomVisualDialog()? In other words, I have a dialog and a custom panel. I have some button in that panel which I want to have a confirm window (so that it would not close the main custom panel when appearing). Is that possible to implement at all? Tried to create another delegate - button just stops reacting.

In general the relationship between dialog, delegate, panel and plugin is not entirely clear to me - able to get it work, but chiefly through trial and error.

Edit: Also, is it possible to emulate behaviour of button-behaving text labels like, say, "Production capacity per month" label in custom production tab? Namely, glow and sound on mouseover. I understand that given render() I can probably implement my own version from scratch, but really would like to stick to vanilla implementations.

Edit 2: There's one more thing that has been bothering me for quite some time: fleetMember icon which is added by addShipList() in TooltipMakerAPI has 2 widgets for officer and permamods apart from main sprite. The issue is that permamods widget has one little black stripe in place even when there are no actual permamods - completely invisible on the black background but gets painfully obvious when placed on a highlighted/colored panel. See attached.

There are ways to work around this (which, regrettably, involve turning off the icon button and therefore losing access to member tooltip), so no big deal at all. Just hope it gets changed some time in the future.

Edit 3: Also: having a very insidious glitch with my TooltipMakerAPI objects with scrolling list. Button objects stays interactive even when scrolled away beyond the tooltip panel border and even beyond parent custom panel border.  Tried additional custom panel containers, tried various configs of setForceProcessInput() - no luck. Strangely enough, when I designed my first scrollable list this issue never came up - despite panel/tooltip configs being much the same. I believe I can work around this by disabling ship icon button and setting mouseover sound of checkbox to null, but that's not particularly desirable for me in terms of user experience. Might there be something I overlooked? See second attached for visual on the problem.

[attachment deleted by admin]
« Last Edit: January 22, 2023, 02:37:42 AM by Ontheheavens »
Logged
   

bananana

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9505 on: January 22, 2023, 12:23:52 AM »

deleted

« Last Edit: January 22, 2023, 02:41:09 AM by passwalker »
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.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9506 on: January 22, 2023, 08:00:05 AM »

A projectile can be made to only have a proximity detonation near missiles by giving vsMissileRange a value other than 0 and giving range a value of 0, but how do you make a projectile detonate on proximity with both missiles and fighters but not ships?

Fairly sure it's not set up to be configured that way. It's probably possible to script this behavior explicitly though that seems like a decent amount of work.


Can I call showCustomDialog() - which shows a panel - on a same instance of InteractionDialogAPI while already showing a custom panel through showCustomVisualDialog()? In other words, I have a dialog and a custom panel. I have some button in that panel which I want to have a confirm window (so that it would not close the main custom panel when appearing). Is that possible to implement at all? Tried to create another delegate - button just stops reacting.

It won't work, no.

Edit: Also, is it possible to emulate behaviour of button-behaving text labels like, say, "Production capacity per month" label in custom production tab? Namely, glow and sound on mouseover. I understand that given render() I can probably implement my own version from scratch, but really would like to stick to vanilla implementations.

I don't think making these is exposed via the API - sorry!


Edit 2: There's one more thing that has been bothering me for quite some time: fleetMember icon which is added by addShipList() in TooltipMakerAPI has 2 widgets for officer and permamods apart from main sprite. The issue is that permamods widget has one little black stripe in place even when there are no actual permamods - completely invisible on the black background but gets painfully obvious when placed on a highlighted/colored panel. See attached.

Made a note to take a look, thought I'd fixed that but maybe I'm thinking about the fleet screen.


Edit 3: Also: having a very insidious glitch with my TooltipMakerAPI objects with scrolling list. Button objects stays interactive even when scrolled away beyond the tooltip panel border and even beyond parent custom panel border.  Tried additional custom panel containers, tried various configs of setForceProcessInput() - no luck. Strangely enough, when I designed my first scrollable list this issue never came up - despite panel/tooltip configs being much the same. I believe I can work around this by disabling ship icon button and setting mouseover sound of checkbox to null, but that's not particularly desirable for me in terms of user experience. Might there be something I overlooked? See second attached for visual on the problem.

Huh, that's very odd. Nothing comes to mind immediately as a problem. If you have a minimal snippet of code I can run somewhere (i.e. probably pasting it into some existing intel item) to reproduce this behavior, I can take a look!
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9507 on: January 22, 2023, 08:52:54 AM »

Edit 3: Also: having a very insidious glitch with my TooltipMakerAPI objects with scrolling list. Button objects stays interactive even when scrolled away beyond the tooltip panel border and even beyond parent custom panel border.  Tried additional custom panel containers, tried various configs of setForceProcessInput() - no luck. Strangely enough, when I designed my first scrollable list this issue never came up - despite panel/tooltip configs being much the same. I believe I can work around this by disabling ship icon button and setting mouseover sound of checkbox to null, but that's not particularly desirable for me in terms of user experience. Might there be something I overlooked? See second attached for visual on the problem.

Huh, that's very odd. Nothing comes to mind immediately as a problem. If you have a minimal snippet of code I can run somewhere (i.e. probably pasting it into some existing intel item) to reproduce this behavior, I can take a look!

This placeholder list class that I quickly cobbled together has the same issue persisting - tested it in my custom panel tab as I do not work with intel items, but believe it should reproduce given CustomPanelAPI and CustomUIPanelPlugin.
Spoiler
Code
package forgprod.abilities.interaction.panel.components.tabs;

import java.util.ArrayList;
import java.util.List;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.CustomUIPanelPlugin;
import com.fs.starfarer.api.combat.ShipVariantAPI;
import com.fs.starfarer.api.fleet.FleetMemberAPI;
import com.fs.starfarer.api.fleet.FleetMemberType;
import com.fs.starfarer.api.ui.*;
import com.fs.starfarer.api.util.Misc;

public class PlaceholderTab {

    public static CustomPanelAPI create(CustomPanelAPI panel, float width, CustomUIPanelPlugin plugin) {
        CustomPanelAPI placeholderTab = panel.createCustomPanel(width, 400f, plugin);
        TooltipMakerAPI list = addList(placeholderTab);
        placeholderTab.addUIElement(list).inMid();
        panel.addComponent(placeholderTab).inTL(4f, 4f);
        return placeholderTab;
    }


    private static TooltipMakerAPI addList(CustomPanelAPI placeholderTab) {
        TooltipMakerAPI listPanel = placeholderTab.createUIElement(400f, 100f, true);
        List<ShipVariantAPI> blueprints = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            blueprints.add(Global.getSettings().getVariant("crig_Standard"));
        }
        float summaryOffset = 0f;
        for (ShipVariantAPI blueprint : blueprints) {
            addBlueprintEntry(listPanel, blueprint);
            summaryOffset += 9f;
        }
        listPanel.addSpacer(-summaryOffset);
        return listPanel;
    }

    private static void addBlueprintEntry(TooltipMakerAPI listPanel, ShipVariantAPI blueprint) {
        ButtonAPI checkbox = listPanel.addAreaCheckbox("", null, Misc.getDarkPlayerColor(),
                Misc.getDarkPlayerColor(), Misc.getDarkPlayerColor(),
                300f, 30f, 1f);
        checkbox.getPosition().setXAlignOffset(0f);
        listPanel.addSpacer(0f);
        listPanel.getPrev().getPosition().setXAlignOffset(-15f);
        FleetMemberAPI dummyMember = Global.getFactory().createFleetMember(FleetMemberType.SHIP, blueprint);
        List<FleetMemberAPI> memberAsList = new ArrayList<>();
        memberAsList.add(dummyMember);
        listPanel.addShipList(1, 1, 30f, Misc.getDarkPlayerColor(), memberAsList, 0f);
        UIComponentAPI hullIcon = listPanel.getPrev();
        hullIcon.getPosition().setYAlignOffset(30f);
        listPanel.addSpacer(10f);
        listPanel.getPrev().getPosition().setXAlignOffset(25f);
    }

}
[close]

Also, thank you for your time and effort in answering all of the questions and explaining things. I don't think even Tynan holds a candle to you in modding support department!

Edit:

I don't think making these is exposed via the API - sorry!

Any chance this could be exposed in the future?

Made a note to take a look, thought I'd fixed that but maybe I'm thinking about the fleet screen.

To clarify on the issue: black stripe shows on mouseover if the background is not black, without mouseover stripe does not appear.
« Last Edit: January 22, 2023, 09:08:40 PM by Ontheheavens »
Logged
   

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9508 on: January 22, 2023, 09:37:32 AM »

Huh, that's very odd. Nothing comes to mind immediately as a problem. If you have a minimal snippet of code I can run somewhere (i.e. probably pasting it into some existing intel item) to reproduce this behavior, I can take a look!

the issue also shows up when fighting a large enough fleet, ships in the list will still be mouse-overable even if they've been scrolled off the bottom of the main visible area

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9509 on: January 23, 2023, 11:59:58 AM »

This placeholder list class that I quickly cobbled together has the same issue persisting - tested it in my custom panel tab as I do not work with intel items, but believe it should reproduce given CustomPanelAPI and CustomUIPanelPlugin.
the issue also shows up when fighting a large enough fleet, ships in the list will still be mouse-overable even if they've been scrolled off the bottom of the main visible area

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.


Any chance this could be exposed in the future?

... yes, it actually already is, I think. There's a new TooltipMakerAPI.addLabelledValue() method.

To clarify on the issue: black stripe shows on mouseover if the background is not black, without mouseover stripe does not appear.

Ahh, ok - this'll be fixed for the next release, then; the fix I thought I'd made didn't cover the glow case.
Logged
Pages: 1 ... 632 633 [634] 635 636 ... 706