Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 624 625 [626] 627 628 ... 638

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

Ontheheavens

  • Ensign
  • *
  • Posts: 42
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9375 on: November 30, 2022, 04:34:06 AM »

Had a quick look - easy enough to add a check that should (I think) fixed this, but, I'm confused: if this is a tooltip of the sort that gets recreated every frame, then how are you mousing over the table without the mouse movement hiding the tooltip?

Ah, it's the same behaviour as with vanilla tooltips for sensor range and sensor profile: once the tooltip goes expanded, tooltip area encompasses mouse cursor and the tooltip does not go away until mouse is outside it.
« Last Edit: November 30, 2022, 08:04:03 AM by Ontheheavens »
Logged

Mephansteras

  • Lieutenant
  • **
  • Posts: 57
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9376 on: November 30, 2022, 02:45:57 PM »

[EDIT: Resolved!] Looks like my class files weren't getting put into the jar, which explains why the game couldn't find them. Opening up the jar file with 7zip was the key to figuring this out for me, at the advice of some folks on the discord.


Been getting an error for my code now that looks like it should be an easy fix, but I'm just not seeing what's wrong.

Code
34770 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error loading [plugins.stardust_ModPlugin]
java.lang.RuntimeException: Error loading [plugins.stardust_ModPlugin]
at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: plugins.stardust_ModPlugin
at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:179)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)

Which indicates to me that it can't find my mod plugin, but I'm not sure why not.

Code is compiled into Stardust_Ventures.jar. Zero errors compiling the jar, so all good there.

mod_info.json looks like this:
Spoiler
Code
{

    "id": "stardustventures",

    "name": "Stardust Ventures",

    "author": "Mephansteras",

    "version": "0.5.3 Alpha",

    "description": "A set of ships focused on exploration, surveying, and living outside the core worlds.",

    "gameVersion": "0.95.1a-RC6",

     "jars":["jars/Stardust_Ventures.jar"],

    "modPlugin":"plugins.stardust_ModPlugin"

}
[close]

Code for the mod plugin itself is this:
Spoiler
Code
package plugins;

import com.fs.starfarer.api.BaseModPlugin;
import java.lang.RuntimeException;
import java.lang.ClassNotFoundException;

import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.impl.campaign.procgen.ProcgenUsedNames;
import com.fs.starfarer.api.EveryFrameScript;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.MissileAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.PluginPick;
import com.fs.starfarer.api.combat.MissileAIPlugin;
import com.fs.starfarer.api.campaign.CampaignPlugin;
import java.io.IOException;
import org.json.JSONException;
import java.lang.Exception;
import java.util.HashMap;

public class stardust_ModPlugin extends BaseModPlugin
{
    // basic ModPlugin code taken from theDragn's High Tech Expansion mod, but no longer reliant on kotlin
    // Thanks to theDragn for directing me to it!

    @Override
    public void onGameLoad(boolean newGame)
    {
        SectorAPI sector = Global.getSector();
        if (!sector.hasScript(stardust_FleetStatManager.class))
        {
            sector.addScript(new stardust_FleetStatManager());
        }
    }

}

The code has some unnecessary imports I haven't cleaned up yet, but I doubt they'd be causing this specific error./spoiler]


I'm assuming this is something like an IDE configuration problem, or maybe some reference I need that I'm missing?

Just not quite enough info in the log error to really tell me what I'm doing wrong, and I'm too new at Java to spot it.
[close]
« Last Edit: December 01, 2022, 03:03:14 PM by Mephansteras »
Logged

SirHartley

  • Admiral
  • *****
  • Posts: 646
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9377 on: December 04, 2022, 02:12:29 PM »

what are the requirements for a condition to show up in the planet search? Just marking it as "planetary" apparently is not enough.
Thanks for your time!

Edit - Answer: it requires extending BaseHazardCondition and an entry in condition_gen_data.csv, it does not have to be a planetary condition.
« Last Edit: December 04, 2022, 02:33:19 PM by SirHartley »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 21257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9378 on: December 04, 2022, 03:05:40 PM »

is there some hidden trick with fighters' engine controller?

IIRC: yes. I forget exactly what it does but there's some hackery behind the scenes to make it look "right" for the wingmen, so that might explain the odd values you're seeing.

Ah, it's the same behaviour as with vanilla tooltips for sensor range and sensor profile: once the tooltip goes expanded, tooltip area encompasses mouse cursor and the tooltip does not go away until mouse is outside it.

(Ah, thank you - I forgot about that!)
Logged

passwalker

  • Commander
  • ***
  • Posts: 195
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9379 on: December 04, 2022, 10:58:51 PM »

is there some hidden trick with fighters' engine controller?

IIRC: yes. I forget exactly what it does but there's some hackery behind the scenes to make it look "right" for the wingmen, so that might explain the odd values you're seeing.

another question then, is it possible to make wing members behave independently? as in, not fly in formation?
or some other workaround?
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.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 21257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9380 on: December 05, 2022, 08:46:30 AM »

I think *theoretically* maybe yes because you can provide an entirely custom ship AI for them, but at a level of difficulty below that, I don't think so.
Logged

Mephansteras

  • Lieutenant
  • **
  • Posts: 57
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9381 on: December 05, 2022, 10:24:39 AM »

I'd like to add in a hullmod that reduces the chances of hitting an asteroid on the campaign map, but even after walking through a bunch of the code base I'm still not sure what I'd need to do to actually implement that effect.

I expect it'd be similar to the listener I already have in place that checks for ship hullmods in the fleet to improve maneuverability on the campaign map, so I have that in place.

What would be the best way to do this?

Logged

shoi

  • Admiral
  • *****
  • Posts: 574
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9382 on: December 05, 2022, 10:33:02 AM »

Is there any way I can figure out what the exact cause of this crash is given that it's obfuscated?

Quote
1656302 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.combat.ai.movement.maneuvers.RetreatManeuver.o00000(Unknown Source)
   at com.fs.starfarer.combat.ai.movement.maneuvers.RetreatManeuver.o00000(Unknown Source)
   at com.fs.starfarer.combat.ai.movement.maneuvers.int$o.o00000(Unknown Source)
   at com.fs.starfarer.combat.ai.movement.maneuvers.int.super(Unknown Source)
   at com.fs.starfarer.combat.ai.BasicShipAI.advance(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
   at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
   at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:748)

I can't reproduce it and it only seems to happen very rarely, but I can only really can surmise it is related to a ship trying to retreat, and its likely related to my mod since others have reported a similar NPE while using it. Could something like calling ShipAPI.resetDefaultAI() cause it??
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 21257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9383 on: December 05, 2022, 11:54:02 AM »

I'd like to add in a hullmod that reduces the chances of hitting an asteroid on the campaign map, but even after walking through a bunch of the code base I'm still not sure what I'd need to do to actually implement that effect.

I expect it'd be similar to the listener I already have in place that checks for ship hullmods in the fleet to improve maneuverability on the campaign map, so I have that in place.

What would be the best way to do this?

The only easy way to affect this is using Stats.NAVIGATION_PENALTY_MULT (see: Navigation.java for an example), but that affects all terrain penalties, not just asteroid impact chance.

The only other way would be to replace the vanilla AsteroidBeltTerrainPlugin with a custom one but that would be both more involved and less friendly to other mods.

Is there any way I can figure out what the exact cause of this crash is given that it's obfuscated?
...

I can't reproduce it and it only seems to happen very rarely, but I can only really can surmise it is related to a ship trying to retreat, and its likely related to my mod since others have reported a similar NPE while using it. Could something like calling ShipAPI.resetDefaultAI() cause it??

Do you by chance have any HullSize.FIGHTER ships that are not proper fighters but are treated as regular ships instead? If so: that could cause this, and should actually be fixed in the next release.
Logged

Mephansteras

  • Lieutenant
  • **
  • Posts: 57
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9384 on: December 05, 2022, 12:18:04 PM »

I'd like to add in a hullmod that reduces the chances of hitting an asteroid on the campaign map, but even after walking through a bunch of the code base I'm still not sure what I'd need to do to actually implement that effect.

I expect it'd be similar to the listener I already have in place that checks for ship hullmods in the fleet to improve maneuverability on the campaign map, so I have that in place.

What would be the best way to do this?

The only easy way to affect this is using Stats.NAVIGATION_PENALTY_MULT (see: Navigation.java for an example), but that affects all terrain penalties, not just asteroid impact chance.

The only other way would be to replace the vanilla AsteroidBeltTerrainPlugin with a custom one but that would be both more involved and less friendly to other mods.

Hmm. Ok, thanks Alex! I'll take a look at NAVIGATION_PENALTY_MULT and see if I can make that work for what I'm thinking.
Logged

passwalker

  • Commander
  • ***
  • Posts: 195
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9385 on: December 05, 2022, 06:12:49 PM »

question
is there a way to apply dead ship's visuals (i.e. smoke and fire and explosions on surface) to a ship that _isn't_ dead
either entirely to the whole ship, or selectively as individual smoke plumes?
is any part of that directly accessible?
Spoiler
[close]
additionally, what are the steps that needs to be taken to resurrect a dead ship? setting hp to non-zero and setHulk to false and owner to player didn't fix it entirely, it still can't actually do anything

not even considering any particular application, just exploring the possibilities
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.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 21257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9386 on: December 05, 2022, 06:26:54 PM »

question
is there a way to apply dead ship's visuals (i.e. smoke and fire and explosions on surface) to a ship that _isn't_ dead
either entirely to the whole ship, or selectively as individual smoke plumes?
is any part of that directly accessible?
Spoiler
[close]

This is GraphicsLib :)


additionally, what are the steps that needs to be taken to resurrect a dead ship? setting hp to non-zero and setHulk to false and owner to player didn't fix it entirely, it still can't actually do anything

not even considering any particular application, just exploring the possibilities

Not sure, haven't tried it myself! I'd imagine you need to call ship.resetDefaultAI() at some point, and CombatEntityAPI.setOwner(), but you would likely still have issues with CombatFleetManagerAPI thinking the ship is still disabled, when combat is over.
Logged

Arcangelus

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9387 on: December 05, 2022, 07:19:49 PM »

Hello. I was wondering if there is any particular reason to save fleet data alongside the stats of a given captain.

A while ago, I was tinkering with the functions required to copy the stats from a captain to another. In this process, I noticed that there are 3 main structures that a given officer can take (according to the save file). Some are just a references, others contain all the expected data plus memory, and a third type that contains a copy of the fleet information inside the stats section.
This 3rd type is used for (at least) the position (pst) patrolCommander and the fleet section is non interactable (and apparently static). Direct duplicates of the officer in question keep this fleet info. The function getStats() copies this section as well, despite being unused (I manually removed the data from the save file just to test it) and there is no native way of interacting with it.
Manually removing the fleet section via save editing reveals no ills effects that I could see, albeit I never tried to do so on a commanding officer on active patrol.

I asked on discord about it way back on June, and the solution proposed was unable to remove this "junk data". As this "issue" only resulted in slightly larger save files at a time I was experimenting with the IDLE, I did not press further. However, the addition of a method to remove this data (whenever making getStats() ignore it or being able to target it directly) would be welcome.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 21257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9388 on: December 05, 2022, 07:35:26 PM »

The officer data has a reference to the fleet data. How it ends up being laid out in the savefile is not super relevant; one of the places that reference this fleet data will end up having the actual data in the savefile included there, and other references will just... reference it. Where exactly the actual data is inserted in the file is not indicative of the behind-the-scenes structure.
Logged

shoi

  • Admiral
  • *****
  • Posts: 574
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9389 on: December 08, 2022, 01:42:12 AM »

Do you by chance have any HullSize.FIGHTER ships that are not proper fighters but are treated as regular ships instead? If so: that could cause this, and should actually be fixed in the next release.

Yeah, thats probably it. I'll keep hullsize as frigate in the mean time. Thanks!
Logged
Pages: 1 ... 624 625 [626] 627 628 ... 638