Fractal Softworks Forum

Please login or register.

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

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

Obsidian Actual

  • Commander
  • ***
  • Posts: 105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8100 on: November 07, 2021, 12:26:19 PM »

Thank you Alex!

Your solution works as intended in the combat battlespace (i.e. no PPT timer ticking down).

However, when outside of combat, the codex entry (or ship card in the Refit/Fleet screens) displays this as a number instead of simply showing the word "Unlimited" (i.e. what it normally does for ships that have a blank value in the CSV).

Might there be another code solution to clean up this aesthetic? Or perhaps should I log this as a request for a future build of Starsector?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8101 on: November 07, 2021, 12:37:49 PM »

You're welcome!

I think you can get around this by doing:
stats.getCRLossPerSecondPercent().modifyMult(id, 0f);
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8102 on: November 09, 2021, 02:26:53 AM »

I am trying to recreate `showCargo()` and `showShips()` behaviour, already pretty close to it with my `showPeople()`. Now I am adding a new one - showAny - a generalized and custom way of showing a list. It builds up on beginImageWithText(), addPara(), and addImageWithText(). While I managed to get it work for PersonAPI and FleetMemberAPI (except it's not icon, image is not a square), I struggle to get correct (or any) icon for CargoStackAPI. Could you show how icon is determined in `showCargo()` (and also in `showShips()`) please? Or will I be lacking unobfuscated code to actually implement that (I have a feeling you directly render inside those methods)?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8103 on: November 09, 2021, 10:10:13 AM »

Yeah, the rendering for all of these is done with some internal (and relatively involved) code, it's not as simple as just drawing a sprite. Consider that blueprints are composited from a base image and what they're a blueprint of, and that ship icons have a faint grid overlaid on top of them, that sort of thing.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8104 on: November 09, 2021, 02:18:04 PM »

Honestly, I'd say the Codex is not the best point of reference. As you noted from the Ravelin et al being present it's not entirely correct, and generally it's in need of an overhaul at some point - it hasn't really kept up or been properly updated for a very long time..

Sadly, I have to redo my list building. Indeed, Codex is a bad reference - even if something is seen there, it does not mean it is known by anyone and thus might not be showing up in any market. With other mods adding semi-hidden stuff, I need a better way to build those lists. Right now I am considering iterating over each (non-hidden) faction and building a known list of ids (for weapons, hullmods, fighter wings, and ships). Is there a better way?


Also, is it possible to tap into "Show on map" button (or recreate its functionality)? I'd like to add a custom button with a different SectorEntityToken to intel's one.
« Last Edit: November 11, 2021, 07:52:34 AM by Jaghaimo »
Logged

itBeABruhMoment

  • Commander
  • ***
  • Posts: 158
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8105 on: November 11, 2021, 08:59:53 AM »

I'm trying to make a command to search for derelict ships. If I had the SectorEntityToken object of a derelict ship, how would I find what type of hull it is?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8106 on: November 11, 2021, 09:10:58 AM »

Also, is it possible to tap into "Show on map" button (or recreate its functionality)? I'd like to add a custom button with a different SectorEntityToken to intel's one.

It's not currently possible, no. Best you could do is swap out what the getMapLocation() method on the intel returns...

I'm trying to make a command to search for derelict ships. If I had the SectorEntityToken object of a derelict ship, how would I find what type of hull it is?

Something along the lines of:
((DerelictShipEntityPlugin)entity.getPlugin()).getData().ship

And then see the PerShipData class for the specific data members in that.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8107 on: November 11, 2021, 10:30:48 AM »

Also, is it possible to tap into "Show on map" button (or recreate its functionality)? I'd like to add a custom button with a different SectorEntityToken to intel's one.

It's not currently possible, no. Best you could do is swap out what the getMapLocation() method on the intel returns...

That would be enough if there was a way to trigger the button click without actually clicking it... Oh. Oooooh. Swap token with desired one, use AWT keyboard to send S, swap back. Custom show location buttons here I come!
Logged

Alex

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

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

IonDragonX

  • Admiral
  • *****
  • Posts: 816
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8109 on: November 11, 2021, 10:57:11 AM »

Is it possible to hide a variant in the Codex without hiding the other variants for that class?
I don't believe so.
If I made a new .skin file that did nothing except add the HIDE_IN_CODEX hint, would that hide all the variants that use the skin as it was a base hull?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8110 on: November 11, 2021, 11:36:49 AM »

If I made a new .skin file that did nothing except add the HIDE_IN_CODEX hint, would that hide all the variants that use the skin as it was a base hull?

You could try it and see :) Make sure to put all of the base hull's hints in the skin file, too, since if that's present it will be considered the complete set of hints for that hull, not additions to it. (Likewise for tags etc.)
Logged

