Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 540 541 [542] 543 544 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8115 on: November 12, 2021, 08:37:24 AM »

It doesn't look like there's a bug; it looks like your actual solution is correct.

Calling:
tooltip.getPosition().setXAlignOffset(6);
Is going to adjust the position of the tooltip within its parent component, which is not what you want at all.

And since components are added below the left edge of the previous one, what you're doing is exactly right - move component to the right, add a 0-height spacer, and move the spacer to the left so that whatever goes below it is back to the normal alignment. It's part of why addSpacer() is there.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8116 on: November 12, 2021, 08:52:21 AM »

Oh, now it all makes sense. I assumed there was an internal variable offsetX that I could manipulate. Instead I just manipulate position via adding offset to existing position.

Perhaps a moveByOffsetX would be clearer here. I'll add some documentation to my API version. Thanks for explaining.
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 137
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8117 on: November 12, 2021, 10:46:12 AM »

How do I get `buttonPressConfirmed(Object buttonId, IntelUIAPI ui)` to redirect to `Global.getSector().getCampaignUI().showCoreUITab(CoreUITabId.CARGO)` instead of intel tab?
This:

Code
    @Override
    public void buttonPressConfirmed(Object buttonId, IntelUIAPI ui) {
        Global.getSector().getCampaignUI().showCoreUITab(CoreUITabId.CARGO);
    }

Does not work.
Logged
   

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8118 on: November 12, 2021, 11:26:37 AM »

`buttonPressConfirmed` is for button clicks on the intel you are displaying. If you want to "hijack" ui, you could try putting that code in say createSmallIntel.
« Last Edit: November 12, 2021, 11:31:30 AM by Jaghaimo »
Logged

theDragn

  • Captain
  • ****
  • Posts: 307
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8119 on: November 12, 2021, 02:03:27 PM »

About the only way I could see this happening is if there was code that did:

Global.getSector().getIntelManager().getIntel(PersonBountyIntel.class).add(<a VayraPersonBountyIntel object)

Otherwise, that seems impossible. Well, unless there's a very fundamental bug in core utility code that's been exercised a *lot* and not changed for a very long time; odds of this being the case seem exceedingly low, since this (the returned list only containing objects castable to the passed-in class) is an assumption that's relied in everywhere.

That's what I figured, I suppose hoping for a bug in core java was too much to ask. Still haven't been able to replicate it, so I'm gonna pretend it's user error for now.

Helldiver

  • Captain
  • ****
  • Posts: 382
  • space fruit
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8120 on: November 12, 2021, 04:20:30 PM »

Is the correct use for renderOrderMod to have a number following it with higher numbers making weapon slots render above any slot with a lower number (or no renderOrderMod set)?
I have renderOrderMod": 1 on a weapon slot (along with the slot having a higher id number) but it and any weapon mounted on it still render under a nearby slot with no renderOrderMod line.
Logged
Afflictor bean plushie that glows purple when you squeeze it
30$

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8121 on: November 13, 2021, 05:32:14 AM »

Oh, nice idea! *Seems* like it ought to work.

It works: https://cdn.discordapp.com/attachments/824910699415207937/909072511617105920/show-any-market.gif

One caveat though, cannot revert token back to what it was in the same "click" handler, as AWT-sending keystroke is handled in another thread, and by the time it is picked up, the token will be reverted. So instead I let it be whatever was the last one set, and in advance reset it to what it was.

Edit 1:
Question (about efficiency):
Code
    @Override
    public void advance(float amount) {
        setSectorEntityToken(resultSet.getSystemToken());
    }

Or:
Code
    @Override
    public void advance(float amount) {
        if (resultSet.getSystemToken() != getSectorEntityToken()) {
            setSectorEntityToken(resultSet.getSystemToken());
        }
    }

Or perhaps even add script on token swap, let it run while paused, and fix it after X frames have been rendered?

Edit 2:
Ok, self-removing, run while pause advance works like a champ.
Code
    @Override
    public void advance(float amount) {
        advancedAmount += amount;
        if (advancedAmount > 1) {
            setSectorEntityToken(resultSet.getSystemToken());
            SectorUtils.removeScript(this);
            advancedAmount = 0;
        }
    }

Now, if only I could get those new button CutStyles (nothing looks good so far)...
« Last Edit: November 13, 2021, 05:43:46 AM by Jaghaimo »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8122 on: November 13, 2021, 12:10:16 PM »

How do I get `buttonPressConfirmed(Object buttonId, IntelUIAPI ui)` to redirect to `Global.getSector().getCampaignUI().showCoreUITab(CoreUITabId.CARGO)` instead of intel tab?
This:

