Hmm - you might be able to query its contents every frame in a plugin that runs when the game is paused. And that you add when the player is viewing the intel and remove when they're not.
Could you clarify which methods or listeners can be used to tell if certain intel item is currently being viewed, and possibly to report event of opening and closing description panel? There's
and
notifyPlayerAboutToOpenIntelScreen()
, but I'm not sure if this is what I'm looking for.
Tried also to put relevant code into own
of intel item (as it itself implements EveryFrameScript), but the method just doesn't get called even with
set to return true.
Edit: also facing that same challenge with "Show on map" functionality that Jaghaimo had:
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!
In the case of large, custom-panel-powered description this solution doesn't work out of the box, since the vanilla showOnMap button shouldn't be seen by player (looks ugly with its
unmodifiable position), and therefore must be immediately cleaned-up by resetting returns of getMapLocation() back to null. The problem is, if I make the reset right from the execution of buttonPressConfirmed(), the map doesn't show up at all.
Perhaps this can be worked around by placing the reset code in advance() method and call that after map has been shown -
if only I could capture that event, and if I could either get own intel's advance() working or have starting and closing conditions to satellite advance(). But, nonetheless: I think this calls for
a proper showTokenOnMap() method in IntelInfoPlugin.
Edit 2: Figured out that for advance() to work intel should be added to sector as script; but that didn't help me to solve either problem. In advance(), getMapLocation() returns are reset back to null, map's showing fine, but pesky button still persists even after calling
bufferedUI.updateUIForItem(this)
In any case, such a workaround is
not satisfactory for me, since the button is visible for a few frames before map is actually opened. It's no biggie, my mod will have to do without such a feature, but these API constraints sure do not spark joy.
Edit 3: while working with campaign entities, noticed an OCD-unfriendly typo in Valhalla System - Valkyrie has a space before its name:
// Valkyrie jump
JumpPointAPI jumpPoint = Global.getFactory().createJumpPoint("valkyrie_jump", " Valkyrie Jump-point");
Edit 4: I want to emulate behaviour of skill buttons in Character tab. Speaking more broadly, I want buttons with arbitrary images/textures on them. And I want them in tooltip instances and large intel descriptions, not just in custom panels with work-from-scratch GL11. Is this realistic at all or am I out of luck?