From 7bb410ef52472b4ff59f659fce8c697c89e2fc50 Mon Sep 17 00:00:00 2001 From: digitalbarrito Date: Tue, 12 Jan 2021 09:54:01 -0500 Subject: [PATCH 1/6] Update main.lua Add 3 functions --- main.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index 58d0d02..70d1054 100644 --- a/main.lua +++ b/main.lua @@ -10,4 +10,7 @@ SetWarp("test_warp") SetWarp("secondary", "-75.815399", "-113.607819", "111.161728") ListWarps() RemoveWarp("test_warp") -RemoveWarp("secondary") \ No newline at end of file +RemoveWarp("secondary") +Help() +HelpAdd() +HelpRemove() From 4ab19a56119bc45c32f374bcd439638d1462fe1b Mon Sep 17 00:00:00 2001 From: digitalbarrito Date: Tue, 12 Jan 2021 09:56:49 -0500 Subject: [PATCH 2/6] Simple UI Implementation Adds a Simple UI --- cyberessentials/init.lua | 87 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/cyberessentials/init.lua b/cyberessentials/init.lua index fee8f66..eb59141 100644 --- a/cyberessentials/init.lua +++ b/cyberessentials/init.lua @@ -1,4 +1,87 @@ +--UI key, default 0x23 for END +local hotkeyUI = 0x70 --F1 + +--Start CyberEssentials +dofile("cyberessentials/cyberessentials.lua") registerForEvent("onInit", function() - dofile("cyberessentials/cyberessentials.lua") - print("[CyberEssentials] Mod activated...") + print("[CyberEssentials] : Mod activated Press [F1] to open menu...") +end) +registerForEvent("onUpdate", function(deltaTime) + --UIToggle + if (ImGui.IsKeyPressed(hotkeyUI, false)) then + showUI = not showUI + end +end) + +-------- +-- UI -- +-------- +registerForEvent("onDraw", function() + if (showUI) then + --Window Sizing + ImGui.SetNextWindowPos(180, 790, ImGuiCond.FirstUseEver) + ImGui.SetNextWindowSize(265, 175, ImGuiCond.Appearing) + + -- If you add/remove here, remember to set ImGui.PopStyleColor(Int) correctly down towards the bottom of the file if it's being used + ImGui.PushStyleColor(ImGuiCol.FrameBg, 0.56, 0.06, 0.03, 0.35) + --ImGui.PushStyleColor(ImGuiCol.WindowBg, 0.56, 0.06, 0.03, 0.35) + ImGui.PushStyleColor(ImGuiCol.Border, 0.56, 0.06, 0.03, 1) + ImGui.PushStyleColor(ImGuiCol.TitleBg, 0.56, 0.06, 0.03, 0.5) + ImGui.PushStyleColor(ImGuiCol.TitleBgActive, 0.56, 0.06, 0.03, 0.75) + ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, 0.56, 0.06, 0.03, 0.25) + ImGui.PushStyleColor(ImGuiCol.Tab, 1, 0.2, 0.2, 0.5) + ImGui.PushStyleColor(ImGuiCol.TabHovered, 1, 0.2, 0.2, 0.85) + ImGui.PushStyleColor(ImGuiCol.TabActive, 1, 0.2, 0.2, 1) + ImGui.PushStyleColor(ImGuiCol.Button, 0.56, 0.06, 0.03, 0.50) + ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0.56, 0.06, 0.03, 0.75) + ImGui.PushStyleColor(ImGuiCol.ButtonActive, 0.56, 0.06, 0.03, 1) + ImGui.PushStyleColor(ImGuiCol.ResizeGrip, 0.56, 0.06, 0.03, 0.6) + ImGui.PushStyleColor(ImGuiCol.ResizeGripHovered, 0.56, 0.06, 0.03, 0.75) + ImGui.PushStyleColor(ImGuiCol.ResizeGripActive, 0.56, 0.06, 0.03, 1) + + if (ImGui.Begin("[CyberEssentials]:")) then + + --Button Sizes + local buttonHeight1 = 19 + local buttonHeight2 = 30 + local buttonWidth1 = 120 + local buttonWidth2 = 159 + local buttonWidth3 = 248 + local buttonWidth4 = 492 + + if (ImGui.BeginTabBar("CETabs")) then + + + + --CyberEssentials GUI Buttons + if (ImGui.BeginTabItem("CyberEssentials")) then + ImGui.Spacing() + ImGui.Text("CyberEssentials Usage") + ImGui.Spacing() + ImGui.PushItemWidth(250) + if(ImGui.Button("List Warps", buttonWidth1, buttonHeight1)) then + ListWarps() + end + ImGui.SameLine() + if (ImGui.Button("Where Am I?", buttonWidth1, buttonHeight1)) then + WhereAmI() + end + if(ImGui.Button("Add Warp", buttonWidth1, buttonHeight1)) then + HelpAdd() + end + ImGui.SameLine() + if(ImGui.Button("Remove Warp", buttonWidth1, buttonHeight1)) then + HelpRemove() + end + if(ImGui.Button("CyberEssentials Commands List", buttonWidth3, buttonHeight2)) then + Help() + end + ImGui.EndTabItem() + end + ImGui.EndTabBar() + end + end + ImGui.PopStyleColor(14) --Contains the PushStyleColors above to this menu's Window. Remove this line to push this color scheme to all windows + ImGui.End() + end end) From 542e9aef33837176826a6ab52c4ea04c80afdb9d Mon Sep 17 00:00:00 2001 From: digitalbarrito Date: Tue, 12 Jan 2021 09:58:32 -0500 Subject: [PATCH 3/6] Update cyberessentials.lua adds 3 Functions. --- cyberessentials/cyberessentials.lua | 123 ++++++++++++++++++++++++++-- 1 file changed, 114 insertions(+), 9 deletions(-) diff --git a/cyberessentials/cyberessentials.lua b/cyberessentials/cyberessentials.lua index 64951cd..4a24aa2 100644 --- a/cyberessentials/cyberessentials.lua +++ b/cyberessentials/cyberessentials.lua @@ -4,7 +4,7 @@ local headingCalculator = require "cyberessentials/tools/headingcalculator" local repoTools = require "cyberessentials/tools/repo" -local game = cyberpunk:new().game +local game = cyberpunk:new({ game = Game }).game local player = playerTools:new({ game = game }) local repo = repoTools:new({ path = "cyberessentials/data/cyberessentials_data.json"}) @@ -22,7 +22,8 @@ function ListWarps() end end - print("[CyberEssentials] " .. warp_list) + print("[CyberEssentials] : " .. warp_list) + print("Warp()") end function RemoveWarp(warp_name) @@ -31,12 +32,12 @@ function RemoveWarp(warp_name) for warp_number, warp_data in pairs(current_warps) do if warp_data.name == warp_name then repo:RemoveWarp(current_warps, warp_number) - print("[CyberEssentials] Removed the warp \"" .. warp_name .. "\".") + print("[CyberEssentials] : Removed the warp \"" .. warp_name .. "\".") return end end - print("[CyberEssentials] No warp named \"" .. warp_name .. "\" to remove.") + print("[CyberEssentials] : No warp named \"" .. warp_name .. "\" to remove.") end function SetWarp(warp_name, xCoord, yCoord, zCoord) @@ -50,13 +51,13 @@ function SetWarp(warp_name, xCoord, yCoord, zCoord) for warp_number, warp_data in pairs(current_warps) do if warp_data.name == warp_name then - print("[CyberEssentials] A warp with the name \"" .. warp_name .. "\" already exists, please pick a different name.") + print("[CyberEssentials] : A warp with the name \"" .. warp_name .. "\" already exists, please pick a different name.") return end end repo:AddWarp(current_warps, warp_name, xCoord, yCoord, zCoord) - print("[CyberEssentials] Set the warp \"" .. warp_name .. "\".") + print("[CyberEssentials] : Set the warp \"" .. warp_name .. "\".") end function Warp(warp_name) @@ -65,14 +66,14 @@ function Warp(warp_name) for warp_number, warp_data in pairs(current_warps) do if warp_data.name == warp_name then - print("[CyberEssentials] Warping player to \"" .. warp_data.name .. "\".") + print("[CyberEssentials] : Warping player to \"" .. warp_data.name .. "\".") previousPosition = my_player game.TeleportPlayerToPosition(warp_data.x, warp_data.y, warp_data.z) return end end - print("[CyberEssentials] Warp \"" .. warp_name .. "\" not found.") + print("[CyberEssentials] : Warp \"" .. warp_name .. "\" not found.") end function MoveForward(amount) @@ -104,7 +105,7 @@ function Back() local my_player = player:getPlayerInfo() if (not previousPosition) then - print("[CyberEssentials] There is no previous position to move you to.") + print("[CyberEssentials] : There is no previous position to move you to.") else game.TeleportPlayerToPosition(previousPosition.xCoord, previousPosition.yCoord, previousPosition.zCoord) previousPosition = my_player @@ -119,3 +120,107 @@ function WhereAmI() print("z: " .. my_player.zCoord) print("yaw: " .. my_player.yaw) end + +function Help() + + print(" ") + print("[CyberEssentials] : Commands List (Tip: You can click a line in the console to copy it directly) ") + print(" ") + print("SetWarp()") + + print("-Note!: To use this command, you must put quotes around the name of the warp you want to create!") + + print("--Description:") + print("--This command allows you to create a new warp based on your current position or a set of coordinates that you can teleport to using the Warp() command.") + + print("---Usages:") + print("--- SetWarp(My new warp)") + print("--- SetWarp(Peralezes' Apartment, -75.815399, -113.607819, 111.161728)") + + print(" ") + print("[CyberEssentials] : ") + print("Warp()") + + print("-Note!: To use this command, you must put quotes around the name of the warp you want to go to!") + + print("--Description:") + print("--This command allows you to teleport to any previously created warp locations.") + + print("---Usage: Warp(V's Apartment)") + print(" ") + print("[CyberEssentials] : ") + print("RemoveWarp()") + + print("-Note!: To use this command, you must put quotes around the name of the warp you want to remove!") + + print("--Description:") + print("--This command allows you to remove a previously created warp.") + + print("---Usage: RemoveWarp(V's Apartment)") + + print(" ") + print("[CyberEssentials] : ") + print("MoveForward()") + + print("--Description:") + print("--This command will move you in the direction you're looking by the specified distance.") + + print("---Usage: MoveForward(10)") + + print(" ") + print("[CyberEssentials] : ") + print("Back()") + + print("--Description:") + print("--This command will move you to the players last location before using any of the movement commands.") + + print("---Usage: Back(10)") + + print(" ") + print("[CyberEssentials] : ") + print("GoUp()") + + print("--Description: ") + print("--This command will move you up by the specified distance.") + + print("---Usage: GoUp(10)") + + print(" ") + print("[CyberEssentials] : ") + print("GoDown()") + + print("--Description:") + print("--This command will move you down by the specified amount.") + + print("---Usage: GoDown(10)") + + +end + +function HelpAdd() + print(" ") + print("[CyberEssentials] : Add New Warp Usage") + print("SetWarp()") + + print("-Note!: To use this command, you must put quotes around the name of the warp you want to create!") + + print("--Description:") + print("--This command allows you to create a new warp based on your current position or a set of coordinates that you can teleport to using the Warp() command.") + + print("---Usages:") + print("--- SetWarp(My new warp)") + print("--- SetWarp(Peralezes' Apartment, -75.815399, -113.607819, 111.161728)") +end + +function HelpRemove() + print(" ") + print("[CyberEssentials] : Remove Warp Usage") + print("RemoveWarp()") + + print("-Note!: To use this command, you must put quotes around the name of the warp you want to remove!") + + print("--Description:") + print("--This command allows you to remove a previously created warp.") + + print("---Usage: RemoveWarp(V's Apartment)") +end From 3b73a0c2f54f5db9188531ae30eb1bfb3829466e Mon Sep 17 00:00:00 2001 From: digitalbarrito Date: Tue, 12 Jan 2021 10:03:36 -0500 Subject: [PATCH 4/6] Update README.md add 3 functions --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f4a10c3..2c7cfe9 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 1. Navigate to your Cyberpunk install 1. Go to the directory `bin/x64/plugins/cyber_engine_tweaks/mods` 1. copy the `cyberessentials` folder into the `mods` folder -1. Launch Cyberpunk 2077 and then open the Cyber Engine Tweaks Console, if you see "[CyberEssentials] Mod activated..." in the console you know it worked. +1. Launch Cyberpunk 2077 and then open the Cyber Engine Tweaks Console, if you see "[CyberEssentials] : Mod activated Press [F1] to open menu..." in the console you know it worked. ## Commands @@ -56,3 +56,14 @@ **Description:** This command is a shorter and more succinct way to get your current in game coordinates. **Usage:** `WhereAmI()` +### Help() +**Description:** This command will list all commands and their usages and descriptions. +**Usage:** `Help()` + +### HelpAdd() +**Description:** This command will list usage and description for SetWarp(). +**Usage:** `HelpAdd()` + +### HelpRemove() +**Description:** This command will list usage and description for RemoveWarp(). +**Usage:** `HelpRemove()` From 61121b8625e082db82f320e31fa705e3c4f39503 Mon Sep 17 00:00:00 2001 From: digitalbarrito Date: Tue, 12 Jan 2021 10:21:10 -0500 Subject: [PATCH 5/6] Update init.lua Change Window Starting Position --- cyberessentials/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cyberessentials/init.lua b/cyberessentials/init.lua index eb59141..0e06a6e 100644 --- a/cyberessentials/init.lua +++ b/cyberessentials/init.lua @@ -19,9 +19,10 @@ end) registerForEvent("onDraw", function() if (showUI) then --Window Sizing - ImGui.SetNextWindowPos(180, 790, ImGuiCond.FirstUseEver) + ImGui.SetNextWindowPos(0, 450, ImGuiCond.FirstUseEver) ImGui.SetNextWindowSize(265, 175, ImGuiCond.Appearing) + -- Window Color Scheme -- If you add/remove here, remember to set ImGui.PopStyleColor(Int) correctly down towards the bottom of the file if it's being used ImGui.PushStyleColor(ImGuiCol.FrameBg, 0.56, 0.06, 0.03, 0.35) --ImGui.PushStyleColor(ImGuiCol.WindowBg, 0.56, 0.06, 0.03, 0.35) From b2948d1cebfd1eb3b4d66360115fb923a122ea9a Mon Sep 17 00:00:00 2001 From: digitalbarrito Date: Tue, 12 Jan 2021 11:41:44 -0500 Subject: [PATCH 6/6] Update cyberessentials.lua --- cyberessentials/cyberessentials.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cyberessentials/cyberessentials.lua b/cyberessentials/cyberessentials.lua index 4a24aa2..5ec7d54 100644 --- a/cyberessentials/cyberessentials.lua +++ b/cyberessentials/cyberessentials.lua @@ -4,7 +4,7 @@ local headingCalculator = require "cyberessentials/tools/headingcalculator" local repoTools = require "cyberessentials/tools/repo" -local game = cyberpunk:new({ game = Game }).game +local game = cyberpunk:new().game local player = playerTools:new({ game = game }) local repo = repoTools:new({ path = "cyberessentials/data/cyberessentials_data.json"})