zer0Kerbal / ModularRocketSystems

A stock-alike parts pack that fills in a variety of gaps in the stock lineup of rocketry parts for Kerbal Space Program.
https://forum.kerbalspaceprogram.com/index.php?/topic/211992-*/
Creative Commons Attribution Share Alike 4.0 International
3 stars 2 forks source link

[Bug 🐞]: Lander leg missing ModuleWheelDamage, causes IVA mods (MAS/ASET) to crash #146

Closed tofof closed 1 year ago

tofof commented 1 year ago

Brief description of your issue (aka the problem)

IVA mods crash when they try to read ModuleWheelDamage on landing gear that don't have it.

See e.g. this line, responsible for MAS crashing: https://github.com/MOARdV/AvionicsSystems/blob/f14d66b0e7a71e271df32520e5f3ab053e93669a/Source/MASVesselComputerModules.cs#L1342

This causes IVA cockpit panels to become nonfunctional.

Solution

Add the following (or other appropriate values, these were borrowed from Squad\landingLegLT-5.cfg) to NBlandingLeg1.cfg:

    MODULE
    {
        name = ModuleWheelDamage
        baseModuleIndex = 0

        stressTolerance = 99999999
        impactTolerance = 40
        deflectionMagnitude = 1
        deflectionSharpness = 2.0
        slipMagnitude = 0
        slipSharpness = 2.0
        explodeMultiplier = 1.0
    }

Operating system

Win11

KSP version

1.12.5

Version of addon

Version 1.13.2.0-release <Archival>

Steps to reproduce the behavior or issue

Mods (CKAN)

Mk3b Pandora pod + MRS Landing leg, go IVA, click buttons on panels and they're nonfunctional. Mk3b Pandora pod + stock legs, go IVA, functional

ksp.log showing:

IndexOutOfRangeException: Index was outside the bounds of the array. AvionicsSystems.MASVesselComputer.UpdateGear () (at <2bb05d285e56479a9e9bde992b09bb1d>:0) AvionicsSystems.MASVesselComputer.UpdateModuleData () (at <2bb05d285e56479a9e9bde992b09bb1d>:0) AvionicsSystems.MASVesselComputer.RefreshData () (at <2bb05d285e56479a9e9bde992b09bb1d>:0) AvionicsSystems.MASVesselComputer.Awake () (at <2bb05d285e56479a9e9bde992b09bb1d>:0) UnityEngine.DebugLogHandler:LogException(Exception, Object) ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object) UnityEngine.GameObject:AddComponent() AvionicsSystems.MASPersistent:FetchVesselComputer(Vessel) AvionicsSystems.MASFlightComputer:Start()

Expected behavior

Legs have required modules used by all other landing leg mods and don't cause crashes in other mods

Actual behavior

No response

Environment

You ask for literally each of these pieces of info elsewhere

Log files

KSP.log

Screenshots

No response

Additional context

No response

How did you download and install this?

GitHub release .zip (advanced manual installation)

github-actions[bot] commented 1 year ago

:+1: Thank you @tofof :octocat:

:question::grey_question:

Have you reviewed the open issues logs and recent changelogs?

In order to help us help you, please provide:

You can archive these files (rar or zip, sadly no 7zip) and drag-n-drop them into an issue comment

:vibration_mode::eyes:Please either watch this repositiory for updates.

:speech_balloon:Kindly read our simple guides to:

Lisias commented 1 year ago

If IVA mods crash when parts don't have the ModuleWheelDamage module, perhaps they should check if the part have the module before trying to use it?

tofof commented 1 year ago

Yes, they should do that. Just like how parts packs should define all the appropriate modules.

zer0Kerbal commented 1 year ago

@tofof Thank you for the bug report! Am looking into it.

If IVA mods crash when parts don't have the ModuleWheelDamage module, perhaps they should check if the part have the module before trying to use it?

Thank you, @Lisias My thoughts exactly.

I will add a RPM/MAS compatibility patch that adds a blank part module if RPM/MAS is installed. This is just until I can update the part which is planned in the next couple of updates.

zer0Kerbal commented 1 year ago

Yes, they should do that. Just like how parts packs should define all the appropriate modules.

this parts pack was released for KSP 1.4.5 and is in the process of updating it to 1.12.x;

Should define IF they are needed; and I still haven't determined that. ModuleWheelLock isn't defined in the mentioned part, but not having it doesn't lock up the MAS/RPM IVA screen.

Just a conversation, partly because this is the first I've heard about this and I have approaching 200 addons (about 150 published, and the rest on the way) with about 80% being parts addons.

Still glad to know - and something learned. Hopefully you also posted a bug report on MAS/RPM to let them know. Just trying to find the root cause/best solution which is why bug reporting is encouraged. πŸ™‚

My plan is still the same - a hotfix to push the module manager patch for this part; and will review/update both the patch and the part when I get to updating/including this part in the new release.