Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 ... 447 448 [449] 450 451 ... 706

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6720 on: July 31, 2020, 12:45:59 PM »

Checked into, and looks like that's hardcoded, I don't think there's any way to avoid that.

... well, I think setting the collision  radius to zero might, actually, but I'm not sure that there's a hook where you'd be able to do that at the right point in time.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6721 on: August 01, 2020, 05:20:35 PM »

How can I tell whether a course is laid in?

PersistentUIDataAPI.getCourseTarget() doesn't work because null is a valid target.

EDIT: To be more specific, the course target is null when no course is selected, but it is also null when a course is set to an arbitrary point.
« Last Edit: August 01, 2020, 07:14:17 PM by SafariJohn »
Logged

connortron7

  • Captain
  • ****
  • Posts: 439
  • "God has cursed me for my hubris" - brian gilbert
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6722 on: August 01, 2020, 09:24:52 PM »

how does one go about making a custom phase glow color?

EDIT: got on the right track.
« Last Edit: August 01, 2020, 10:05:52 PM by connortron7 »
Logged

Cabbs

  • Ensign
  • *
  • Posts: 24
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6723 on: August 03, 2020, 02:01:45 PM »

Hey!

Can anyone briefly explain part of the WeaponAPI to me?

More specifically, I want a hullmod to modify the stats of individual weapons on a ship, like their (missile) damage or fire rate.  Messing with missile weapons for my mod, and will be messing with other things later.

- I assume this would need to happen in applyEffectsAfterShipCreation
- But it does not look like fire rate can be changed outside of MutableStats
- It looks like I can't clone a set of MutableStats to apply to each weapon?

Have searched high and low but looks like I'm missing something.

EDIT: alright, after due diligence I am giving up on this half-formed idea - can see why this isn't possible, at least for me.

I was attempting to create a hullmod that provides 50% missile ammo rather than 100%, and manage 1-shot missiles with additional downsides, as their ammo would need to round up to 2.
« Last Edit: August 04, 2020, 11:27:53 AM by Cabbs »
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6724 on: August 04, 2020, 07:56:08 PM »

IIRC per-weapon stats configuration is coming in next version.

Question: How are ships sold on a submarket named? There's a minor text bug in Nexerelin (see here and the next two posts) where when a market and its submarkets are transferred to another faction, the ships for sale use the previous owner's ship name prefix.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6725 on: August 04, 2020, 08:36:09 PM »

It's based on this in BaseSubmarketPlugin, iirc:
this.cargo.initMothballedShips(submarket.getFaction().getId());

But calling that method again will do nothing since the mothballed ships FleetDataAPI is already inited. So you'd need to make a copy of the cargo and init the copy's mothballed ships... but "cargo" is a private variable in BaseSubmarketPlugin (urgh, sorry - just changed it to protected and added a setter.)
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6726 on: August 06, 2020, 07:33:26 PM »

How can I tell whether a course is laid in?

PersistentUIDataAPI.getCourseTarget() doesn't work because null is a valid target.

EDIT: To be more specific, the course target is null when no course is selected, but it is also null when a course is set to an arbitrary point.

Huh, looks like I was wrong and arbitrary points are a waypoint SectorEntityToken, not null as I thought. That is good news!
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6727 on: August 08, 2020, 06:38:41 AM »

I'm drawing some things in the campaign UI with OpenGL, at a position relative to the player fleet. This is done in the advance() method of an EveryFrameScript.
When I press Shift to speed up time, the drawing is duplicated and moved based on the player's motion. This effect goes away when the game is paused.
How do I fix?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6728 on: August 08, 2020, 10:16:15 AM »

Yeah, that's... probably not the only problem you'd have trying to do rendering in the advance() method. It's not a good idea. I wouldn't be surprised if this could, say, cause a crash during saving or loading.

I'd suggest using a custom campaign entity plugin instead as that has a proper render() method and you can specify which layer you want in the custom_entities.json definition of your custom entity. Since it's a UI thing, you might need to scale things to invert the zoom factor and do some coordinate translation, but given what you've described, that sounds doable.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6729 on: August 09, 2020, 02:44:59 AM »

Ah, I see. (Common Radar mod seems to work fine rendering in advance() though, in terms of not having crashes attributed to it)

I'll try creating a custom entity and moving it around to "stick" to the player. For the future, perhaps we could get an interface for campaign layer rendering without a sector entity?