theDragn

  • Captain
  • ****
  • Posts: 307
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8111 on: November 11, 2021, 06:00:12 PM »

Is there any way that IntelManagerAPI.getIntel(PersonBountyIntel.class) could be returning classes that aren't PersonBountyIntels? I've run into an interesting cross-mod interaction- Fleet Action History has the following code:
    for (IntelInfoPlugin i : Global.getSector().getIntelManager().getIntel(PersonBountyIntel.class)) {
      String bountyString = ((PersonBountyIntel) i).getName();
      /* ... */
    }

This causes a ClassCastException error when it runs into a (unofficially updated) Vayra's Sector VayraPersonBountyIntel object because that object extends BaseIntelPlugin, not PersonBountyIntel and thus can't be cast to a PersonBountyIntel. But that also means that getIntel(PersonBountyIntel.class) shouldn't be returning it in the first place.

Also worth noting that this is a one-off crash that I haven't been able to replicate, but the player who reported it was able to.

Histidine

  • Admiral
  • *****
  • Posts: 4681
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8112 on: November 11, 2021, 07:01:52 PM »

Addendum to previous: Could the fact that previous versions of Vayra's Sector did have VayraPersonBountyIntel extend PersonBountyIntel be affecting it (in some weird, incomprehensible way)?

(requoted since it's on previous page)
Is there any way that IntelManagerAPI.getIntel(PersonBountyIntel.class) could be returning classes that aren't PersonBountyIntels? I've run into an interesting cross-mod interaction- Fleet Action History has the following code:
    for (IntelInfoPlugin i : Global.getSector().getIntelManager().getIntel(PersonBountyIntel.class)) {
      String bountyString = ((PersonBountyIntel) i).getName();
      /* ... */
    }

This causes a ClassCastException error when it runs into a (unofficially updated) Vayra's Sector VayraPersonBountyIntel object because that object extends BaseIntelPlugin, not PersonBountyIntel and thus can't be cast to a PersonBountyIntel. But that also means that getIntel(PersonBountyIntel.class) shouldn't be returning it in the first place.

Also worth noting that this is a one-off crash that I haven't been able to replicate, but the player who reported it was able to.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8113 on: November 11, 2021, 07:18:25 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.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8114 on: November 12, 2021, 07:53:18 AM »

How do I use `TooltipMakerAPI`s `setXAlignOffset()`? Specifically, how do I reset it so it's back to (0?) for the next usage?

I move the last added element by 6 to the left, and (naively) reset tooltip back to 0, but every next item that is added starts aligned by -6.

Code
        tooltip.getPrev().getPosition().setXAlignOffset(-6);
        tooltip.getPosition().setXAlignOffset(6);

Edit: Might there be a bug in the logic? I worked around this by:

Code
        tooltip.getPrev().getPosition().setXAlignOffset(-6);
        tooltip.addSpacer(0);
        tooltip.getPrev().getPosition().setXAlignOffset(6);
« Last Edit: November 12, 2021, 07:59:29 AM by Jaghaimo »
Logged
Pages: 1 ... 539 540 [541] 542 543 ... 710