From c3052ebd2c6e186d2d669c7174b42a13eed9e50c Mon Sep 17 00:00:00 2001 From: Brock Graton Date: Thu, 4 Apr 2024 22:28:29 -0500 Subject: [PATCH] Stabilized v1.1 --- manifest.json | 2 +- mods/FrothyWiFi.CYNHUD/mod.json | 6 ++-- .../mod/scripts/vscripts/cynhud.nut | 33 ++++++++++--------- .../mod/scripts/vscripts/ui/ms_cynhud.nut | 2 +- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/manifest.json b/manifest.json index 4a4c770..2e00628 100644 --- a/manifest.json +++ b/manifest.json @@ -2,6 +2,6 @@ "name": "CYNHUD", "version_number": "1.0.0", "website_url": "https://github.com/frothy-wifi/CYNHUD", - "description": "Adds an easily customizable message to your HUD, with the default message as a Cyn reference.", + "description": "Adds an easily customizable (through Mod Settings) message to your HUD, with the default message as a Cyn reference.", "dependencies": [] } \ No newline at end of file diff --git a/mods/FrothyWiFi.CYNHUD/mod.json b/mods/FrothyWiFi.CYNHUD/mod.json index cef6940..ea3477a 100755 --- a/mods/FrothyWiFi.CYNHUD/mod.json +++ b/mods/FrothyWiFi.CYNHUD/mod.json @@ -1,9 +1,9 @@ { "Name": "FrothyWiFi.CYNHUD", - "Description": "Adds an easily customizable message to your HUD, with the default message as a Cyn reference.", + "Description": "Adds an easily customizable (through Mod Settings) message to your HUD, with the default message as a Cyn reference.", "LoadPriority": 2, "RequiredOnClient": false, - "Version": "1.0.0", + "Version": "1.1.0", "ConVars": [ { "Name": "ch_hud_message", @@ -11,7 +11,7 @@ }, { "Name": "ch_hud_message_pos", - "DefaultValue": "Bottom-right" + "DefaultValue": "Middle" } ], "Scripts": [ diff --git a/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut b/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut index b09b774..4fe6ae7 100755 --- a/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut +++ b/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut @@ -1,4 +1,4 @@ -// TODO: Fix the message position logic +// TODO: Fix the message position logic /// IN PROGRESS global function CynHud_Init; #if CLIENT @@ -9,19 +9,20 @@ void function CynHud_Init() { var rui = null; string mapName = ""; string message = ""; -// string messagePos = ""; +string messagePos = ""; void function CynHud_ConfigureRui() { RuiSetInt(rui, "maxLines", 1); RuiSetInt(rui, "lineNum", 1); - // if (messagePos == "Bottom-right") { - // RuiSetFloat2(rui, "msgPos", <0.825, 0.92, 0.0>); - // } else if (messagePos == "Middle-right") { - // RuiSetFloat2(rui, "msgPos", <0.825, 0.46, 0.0>); - // } else if (messagePos == "Top-right") { - // RuiSetFloat2(rui, "msgPos", <0.825, -0.92, 0.0>); - // } - RuiSetFloat2(rui, "msgPos", <0.825, 0.92, 0.0>); + if (messagePos == "Bottom") { + RuiSetFloat2(rui, "msgPos", <0.825, 0.92, 0.0>); + } else if (messagePos == "Middle") { + RuiSetFloat2(rui, "msgPos", <0.825, 0.46, 0.0>); + } else if (messagePos == "Top") { + RuiSetFloat2(rui, "msgPos", <0.825, 0.0, 0.0>); + } else { + RuiSetFloat2(rui, "msgPos", <0.825, 0.46, 0.0>); + } RuiSetString(rui, "msgText", message); RuiSetFloat(rui, "msgFontSize", 25.0); RuiSetFloat(rui, "msgAlpha", 0.5); @@ -35,8 +36,10 @@ void function CynHud_DoMessage() { mapName = GetMapName(); rui = RuiCreate($"ui/cockpit_console_text_top_left.rpak", clGlobal.topoCockpitHudPermanent, RUI_DRAW_COCKPIT, 0); message = GetConVarString("ch_hud_message"); - // messagePos = GetConVarString("ch_hud_message_pos"); + messagePos = GetConVarString("ch_hud_message_pos"); + WaitFrame(); + CynHud_ConfigureRui(); while (mapName == GetMapName()) { @@ -45,10 +48,10 @@ void function CynHud_DoMessage() { RuiDestroy(rui); CynHud_DoMessage(); } - // if (GetConVarString("ch_hud_message_pos") != messagePos) { - // RuiDestroy(rui); - // CynHud_DoMessage(); - // } + if (GetConVarString("ch_hud_message_pos") != messagePos) { + RuiDestroy(rui); + CynHud_DoMessage(); + } } RuiDestroy(rui); } diff --git a/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/ui/ms_cynhud.nut b/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/ui/ms_cynhud.nut index 73c1664..dd1efc2 100644 --- a/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/ui/ms_cynhud.nut +++ b/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/ui/ms_cynhud.nut @@ -5,6 +5,6 @@ void function CynHud_AddModSettings() { AddModTitle("CYNHUD"); AddModCategory("Configuration"); AddConVarSetting("ch_hud_message", "HUD Message (case-insensitive)"); - // AddConVarSettingEnum("ch_hud_message_pos", "HUD Message Position on Screen", ["Bottom-right", "Middle-right", "Top-right"]); + AddConVarSetting("ch_hud_message_pos", "HUD Message Position on Screen (Bottom, Middle, Top)"); } #endif \ No newline at end of file