Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Final v1.3 files
Browse files Browse the repository at this point in the history
  • Loading branch information
frothy-wifi committed Apr 8, 2024
1 parent 94a07e0 commit bc16947
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 16 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "CYNHUD",
"version_number": "1.2.1",
"version_number": "1.3.0",
"website_url": "https://github.com/frothy-wifi/CYNHUD",
"description": "Adds an easily customizable (through Mod Settings) message to your HUD. The default message is a Cyn reference.",
"description": "Adds an easily customizable (through Mod Settings) message to your HUD and useful game commands.",
"dependencies": []
}
10 changes: 6 additions & 4 deletions mods/FrothyWiFi.CYNHUD/mod.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"Name": "FrothyWiFi.CYNHUD",
"Description": "Adds an easily customizable (through Mod Settings) message to your HUD. The default message is a Cyn reference.",
"Description": "Adds an easily customizable (through Mod Settings) message to your HUD and useful game commands.",
"LoadPriority": 2,
"RequiredOnClient": false,
"Version": "1.2.1",
"Version": "1.3.0",
"ConVars": [
{
"Name": "ch_hud_message",
"DefaultValue": "get snuck-up on"
"DefaultValue": "get snuck-up on",
"HelpString": "The message CYNHUD will display on your HUD."
},
{
"Name": "ch_hud_message_pos",
"DefaultValue": "Middle"
"DefaultValue": "Middle",
"HelpString": "The position of the message CYNHUD will display on your HUD. (Bottom, Middle, Top)"
}
],
"Scripts": [
Expand Down
52 changes: 42 additions & 10 deletions mods/FrothyWiFi.CYNHUD/mod/scripts/vscripts/cynhud.nut
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
global function CynHud_Init;

#if CLIENT
void function CynHud_WriteChatMessage(string message) {
Chat_GameWriteLine("\x1b[113mCYNHUD Control:\x1b[0m " + message);
}

void function CynHud_Init() {
thread CynHud_DoMessage();
}

var rui = null;
string mapName = "";
string message = "";
string messagePos = "";
bool shouldReload = false;
bool hasShownWelcomeTextAlready = false;

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.");
} else if (message.message == "$ch.reload") {
message.shouldBlock = true;
shouldReload = true;
} else if (message.message == "$ch.uid") {
message.shouldBlock = true;
CynHud_WriteChatMessage("You are Pilot \x1b[111m" + NSGetLocalPlayerUID() + "\x1b[0m.");
}
return message;
}

void function CynHud_ConfigureRui() {
RuiSetInt(rui, "maxLines", 1);
Expand Down Expand Up @@ -47,17 +59,37 @@ 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.");
hasShownWelcomeTextAlready = true;
}
if (shouldReload) {
shouldReload = false;
RuiDestroy(rui);
CynHud_WriteChatMessage("Manual reload request recieved; reloading HUD message.");
CynHud_DoMessage();
}
if (GetConVarString("ch_hud_message") != message) {
RuiDestroy(rui);
CynHud_WriteChatMessage("Reloading HUD message.");
CynHud_WriteChatMessage("Message changed; reloading HUD message.");
CynHud_DoMessage();
}
if (GetConVarString("ch_hud_message_pos") != messagePos) {
RuiDestroy(rui);
CynHud_WriteChatMessage("Reloading HUD message.");
CynHud_WriteChatMessage("Message position changed; reloading HUD message.");
CynHud_DoMessage();
}
}
RuiDestroy(rui);
hasShownWelcomeTextAlready = false;
}

void function CynHud_WriteChatMessage(string message) {
Chat_GameWriteLine("\x1b[33mCYNHUD:\x1b[0m " + message);
}

void function CynHud_Init() {
AddCallback_OnReceivedSayTextMessage(CynHud_CommandFilter);
thread CynHud_DoMessage();
}
#endif

0 comments on commit bc16947

Please sign in to comment.