Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 625 626 [627] 628 629 ... 710

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

JAL28

  • Commander
  • ***
  • Posts: 217
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9390 on: December 10, 2022, 01:20:12 AM »

Is there a way to prevent a specific ship and it’s bp from generating in salvage/as derelicts during a new game start as part of a settings.json Boolean?
Logged

vicegrip

  • Commander
  • ***
  • Posts: 193
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9391 on: December 10, 2022, 04:36:01 AM »

For hullmods, is there a way to pull the ship.getFleetMember().getCaptain().getAICoreId() inside applyEffectsBeforeShipCreation? stats.getEntity() doesn't work outside of combat, so I'm kind of stuck.

Edit: never mind, after banging my head against this for hours I got it to work with:

Code
if (stats.getFleetMember() != null) String coreId = stats.getFleetMember().getCaptain().getAICoreId();
« Last Edit: December 10, 2022, 04:58:33 AM by vicegrip »
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9392 on: December 10, 2022, 04:51:30 PM »

Weird things, sometimes if I use addPara in TextPanelAPI, the paras will have a basic padding between lines. Meanwhile if I use textPanel.beginTooltip() and use tooltip.addPara(), the paras will be no padding between lines.

Is there any way to make the tooltip paras work like textpanel texts?
« Last Edit: December 10, 2022, 05:02:02 PM by Originem »
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9393 on: December 10, 2022, 05:37:29 PM »

is there a way to make a specific music track play when within specific systems?, could this be doable only on a per system basis or possibly via faction control?

You can put the sound id (from sounds.json) of the music you want for that system into the system's memory, using the MusicPlayerPluginImpl.MUSIC_SET_MEM_KEY key.

Is there a way to prevent a specific ship and it’s bp from generating in salvage/as derelicts during a new game start as part of a settings.json Boolean?

For blueprints, you'd need to add the rare_bp tag for blueprints to be generated, so it'd just be a matter of not doing that. For derelicts, you'd need to make the ship not available to any faction.


Weird things, sometimes if I use addPara in TextPanelAPI, the paras will have a basic padding between lines. Meanwhile if I use textPanel.beginTooltip() and use tooltip.addPara(), the paras will be no padding between lines.

Is there any way to make the tooltip paras work like textpanel texts?

TooltipMakerAPI.addPara() takes a pad parameter, so just passing in some value >0 for that should do the job? I forget what the exact value TextPanelAPI uses; I think it's something like 1.5x the line height of the font.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9394 on: December 10, 2022, 10:54:08 PM »

TooltipMakerAPI.addPara() takes a pad parameter, so just passing in some value >0 for that should do the job? I forget what the exact value TextPanelAPI uses; I think it's something like 1.5x the line height of the font.

Well I mean the padding between the lines not the paragraphs...
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9395 on: December 11, 2022, 08:00:02 AM »

Could you post a screenshot? The spacing between lines of the same paragraph should be the same (provided the font is the same), both use the same Label class which means the same code handles line wrapping/spacing/etc.
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 137
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9396 on: December 11, 2022, 08:55:30 AM »

I would like to add a weapon icon to a hull mods description through Tooltip.addImage
and the ToolTipMakerAPI.addImage only accepts string not SpriteAPI. Does one exist where I can addImage through SpriteAPI or alternatively is there a way to grab the sprite image when it's displayed in codex or refit
There *is* no one sprite for weapons with barrels or missiles, it's composited together from the various pieces depending on how the weapon is set up. Your best bet might be to add something like TooltipMakerAPI.showCargo(), though that likely won't do quite what you want.

I'm interested specifically in those simple shapes beneath weapon sprite that represent ballistic/missile/energy slots and sizes. I take it they are fully procedurally drawn with GL11 calls, right? Could there be any way for me to recreate these simple shapes (or shapes of similar design) with the color I want in TooltipMakerAPI? I looked around in StandardTooltipV2 and CargoTooltipFactory, but the process definitely eludes me.
Logged
   

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9397 on: December 11, 2022, 10:04:24 AM »

Ah - yeah, it's a bunch of GL11 calls, and there isn't any way to easily duplicate that via the API, sorry!
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 137
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9398 on: December 12, 2022, 12:48:19 AM »

I've ran into an issue with
Code
addImage(String spriteName)
in TooltipMakerAPI. Method works when I pass "graphics/icons/cargo/whatever.png" with vanilla icons, but when I try to do the same with images in my mod graphics folders it doesn't render the sprite. I've double-checked with a sprite that was already working as part of BaseIntelPlugin-inheritor class
Code
public String getIcon() {
        return Global.getSettings().getSpriteName("intel", "forge_production_report");
    }
- it renders fine when appearing as campaign UI message icon (so game loads it), but fails to render via addImage in TooltipMakerAPI. Tinkered plenty with settings.json graphics categories and ids - nothing; another noticeable thing is that icons in vanilla cargo folders load alright, but all-white vanilla icons like those in graphics/ui/icons do not; so maybe there's some property of image files that needs to be adhered to.

Searched through forum, seems like people already had this issue pop up - not sure how it was resolved if was at all. My question  is: how do I use addImage() properly to get it to render images? What properties the images should have? Searched also through  various methods in API that concern sprites - not much luck with Javadocs.

Edit: resolved, problem was my own lack of attention when writing methods.
« Last Edit: December 12, 2022, 01:11:30 AM by Ontheheavens »
Logged
   

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9399 on: December 12, 2022, 07:37:16 AM »

If a module on a ship is destryoed, is it possible to replace it with a new one during combat? I'd imagine this is a no go since it'd require a change to the variant or something and those dont seem to be something that can be reloaded in combat but figured id double check before proceeding with a (kind of) hacky alternative
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9400 on: December 12, 2022, 01:24:56 PM »

If a module on a ship is destryoed, is it possible to replace it with a new one during combat? I'd imagine this is a no go since it'd require a change to the variant or something and those dont seem to be something that can be reloaded in combat but figured id double check before proceeding with a (kind of) hacky alternative

You couple probably "replace" it in the sense of "spawning another ship of the same type and variant at the same location" but linking it up with the same fleet member, making sure the game doesn't still think it was destroyed, etc, is going to be tricky. I think your best bet might be looking at the PhaseAnchor hullmod - it avoids these issues by triggering right before fatal damage is applied.

(Note: the javadoc for HullDamageAboutToBeTakenListener.notifyAboutToTakeHullDamage() is wrong; returning true is what makes the damage be negated. I've fixed up the javadoc just now.)
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9401 on: December 14, 2022, 07:53:53 AM »

That works perfectly. Thanks!
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9402 on: December 17, 2022, 07:27:48 AM »

not directly modding related, but is there a reason why a load of in-combat scripts (esp. like ship systems) run in the refit screen?
mostly asking because it's been annoying me lately, I keep forgetting to check for a ship's owner and the game just explodes on me because of it

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9403 on: December 17, 2022, 08:51:23 AM »

... yes? :)

(Seriously, though, it's just a "how it works".)
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9404 on: December 17, 2022, 01:37:52 PM »

fair heh, I wasn't entirely sure what answer I was expecting :D

though, an isInRefitScreen() or similar boolean would be nice for shipAPI, checking the owner feels overly wierd and janky even if it's technically correct
Pages: 1 ... 625 626 [627] 628 629 ... 710