Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95.1a is out! (12/10/21); Blog post: The Pilgrim's Path (07/19/22)

Pages: 1 ... 591 592 [593] 594 595 ... 602

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

ez

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8880 on: June 29, 2022, 10:37:05 AM »

Hi folks,

This Q is maybe too meta for this thread, so apologies. I made a small mod for myself that I'd like to share but not sure if I should post it in this area (Modding) or if it needs to go in the top-level Mods section? Side Q: I can't start a new thread in the Mods section, wondering how I'd go about posting there if that's where it should go. I noticed some mods in Modding get moved elsewhere, so figured it's worth asking before I do anything.

Thanks!
Logged

Ruddygreat

  • Commander
  • ***
  • Posts: 215
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8881 on: June 29, 2022, 12:23:37 PM »

Hi folks,

This Q is maybe too meta for this thread, so apologies. I made a small mod for myself that I'd like to share but not sure if I should post it in this area (Modding) or if it needs to go in the top-level Mods section? Side Q: I can't start a new thread in the Mods section, wondering how I'd go about posting there if that's where it should go. I noticed some mods in Modding get moved elsewhere, so figured it's worth asking before I do anything.

Thanks!

you need to make a thread in modding and ask a forum moderator to move it to mods
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20603
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8882 on: June 29, 2022, 02:55:50 PM »

I was able to do the first point, hullmod for the armor and hull but I can't find a way to modify the ordnance points as the only related thing I can find it's in "MutableCharacterStatsAPI".

Hmm - the only way that comes to mind would be using hidden hullmods with a negative deployment point cost, but you'd need a bunch of them (for the different number of points you want to add) so it'd be pretty clumsy. Maybe there's a cleaner way, though; just not coming up with one right now.

For the second point a good solution could be multiplying the capital ships deployment points so you wouldn't be able to deploy many capitals but i'm unable to find a way to do it, i've tried to do getSuppliesPerMonth() and getSuppliesToRecover() with a.modifyPercent() in the hullmod but it doesn't change the ships deployment points. Any ideas?

EDIT: I've found a way with getSuppliesToRecover and setSuppliesToRecover in the hullmod plugin (ShipHullSpecAPI). But now I need a way to limit this to capital ships only, is this possible?
EDIT 2: Finally figure it out, it was way simpler than what I was thinking.

I think what you want is stats.getDynamic().getMod(Stats.DEPLOYMENT_POINTS_MOD)


you need to make a thread in modding and ask a forum moderator to move it to mods

Right! With the intermediate step of the mod getting some player use, a bit of feedback, etc, so that when/if it ends up in the Mods forum (and possibly in the mod list), it's a little more mature.
Logged

ez

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8883 on: June 30, 2022, 10:23:29 AM »

Thanks guys  ;D
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8884 on: June 30, 2022, 11:02:18 PM »

I created a custom star system, and added the hyperspace objects manually.

Now the star system name NEVER show on hyperspace, including you can't select it as gate destination when gate travelling.

How I fix that?

And no, the thing that lights out mod does is not what I want...
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3890
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8885 on: July 03, 2022, 07:18:53 AM »

A custom allied fleet is having the captain removed from its flagship when I join its battle.
Breakpointing FleetMemberAPI.setCaptain led me to FleetData.ensureHasFlagship in the obsf code.

Am I reading this method right, does the code here mean that a fleet must have its flagship be the first ship in the fleet, else that status is given to the said first ship?
It would be nice if it didn't do this if the fleet already has a valid flagship, or at least if it didn't kick off the old flagship's captain when revoking its flagship status. Or if FleetDataAPI.sort put the existing flagship at the front of the fleet to circumvent this issue.

(The fleet's flagship is a cruiser while there is also a capital in the fleet, which I don't want to be the flagship for reasons)

Can I force the flagship to be at the front of the fleet data somehow?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20603
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8886 on: July 03, 2022, 07:51:53 AM »

A custom allied fleet is having the captain removed from its flagship when I join its battle.
Breakpointing FleetMemberAPI.setCaptain led me to FleetData.ensureHasFlagship in the obsf code.

Am I reading this method right, does the code here mean that a fleet must have its flagship be the first ship in the fleet, else that status is given to the said first ship?
It would be nice if it didn't do this if the fleet already has a valid flagship, or at least if it didn't kick off the old flagship's captain when revoking its flagship status. Or if FleetDataAPI.sort put the existing flagship at the front of the fleet to circumvent this issue.

(The fleet's flagship is a cruiser while there is also a capital in the fleet, which I don't want to be the flagship for reasons)

