mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
Move many mods to Deprecated folder, fix spelling
This commit is contained in:
parent
5e822cec8d
commit
0042590aa6
539 changed files with 7475 additions and 3120 deletions
|
@ -1,4 +1,6 @@
|
|||
using MelonLoader;
|
||||
using ABI_RC.Scripting.ScriptNetwork;
|
||||
using ABI_RC.Systems.ModNetwork;
|
||||
using MelonLoader;
|
||||
using NAK.LuaTTS.Patches;
|
||||
|
||||
namespace NAK.LuaTTS;
|
||||
|
@ -8,6 +10,33 @@ public class LuaTTSMod : MelonMod
|
|||
public override void OnInitializeMelon()
|
||||
{
|
||||
ApplyPatches(typeof(LuaScriptFactoryPatches));
|
||||
|
||||
ModNetworkMessage.AddConverter<ScriptID>(ReadScriptID, WriteScriptID);
|
||||
ModNetworkMessage.AddConverter<ScriptInstanceID>(ReadScriptInstanceID, WriteScriptInstanceID);
|
||||
}
|
||||
|
||||
private static ScriptID ReadScriptID(ModNetworkMessage msg)
|
||||
{
|
||||
msg.Read(out byte[] value);
|
||||
ScriptID scriptID = new(value);
|
||||
return scriptID;
|
||||
}
|
||||
|
||||
private static void WriteScriptID(ModNetworkMessage msg, ScriptID scriptID)
|
||||
{
|
||||
msg.Write(scriptID.value);
|
||||
}
|
||||
|
||||
private static ScriptInstanceID ReadScriptInstanceID(ModNetworkMessage msg)
|
||||
{
|
||||
msg.Read(out byte[] value);
|
||||
ScriptInstanceID scriptInstanceID = new(value);
|
||||
return scriptInstanceID;
|
||||
}
|
||||
|
||||
private static void WriteScriptInstanceID(ModNetworkMessage msg, ScriptInstanceID scriptInstanceID)
|
||||
{
|
||||
msg.Write(scriptInstanceID.value);
|
||||
}
|
||||
|
||||
private void ApplyPatches(Type type)
|
||||
|
|
|
@ -11,17 +11,17 @@ internal static class LuaScriptFactoryPatches
|
|||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(LuaScriptFactory.CVRRequireModule), nameof(LuaScriptFactory.CVRRequireModule.Require))]
|
||||
private static void Postfix_CVRRequireModule_require(
|
||||
string modid,
|
||||
string moduleFriendlyName,
|
||||
ref LuaScriptFactory.CVRRequireModule __instance,
|
||||
ref object __result,
|
||||
ref Script ___script,
|
||||
ref CVRLuaContext ___context)
|
||||
ref Script ____script,
|
||||
ref CVRLuaContext ____context)
|
||||
{
|
||||
const string TTSModuleID = "TextToSpeech";
|
||||
if (TTSModuleID != modid)
|
||||
if (TTSModuleID != moduleFriendlyName)
|
||||
return; // not our module
|
||||
|
||||
__result = TTSLuaModule.RegisterUserData(___script, ___context);
|
||||
__result = TTSLuaModule.RegisterUserData(____script, ____context);
|
||||
__instance.RegisteredModules[TTSModuleID] = __result; // add module to cache
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue