kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

trying to jettison fairing results in error

Tastaturtaste opened this issue ยท 2 comments

commented

Calling the following Pythoncode results in a crash.

for fairing in vessel.parts.fairings:
    fairing.jettison()

The errorcode looks like this:

Traceback (most recent call last):
File "", line 2, in
File "", line 1, in
File "C:\Program Files (x86)\Python37-32\lib\site-packages\krpc\client.py", line 140, in _invoke
raise self._build_error(response.results[0].error)
krpc.error.RPCError: Object reference not set to an instance of an object
Server stack trace:
at KRPC.SpaceCenter.Services.Parts.Fairing.get_Jettisoned () [0x00000] in :0
at KRPC.SpaceCenter.Services.Parts.Fairing.Jettison () [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0

Calling the following code works:

for fairing in vessel.parts.fairings:
    for module in fairing.part.modules:
        if module.name == 'ModuleProceduralFairing':
            module.trigger_event('Deploy')

I tested this with the AE-FF1 Airstream Protective Shell (1.25m)

commented

@djungelorm I encountered something similar in KRPC 0.4.8/KSP 1.5.1.

Load into a vessel with parachutes tagged "parachute"
Quicksave
Deploy the parachutes
for part in vessel.parts.with_tag("parachute"): part.parachute.deploy()
With the server still running, quickload.

If I restart the server, and then run my script, I never hit that exception.

commented

Managed to reproduce the issue, by doing the following:

  • Launch a vessel
  • Deploy it's fairing using fairing.jettison()
  • Revert to launch
  • Call fairing.jettison() which results in an exception.

Is this what you were doing or is there also some other way of triggering the exception?

I also have a possible fix for this, and a pre-release version with the fix is available here for you to test if you want: https://krpc.s3.amazonaws.com/deploy/bug/fairings/1237.1/krpc-0.4.8-45-g858a752.zip