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 ... 349 350 [351] 352 353 ... 706

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

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5250 on: October 01, 2019, 10:08:43 AM »

Why might this happen?
Spoiler


I'm trying to imitate how ShipRecoverySpecial handles ship recovery, except directly from an InteractionDialogPlugin (using ShipRecoverySpecial  properly doesn't seem to support my needs). Everything is working the way I want it to, except for this one bug. The biggest deviation from the ShipRecoverySpecial implementation is that I've removed all references to the ShipRecoverySpecialData instance (data), but I don't see how that could cause this issue. Here's how I'm calling showFleetMemberRecoveryDialog:

Code
public class SalvageFamousDerelictDialogPlugin implements InteractionDialogPlugin {
    public static final String RECOVER = "recover";

    InteractionDialogAPI dialog;
    FamousDerelictIntel intel;

    final SectorEntityToken derelict;
    final Random random;
    final CampaignFleetAPI playerFleet;
    final List shipList = new LinkedList();

    public SalvageFamousDerelictDialogPlugin(SectorEntityToken derelict) {
        this.derelict = derelict;
        this.random = new Random(derelict.toString().hashCode());
        this.playerFleet = Global.getSector().getPlayerFleet();
    }

    @Override
    public void init(InteractionDialogAPI dialog) {
        this.dialog = dialog;

        intel = (FamousDerelictIntel)derelict.getMemory().get(FamousDerelictIntel.MEMORY_KEY);

        intel.showRecoveryDescription(dialog.getTextPanel());
        prepareMember(intel.ship, intel.wreckData); /* Copied from ShipRecoverySpecial */
        shipList.add(intel.ship); /* shipList is fed to dialog.showFleetMemberRecoveryDialog */
        intel.ship.updateStats(); /* Just in case */

        dialog.getVisualPanel().showFleetMemberInfo(intel.ship, true);

        dialog.getOptionPanel().clearOptions();
        dialog.getOptionPanel().addOption("Consider ship recovery", RECOVER);
        dialog.getOptionPanel().addOption("Not now", LEAVE);
        dialog.getOptionPanel().setShortcut(LEAVE, Keyboard.KEY_ESCAPE, false, false, false, true);
    }

    @Override
    public void optionSelected(String optionText, Object optionData) {
        switch ((String)optionData) {
            case RECOVER:
                final CampaignFleetAPI playerFleet = Global.getSector().getPlayerFleet();
                dialog.showFleetMemberRecoveryDialog("Select ships to recover", shipList, new FleetMemberPickerListener() {
                    public void pickedFleetMembers(List<FleetMemberAPI> selected) {
                        if (selected.isEmpty()) return;

                        for (FleetMemberAPI member : selected) {
                            int index = shipList.indexOf(member);
                            if (index >= 0) {
                                /* ShipRecoverySpecial.PerShipData shipData = data.ships.get(index);
                                   data.ships.remove(index); */
                                shipList.remove(index);

                                float minHull = playerFleet.getStats().getDynamic().getValue(Stats.RECOVERED_HULL_MIN, 0f);
                                float maxHull = playerFleet.getStats().getDynamic().getValue(Stats.RECOVERED_HULL_MAX, 0f);
                                float minCR = playerFleet.getStats().getDynamic().getValue(Stats.RECOVERED_CR_MIN, 0f);
                                float maxCR = playerFleet.getStats().getDynamic().getValue(Stats.RECOVERED_CR_MAX, 0f);

                                float hull = (float) Math.random() * (maxHull - minHull) + minHull;
                                hull = Math.max(hull, member.getStatus().getHullFraction());
                                member.getStatus().setHullFraction(hull);

                                float cr = (float) Math.random() * (maxCR - minCR) + minCR;
                                member.getRepairTracker().setCR(cr);

                                playerFleet.getFleetData().addFleetMember(member);
                            }

                            dialog.getPlugin().optionSelected(null, RECOVERY_FINISHED);
                        }
                    }
                    public void cancelledFleetMemberPicking() { }
                });
                break;

            /* Other cases */
        }
    }

    /* Irrelevant stuff, including the copy of prepareMember and its supporting functions */
}

Thanks in advance for any help!
[close]
« Last Edit: October 04, 2019, 04:00:20 PM by Sundog »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5251 on: October 01, 2019, 10:46:42 AM »

Hmm. With the caveat that I didn't really look at the code (brain currently mush, argh insomnia) - is the FleetMember mothballed? And/or does it have repairs suspended? (via getRepairTracker() etc)
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5252 on: October 01, 2019, 11:23:23 AM »

I tried calling all four combinations of these right before prepareMember:

Code
intel.ship.getRepairTracker().setSuspendRepairs(true / false);
intel.ship.getRepairTracker().setMothballed(true / false);
Whether or not repairs were suspended didn't seem to make a difference.
When mothballed crew required also showed 0

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5253 on: October 01, 2019, 12:10:09 PM »

Is it possible that the fleet member is already fully repaired and at full CR? I mean, that's supposed to be set in prepareMember(), but... hmm.

Maybe try not calling:
intel.ship.updateStats();
?

