2021-10-15 21:06:51 +01:00
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using QSB.Events;
|
2020-12-31 12:10:55 +00:00
|
|
|
|
using QSB.Patches;
|
2021-02-24 10:45:25 +00:00
|
|
|
|
using QSB.TranslationSync.WorldObjects;
|
|
|
|
|
using QSB.WorldSync;
|
2020-12-31 12:10:55 +00:00
|
|
|
|
|
|
|
|
|
namespace QSB.TranslationSync.Patches
|
|
|
|
|
{
|
2021-10-15 21:06:51 +01:00
|
|
|
|
[HarmonyPatch]
|
2020-12-31 12:10:55 +00:00
|
|
|
|
internal class SpiralPatches : QSBPatch
|
|
|
|
|
{
|
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
|
|
|
|
|
2021-10-15 21:06:51 +01:00
|
|
|
|
[HarmonyPrefix]
|
|
|
|
|
[HarmonyPatch(typeof(NomaiWallText), nameof(NomaiWallText.SetAsTranslated))]
|
2021-06-18 21:54:32 +01:00
|
|
|
|
public static bool NomaiWallText_SetAsTranslated(NomaiWallText __instance, int id)
|
2020-12-31 12:10:55 +00:00
|
|
|
|
{
|
|
|
|
|
if (__instance.IsTranslated(id))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-06-18 22:38:32 +01:00
|
|
|
|
|
2021-02-10 19:34:41 +00:00
|
|
|
|
QSBEventManager.FireEvent(
|
2020-12-31 12:10:55 +00:00
|
|
|
|
EventNames.QSBTextTranslated,
|
|
|
|
|
NomaiTextType.WallText,
|
2021-02-24 10:45:25 +00:00
|
|
|
|
QSBWorldSync.GetIdFromUnity<QSBWallText, NomaiWallText>(__instance),
|
2020-12-31 12:10:55 +00:00
|
|
|
|
id);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-15 21:06:51 +01:00
|
|
|
|
[HarmonyPrefix]
|
|
|
|
|
[HarmonyPatch(typeof(NomaiComputer), nameof(NomaiWallText.SetAsTranslated))]
|
2021-06-18 21:54:32 +01:00
|
|
|
|
public static bool NomaiComputer_SetAsTranslated(NomaiComputer __instance, int id)
|
2020-12-31 12:10:55 +00:00
|
|
|
|
{
|
|
|
|
|
if (__instance.IsTranslated(id))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-06-18 22:38:32 +01:00
|
|
|
|
|
2021-02-10 19:34:41 +00:00
|
|
|
|
QSBEventManager.FireEvent(
|
2020-12-31 12:10:55 +00:00
|
|
|
|
EventNames.QSBTextTranslated,
|
|
|
|
|
NomaiTextType.Computer,
|
2021-02-24 10:45:25 +00:00
|
|
|
|
QSBWorldSync.GetIdFromUnity<QSBComputer, NomaiComputer>(__instance),
|
2020-12-31 12:10:55 +00:00
|
|
|
|
id);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-15 21:06:51 +01:00
|
|
|
|
[HarmonyPrefix]
|
|
|
|
|
[HarmonyPatch(typeof(NomaiVesselComputer), nameof(NomaiWallText.SetAsTranslated))]
|
2021-06-18 21:54:32 +01:00
|
|
|
|
public static bool NomaiVesselComputer_SetAsTranslated(NomaiVesselComputer __instance, int id)
|
2020-12-31 12:10:55 +00:00
|
|
|
|
{
|
|
|
|
|
if (__instance.IsTranslated(id))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-06-18 22:38:32 +01:00
|
|
|
|
|
2021-02-10 19:34:41 +00:00
|
|
|
|
QSBEventManager.FireEvent(
|
2020-12-31 12:10:55 +00:00
|
|
|
|
EventNames.QSBTextTranslated,
|
|
|
|
|
NomaiTextType.VesselComputer,
|
2021-02-24 10:45:25 +00:00
|
|
|
|
QSBWorldSync.GetIdFromUnity<QSBVesselComputer, NomaiVesselComputer>(__instance),
|
2020-12-31 12:10:55 +00:00
|
|
|
|
id);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|