Bug report, found while experimenting with a script to mirror weapons on the left/right sides of the ship (based on Wyvern's code here):

After calling WeaponSpecAPI.ensureClonedSpec(), modifying the weapon's fire offsets still affects all weapons of that type. Angle offset works correctly.
I'm guessing this is because the spec cloning does a shallow copy on the fire offsets (a list of Vector2fs)?

Sample EveryFrameWeaponPlugin code
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6730 on: August 09, 2020, 09:45:49 AM »

Ah, I see. (Common Radar mod seems to work fine rendering in advance() though, in terms of not having crashes attributed to it)

Ah, good to know. Interesting!

I'll try creating a custom entity and moving it around to "stick" to the player. For the future, perhaps we could get an interface for campaign layer rendering without a sector entity?

Yeah, I can see adding a callback for UI rendering; I'll keep it in mind. An entity is probably the best bet for in-engine-coordinates rendering, though, especially since layer control etc is already there.

Btw - as far as moving the entity - maybe you're already planning it this way, but based on what you're saying, it sounds like you might not be, so I thought I'd mention it:

(I'd suggest using its advance() method to make sure it's always in the player's current LocationAPI, and not worrying about the coordinates too much - using the player fleet's coordinates directly for any rendering, and having getRenderRange() return some absurdly high value to make sure it's always rendered if it's in the current location. Apologies if this is obvious!)

Bug report, found while experimenting with a script to mirror weapons on the left/right sides of the ship (based on Wyvern's code here):

After calling WeaponSpecAPI.ensureClonedSpec(), modifying the weapon's fire offsets still affects all weapons of that type. Angle offset works correctly.
I'm guessing this is because the spec cloning does a shallow copy on the fire offsets (a list of Vector2fs)?

Sample EveryFrameWeaponPlugin code

Thank you! ... checking the SVN history, it looks like I actually fixed this some number of months ago, so it must've come up. Ah, I vaguely remember noticing this while looking at something semi-related. And, yeah, the clone() method wasn't deep-copying the fire offsets.
Logged

N1MH

  • Ensign
  • *
  • Posts: 18
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6731 on: August 09, 2020, 10:11:02 PM »

Are beams that pierce depending on the targets "soft flux" possible? Such as the way the ion beam does it (with hard flux), but able to do so even if the enemy only has soft flux.

Examples for clarity:

I shoot a Enforcer with >60% flux (soft and hard), the beam pierces.

I shoot a ship that has <50% flux, the beam fails to pierce.

Modded Beam fires at Hammerhead with >70% SOFT flux, it pierces due to script attached to modded beam.

TL;DR: can one make beam that pierce shield depending on enemy overall flux, not just hard
Logged

WarStalkeR

  • Captain
  • ****
  • Posts: 343
  • Per Aspera Ad Astra!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6732 on: August 10, 2020, 12:56:23 AM »

Were any feature added that allows me to limit specific weapons to specific ships? I.e. faction A ships can only use faction A weapons.
Logged

"Happiness for everybody, freely, and let no one to leave unhappy!" (c) Strugatsky Brothers
Independent Defense Force is here! And they already in Sector Xplo.

N1MH

  • Ensign
  • *
  • Posts: 18
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6733 on: August 10, 2020, 06:51:50 AM »

As far as I know, there isn't a feature like that in the current version.

A crude workaround you could use is to hand-make the variants yourself and limit the factions to using 'em only via the variantOverrides section in the .faction file.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6734 on: August 12, 2020, 02:02:17 PM »

Is it safe, generally speaking, to modify market industries/conditions/stations during a save load from:

Code
    public void onGameLoad(boolean newGame)

Where newGame is false?

I'm going to all of this trouble so that I can create settings configuration to be able to "enable/disable" vanilla content very, very easily and without any technical skill. So I can preserve the TC experience as the default whilst simultaneously providing a user the option to have a full toybox if that is what they would prefer.

All of this seems to be working correctly from the perspective of disabling components through settings config. I now need to add the logic to re-enable everything and I was hoping I could mostly do that between saves rather than just on a new game.

Anything that deals with a SpecAPI doesn't need this as its read and configured every application start, but for things like knownShips, market components like industries, etc, those are obviously captured and loaded as is when a save is loaded.

As a side note to that, are there any economy-based methods that will for sure need to be called when doing this? For instance, I already call MarketAPI.reapplyIndustries() and MarketAPI.reapplyConditions() respectively - just to be safe.
Logged
Pages: 1 ... 447 448 [449] 450 451 ... 706