emmVRC / emmVRC-Public

Public page for the emmVRC mod
30 stars 8 forks source link

Expose method for risky funcs API #1481

Open Bluscream opened 3 years ago

Bluscream commented 3 years ago

The current implementation can cause a lot of redundant web requests when you got a lot of mods checking for risky worlds and also a lot of mods dont check for the risky gameobject. It would be much better if there was one unobfuscated method that other mods can call to check for a result which would work like this:

public bool emmRiskyCheckCurrentWorld() {

  if (riskyCache.ContainsKey(currentWorldId)) return riskyCache[currentWorldId];
  if(gameObject.Exists(emmRiskyGameObjectName) { riskyCache.Add(currentWorldId, true); return true; }
  if(riskyWebAPI.CheckWorld(currentWorldId)) { riskyCache.Add(currentWorldId, true); return true; }
  riskyCache.Add(currentWorldId, false); return false;

Sent from my Lenovo TB-X606F using FastHub

Bluscream commented 3 years ago

In case emm isnt installed you could either provide that method open-src or make something like a nuget lib thats easy to implement

thetrueyoshifan commented 3 years ago

emmVRC is not obfuscated, and while it's not ideal, you can read from RiskyFunctionsManager.RiskyFuncsAreAllowed. But I'll look into potentially having some of our internal properties exposed, in case other mods want to take advantage of them.

Bluscream commented 3 years ago

@thetrueyoshifan thanks a lot

Sent from my Lenovo TB-X606F using FastHub