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: Codex Overhaul (05/11/24)

Pages: 1 ... 643 644 [645] 646 647 ... 714

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

Ruddygreat

  • Admiral
  • *****
  • Posts: 530
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9660 on: March 07, 2023, 11:25:59 AM »

I was going to suggest using getMergedSpreadsheetDataForMod();, it should also work for this purpose?

something like Global.getSettings().getMergedSpreadsheetDataForMod("id", "data/hulls/ship_data.csv", "yourmodid"); should do it

ctuncks

  • Commander
  • ***
  • Posts: 127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9661 on: March 07, 2023, 05:35:47 PM »

Is it possible/feasible to use custom AIHints for weapons that don't do anything other than act as hidden identifier for further scripting? I don't strictly need the capacity per se, but it would simplify matters greatly.
Logged

RoboticManiac

  • Ensign
  • *
  • Posts: 22
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9662 on: March 08, 2023, 12:28:24 AM »

Is it possible to increase the amount of fleets in the game? Meaning a higher density of pirate, patrol, salvagers etc fleets flying around? And how might one go about doing so, should it be possible?
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 530
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9663 on: March 08, 2023, 12:56:02 AM »

Is it possible/feasible to use custom AIHints for weapons that don't do anything other than act as hidden identifier for further scripting? I don't strictly need the capacity per se, but it would simplify matters greatly.

no, but you can just use custom tags, they're just a list of arbitrary strings so you can stick w/e in there.

ctuncks

  • Commander
  • ***
  • Posts: 127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9664 on: March 08, 2023, 05:30:51 AM »

Is it possible/feasible to use custom AIHints for weapons that don't do anything other than act as hidden identifier for further scripting? I don't strictly need the capacity per se, but it would simplify matters greatly.

no, but you can just use custom tags, they're just a list of arbitrary strings so you can stick w/e in there.

Would you happen to know what method you'd need to look for them? I know how to check a weapon for hints, it's display name or Id, but not tags.
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 530
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9665 on: March 08, 2023, 05:34:04 AM »

WeaponAPI.getSpec().getTags(); will give you the full list, then you can just .contains(); it to check for specific tags

ctuncks

  • Commander
  • ***
  • Posts: 127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9666 on: March 08, 2023, 05:54:21 AM »

WeaponAPI.getSpec().getTags(); will give you the full list, then you can just .contains(); it to check for specific tags

Cheers, didn't even know that method existed.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24252
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9667 on: March 08, 2023, 01:35:11 PM »

Is it possible to increase the amount of fleets in the game? Meaning a higher density of pirate, patrol, salvagers etc fleets flying around? And how might one go about doing so, should it be possible?

Ah - not in a super straightforward way like tweaking a few config values; you'd need to dig through the code that handles each of these things and adjust it separately.
Logged

Xaiier

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9668 on: March 08, 2023, 10:10:47 PM »

Why do...

WeaponSlotAPI.setArc(float arc);
WeaponSlotAPI.setAngle(float angle);

...apply to the visuals, but don't update the behavior?
Logged

Dazs

  • Admiral
  • *****
  • Posts: 1082
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9669 on: March 09, 2023, 06:00:27 AM »

Hello all, I am looking for some guidance to solve an issue that has come up with Hiver Swarm. They show up as a target for missions given in the bar such as having one of their planets a trade target destination. Today I received a message from a player who said they were doing the red planet missions that the 2nd guy you have to talk to after the old spacer was on a Hiver world. Since they are hostile to all factions it would make those missions not completable.

Histidine was kind enough to point me in the direction of a command I did find on the SS API website, market.setInvalidMissionTarget(true) so if I understand it correctly then that *should* effect vanilla missions but there are so many files that effect a faction's market I am unsure where that would go in the Hiver faction market creation process. Any help would be appreciated, thank you.

Sundog

  • Admiral
  • *****
  • Posts: 1732
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9670 on: March 09, 2023, 06:43:53 AM »

Is it safe to save instances of BaseIntelPlugin in persistent data? What about a planet's custom data? I thought it would be safe to do so since BaseIntelPlugin does not reference any other UI elements, but I'm told it can still cause issues. Thanks for any help!

...apply to the visuals, but don't update the behavior?
What behavior isn't being updated?

Sundog

  • Admiral
  • *****
  • Posts: 1732
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9671 on: March 09, 2023, 08:17:53 AM »

Is it safe to save instances of BaseIntelPlugin in persistent data? What about a planet's custom data? I thought it would be safe to do so since BaseIntelPlugin does not reference any other UI elements, but I'm told it can still cause issues. Thanks for any help!

...apply to the visuals, but don't update the behavior?
What behavior isn't being updated?

Edit for more context:
I have good reason to believe that my newest mod has caused save corruption for a user. They're sometimes getting this error when saving:
Spoiler
7324113 [Thread-3] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving stage 2
7324113 [Thread-3] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Saving stage 3
7327332 [Thread-3] INFO  com.fs.starfarer.campaign.save.CampaignGameManager  - Error saving game
7327332 [Thread-3] ERROR com.fs.starfarer.campaign.save.CampaignGameManager  -
java.lang.StackOverflowError
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.DynamicProxyMapper.serializedClass(DynamicProxyMapper.java:47)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.PackageAliasingMapper.serializedClass(PackageAliasingMapper.java:69)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.ClassAliasingMapper.serializedClass(ClassAliasingMapper.java:64)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.ArrayMapper.serializedClass(ArrayMapper.java:45)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.DefaultImplementationsMapper.serializedClass(DefaultImplementationsMapper.java:64)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.EnumMapper.serializedClass(EnumMapper.java:61)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.LambdaMapper.serializedClass(LambdaMapper.java:58)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.mapper.AnnotationMapper.serializedClass(AnnotationMapper.java:128)
   at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:121)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:231)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:213)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMa rshal(AbstractReflectionConverter.java:144)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hal(AbstractReflectionConverter.java:90)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
   at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hallField(AbstractReflectionConverter.java:274)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:250)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:213)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMa rshal(AbstractReflectionConverter.java:144)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hal(AbstractReflectionConverter.java:90)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
   at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hallField(AbstractReflectionConverter.java:274)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:250)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.<init>(AbstractReflectionConverter.java:213)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMa rshal(AbstractReflectionConverter.java:144)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.mars hal(AbstractReflectionConverter.java:90)
   at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
   at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)

Repeats ~200 times
[close]
And the end of their save file is filled with this nonsense afterward:
Spoiler
<oo0000 cl="java.nio.DirectFloatBufferU" z="291814">
<mark>-1</mark>
<position>0</position>
<limit>400</limit>
<capacity>400</capacity>
<address>2043140605536</address>
<offset>0</offset>
<isReadOnly>false</isReadOnly>
<att cl="java.nio.DirectByteBuffer" z="291815">
<mark>-1</mark>
<position>0</position>
<limit>1600</limit>
<capacity>1600</capacity>
<address>2043140605536</address>
<offset>0</offset>
<isReadOnly>false</isReadOnly>
<bigEndian>false</bigEndian>
<nativeByteOrder>true</nativeByteOrder>
<cleaner z="291816">
<referent cl="java.nio.DirectByteBuffer" ref="291815"></referent>
<queue z="291817">
<lock z="291818"></lock>
<queueLength>0</queueLength>
</queue>
<next z="291819">
<referent cl="java.nio.DirectByteBuffer" z="291820">
<mark>-1</mark>
<position>0</position>
<limit>16</limit>
<capacity>16</capacity>
<address>2038711492576</address>
<offset>0</offset>
<isReadOnly>false</isReadOnly>
<bigEndian>false</bigEndian>
<nativeByteOrder>true</nativeByteOrder>
<cleaner ref="291819"></cleaner>
</referent>
<queue ref="291817"></queue>
<next z="291821">
<referent cl="java.nio.DirectByteBuffer" z="291822">
<mark>-1</mark>
<position>0</position>
<limit>32</limit>
<capacity>32</capacity>
<address>2043214702512</address>
<offset>0</offset>
<isReadOnly>false</isReadOnly>
<bigEndian>false</bigEndian>
<nativeByteOrder>true</nativeByteOrder>
<cleaner ref="291821"></cleaner>
</referent>
<queue ref="291817"></queue>
<next z="291823">
[close]
I can't think of anything that would cause something like that other than an endless recursion loop caused by trying to save a looping reference.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24252
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9672 on: March 09, 2023, 08:55:38 AM »

Why do...

WeaponSlotAPI.setArc(float arc);
WeaponSlotAPI.setAngle(float angle);

