Skip to content

Commit

Permalink
Fix Enigma being called on non-local characters.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNexusAvenger committed Jul 4, 2024
1 parent f5ee5f2 commit 6aee946
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/Character/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -401,22 +401,31 @@ function Character:UpdateFromInputs(HeadControllerCFrame: CFrame, LeftHandContro
local JointCFrames = self.Torso:GetAppendageJointCFrames(LowerTorsoCFrame, UpperTorsoCFrame)

--Get the tracker CFrames from Enigma and fallback feet CFrames.
local IsLocalCharacter = (Players.LocalPlayer and Players.LocalPlayer.Character == self.CharacterModel)
local LeftFoot: CFrame, RightFoot: CFrame = self.FootPlanter:GetFeetCFrames()
local NewTrackerCFrames = EnigmaService:GetCFrames(self)
if NewTrackerCFrames.LeftFoot then
LeftFoot = NewTrackerCFrames.LeftFoot
elseif TrackerData and TrackerData.LeftFoot then
if TrackerData and TrackerData.LeftFoot then
LeftFoot = TrackerData.LeftFoot
else
LeftFoot = LeftFoot * CFrame.Angles(0, math.pi, 0)
end
if NewTrackerCFrames.RightFoot then
RightFoot = NewTrackerCFrames.RightFoot
elseif TrackerData and TrackerData.RightFoot then
if TrackerData and TrackerData.RightFoot then
RightFoot = TrackerData.RightFoot
else
RightFoot = RightFoot * CFrame.Angles(0, math.pi, 0)
end
if IsLocalCharacter then
local NewTrackerCFrames = EnigmaService:GetCFrames(self)
if NewTrackerCFrames.LeftFoot then
LeftFoot = NewTrackerCFrames.LeftFoot
end
if NewTrackerCFrames.RightFoot then
RightFoot = NewTrackerCFrames.RightFoot
end
self.ReplicationTrackerData = {
LeftFoot = NewTrackerCFrames.LeftFoot,
RightFoot = NewTrackerCFrames.RightFoot,
}
end

--Set the character CFrames.
--HumanoidRootParts must always face up. This makes the math more complicated.
Expand Down Expand Up @@ -457,12 +466,8 @@ function Character:UpdateFromInputs(HeadControllerCFrame: CFrame, LeftHandContro
end

--Replicate the changes to the server.
if Players.LocalPlayer and Players.LocalPlayer.Character == self.CharacterModel then
if IsLocalCharacter then
self.ReplicationCFrames = {HeadControllerCFrame, LeftHandControllerCFrame, RightHandControllerCFrame}
self.ReplicationTrackerData = {
LeftFoot = NewTrackerCFrames.LeftFoot,
RightFoot = NewTrackerCFrames.RightFoot,
}
end
end

Expand Down

0 comments on commit 6aee946

Please sign in to comment.