Space Engineers

Space Engineers

Ore Detector Reforged
ame824 24 Aug, 2023 @ 9:27am
got Error (Crash) with finding ore
Gamecrash+Log

Exception occurred: VRage.Compiler.ScriptOutOfRangeException: Exception of type 'VRage.Compiler.ScriptOutOfRangeException' was thrown.
(1000 lines of this:)
at Program.OnOreDetected(List`1 orePositions)


Here is the code what I tried to do

Action<List<Vector3D>> oreDetectedCallback = null;

void ReforgedDetectN(BoundingSphereD area, string minedOre, int count, Action<List<Vector3D>> callBack)
{
oreDetectedCallback = callBack;
Me.CustomData = minedOre; // Speichern Sie das abzubauende Erz in CustomData
Me.SetValue("ReforgedDetectN", new ValueTuple<BoundingSphereD, string, int, Action<List<Vector3D>>>(area, minedOre, count, callBack));
}

void OnOreDetected(List<Vector3D> orePositions)
{
if (oreDetectedCallback != null)
{
oreDetectedCallback.Invoke(orePositions);
}
}

public void Main(string argument, UpdateType updateSource)
{
if (updateSource == UpdateType.Terminal)
{
BoundingSphereD scanArea = new BoundingSphereD(Me.GetPosition(), 30000); // Setzen Sie den gewünschten Scan-Bereich hier ein
ReforgedDetectN(scanArea, argument, 1, OnOreDetected);
}
}
< >
Showing 1-1 of 1 comments
Racher  [developer] 29 Sep, 2023 @ 12:37am 
It seems like your callback calls itself endlessly
< >
Showing 1-1 of 1 comments
Per page: 1530 50