Skip to content

Commit

Permalink
Add setting to disable Enigma.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNexusAvenger committed Jul 3, 2024
1 parent cf50ae3 commit 9b6c00a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions NexusVRCharacterModelLoader.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ local Configuration = {
--the client code.
HideVersion = false,

--If true, Enigma (https://github.com/TheNexusAvenger/Enigma) will be enabled
--to allow players to use additional SteamVR trackers.
--It is only recommended to disable if this causes problems, and said problems
--can't be addressed.
EnigmaEnabled = true,

--If true, Nexus-Appendage with IKControl will be used.
--Workspace.IKControlConstraintSupport MUST be set to Enabled for proper results.
--In Team Create, it may not set correctly. Make sure to close and re-open
Expand Down
4 changes: 3 additions & 1 deletion src/NexusVRCharacterModelClientLoader.client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ if Settings:GetSetting("Extra.NexusVRBackpackEnabled") ~= false then
end

--Load Enigma.
EnigmaService:Enable()
if Settings:GetSetting("Extra.EnigmaEnabled") ~= false then
EnigmaService:Enable()
end

--Start updating the VR character.
RunService:BindToRenderStep("NexusVRCharacterModelUpdate", Enum.RenderPriority.Camera.Value - 1, function()
Expand Down
3 changes: 3 additions & 0 deletions src/State/EnigmaService.luau
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local UserInputService = game:GetService("UserInputService")
local NexusVRCharacterModel = script.Parent.Parent
local Enigma = require(NexusVRCharacterModel:WaitForChild("Enigma"))
local Head = require(NexusVRCharacterModel:WaitForChild("Character"):WaitForChild("Head"))
local Settings = require(NexusVRCharacterModel:WaitForChild("State"):WaitForChild("Settings")).GetInstance()

local EnigmaService = {}
EnigmaService.__index = EnigmaService
Expand Down Expand Up @@ -50,6 +51,7 @@ end
Returns the CFrames for the trackers.
--]]
function EnigmaService.GetCFrames(self: EnigmaService, Character: any): TrackerData
if Settings:GetSetting("Extra.EnigmaEnabled") == false then return {} end
local HeadsetWorldCFrame = Character.Parts.Head.CFrame * Character.Head:GetEyesOffset()
local FloorWorldCFrame = HeadsetWorldCFrame * (UserInputService:GetUserCFrame(Enum.UserCFrame.Head):Inverse() * UserInputService:GetUserCFrame(Enum.UserCFrame.Floor))

Expand All @@ -69,6 +71,7 @@ end
Calibrates any inputs based on the current inputs.
--]]
function EnigmaService.Calibrate(self: EnigmaService, Character: any): ()
if Settings:GetSetting("Extra.EnigmaEnabled") == false then return end
local LeftFootTrackerCFrame = Enigma:GetUserCFrame("LeftFoot")
local RightFootTrackerCFrame = Enigma:GetUserCFrame("RightFoot")
if not LeftFootTrackerCFrame and not RightFootTrackerCFrame then return end
Expand Down
5 changes: 5 additions & 0 deletions src/UI/View/EnigmaView.luau
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local Enigma = require(NexusVRCharacterModel:WaitForChild("Enigma"))
local NexusInstance = require(NexusVRCharacterModel:WaitForChild("NexusInstance"):WaitForChild("NexusInstance"))
local CharacterService = require(NexusVRCharacterModel:WaitForChild("State"):WaitForChild("CharacterService")).GetInstance()
local EnigmaService = require(NexusVRCharacterModel:WaitForChild("State"):WaitForChild("EnigmaService")).GetInstance()
local Settings = require(NexusVRCharacterModel:WaitForChild("State"):WaitForChild("Settings")).GetInstance()

local TextButtonFactory = require(NexusVRCharacterModel:WaitForChild("NexusButton"):WaitForChild("Factory"):WaitForChild("TextButtonFactory")).CreateDefault(Color3.fromRGB(0, 170, 255))
TextButtonFactory:SetDefault("Theme", "RoundedCorners")
Expand Down Expand Up @@ -38,6 +39,10 @@ function EnigmaView:__new(View: any): ()
EnigmaText.TextStrokeTransparency = 0
EnigmaText.Parent = Container
self.EnigmaText = EnigmaText
if Settings:GetSetting("Extra.EnigmaEnabled") == false then
EnigmaText.Text = "This game has disabled Enigma (Beta)."
return
end
self:UpdateText()

task.spawn(function()
Expand Down

0 comments on commit 9b6c00a

Please sign in to comment.