(1.6.4) Managed RandomEvent Message
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -28,6 +29,31 @@ namespace MxValheim.Patch.HUD
|
||||
return $"{hours:00}:{minutes:00}";
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MessageHud), nameof(MessageHud.ShowMessage))]
|
||||
public static class HideEventMessage_Patch
|
||||
{
|
||||
// We use a Prefix to check the message before it is displayed
|
||||
static bool Prefix(MessageHud.MessageType type, string text)
|
||||
{
|
||||
// Check if a raid is active
|
||||
if (RandEventSystem.instance != null)
|
||||
{
|
||||
RandomEvent activeEvent = RandEventSystem.instance.GetActiveEvent();
|
||||
if (activeEvent != null)
|
||||
{
|
||||
// If the message text matches the start or end message of the raid, block it
|
||||
if (text == activeEvent.GetHudText())
|
||||
{
|
||||
Debug.Log("Reached msg logic!!!");
|
||||
// Returning false tells Harmony to skip the original method (don't show text)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true; // Show all other messages (health, items, etc.) normally
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateOverlay()
|
||||
{
|
||||
m_canvasObject = new GameObject("ModdedCanvas");
|
||||
|
||||
Reference in New Issue
Block a user