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 ... 598 599 [600] 601 602

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

Wispborne

  • Commander
  • ***
  • Posts: 221
  • Discord: Wisp#0302
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8985 on: July 31, 2022, 09:53:12 PM »

Is there a way to arbitrarily set the min/max campaign zoom at runtime?

I've gotten as far as `game.settings.setFloat("maxCampaignZoom", zoomMult)` but it doesn't stick and it doesn't look like I have access to any code needed to make it stick, but maybe I'm wrong?

My goal is to be able to allow the player to zoom out to see most of a system for some set period, then change the limit back to their normal one.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20595
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8986 on: August 01, 2022, 08:10:55 AM »

Yeah, that's not going to work - those values are just used to initialize the zoom tracker. Let me add some stuff to CampaignUIAPI:

float getMinZoomFactor();
float getMaxZoomFactor();
void setMinZoomFactor(float min);
void setMaxZoomFactor(float max);

My goal is to be able to allow the player to zoom out to see most of a system for some set period, then change the limit back to their normal one.

Just as a heads up, that seems likely to cause an FPS dive in some star systems, especially if there is a lot of nebula. (Also, stuff isn't designed to look good at that level, but, I mean, that's kind of whatever.)
Logged

Liral

  • Commander
  • ***
  • Posts: 196
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8987 on: August 01, 2022, 08:28:42 AM »

Yeah, that's not going to work - those values are just used to initialize the zoom tracker. Let me add some stuff to CampaignUIAPI:

float getMinZoomFactor();
float getMaxZoomFactor();
void setMinZoomFactor(float min);
void setMaxZoomFactor(float max);

Ooh, while we're talking zoom, I would love for my mod to zoom out further in the Command UI but can't find any handle for it in the API.  Have I gotten lost, or is it really not there?
Logged

Wispborne

  • Commander
  • ***
  • Posts: 221
  • Discord: Wisp#0302
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8988 on: August 01, 2022, 08:50:42 AM »

Yeah, that's not going to work - those values are just used to initialize the zoom tracker. Let me add some stuff to CampaignUIAPI:

float getMinZoomFactor();
float getMaxZoomFactor();
void setMinZoomFactor(float min);
void setMaxZoomFactor(float max);

My goal is to be able to allow the player to zoom out to see most of a system for some set period, then change the limit back to their normal one.

Just as a heads up, that seems likely to cause an FPS dive in some star systems, especially if there is a lot of nebula. (Also, stuff isn't designed to look good at that level, but, I mean, that's kind of whatever.)

Epic, thank you!

I might have already handled the performance/visual problem through other means (mod story spoiler stuff), but I'll make sure to check when possible.


Actually - another thing I wanted to change was the `easySensorBonus`, which is "hardcoded" at runtime.
I did successfully change it at runtime, but, uh, in such a way that will probably break next patch (by calling `settings.setFloat("easySensorBonus", bonus)` and then calling a method in `StarfarerSettings` to make it stick, which is bad).

Any chance of getting that one moddable as well? Not a biggie to me if not, having that zoom adjustment will be far more impactful what what I'm doing.
« Last Edit: August 01, 2022, 09:28:46 AM by Wispborne »
Logged

Gabs

  • Ensign
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8989 on: August 05, 2022, 01:11:57 PM »

Hello, any tips on how to draw a modded commodity in the same way as the crew and marines? I mean the 'more quantity' = 'draw bowling pin formation' in the cargo holds.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20595
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8990 on: August 06, 2022, 12:06:35 PM »

Re: further zoom stuff etc - I'll keep it in mind!

Also, added SettingsAPI.setEasySensorBonus(float easySensorBonus);

Hello, any tips on how to draw a modded commodity in the same way as the crew and marines? I mean the 'more quantity' = 'draw bowling pin formation' in the cargo holds.

Ah - that's actually totally hardcoded to only work for crew and marines, sorry :)

Logged

Liral

  • Commander
  • ***
  • Posts: 196
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8991 on: August 06, 2022, 12:45:04 PM »

Re: further zoom stuff etc - I'll keep it in mind!

Yay!
Logged

Antichrist Hater

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8992 on: August 08, 2022, 08:48:43 PM »

Also is there a way to increase ECM cap to %20 just like Nav rating?

Yes but you'd, IIRC, have to edit the script and recompile it/provide your own version etc.


How do I do this? 10% is insignificant. The cap should be higher by default
Logged

Liral

  • Commander
  • ***
  • Posts: 196
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8993 on: August 09, 2022, 05:26:58 AM »

NickXR and I encountered a problem when trying to make my mod pass messages to his Detailed Combat Results mod during combat: the only available bus was Global.getCombatEngine().getCustomData(), entries in which accumulate and might persist in saves.  Therefore, NickXR had to add to the manager of these entries a method to delete them, and my own mod must include a duplicate of that manager to call this method every frame should Realistic Combat be installed without Detailed Combat Results.  It occurs to me that a similar API method called HashMap<String, Object> Global.getCombatEngine().getFrameCustomData() providing a data bus flushed after every frame would let all modders that want to pass messages between mods every frame avoid this issue.
Logged

Lemuria

  • Ensign
  • *
  • Posts: 22
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8994 on: August 09, 2022, 11:38:08 AM »

How can I alter the description of a planet/station?

Anything - file editing or ConsoleCommands will work.
Logged
Lemuria#0685 on the Unofficial Starsector Discord

presidentmattdamon

  • Commander
  • ***
  • Posts: 107
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8995 on: August 09, 2022, 11:49:53 AM »

NickXR and I encountered a problem when trying to make my mod pass messages to his Detailed Combat Results mod during combat: the only available bus was Global.getCombatEngine().getCustomData(), entries in which accumulate and might persist in saves.  Therefore, NickXR had to add to the manager of these entries a method to delete them, and my own mod must include a duplicate of that manager to call this method every frame should Realistic Combat be installed without Detailed Combat Results.  It occurs to me that a similar API method called HashMap<String, Object> Global.getCombatEngine().getFrameCustomData() providing a data bus flushed after every frame would let all modders that want to pass messages between mods every frame avoid this issue.

shouldn't he just add methods that you and other modders can call rather than a whole entry manager?

edit: i think i understand, it's so you don't need to add it as a compile dependency. my only comment on that is you should just not add entries if the mod isn't enabled, unless your mod also has a use for those entries.
« Last Edit: August 09, 2022, 11:57:38 AM by presidentmattdamon »
Logged

Liral

  • Commander
  • ***
  • Posts: 196
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8996 on: August 09, 2022, 01:33:59 PM »

shouldn't he just add methods that you and other modders can call rather than a whole entry manager?

edit: i think i understand, it's so you don't need to add it as a compile dependency. my only comment on that is you should just not add entries if the mod isn't enabled, unless your mod also has a use for those entries.

I suggested this, but Nick rightly pointed out that it would create a hard dependency on DCR.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20595
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8997 on: August 09, 2022, 06:24:37 PM »

NickXR and I encountered a problem when trying to make my mod pass messages to his Detailed Combat Results mod during combat: the only available bus was Global.getCombatEngine().getCustomData(), entries in which accumulate and might persist in saves.  Therefore, NickXR had to add to the manager of these entries a method to delete them, and my own mod must include a duplicate of that manager to call this method every frame should Realistic Combat be installed without Detailed Combat Results.  It occurs to me that a similar API method called HashMap<String, Object> Global.getCombatEngine().getFrameCustomData() providing a data bus flushed after every frame would let all modders that want to pass messages between mods every frame avoid this issue.

Stuff in combat engine should not persist in saves unless a mod does something really ill-advised such as saving a reference to Global.getCombatEngine() in a member variable of a script that *does* go into a savefile, or some such. The combat engine, and more specifically the custom data, will get reset every time there's a new battle, or a new simulator run, etc.
Logged

Liral

  • Commander
  • ***
  • Posts: 196
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8998 on: August 09, 2022, 07:01:54 PM »

Stuff in combat engine should not persist in saves unless a mod does something really ill-advised such as saving a reference to Global.getCombatEngine() in a member variable of a script that *does* go into a savefile, or some such. The combat engine, and more specifically the custom data, will get reset every time there's a new battle, or a new simulator run, etc.

That's a relief to know, though I take you to mean Global.getCombatEngine().getCustomData() persists between frames.  A version that resets every frame would be very helpful for message passing.  :)
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 107
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8999 on: August 09, 2022, 07:10:01 PM »

Stuff in combat engine should not persist in saves unless a mod does something really ill-advised such as saving a reference to Global.getCombatEngine() in a member variable of a script that *does* go into a savefile, or some such. The combat engine, and more specifically the custom data, will get reset every time there's a new battle, or a new simulator run, etc.

That's a relief to know, though I take you to mean Global.getCombatEngine().getCustomData() persists between frames.  A version that resets every frame would be very helpful for message passing.  :)

why do you need his listener though? why can't you use Global.getSettings().getModManager() (i forget what the actual method is) to check if the Detailed Combat Results mod is enabled before putting messages into the custom data?
Logged
Pages: 1 ... 598 599 [600] 601 602