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

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

7.8k Downloads

Decoupling a separator throws an error

Rhahi opened this issue ยท 0 comments

commented

What happened?

Decoupled a separator while sitting on a launchpad.
The separator does separate, but it throws an error.

---------------------------------------------------------------------------
RPCError                                  Traceback (most recent call last)
Cell In[6], line 3
      1 ves = sc.active_vessel
      2 sep = ves.parts.with_tag("sep")[0]
----> 3 sep.decoupler.decouple()

File [~/.julia/dev/SpaceLib/python/venv/lib64/python3.11/site-packages/krpc/services/spacecenter.py:8496](https://vscode-remote+ssh-002dremote-002bbuilder.vscode-resource.vscode-cdn.net/home/rhahi/.julia/dev/SpaceLib/python/~/.julia/dev/SpaceLib/python/venv/lib64/python3.11/site-packages/krpc/services/spacecenter.py:8496), in Decoupler.decouple(self)
   8487 def decouple(self) -> Vessel:
   8488     """
   8489     Fires the decoupler. Returns the new vessel created when the decoupler fires.
   8490     Throws an exception if the decoupler has already fired.
   (...)
   8494     SpaceCenter#activeVessel no longer refer to the active vessel.
   8495     """
-> 8496     return self._client._invoke(
   8497         "SpaceCenter",
   8498         "Decoupler_Decouple",
   8499         [self, ],
   8500         ["self", ],
   8501         [self._client._types.class_type("SpaceCenter", "Decoupler"), ],
   8502         self._client._types.class_type("SpaceCenter", "Vessel")
   8503     )

File [~/.julia/dev/SpaceLib/python/venv/lib64/python3.11/site-packages/krpc/client.py:204](https://vscode-remote+ssh-002dremote-002bbuilder.vscode-resource.vscode-cdn.net/home/rhahi/.julia/dev/SpaceLib/python/~/.julia/dev/SpaceLib/python/venv/lib64/python3.11/site-packages/krpc/client.py:204), in Client._invoke(self, service, procedure, args, param_names, param_types, return_type)
    202 # Check for an error response
    203 if response.HasField('error'):
--> 204     raise self._build_error(response.error)
    206 # Check for an error in the procedure results
    207 if response.results[0].HasField('error'):

RPCError: Exception has been thrown by the target of an invocation.
Server stack trace:
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 
  at KRPC.Service.YieldException.CallUntyped () [0x00046] in :0 
  at KRPC.Service.ProcedureCallContinuation+c__AnonStorey0.<>m__0 () [0x00000] in :0 
  at KRPC.Service.Services.ExecuteCall (KRPC.Service.Scanner.ProcedureSignature procedure, System.Func`1[TResult] continuation) [0x00000] in :0

How can someone else reproduce it?

User configurations:

  • Launch a craft with a separator with part tagged "sep".
  • Hostname
import krpc
conn = krpc.connect("Test", "10.0.0.51")
sc = conn.space_center
ves = sc.active_vessel
sep = ves.parts.with_tag("sep")[0]
sep.decoupler.decouple()

What is your environment?

  • KSP 1.12.3
  • Mods: KRPC 0.5.3, KOS, LaserDist
  • Python: 3.11.2

Anything else we need to know?

I don't really use separators myself, so this bug does not affect me personally. I just discovered this issue while testing and wanted to let you know.