Skip to content

Mod contacts may cause a player's fleet wipe out - United Aurora Federation #119

@Evolter

Description

@Evolter

Got a bug report from forum, I had a look but not sure how to fix it at the moment, so leaving my finding here for now.

Stelnet context

Stelnet - allows to call contacts from afar - it works by:

  • deleting player's fleet in the current location,
  • going to the location of the contact we are calling,
  • starting a dialog,
  • going back to start location and recreating fleet after dialog is done.

Offending mod

There is a mod UAF, that have contacts that may (because of rep - e.g. resign commission with UAF) stop talking to us, and instead of giving some options, it just shows a text that we cannot talk with them along with the contact's station main menu - that causes to not recreate player's fleet after the call. From rules.csv:

id	UAFDefaultInariGate
trigger	PickGreeting
conditions	$id == uaf_inari score:100
		!$player.UAFNiaRecommendation
script	ShowDefaultVisual
	 EndConversation
text	"Access denied, we are currently limiting contact with unknown spacefarer, for more information please visit "Aurora Diplomatic Bureau"."
	 Someone said from the other end of the speaker.
options
notes

Bug

We are creating ContactDialog that extends com.fs.starfarer.api.impl.campaign.RuleBasedInteractionDialogPluginImpl:

    @Override
    public void init(InteractionDialogAPI dialog) {
        SectorEntityToken token = dialog.getInteractionTarget();
        token.setActivePerson(person);  // here we have a dialog
        // We are passing dialog, but at some point it is overwritten and it ends up being null.
        super.init(dialog);  // error when calling notifyActivePersonChanged/dismiss because dialog=null
        this.dialog = dialog;  // here we have a dialog
    }

    @Override
    public void notifyActivePersonChanged() {
        dialog.hideVisualPanel();
        super.notifyActivePersonChanged();
        dismiss();
    }

    private void dismiss() {
        MemoryHelper.unset(ModConstants.MEMORY_IS_CALLING);
        ContactsBoard board = StelnetHelper.getInstance(ContactsBoard.class);
        if (this.isRemoteCall()) {
            board.getRenderableState().addTrackingData(market, storageData, playerData);
            storageData.add(playerData);
            playerData.restore();
        }
        dialog.dismiss();
        ui.recreateIntelUI();
        ui.updateUIForItem(board);
    }

Potential solution to find

How to show the contact's text ("Access denied...") with option "You decide to... 1. Leave" to prevent game from triggering the bug?

My findings so far

This is the screen we can see:
Image
After we exit it, our fleet is gone, plus Contacts intel is broken.

If I add a if dialog null check in notifyActivePersonChanged, then:
Image
We are getting ugly error, but after we exit it, our fleet is ok and Contacts intel still works - this (but w/o error) would be probably the behaviour we would like to see, but if I add a if dialog null check in dismiss, then:
Image
We can see that our fleet is docket on the contact's station which is not what we want.

I tried in the init to move this.dialog = dialog; before super.init(dialog); (without if dialog null checks) and when calling the offending contact, it shows station's dialog options (like above) for a split second and goes back to the contact intel:
Image
Testing this currently (on branch hotfix-119) and so far looks like moving it before super doesn't break anything else, that said, this is not a proper fix unless those mod contacts had a separate dialog instead of going back straight to the station menu.

TODO

Need to figure out how Starsector dialog work - why super.init although it is setting this.dialog to passed object:

// com/fs/starfarer/api/impl/campaign/RuleBasedInteractionDialogPluginImpl.class
    public void init(InteractionDialogAPI dialog) {
        this.dialog = dialog;

when calling overriden notifyActivePersonChanged and dismiss it is set to null. And/or how to ensure that called contacts never go back to the "station dialog".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions