Closed Gordon-Dry closed 5 years ago
First this is patched to the kerbalEVA:
// ============================================================================
// add Antenna to EVA suits
// ============================================================================
@PART[kerbalEVA*]:FOR[zzzKerbalism]
{
%MODULE[ModuleCommand]
{
%minimumCrew = 0
%hasHibernation = False
}
}
@PART[kerbalEVA*]:FOR[Kerbalism]
{
%MODULE[ModuleDataTransmitter]
{
%antennaType = DIRECT
%packetInterval = 0.2
%packetSize = 1.35
%packetResourceCost = 0.375
%requiredResource = ElectricCharge
%antennaPower = 35000
%optimumRange = 5000
%packetFloor = 0.1
%packetCeiling = 5
}
}
// ============================================================================
// EVA Kerbals can remote control a probe
// ============================================================================
@PART[kerbalEVA*]:FOR[Kerbalism]
{
%MODULE[ModuleProbeControlPoint]
{
%minimumCrew = 1
%multiHop = False
}
}
then this:
// a Kerbal on EVA can transmit EVA report via the next pod within 35km range
@PART[kerbalEVA*]:NEEDS[RemoteTech]:AFTER[RemoteTech]
{
!MODULE[ModuleDataTransmitter],* {}
%MODULE[ModuleSPUPassive] {}
%MODULE[ModuleRTAntenna]
{
%TechRequired = start
%Mode0OmniRange = 500
%Mode1OmniRange = 35000
%EnergyCost = 0.0375
%IsRTActive = true
%TRANSMITTER {
%PacketInterval = 0.2
%PacketSize = 1.35
%PacketResourceCost = 0.00375
}
}
}
Ok, First problem guys
You can't assume var will be 'null' without cause error, if any one send a invalid GUID, it will cause an IndexOutOfRangeException, since it is not in your Satellites array.
replace
var satellite = RTCore.Instance.Satellites[id];
to
var satellite = RTCore.Instance.Satellites.Where(sat => sat.Guid.Equals(id)).FirstOrDefault();
This will solve the Exception if any other mod send invalid GUID.
PR - https://github.com/RemoteTechnologiesGroup/RemoteTech/pull/772
Also, I think you could include some Log like "Invalid GUID" before return, I didn't add it.
Hi, I don't understand how IndexOutOfRangeException
occurs on RTCore.Instance.Satellites[id];
.
I tried to reproduce with a valid GUID (but not matched to anything) on RTCore.Instance.Satellites[id];
and receive satellite = null
based on this method.
Can you give an example of the invalid GUID you observed at your end?
I am not too excited about this PR (seems like addressing the symptoms)
I'm not 100% sure because I didn't create the EVA antenna, but looks like it is related to EVA, something between the process to go "onBoard", the EVA GUID still in our cache(Kerbalism), but doesn't exist in your Satellite list any more. Looks like RT updated before our Kerbalism, then we are sending a GUID to RT, but this GUID doesn't exist any more there.
Looks like that this behavior is more expected when the game has a lot of delay (Hardware or something like that).
Talking about the PR, it is just to prevent RT cause IndexOutOfRangeException when any other mod send an invalid GUID to RT API, otherwise your API will have a exception and people will think that is RT problem and not they mod that is sending an invalid GUID.
Yesterday I simulated to send GUID that doesn't exists and RT started to report a lot of Exceptions, I can double check tonight, but it was the same error that Gordon had reported here
ArgumentOutOfRangeException: Argument is out of range. Parameter name: index
Also, your API is not calling the method that you said, but it is trying to go direct to an index in your array.
All right, I accept your PR (after fixing indent chars) on API.cs
. It is going to cost bits in every API call.
I can't reproduce this issue no matter what I tried with different ways.
Edit: Please help to verify at your end on the updated RT API.
@HaullyGames Last call before I publish the 1.9.0 release to 1.5.1, 1.4.5 and 1.3.1
Everything works fine with the last develop version, Thanks! We are waiting for this release!
Besides my late night partly-stupidity and some conceptual misunderstanding by pov - yes I'm fine with it.
In my tests for the new RT API / Kerbalism implementaion of that API I found this 44x written to the log after leaving the pod for going EVA:
I'm not sure why this was written to the log exactly 44x - but perhaps all vessels in my career got a total of 44 hops?
On Discord @HaullyGames mentioned
target_name = status == LinkStatus.direct_link ? Lib.Ellipsis("DSN: " + (RemoteTech.NameTargetsKSC(v.id) ?? ""), 20) :
Is this solvable?