Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 354c455
Showing
4 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# CyberEssentials | ||
|
||
## Requirements | ||
- [Cyberpunk 2077](https://www.gog.com/game/cyberpunk_2077) by CD Projekt Red | ||
- [Cyber Engine Tweaks](https://github.com/yamashi/CyberEngineTweaks) by [yamashi](https://github.com/yamashi) | ||
|
||
## To Install | ||
1. Navigate to your Cyberpunk install | ||
1. Go to the directory `bin/x64/` and create a `scripts` folder | ||
1. Move the `ce_tools` folder and cyberessentials.lua files inside of it | ||
|
||
## To Activate | ||
> **Note**: You'll need to activate CyberEssentials every time you relaunch the game. | ||
1. Open Cyberpunk 2077 | ||
1. Once in game, open the Cyber Engine Tweaks Console | ||
1. Run the command `dofile("bin/x64/scripts/cyberessentials.lua")` | ||
1. You'll know it worked if you see "CyberEssentials activated..." appear in the console | ||
|
||
## Commands | ||
|
||
### MoveForward(`distance`) | ||
**Description:** This command will move you in the direction you're looking by the specified distance. | ||
**Usage:** `MoveForward(10)` | ||
|
||
### GoUp(`distance`) | ||
**Description:** This command will move you up by the specified distance. | ||
**Usage:** `GoUp(10)` | ||
|
||
### GoDown(`distance`) | ||
**Description:** This command will move you down by the specified distance. | ||
**Usage:** `GoDown(10)` | ||
|
||
### Back() | ||
**Description:** This command will move you to the players last location before using any of the movement commands. | ||
**Usage:** `Back()` | ||
|
||
### WhereAmI() | ||
**Description:** This command is a shorter and more succinct way to get your current in game coordinates. | ||
**Usage:** `WhereAmI()` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
local headings = { | ||
north = { min = -22.5, max = 22.5, offsets = { x = 0, y = 1 } }, | ||
northeast = { min = -67.5, max = -22.5, offsets = { x = 0.5, y = 0.5 } }, | ||
east = { min = -112.5, max = -67.5, offsets = { x = 1, y = 0 } }, | ||
southeast = { min = -157.5, max = -112.5, offsets = { x = 0.5, y = -0.5 } }, | ||
southpositive = { min = 157.5, max = 180, offsets = { x = 0, y = -1 } }, | ||
southnegative = { min = -180, max = -157.5, offsets = { x = 0, y = -1 } }, | ||
southwest = { min = 112.5, max = 157.5, offsets = { x = -0.5, y = -0.5 } }, | ||
west = { min = 67.5, max = 112.5, offsets = { x = -1, y = 0 } }, | ||
northwest = { min = 22.5, max = 67.5, offsets = { x = -0.5, y = 0.5 } } | ||
} | ||
|
||
function GetOffsets(yaw) | ||
for heading, data in pairs(headings) do | ||
if yaw >= data.min and yaw <= data.max then | ||
print(heading) | ||
return data.offsets | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
local function combineStringTable(stringTable) | ||
local combined = "" | ||
|
||
for key, value in pairs(stringTable) do | ||
combined = combined .. value | ||
end | ||
|
||
return combined | ||
end | ||
|
||
function SplitString(str, delimiter) | ||
local length = string.len(str) | ||
local charTable = {} | ||
local stringTable = {} | ||
local stringTableCount = 0 | ||
for i = 1, length, 1 do | ||
local currentChar = str:sub(i, i) | ||
if i == length or currentChar == delimiter then | ||
stringTable[stringTableCount] = combineStringTable(charTable) | ||
stringTableCount = stringTableCount + 1 | ||
charTable = {} | ||
else | ||
table.insert(charTable, currentChar) | ||
end | ||
end | ||
|
||
return stringTable | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
local strHelper = require "scripts/ce_tools/stringhelpers" | ||
local headingCalculator = require "scripts/ce_tools/headingcalculator" | ||
|
||
|
||
-- local strHelper = require "tools.stringhelpers" | ||
-- local headingCalculator = require "tools.headingcalculator" | ||
|
||
|
||
print("CyberEssentials activated...") | ||
local previousPosition = {false} | ||
|
||
|
||
local function rawPositionToList(pos) | ||
-- Coords Format: "ToVector4{ x = 1784.8895, y = 2323.1487, z = 184.28886, w = 1.0 }" | ||
|
||
local posAsString = tostring(pos) | ||
local minusPreamble = string.gsub(posAsString, "ToVector4{ x = ", "") | ||
local yReplaced = string.gsub(minusPreamble, ", y = ", ",") | ||
local zReplaced = string.gsub(yReplaced, ", z = ", ",") | ||
local wReplaced = string.gsub(zReplaced, ", w = ", ",") | ||
local Delimited = string.gsub(wReplaced, " }", "") | ||
|
||
return SplitString(Delimited, ",") | ||
end | ||
|
||
local function getPlayerInfo() | ||
local player = Game.GetPlayer() | ||
local rawplayerPosition = player:GetWorldPosition() | ||
|
||
local playerPosition = rawPositionToList(rawplayerPosition) | ||
local playerDirection = player:GetWorldYaw() | ||
|
||
return { | ||
xCoord = playerPosition[0], | ||
yCoord = playerPosition[1], | ||
zCoord = playerPosition[2], | ||
yaw = playerDirection | ||
} | ||
end | ||
|
||
function MoveForward(amount) | ||
local player = getPlayerInfo() | ||
local offsets = GetOffsets(player.yaw) | ||
|
||
local xOffset = amount * offsets.x | ||
local yOffset = amount * offsets.y | ||
|
||
previousPosition = player | ||
Game.TeleportPlayerToPosition(player.xCoord + xOffset, player.yCoord + yOffset, player.zCoord + 1) | ||
end | ||
|
||
function GoUp(amount) | ||
local player = getPlayerInfo() | ||
|
||
previousPosition = player | ||
Game.TeleportPlayerToPosition(player.xCoord, player.yCoord, player.zCoord + amount) | ||
end | ||
|
||
function GoDown(amount) | ||
local player = getPlayerInfo() | ||
|
||
previousPosition = player | ||
Game.TeleportPlayerToPosition(player.xCoord, player.yCoord, player.zCoord - amount) | ||
end | ||
|
||
function Back() | ||
if previousPosition[1] == false then | ||
print("There is no previous position to move you to.") | ||
else | ||
Game.TeleportPlayerToPosition(previousPosition.xCoord, previousPosition.yCoord, previousPosition.zCoord) | ||
previousPosition = {false} | ||
end | ||
end | ||
|
||
function WhereAmI() | ||
local player = getPlayerInfo() | ||
|
||
print("x: " .. player.xCoord) | ||
print("y: " .. player.yCoord) | ||
print("z: " .. player.zCoord) | ||
print("yaw: " .. player.yaw) | ||
end |