SSTU - Shadow Space Technologies Unlimited

SSTU - Shadow Space Technologies Unlimited

98.5k Downloads

MFT-Radial Tank Symmetry - Resource Add bug

Theysen opened this issue ยท 4 comments

commented
  • SSTU 0.5.32.120 installed

Upon attaching the radial stock fuel tanks which are configured by SSTU and opening 'Configure Container' the fuel tank gui adds endless amounts of Electric Charge lines when you select EC in the second part of your custom resource GUI. After that right click on parts doesn't work and it needs a VAB reenter to work again.

I didn't test it with other resources yet - and blame me if I use your system incorrectly - but I don't think the NRE spam is intentional. Logs are here (IIRC you want the KSP.log instead of the output_log.txt - hit me up if you need more - I will test other parts aswell).

The exceptions are at the end:

https://www.dropbox.com/s/dbu9j4a10otkgj7/KSP.log?dl=0

commented

Interesting.

I'm not sure I ever tested using the GUI with symmetry counterparts, and fairly certain I didn't add any code to handle symmetry updates.

So, thanks for the report and log, and good work on the bug-hunting :) I will attempt to look into this sometime this week before I head out, but no guarantees.

commented

Even more interesting, excerpt from the log:

SSTU-SC-TANK-MFT-R added to ship - part count: 9
[EXC 12:54:11.445] NullReferenceException: Object reference not set to an instance of an object
    UIPartActionResourceItem.SetSymCounterpartsAmount (Double amount)
    UIPartActionResourceEditor.OnSliderChanged (Single obj)
    UIPartActionResourceEditor.Setup (.UIPartActionWindow window, .Part part, UI_Scene scene, .UI_Control control, .PartResource resource)
    UIPartActionWindow.AddResourceEditorControl (.PartResource r)
    UIPartActionWindow.SetupResourceControls (.PartResource r, Boolean clearFirst, UI_Scene scene, System.Int32& controlIndex)
    UIPartActionWindow.CreatePartList (Boolean clearFirst)
    UIPartActionWindow.UpdateWindow ()
    UIPartActionController.UpdateActiveWindows ()
    UIPartActionController.UpdateEditor ()
    UIPartActionController.Update ()

Will have to do some focused testing and debugging on this issue; something is causing the stock resource-updating code to go haywire.

Seems plausible that it is trying to update a slider for a resource that doesn't exist on the symmetry part, as the container-editing code does not update symmetry counterparts at all; will likely have to add some symmetry update code to the container GUI and resource updating methods.

commented

Indeed, there is apparently no handling of symmetry parts in the container-gui code; however stock expects symmetry parts to always have the same resources, which I did not consider when I was initially writing the system.

The first bad news is that the current GUI code is a bit of a jumbled mess, with the GUI operating directly on the container-data from a single Part/PartModule, bypassing the VolumeContainer PartModule entirely; so I have no easy method to access the symmetry parts from the current code.

Good news is that I was already planning a cleanup and revamp pass on some of that code to clean out some partially implemented-but-dropped features, and add cleaner output handling for electric-charge / battery mass and volume. Knowing the problems/assumptions with symmetry counterparts I can re-code it in method to handle it.

The second bad news is that it will not be an easy affair to rework the code, and I already know that I won't have time to get to it for at least a week, probably closer to two.

So sadly, an ETA on this will be from 8-8, to 8-15.

In the mean-time a workaround is to first setup a single fuel tank, edit its config through GUI, and then pickup and re-place it with symmetry enabled. This should properly copy the customized tank for the symmetry counterparts.

commented

Should have this fixed in dev code. Will be doing further testing and cleanup this week, but symmetry updates for GUI interaction should now be in place and working.