Can I force the flagship to be at the front of the fleet data somehow?

Hmm, that's odd - the first ship does not have to be the flagship, no. I think you can see plenty of fleets in vanilla where this isn't the case. The ensureHasFlagship() method should be a no-op if the fleet has exactly one flagship. Is this a manually created fleet? I suspect it may be an issue with the fleet having a commander set, and the commander being assigned to captain a ship, but there not being a fleet.getFleetData().setFlagship(member) call somewhere in there.

(I don't recall why there's a distinction between "flagship" and "fleet member with the fleet commander assigned as captain", but it exists. Possibly to do with some plans that never materialized?)
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3890
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8887 on: July 03, 2022, 10:02:30 AM »

So far as I can tell, the flagship has been set correctly in fleet data; only one fleet member returns true for isFlagship(), and it is the same one as returned by fleet.getFlagship(). It's a manually created fleet, yeah.
I'll see later if I can generate a small sample fleet that repros the issue.

I created a custom star system, and added the hyperspace objects manually.

Now the star system name NEVER show on hyperspace, including you can't select it as gate destination when gate travelling.

How I fix that?

And no, the thing that lights out mod does is not what I want...
At a guess, the system needs to have its hyperspace anchor set to appear on the map (which would explain why Ziggurat blacksite doesn't have it).
The javadocs are contradictory and out of date, but: Try calling system.generateAnchorIfNeeded to make the system appear.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20603
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8888 on: July 03, 2022, 10:46:14 AM »

Ahh, I think I see the issue - it happens when you actually get into the combat, not just when you join the battle in the campaign screen. Checking it out!

Edit: fixed this up! It would only affect allied fleets, and I *think* it would kick out the fleet commander regardless of what ship they were in, so, a pretty significant bug at that. Thank you for the report!

I don't *think* there's a particularly clean workaround, other than, say, undoing this in some combat plugin's init() method or something similar.
« Last Edit: July 03, 2022, 10:55:09 AM by Alex »
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8889 on: July 03, 2022, 05:13:08 PM »

So far as I can tell, the flagship has been set correctly in fleet data; only one fleet member returns true for isFlagship(), and it is the same one as returned by fleet.getFlagship(). It's a manually created fleet, yeah.
I'll see later if I can generate a small sample fleet that repros the issue.

I created a custom star system, and added the hyperspace objects manually.

Now the star system name NEVER show on hyperspace, including you can't select it as gate destination when gate travelling.

How I fix that?

And no, the thing that lights out mod does is not what I want...
At a guess, the system needs to have its hyperspace anchor set to appear on the map (which would explain why Ziggurat blacksite doesn't have it).
The javadocs are contradictory and out of date, but: Try calling system.generateAnchorIfNeeded to make the system appear.

I had to go poke in the source to find it.

Basically the map shows as valid systems and gate destinations, only jump points (not gravity wells), and they must end on a star. (or nebula, I assume).

A system anchor is NOT enough. A gravity well is NOT enough either, it must be a jump point, and its target must be a star, not another jump point, not a planet, etc... must be specifically, a star.

What the code does when rendering  the map is is call a function on the jump point itself (thus gravity wells don't have it), and the jump point function grabs its destination, then calls "isStar()".
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2539
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8890 on: July 03, 2022, 08:24:16 PM »

There doesn't have to be a star jump point. See: nebula centers.
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8891 on: July 04, 2022, 06:02:46 AM »

I think nebula centers count as star.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2539
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8892 on: July 04, 2022, 07:37:27 AM »

Yes, but there is no jump point for it.
Logged

Liral

  • Commander
  • ***
  • Posts: 201
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8893 on: July 04, 2022, 09:51:24 AM »

I want to programmatically hide the friendly info boxes during combat because they overlap and clutter the battlefield under the extreme zoom-out my mod involves, and I want to replace them with flux and hull diamonds, for which I already have working code, but cannot find an API call to hide the info boxes. I found a hack by simulating an F11 keypress via Robot, to which the OS responds by asking if Starsector should be allowed to control the computer, but I don't want to make users think that my mod hijacks their machine.  Does or will any workaround exist?
« Last Edit: July 04, 2022, 10:04:51 AM by Liral »
Logged

intrinsic_parity

  • Admiral
  • *****
  • Posts: 2854
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8894 on: July 04, 2022, 04:38:07 PM »

Is anyone aware of a mod that disables the ability to create stable points using an alpha core + story point at a star, or any reason why it wouldn't be possible? I don't seem to be able to do that in my current campaign.
Logged
Pages: 1 ... 591 592 [593] 594 595 ... 602