Skip to content

Commit fa97c19

Browse files
committed
Let failed world load indicator stay for at least 20 seconds
Adds a fix for Yellow-Dog-Man/Resonite-Issues#1019
1 parent 7fe681b commit fa97c19

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

CommunityBugFixCollection/Locale/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"CommunityBugFixCollection.ImportMultipleAudioFiles.Description": "Macht es möglich mehrere Audiodateien auf einmal zu importieren.",
2929
"CommunityBugFixCollection.ImportWebFilesAsUrls.Description": "Sorgt dafür, dass URLs zu Textdateien oder Resonite Packages nicht importiert werden, statt als Hyperlink aufzutauchen.",
3030
"CommunityBugFixCollection.IndependentlyScaleDirectCursor.Description": "Verhindert, dass der direkte Cursor sehr groß wird, wenn er an einem deutlich nährem Objekt hängt als der echte Cursor.",
31+
"CommunityBugFixCollection.LongerWorldLoadingFailIndication.Description": "Lässt den Welt-Ladefortschritts-Indikator frühestens nach 20s verschwinden, falls der Vorgang fehlgeschlagen ist.",
3132
"CommunityBugFixCollection.NoLossOfColorProfile.Description": "Verhindert, dass Farbprofile nicht bei allen Berechnungen erhalten bleiben.",
3233
"CommunityBugFixCollection.NoZeroScaleToolRaycast.Description": "Verhinder einen Crash wenn (Multi-)Werkzeuge auf null skaliert werden.",
3334
"CommunityBugFixCollection.NodeNameAdjustments.Description": "Korrigiert, dass die Namen der meisten ProtoFlux Nodes in Strings > Constants unsichtbar sind.",

CommunityBugFixCollection/Locale/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"CommunityBugFixCollection.ImportMultipleAudioFiles.Description": "Fixes it not being possible to import multiple audio clips at once.",
2929
"CommunityBugFixCollection.ImportWebFilesAsUrls.Description": "Fixes URLs to text files or Resonite Packages failing to import instead of appearing as a hyperlink.",
3030
"CommunityBugFixCollection.IndependentlyScaleDirectCursor.Description": "Fixes direct cursor size becoming very large when snapped to an object much closer than the true cursor.",
31+
"CommunityBugFixCollection.LongerWorldLoadingFailIndication.Description": "Only lets the World Load Progress Indicator disappear after 20s or more if the process failed.",
3132
"CommunityBugFixCollection.NoLossOfColorProfile.Description": "Fixes Color Profile not being preserved on all operations.",
3233
"CommunityBugFixCollection.NoZeroScaleToolRaycast.Description": "Fixes a crash when a (multi)tool is scaled to zero.",
3334
"CommunityBugFixCollection.NodeNameAdjustments.Description": "Fixes most ProtoFlux nodes in Strings > Constants having invisible names.",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using FrooxEngine;
2+
using HarmonyLib;
3+
using MonkeyLoader.Resonite;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Reflection.Emit;
7+
using System.Text;
8+
9+
namespace CommunityBugFixCollection
10+
{
11+
[HarmonyPatchCategory(nameof(LongerWorldLoadingFailIndication))]
12+
[HarmonyPatch(typeof(WorldLoadProgress), nameof(WorldLoadProgress.OnCommonUpdate))]
13+
internal sealed class LongerWorldLoadingFailIndication : ResoniteMonkey<LongerWorldLoadingFailIndication>
14+
{
15+
private static float _vanillaDelay = 5f;
16+
public override IEnumerable<string> Authors => Contributors.Banane9;
17+
18+
public override bool CanBeDisabled => true;
19+
20+
private static float GetDestroyDelay()
21+
=> Enabled ? Math.Max(20f, _vanillaDelay) : _vanillaDelay;
22+
23+
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions)
24+
{
25+
var instructions = new List<CodeInstruction>(codeInstructions);
26+
27+
var getDestroyDelayMethod = AccessTools.DeclaredMethod(typeof(LongerWorldLoadingFailIndication), nameof(GetDestroyDelay));
28+
var runInSecondsMethod = AccessTools.DeclaredMethod(typeof(ComponentBase<Component>), nameof(ComponentBase<Component>.RunInSeconds));
29+
30+
var runInSecondsIndex = instructions.FindIndex(instruction => instruction.Calls(runInSecondsMethod));
31+
var loadDelayIndex = instructions.FindLastIndex(runInSecondsIndex, instruction => instruction.opcode == OpCodes.Ldc_R4);
32+
33+
_vanillaDelay = (float)instructions[loadDelayIndex].operand;
34+
instructions[loadDelayIndex] = new CodeInstruction(OpCodes.Call, getDestroyDelayMethod);
35+
36+
return instructions;
37+
}
38+
}
39+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ just disable them in the settings in the meantime.
4444
* The NoDestroyUndo component not preventing undoing the destruction of something (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/979)
4545
* References in multiple duplicated or transferred-between-worlds items breaking (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/984)
4646
* Context Menu changing size and becoming unusable with extreme FOVs (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/991)
47+
* World Load Progress Indicator disappearing too quickly on fail (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1019)
4748
* Context Menu label outline not fading out like everything else (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1027)
4849
* ColorX From HexCode (ProtoFlux node) defaults to Linear profile (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1404)
4950
* UserInspectors not listing existing users in the session for non-host users (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/1964)

0 commit comments

Comments
 (0)