diff --git a/CHANGELOG.md b/CHANGELOG.md index 14db46c..503a1b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ -#

Changelog

-# v1.2.1 +# v1.4.1 *[Patch]* +- Fix settings not saving +- Update `help` command +- Add manual update check command - `ckupdate` +- Refactor some code +## v1.4 +- Added automatic update checking! +## v1.3 +- Added control messages to confirm that your changes have been noticed by the mod +- Commandds +## v1.2.1 - Added a new logo ## v1.2 - Added message on HUD message reload diff --git a/CHBuild/.vs/CHBuild/DesignTimeBuild/.dtbcache.v2 b/CHBuild/.vs/CHBuild/DesignTimeBuild/.dtbcache.v2 index c4a9fd6..7b09692 100644 Binary files a/CHBuild/.vs/CHBuild/DesignTimeBuild/.dtbcache.v2 and b/CHBuild/.vs/CHBuild/DesignTimeBuild/.dtbcache.v2 differ diff --git a/CHBuild/.vs/CHBuild/FileContentIndex/6ead7d08-5b0f-4ff3-b9fc-0a781e09ba95.vsidx b/CHBuild/.vs/CHBuild/FileContentIndex/c4f01ca2-3afe-483b-b5db-c182400d3301.vsidx similarity index 79% rename from CHBuild/.vs/CHBuild/FileContentIndex/6ead7d08-5b0f-4ff3-b9fc-0a781e09ba95.vsidx rename to CHBuild/.vs/CHBuild/FileContentIndex/c4f01ca2-3afe-483b-b5db-c182400d3301.vsidx index 4d8b159..9f8f532 100644 Binary files a/CHBuild/.vs/CHBuild/FileContentIndex/6ead7d08-5b0f-4ff3-b9fc-0a781e09ba95.vsidx and b/CHBuild/.vs/CHBuild/FileContentIndex/c4f01ca2-3afe-483b-b5db-c182400d3301.vsidx differ diff --git a/CHBuild/.vs/CHBuild/v17/.futdcache.v2 b/CHBuild/.vs/CHBuild/v17/.futdcache.v2 index aea19c0..8fce9a4 100644 Binary files a/CHBuild/.vs/CHBuild/v17/.futdcache.v2 and b/CHBuild/.vs/CHBuild/v17/.futdcache.v2 differ diff --git a/CHBuild/.vs/CHBuild/v17/.suo b/CHBuild/.vs/CHBuild/v17/.suo index 1b6cfd0..50664fe 100644 Binary files a/CHBuild/.vs/CHBuild/v17/.suo and b/CHBuild/.vs/CHBuild/v17/.suo differ diff --git a/CHBuild/.vs/CHBuild/v17/DocumentLayout.json b/CHBuild/.vs/CHBuild/v17/DocumentLayout.json index 2a8d1a9..eb55ed5 100644 --- a/CHBuild/.vs/CHBuild/v17/DocumentLayout.json +++ b/CHBuild/.vs/CHBuild/v17/DocumentLayout.json @@ -24,7 +24,7 @@ "RelativeDocumentMoniker": "Program.cs", "ToolTip": "C:\\Users\\froth\\OneDrive\\Desktop\\CYNHUD\\CHBuild\\Program.cs", "RelativeToolTip": "Program.cs", - "ViewState": "AQIAAAAAAAAAAAAAAAAAAA8AAAA5AQAA", + "ViewState": "AQIAAA0AAAAAAAAAAAAAAA8AAAAEAgAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2024-04-08T18:20:03.119Z", "EditorCaption": "" diff --git a/CHBuild/.vs/ProjectEvaluation/chbuild.metadata.v7.bin b/CHBuild/.vs/ProjectEvaluation/chbuild.metadata.v7.bin index 48ef0ae..40d3976 100644 Binary files a/CHBuild/.vs/ProjectEvaluation/chbuild.metadata.v7.bin and b/CHBuild/.vs/ProjectEvaluation/chbuild.metadata.v7.bin differ diff --git a/CHBuild/.vs/ProjectEvaluation/chbuild.projects.v7.bin b/CHBuild/.vs/ProjectEvaluation/chbuild.projects.v7.bin index 351bf0b..8cbbcb2 100644 Binary files a/CHBuild/.vs/ProjectEvaluation/chbuild.projects.v7.bin and b/CHBuild/.vs/ProjectEvaluation/chbuild.projects.v7.bin differ diff --git a/CHBuild/Program.cs b/CHBuild/Program.cs index dcf55e0..86a94dc 100644 --- a/CHBuild/Program.cs +++ b/CHBuild/Program.cs @@ -13,7 +13,7 @@ public static void Build(string version, bool isThunderstoreBuild=false) string newFolderName = $"FrothyWiFi-CYNHUD-{version}"; Process process = new(); process.StartInfo.FileName = "powershell.exe"; - process.StartInfo.Arguments = isThunderstoreBuild ? $@"Copy-Item -Path ""CYNHUD"" -Destination ""{newFolderName}"" -Recurse; Remove-Item -Path ""{newFolderName}\.gitignore"" -Force; Remove-Item -Path ""{newFolderName}\CHBuild"" -Force -Recurse; Remove-Item -Path {newFolderName}\.git -Force -Recurse; Compress-Archive -Path {newFolderName}\* -DestinationPath {newFolderName}.zip; Remove-Item -Path {newFolderName} -Force -Recurse" : $@"Copy-Item -Path ""CYNHUD"" -Destination ""{newFolderName}"" -Recurse; Remove-Item -Path ""{newFolderName}\.gitignore"" -Force; Remove-Item -Path ""{newFolderName}\CHBuild"" -Force -Recurse; Remove-Item -Path {newFolderName}\.git -Force -Recurse"; + process.StartInfo.Arguments = isThunderstoreBuild ? $@"Copy-Item -Path ""CYNHUD"" -Destination ""{newFolderName}"" -Recurse; Remove-Item -Path ""{newFolderName}\.gitignore"" -Force; Remove-Item -Path ""{newFolderName}\CHBuild"" -Force -Recurse; Remove-Item -Path {newFolderName}\.git -Force -Recurse; Compress-Archive -Path {newFolderName}\* -DestinationPath {newFolderName}.zip; Remove-Item -Path {newFolderName} -Force -Recurse" : $@"Copy-Item -Path ""CYNHUD"" -Destination ""{newFolderName}"" -Recurse"; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.Start(); diff --git a/manifest.json b/manifest.json index 69d371b..4984b28 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "CYNHUD", - "version_number": "1.3.0", + "version_number": "1.4.1", "website_url": "https://github.com/frothy-wifi/CYNHUD", "description": "Adds an easily customizable (through Mod Settings) message to your HUD and useful game commands.", "dependencies": [] diff --git a/mods/FrothyWiFi.CYNHUD/mod.json b/mods/FrothyWiFi.CYNHUD/mod.json index 35ec0d4..87cebc5 100755 --- a/mods/FrothyWiFi.CYNHUD/mod.json +++ b/mods/FrothyWiFi.CYNHUD/mod.json @@ -3,17 +3,19 @@ "Description": "Adds an easily customizable (through Mod Settings) message to your HUD and useful game commands.", "LoadPriority": 2, "RequiredOnClient": false, - "Version": "1.3.0", + "Version": "1.4.1", "ConVars": [ { "Name": "ch_hud_message", "DefaultValue": "get snuck-up on", - "HelpString": "The message CYNHUD will display on your HUD." + "HelpString": "The message CYNHUD will display on your HUD.", + "Flags": 16777216 }, { "Name": "ch_hud_message_pos", "DefaultValue": "Middle", - "HelpString": "The position of the message CYNHUD will display on your HUD. (Bottom, Middle, Top)" + "HelpString": "The position of the message CYNHUD will display on your HUD. (Bottom, Middle, Top)", + "Flags": 16777216 } ], "Scripts": [ diff --git a/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut b/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut index 66f558d..854f5e4 100755 --- a/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut +++ b/mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut @@ -5,23 +5,52 @@ var rui = null; string mapName = ""; string message = ""; string messagePos = ""; -bool shouldReload = false; +string version = "1.4.0"; +bool reloadRequest = false; bool hasShownWelcomeTextAlready = false; +void function CynHud_CheckForUpdates() { + void functionref(HttpRequestResponse) onSuccess = void function(HttpRequestResponse response) { + string webVersion = response.body; + print(response.body); + if (webVersion[0] > version[0]) { + CynHud_WriteChatMessage("New update available: \x1b[113mv" + response.body + "\x1b[0m. Get it from \x1b[111mThunderstore\x1b[0m or \x1b[111mGitHub\x1b[0m."); + } else if (webVersion[2] > version[2]) { + CynHud_WriteChatMessage("New update available: \x1b[113mv" + response.body + "\x1b[0m. Get it from \x1b[111mThunderstore\x1b[0m or \x1b[111mGitHub\x1b[0m."); + } else if (webVersion[4] > version[4]) { + CynHud_WriteChatMessage("New patch available: \x1b[113mv" + response.body + "\x1b[0m. Get it from \x1b[111mThunderstore\x1b[0m or \x1b[111mGitHub\x1b[0m."); + } else { + CynHud_WriteChatMessage("No updates found. Have a good day!") + } + } + void functionref(HttpRequestFailure) onFailure = void function(HttpRequestFailure failure) { + CynHud_WriteChatMessage("\x1b[112mUpdate check failed:\x1b[0m code \x1b[113" + failure.errorCode.tostring() + ": " + failure.errorMessage + "\x1b[0m."); + } + if (NSHttpGet("https://frothywifi.cc/r2ns-ckupdate/cynhud.txt", {}, onSuccess, onFailure)) { + CynHud_WriteChatMessage("Checking for updates."); + } else { + CynHud_WriteChatMessage("\x1b[112mUpdate check failed:\x1b[0m Couldn't start the HTTP request. Do you have HTTP requests disabled in your launch options?"); + } +} + ClClient_MessageStruct function CynHud_CommandFilter(ClClient_MessageStruct message) { if (message.message == "$ch.help") { message.shouldBlock = true; Chat_GameWriteLine("\x1b[33m--== CYNHUD commands ==--\x1b[0m"); - Chat_GameWriteLine("All CYNHUD commands \x1b[112mmust\x1b[0m be prefaced with \x1b[33m\"$ch.\"\x1b[0m."); - Chat_GameWriteLine("\x1b[33m$ch.help\x1b[0m - Show available commands."); - Chat_GameWriteLine("\x1b[33m$ch.reload\x1b[0m - Reload the HUD message manually.") - Chat_GameWriteLine("\x1b[33m$ch.uid\x1b[0m - Show your user ID. CYNHUD also uses this to greet you."); + Chat_GameWriteLine("All CYNHUD commands \x1b[112mmust\x1b[0m be prefaced with \x1b[33m\"$ch.\"\x1b[0m, for example \x1b[33m$ch.uid\x1b[0m."); + Chat_GameWriteLine("\x1b[33mhelp\x1b[0m - Show available commands."); + Chat_GameWriteLine("\x1b[33mreload\x1b[0m - Reload the HUD message manually.") + Chat_GameWriteLine("\x1b[33muid\x1b[0m - Show your user ID. CYNHUD also uses this to greet you."); + Chat_GameWriteLine("\x1b[33mckupdate\x1b[0m - Check for CYNHUD updates."); } else if (message.message == "$ch.reload") { message.shouldBlock = true; - shouldReload = true; + reloadRequest = true; } else if (message.message == "$ch.uid") { message.shouldBlock = true; CynHud_WriteChatMessage("You are Pilot \x1b[111m" + NSGetLocalPlayerUID() + "\x1b[0m."); + } else if (message.message == "$ch.ckupdate") { + message.shouldBlock = true; + CynHud_CheckForUpdates(); } return message; } @@ -60,11 +89,12 @@ void function CynHud_DoMessage() { while (mapName == GetMapName()) { WaitFrame(); if (!hasShownWelcomeTextAlready && mapName != "mp_lobby") { - CynHud_WriteChatMessage("Welcome back, \x1b[111m" + NSGetLocalPlayerUID() + "\x1b[0m. Run $ch.help for a list of commands."); + thread CynHud_CheckForUpdates(); + CynHud_WriteChatMessage("Welcome back, \x1b[111m" + NSGetLocalPlayerUID() + "\x1b[0m. Run \x1b[33m$ch.help\x1b[0m for a list of commands."); hasShownWelcomeTextAlready = true; } - if (shouldReload) { - shouldReload = false; + if (reloadRequest) { + reloadRequest = false; RuiDestroy(rui); CynHud_WriteChatMessage("Manual reload request recieved; reloading HUD message."); CynHud_DoMessage(); @@ -90,6 +120,7 @@ void function CynHud_WriteChatMessage(string message) { void function CynHud_Init() { AddCallback_OnReceivedSayTextMessage(CynHud_CommandFilter); + CynHud_CheckForUpdates(); thread CynHud_DoMessage(); } #endif \ No newline at end of file