This is weird and nothing jumps out at me as being wrong.
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 #5254 on: October 01, 2019, 12:53:08 PM »

Separate question, does the UNBOARDABLE tag for a ship also mean it will not be sold in faction markets? Or just that it can't be recovered after a battle through loot?

Just post-combat and derelict recovery.

Might want to take a look at this if you get a free moment. It doesn't seem to work all the time. Unless it just means you can never actually recover it but it still spawns as a derelict. (My mistake if so)

hulls entry for the ship:
Code
Doom (Ad),doom_adamantine,Phase Cruiser,Adamantine Consortium,temporalshell,12,18000,2000,25000,18000,1600,210,,80,140,110,40,50,1200,PHASE,phasecloak,,,,0.075,0.025,50,100,120,150,3,50,8,200000,8,8,500,0.25,12,5,"UNBOARDABLE, HIDE_IN_CODEX","ultra_rare_bp, consortium_bp, no_autofit",,0.6,2,3,13

Pics
Spoiler


[close]
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5255 on: October 01, 2019, 01:04:16 PM »

I tried setting CR to 0 on my own as part of trying to troubleshoot this before I realized it was already done inside of prepareMember. Calling updateStats was something else I tried in an attempt to fix this. Maybe updateStats prevented one of your suggestions from working? I dunno. Anyway, I'll try to find things that might be off about the member's state. Thanks for pointing me in a plausible direction. I was running out of ideas...

Unless it just means you can never actually recover it but it still spawns as a derelict.
I'm pretty sure that is how UNBOARDABLE is supposed to work. Maybe "unrecoverable" would be more accurate, but it's not a player-facing word so eh

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5256 on: October 01, 2019, 02:23:23 PM »

I tried setting CR to 0 on my own as part of trying to troubleshoot this before I realized it was already done inside of prepareMember. Calling updateStats was something else I tried in an attempt to fix this. Maybe updateStats prevented one of your suggestions from working? I dunno. Anyway, I'll try to find things that might be off about the member's state. Thanks for pointing me in a plausible direction. I was running out of ideas...

If you get stumped and can put a minimal mod together to reproduce this, I can take a look.

Unless it just means you can never actually recover it but it still spawns as a derelict.
I'm pretty sure that is how UNBOARDABLE is supposed to work. Maybe "unrecoverable" would be more accurate, but it's not a player-facing word so eh

Yeah, they can still spawn as derelicts; see: various droneships in vanilla.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5257 on: October 01, 2019, 03:07:31 PM »

If you get stumped and can put a minimal mod together to reproduce this, I can take a look.
Well, thanks! You're too helpful. Don't you have a game to work on? :P
I might just end up doing that. I've spent a lot more time than I'd like trying to figure this out, but I'm probably just overlooking something.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5258 on: October 01, 2019, 03:15:41 PM »

My ships aren't being built per their Variant specifications, even if no_autofit is set. 

They're spawning with empty weapon slots; where the Variant uses my mod's weapons, they're not installed. 

If the Variant calls for Vanilla weapons, all is fine.

What can cause this to happen?  I have a Blueprint Package defined for my Faction in special_items.csv, the ships and weapons are all functional and are listed in default_ship_roles / the Faction's files in KnownWeapons, etc., etc.

IIRC, this wasn't happening when the Blueprint Package for the weapons was set to hightech_bp; I'll test that out now.
« Last Edit: October 01, 2019, 03:19:12 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5259 on: October 01, 2019, 03:21:23 PM »

Weapons need the right tags to work with autofit; that's probably it.


Well, thanks! You're too helpful. Don't you have a game to work on? :P
/quote]

:D
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5260 on: October 01, 2019, 03:28:18 PM »

I've just tested, and nope, setting the weapons to base_dp didn't fix it, either. 

It's like the weapons aren't getting loaded by whatever code is supposed to be aware of their existence when creating new ships.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5261 on: October 01, 2019, 03:31:42 PM »

Unless it just means you can never actually recover it but it still spawns as a derelict.
I'm pretty sure that is how UNBOARDABLE is supposed to work. Maybe "unrecoverable" would be more accurate, but it's not a player-facing word so eh

Yeah, they can still spawn as derelicts; see: various droneships in vanilla.

Ok awesome, thanks for the clarification both of you and sorry for the false alarm.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5262 on: October 01, 2019, 04:16:47 PM »

Aaaaaa how do i make my custom hullmods not appear in blueprints?
Logged
Check out my ships

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5263 on: October 01, 2019, 04:36:05 PM »

Setting "hidden" to true in your hull_mods.csv should do the trick.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5264 on: October 01, 2019, 05:54:58 PM »

@Alex:  I found it, finally!

So... basically, not setting missile8, strike0, etc., etc., in the tags is the cause of this problem.  Put them in, and voila, problem was solved.

These are obviously used by the autofit code, but they really aren't documented; at some point it might be a good idea to explain how they work.
Logged
Please check out my SS projects :)
Xeno's Mod Pack
Pages: 1 ... 349 350 [351] 352 353 ... 706