...apply to the visuals, but don't update the behavior?

Hmm - at a guess, this might be because by the time you're calling these, the ship is already created and deployed.

Hello all, I am looking for some guidance to solve an issue that has come up with Hiver Swarm. They show up as a target for missions given in the bar such as having one of their planets a trade target destination. Today I received a message from a player who said they were doing the red planet missions that the 2nd guy you have to talk to after the old spacer was on a Hiver world. Since they are hostile to all factions it would make those missions not completable.

Histidine was kind enough to point me in the direction of a command I did find on the SS API website, market.setInvalidMissionTarget(true) so if I understand it correctly then that *should* effect vanilla missions but there are so many files that effect a faction's market I am unsure where that would go in the Hiver faction market creation process. Any help would be appreciated, thank you.

Red Planet is not actually checking for isInvalidMissionTarget(), though it should be - fixed this up. It *is* checking for market.isHidden(), though, so you might try that.

You'd want to do this in code somewhere - possibly in your ModPlugin.onNewGameAfterEconomyLoad()


Is it safe to save instances of BaseIntelPlugin in persistent data? What about a planet's custom data? I thought it would be safe to do so since BaseIntelPlugin does not reference any other UI elements, but I'm told it can still cause issues. Thanks for any help!

If I'm understanding the question correctly, for BaseIntelPlugin it should be fine - the vanilla game does this all the time. "A planet's custom data" I'm not 100% sure what you mean - could you clarify?


Edit for more context:
I have good reason to believe that my newest mod has caused save corruption for a user. They're sometimes getting this error when saving:

I can't think of anything that would cause something like that other than an endless recursion loop caused by trying to save a looping reference.

Looping references should be fine - this is, again, something that happens all the time and is handled by xstream. It's very weird that it's writing bytebuffers into the savefile, though. It might help to see more of it, if you have it - could you email it to me?

At a guess, rather than being a recursion loop issue, it may just be an issue with the data structure itself going very deep for some reason - not infinite, but deep enough to cause a stack overflow. So the question is what is this actually rooted in and what's getting into the savefile that shouldn't be. Though, if my guess is right, the issue isn't just that it's getting into the savefile, but also with it growing to the extent that it's a problem, too.

Edit: to be clear, it would be really helpful (well, probably) to see where this stuff *starts* in the save. Or better, the whole save.

Edit #2: seeing a "next" element in there makes me think it's some kind of linked list or perhaps linked hashmap that gets added to in an unbounded fashion. That would explain the stack overflow exception, too - when a long linked list is serialized by xstream, chances are it would happen depth-first.
« Last Edit: March 09, 2023, 09:09:33 AM by Alex »
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1732
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9673 on: March 09, 2023, 04:35:18 PM »

Thanks for the help, Alex! I suspect the issue isn't caused by the intel items being saved in persistent data, but by a TooltipMaker field that I overlooked in a different intel (one that is saved normally). I can't remove the field or make it transient now without creating a save incompatibility, so I'm just making sure it's null before being saved. That's an easy fix, but the intel items being saved to persistent data is integral to the structure of the mod, so I'm hesitant to change it. Other than the fields they inherit from BaseIntelPlugin and some primitives, the intel items I'm saving also have a reference to the planet they're attached to, if that matters.

If I'm understanding the question correctly, for BaseIntelPlugin it should be fine - the vanilla game does this all the time. "A planet's custom data" I'm not 100% sure what you mean - could you clarify?
Something like this:
Code: java
        List<BaseIntelPlugin> intelList = new ArrayList<>();
        intelList.add(intel1);
        intelList.add(intel2);
        planet.getCustomData().put("myIntelListKey", intelList);
Looping references should be fine - this is, again, something that happens all the time and is handled by xstream. It's very weird that it's writing bytebuffers into the savefile, though. It might help to see more of it, if you have it - could you email it to me?
I'll ask the user to upload or email it.

banano of doom

  • Commander
  • ***
  • Posts: 232
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9674 on: March 09, 2023, 05:09:39 PM »

is there a way to check which specific launch port the individual ShipAPI fighter is launching from ?
calling fiighter.getWing.getSource returns the whole bay from which the wing belongs, and i can get individual port locations from it
but not which fighter was launched from where
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.
Pages: 1 ... 643 644 [645] 646 647 ... 714