Code
    @Override
    public void buttonPressConfirmed(Object buttonId, IntelUIAPI ui) {
        Global.getSector().getCampaignUI().showCoreUITab(CoreUITabId.CARGO);
    }

Does not work.

Hmm - this method just doesn't work if you're interacting with an entity. For example it'll work if you open the intel screen while flying in space, but it doesn't work if you do it while docked at Jangala.


Is the correct use for renderOrderMod to have a number following it with higher numbers making weapon slots render above any slot with a lower number (or no renderOrderMod set)?
I have renderOrderMod": 1 on a weapon slot (along with the slot having a higher id number) but it and any weapon mounted on it still render under a nearby slot with no renderOrderMod line.

It's a modifier to the default render order, which is based on weapon size and slot type. For example, hardpoints render under turrets, and larger weapons render over smaller ones, etc. I'd suggest experimenting with the values to find one that works for what you want; something in the -30 to 30 range should do the job.

Edit 2:
Ok, self-removing, run while pause advance works like a champ.

*thumbs up*, looks good!
Logged

JAL28

  • Commander
  • ***
  • Posts: 217
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8123 on: November 14, 2021, 06:40:29 AM »

How to generate a gravity well for a gas giant manually without using autogenerateHyperspacePoints? I’m trying to add a gas giant into an existing system and it doesn’t spawn with a gravity well if this is not used, while if it is used it spawns duplicates of existing jump points.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3023
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8124 on: November 14, 2021, 06:54:24 AM »

You need to spawn a jump point using FactoryAPI.createJumpPoint(), put it in hyperspace orbiting the star's JP, and set it up so it looks like normal gas giant JPs.
Logged

Xaiier

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8125 on: November 14, 2021, 04:28:45 PM »

What is the best way to prevent the AI from taking manual control of a weapon? I have a unique weapon which requires custom aiming logic with an AutofireAIPlugin, but when the AI selects the group, it reverts to the default "mouse aim" AI which is unsuitable for the weapon.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8126 on: November 15, 2021, 10:07:20 AM »

What is the best way to prevent the AI from taking manual control of a weapon? I have a unique weapon which requires custom aiming logic with an AutofireAIPlugin, but when the AI selects the group, it reverts to the default "mouse aim" AI which is unsuitable for the weapon.

I think if you add the PD hint that might do it, though that'll also have an impact on the AI's understanding of what range the ship should try to maintain vs an enemy. Making its size "small" might also have an effect. If it's a missile, the DO_NOT_CONSERVE and DO_NOT_AIM hints may help, too.
Logged

Alex_Sans

  • Ensign
  • *
  • Posts: 32
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8127 on: November 15, 2021, 12:36:29 PM »

Is it possible to mod the player faction music (when you land on your colony or interact with your patrol) without changing the Independent and/or Persean League?
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8128 on: November 16, 2021, 03:53:01 AM »

How do one use LabelAPI.computeTextHeight(string)? Is it what the height would be had the text been vertically rendered? For a 65 tall PositionAPI, the call returned me 998 when I passed same string as I did to original addPara().

Also, I think we are missing the ability to set font on an AreaCheckbox, tried all four and didn't change:

Code
        tooltip.setButtonFontVictor10();// this would be expected one to work, since it returns ButtonAPI
        tooltip.setParaFont(Fonts.VICTOR_10);
        tooltip.setTitleFont(Fonts.VICTOR_10);
        tooltip.setGridFont(Fonts.VICTOR_10);
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24125
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8129 on: November 16, 2021, 07:57:38 AM »

Is it possible to mod the player faction music (when you land on your colony or interact with your patrol) without changing the Independent and/or Persean League?

Yeah - you'd specify the music in the player.faction file. See, say, hegemony.faction for an example.


How do one use LabelAPI.computeTextHeight(string)? Is it what the height would be had the text been vertically rendered? For a 65 tall PositionAPI, the call returned me 998 when I passed same string as I did to original addPara().

It returns the number of linebreaks in the string (plus one) times the "line height" of the font.

... except, oops, it was calling computeStringWidth() under the hood! Fixed that up, thank you :)

Also, I think we are missing the ability to set font on an AreaCheckbox, tried all four and didn't change:

Code
        tooltip.setButtonFontVictor10();// this would be expected one to work, since it returns ButtonAPI
        tooltip.setParaFont(Fonts.VICTOR_10);
        tooltip.setTitleFont(Fonts.VICTOR_10);
        tooltip.setGridFont(Fonts.VICTOR_10);

Yeah, that's not currently configurable. Let me add these to TooltipMakerAPI:
void setAreaCheckboxFont(String areaCheckboxFont);
void setAreaCheckboxFontDefault();
Logged
Pages: 1 ... 540 541 [542] 543 544 ... 710