optimize native scripts

This commit is contained in:
2024-09-06 14:58:12 -04:00
parent f0bf277d13
commit a5afa7792a
61 changed files with 45 additions and 96 deletions

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type UDP = UnreliableRemoteEvent type UDP = UnreliableRemoteEvent
@@ -110,7 +109,7 @@ function Actions:DisableCrouch()
local Easing = TweenInfo.new(Actions.CrouchSpeed, Enum.EasingStyle.Linear) local Easing = TweenInfo.new(Actions.CrouchSpeed, Enum.EasingStyle.Linear)
local WalkSpeed = self.Humanoid.WalkSpeed local WalkSpeed = self.Humanoid.WalkSpeed
CrouchTween:Start(self.Humanoid, { CrouchTween:Start(self.Humanoid, {
HipHeight = Actions.StandHeight, HipHeight = Actions.StandHeight,
WalkSpeed = math.max(1, WalkSpeed+Actions.WalkSpeedMultiplier) WalkSpeed = math.max(1, WalkSpeed+Actions.WalkSpeedMultiplier)
@@ -126,7 +125,7 @@ function Actions:EnableFlashlight(FlashlightKey)
--Note: if dictionaries are more than 1 value, encode it into JSON --Note: if dictionaries are more than 1 value, encode it into JSON
local c = table.pack(self.CurrentCamera.CFrame:ToEulerAnglesXYZ()) local c = table.pack(self.CurrentCamera.CFrame:ToEulerAnglesXYZ())
table.insert(c, c.n) table.insert(c, c.n)
self.FlashlightRemote:FireServer(c) self.FlashlightRemote:FireServer(c)
Delta:time() Delta:time()
end end

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type AnimationsMap = { type AnimationsMap = {
@@ -74,6 +73,7 @@ function Bobbing.constructor(HumanoidRootPart: HumanoidRootPart, CurrentCamera:
}, Bobbing) }, Bobbing)
end end
@native
function Animations.Idle(t: tick, dt: deltatime) function Animations.Idle(t: tick, dt: deltatime)
return ANG( return ANG(
math.rad(math.cos(t/80)/(Bobbing.AnimationSpeed+50)), math.rad(math.cos(t/80)/(Bobbing.AnimationSpeed+50)),
@@ -82,6 +82,7 @@ function Animations.Idle(t: tick, dt: deltatime)
) )
end end
@native
function Animations.Walk(t: tick, dt: deltatime) function Animations.Walk(t: tick, dt: deltatime)
-- return ANG( -- return ANG(
-- math.rad(-10*math.cos(t)/2), -- math.rad(-10*math.cos(t)/2),
@@ -95,19 +96,23 @@ function Animations.Walk(t: tick, dt: deltatime)
) )
end end
@native
function Animations.Stop() function Animations.Stop()
return ANG(0,0,0) return ANG(0,0,0)
end end
@native
function Animations.Falling() function Animations.Falling()
return ANG(0,0,0) return ANG(0,0,0)
end end
@native
local function Camera_YArc(Camera: Camera): EulerValue --stop Euler gimbal lock when you're looking directly up or down local function Camera_YArc(Camera: Camera): EulerValue --stop Euler gimbal lock when you're looking directly up or down
local EulerY,_,_ = Camera.CFrame.Rotation:ToEulerAnglesYXZ() local EulerY,_,_ = Camera.CFrame.Rotation:ToEulerAnglesYXZ()
return math.abs(math.deg(EulerY)) return math.abs(math.deg(EulerY))
end end
@native
local function CameraAnimation(self: ClassConstructor, dt: deltatime) local function CameraAnimation(self: ClassConstructor, dt: deltatime)
--crying --crying
Bobbing.Tick += 1 Bobbing.Tick += 1
@@ -125,6 +130,7 @@ local function CameraAnimation(self: ClassConstructor, dt: deltatime)
return Animation:Lerp(CurrentAnimation, Bobbing.AnimationAlpha) return Animation:Lerp(CurrentAnimation, Bobbing.AnimationAlpha)
end end
@native
function Bobbing:Frame(dt) function Bobbing:Frame(dt)
local Camera = self.CurrentCamera local Camera = self.CurrentCamera
local Humanoid = self.Humanoid local Humanoid = self.Humanoid

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Bobbing = require(script:WaitForChild("Bobbing")) local Bobbing = require(script:WaitForChild("Bobbing"))

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type WalkSpeed = number? type WalkSpeed = number?

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type HumanoidRootPart = BasePart type HumanoidRootPart = BasePart

View File

@@ -1,3 +1,2 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type UDP = UnreliableRemoteEvent type UDP = UnreliableRemoteEvent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local RS = game:GetService("RunService") local RS = game:GetService("RunService")
@@ -36,7 +35,7 @@ type Impl_Constructor = {
} & Impl_Static_Props } & Impl_Static_Props
type Impl_Static_Props = { type Impl_Static_Props = {
KeyBinds: { KeyBinds: {
Crouch: {Enum.KeyCode}, Crouch: {Enum.KeyCode},
Walk: {Enum.KeyCode}, Walk: {Enum.KeyCode},
Flashlight: {Enum.KeyCode} Flashlight: {Enum.KeyCode}
@@ -76,7 +75,7 @@ CharacterModule.KeyBinds = {
function CharacterModule.constructor(Character) function CharacterModule.constructor(Character)
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") :: HumanoidRootPart local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") :: HumanoidRootPart
local Humanoid = Character:WaitForChild("Humanoid") :: Humanoid local Humanoid = Character:WaitForChild("Humanoid") :: Humanoid
local self = {} :: Constructor_Return_Props local self = {} :: Constructor_Return_Props
self.CharacterShared = Character:WaitForChild("shared") :: Folder self.CharacterShared = Character:WaitForChild("shared") :: Folder
self.CurrentCamera = workspace.CurrentCamera self.CurrentCamera = workspace.CurrentCamera
@@ -101,7 +100,7 @@ end
function CharacterModule:CharacterKeyBinds() function CharacterModule:CharacterKeyBinds()
local ClientBindMap = BindModule.constructor(false) local ClientBindMap = BindModule.constructor(false)
local Actions = ActionsModule.constructor(self.CharacterShared, self.HumanoidSettings, self.CurrentCamera, self.ActionsTCP) local Actions = ActionsModule.constructor(self.CharacterShared, self.HumanoidSettings, self.CurrentCamera, self.ActionsTCP)
--Crouch --Crouch
ClientBindMap:AddInputBegan(CharacterModule.KeyBinds.Crouch, function(_KeyPressed) ClientBindMap:AddInputBegan(CharacterModule.KeyBinds.Crouch, function(_KeyPressed)
Actions:EnableCrouch() Actions:EnableCrouch()
@@ -126,7 +125,7 @@ end
function CharacterModule:Crosshair() function CharacterModule:Crosshair()
local RootVelocity = ClientStorage:WaitForChild("RootVelocity") :: BindableEvent local RootVelocity = ClientStorage:WaitForChild("RootVelocity") :: BindableEvent
local RootVelocityStep = RS.Heartbeat:Connect(function(_dt) local RootVelocityStep = RS.Heartbeat:Connect(function(_dt)
RootVelocity:Fire(self.HRPSettings:Velocity()) RootVelocity:Fire(self.HRPSettings:Velocity())
end) end)

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type CustomCoreGuiEnums = {Enum.CoreGuiType} type CustomCoreGuiEnums = {Enum.CoreGuiType}

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local GuiModule = {} local GuiModule = {}

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Mouse = {} local Mouse = {}

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type rbxassetid = string type rbxassetid = string
@@ -55,11 +54,11 @@ function CrosshairModule:Change(ID: rbxassetid)
end end
function CrosshairModule:Jump(RootVelocity: Vector3) function CrosshairModule:Jump(RootVelocity: Vector3)
local X, Y = RootVelocity.X, RootVelocity.Y; -- local X, Y = RootVelocity.X, RootVelocity.Y;
self.Icon.Position = UDim2.fromScale( -- self.Icon.Position = UDim2.fromScale(
Y>1 and Algbera.Easing.Linear(.5,.5+(X/1000),.3) or .5, -- Y>1 and Algbera.Easing.Linear(.5,.5+(X/1000),.3) or .5,
math.clamp(.4, .5-(-Y/1000), .6) -- math.clamp(.4, .5-(-Y/1000), .6)
) -- )
end end
return CrosshairModule return CrosshairModule

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local VignetteModule = { local VignetteModule = {

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type CurrentCamera = Camera type CurrentCamera = Camera

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
--Not a good idea to call modules from other services here --Not a good idea to call modules from other services here

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local load_elapse_start = os.clock() local load_elapse_start = os.clock()
@@ -22,10 +21,10 @@ local function LoadingIntroGUI()
task.wait() task.wait()
until Player until Player
end end
local PlayerGui = Player:WaitForChild("PlayerGui") local PlayerGui = Player:WaitForChild("PlayerGui")
IntroGui = PlayerGui:WaitForChild("rhpidframework_intro", 10) IntroGui = PlayerGui:WaitForChild("rhpidframework_intro", 10)
if IntroGui then if IntroGui then
--Let the magic begin --Let the magic begin
RunIntroGui(IntroGui, load_elapse_start) RunIntroGui(IntroGui, load_elapse_start)

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Elevators = script.Parent local Elevators = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ElevatorDir = script.Parent local ElevatorDir = script.Parent
@@ -36,8 +35,8 @@ type Impl_Static_Props = {
type Constructor_Fun = (MainDisplay: UnionOperation, LanternsMap: Tags.Lanterns, ElevatorSounds: ElevatorSounds, Colors: ElevatorButtonColors) -> ClassConstructor type Constructor_Fun = (MainDisplay: UnionOperation, LanternsMap: Tags.Lanterns, ElevatorSounds: ElevatorSounds, Colors: ElevatorButtonColors) -> ClassConstructor
type Constructor_Return_Props = { type Constructor_Return_Props = {
LanternsMap: Tags.Lanterns, LanternsMap: Tags.Lanterns,
AudioChimeDirection: Sound, AudioChimeDirection: Sound,
AudioChimeLanding: Sound, AudioChimeLanding: Sound,
Colors: ElevatorButtonColors Colors: ElevatorButtonColors
} }
@@ -82,7 +81,7 @@ function Lanterns.constructor(MainDisplay, LanternsMap, ElevatorSounds, Colors)
AudioChimeDirection.Parent = MainDisplay AudioChimeDirection.Parent = MainDisplay
AudioChimeLanding.Parent = MainDisplay AudioChimeLanding.Parent = MainDisplay
return setmetatable({ return setmetatable({
LanternsMap = LanternsMap, LanternsMap = LanternsMap,
AudioChimeDirection = AudioChimeDirection, AudioChimeDirection = AudioChimeDirection,
@@ -162,7 +161,7 @@ end
function Lanterns:Toggle(Enabled, Floor) function Lanterns:Toggle(Enabled, Floor)
local FloorLantern = self.LanternsMap[Floor] local FloorLantern = self.LanternsMap[Floor]
if FloorLantern then if FloorLantern then
if not Enabled then if not Enabled then
FloorLantern.Played = false FloorLantern.Played = false

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
return { return {

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor)) type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ButtonPromptsDistance = Vector3.new(-.05,0,0) local ButtonPromptsDistance = Vector3.new(-.05,0,0)

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
return { return {

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor)) type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Elevators = script.Parent local Elevators = script.Parent
@@ -65,9 +64,9 @@ local function OtimSoundAndRelayConfiguration(RelayAudioActivated: Sound, RelayA
RelayAudioActivated.SoundGroup = SoundEffects.SoundGroup RelayAudioActivated.SoundGroup = SoundEffects.SoundGroup
RelayAudioDeActivated.SoundGroup = SoundEffects.SoundGroup RelayAudioDeActivated.SoundGroup = SoundEffects.SoundGroup
if RelayProperties.Name == "240 V" or if RelayProperties.Name == "240 V" or
RelayProperties.Name == "440 V" or RelayProperties.Name == "440 V" or
RelayProperties.Name == "UP" or RelayProperties.Name == "UP" or
RelayProperties.Name == "DOWN" RelayProperties.Name == "DOWN"
then then
--Bigger relays --Bigger relays
@@ -120,7 +119,7 @@ function PhysicalRelay.constructor(ElevatorModel, RelayTagList)
--Audio --Audio
local RelayAudioActivated = Instance.new("Sound") :: Sound local RelayAudioActivated = Instance.new("Sound") :: Sound
local RelayAudioDeActivated = Instance.new("Sound") :: Sound local RelayAudioDeActivated = Instance.new("Sound") :: Sound
if ElevatorModel == Enums.Elevator.Otis1960 then if ElevatorModel == Enums.Elevator.Otis1960 then
if SoundEffects then if SoundEffects then
OtimSoundAndRelayConfiguration(RelayAudioActivated, RelayAudioDeActivated, SoundEffects, RelayProperties) OtimSoundAndRelayConfiguration(RelayAudioActivated, RelayAudioDeActivated, SoundEffects, RelayProperties)
@@ -150,8 +149,8 @@ local function OtimRelayAnimation(Relay: Tags.RelayProperties, State: boolean)
CFrame = ( CFrame = (
Relay.Unique and CFrame.new((Relay.Inst :: BasePart).Position) or (Relay.Inst :: BasePart).CFrame Relay.Unique and CFrame.new((Relay.Inst :: BasePart).Position) or (Relay.Inst :: BasePart).CFrame
)*CFrame.Angles( )*CFrame.Angles(
math.rad(State and (Relay.Unique and 1.5 or 13) or (Relay.Unique and -15 or -13)), math.rad(State and (Relay.Unique and 1.5 or 13) or (Relay.Unique and -15 or -13)),
0, 0,
Relay.Unique and math.rad(-90) or 0 Relay.Unique and math.rad(-90) or 0
) )
}) })

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
-- self.ElevatorBox_1960 = TagsConstructor:Request("ElevatorMover_1960") :: UnionOperation -- self.ElevatorBox_1960 = TagsConstructor:Request("ElevatorMover_1960") :: UnionOperation

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
--Slap this here --Slap this here

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Elevators = script.Parent local Elevators = script.Parent
@@ -305,6 +304,7 @@ local Debounce = {
Leveling3Phase = false Leveling3Phase = false
} }
@native
local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC3_Y_WRAP: Vector3) local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC3_Y_WRAP: Vector3)
local ElevatorPosition = self.Elevator.BoxModel.Position local ElevatorPosition = self.Elevator.BoxModel.Position
local AtFloorY = self.FloorLevelingPositions[FloorsClamp(self, self.Attributes.TravelingUpwards.Value and self.Attributes.CurrentFloor.Value+1 or self.Attributes.CurrentFloor.Value-1)] local AtFloorY = self.FloorLevelingPositions[FloorsClamp(self, self.Attributes.TravelingUpwards.Value and self.Attributes.CurrentFloor.Value+1 or self.Attributes.CurrentFloor.Value-1)]

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local MapDir = script.Parent.Parent local MapDir = script.Parent.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type LightingProps = { [string]: Color3 | number | boolean | string | Enum.Technology } type LightingProps = { [string]: Color3 | number | boolean | string | Enum.Technology }

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
--All debugging objects such as light source indicating objects will be turned invisible --All debugging objects such as light source indicating objects will be turned invisible

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local StarterPlayer = game:GetService("StarterPlayer") local StarterPlayer = game:GetService("StarterPlayer")

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local TagsDir = script.Parent local TagsDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type rbxassetid = string type rbxassetid = string

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local CS = game:GetService("CollectionService") local CS = game:GetService("CollectionService")

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
return function() return function()

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type HumanoidRootPart = BasePart type HumanoidRootPart = BasePart
@@ -23,7 +22,7 @@ type Constructor_Fun = (Prompt: ProximityPrompt, Instance: Instance, Enabled: bo
type Constructor_Return_Props = { type Constructor_Return_Props = {
Prompt: ProximityPrompt, Prompt: ProximityPrompt,
Instance: Instance, Instance: Instance,
__TriggeredCallback: PromptCallback?, __TriggeredCallback: PromptCallback?,
__TriggerEndedCallback: PromptCallback?, __TriggerEndedCallback: PromptCallback?,
__PromptConnections: { __PromptConnections: {
@@ -116,7 +115,7 @@ end
function Prompts:Enable() function Prompts:Enable()
self.Prompt.Enabled = true self.Prompt.Enabled = true
if self.__TriggeredCallback and not (self.__PromptConnections.Triggered and self.__PromptConnections.Triggered.Connected) then if self.__TriggeredCallback and not (self.__PromptConnections.Triggered and self.__PromptConnections.Triggered.Connected) then
self:Triggered(self.__TriggeredCallback) self:Triggered(self.__TriggeredCallback)
end end

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type EventFunction = (KeyPressed: Enum.KeyCode) -> () type EventFunction = (KeyPressed: Enum.KeyCode) -> ()

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type UDP = UnreliableRemoteEvent type UDP = UnreliableRemoteEvent
@@ -29,7 +28,7 @@ type Impl_Static_Props = {
type Constructor_Return_Props = { type Constructor_Return_Props = {
FlashlightPart: Part, FlashlightPart: Part,
SpotLight: SpotLight, SpotLight: SpotLight,
ToggleSound: Sound ToggleSound: Sound
} }
export type FlashlightConstructor = ClassConstructor export type FlashlightConstructor = ClassConstructor

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
--This really should be only client --This really should be only client

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type Head = BasePart type Head = BasePart
@@ -29,7 +28,7 @@ type Impl_Static_Props = {
Enabled: boolean, Enabled: boolean,
Multiplier: number Multiplier: number
} }
type Constructor_Return_Props = { type Constructor_Return_Props = {
Remote: UDP, Remote: UDP,
Head: Head, Head: Head,
UpperTorso: UpperTorso, UpperTorso: UpperTorso,
@@ -63,6 +62,7 @@ function Spine.constructor(CharacterShared, Head, UpperTorso)
return setmetatable(self, Spine) return setmetatable(self, Spine)
end end
@native
local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFirstPerson: boolean): struct_SpineMovement local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFirstPerson: boolean): struct_SpineMovement
local HeadCFrame: CFrame = self.Head.CFrame local HeadCFrame: CFrame = self.Head.CFrame
local TorsoPosition: Vector3 = self.UpperTorso.Position local TorsoPosition: Vector3 = self.UpperTorso.Position
@@ -78,7 +78,7 @@ local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFir
local arc = Spine.Multiplier*math.asin(HeadDelta.Y/HeadDeltaMagnitude) local arc = Spine.Multiplier*math.asin(HeadDelta.Y/HeadDeltaMagnitude)
local Neck = CFrame.Angles(arc, 0, 0) local Neck = CFrame.Angles(arc, 0, 0)
local Waist = CFrame.Angles(arc, 0, 0) local Waist = CFrame.Angles(arc, 0, 0)
if not IsFirstPerson then if not IsFirstPerson then
--Make this less cringe at some point, combine the dot product into the equation --Make this less cringe at some point, combine the dot product into the equation
local LookingAtSelf = CameraCFrame.LookVector:Dot(HeadCFrame.LookVector)<0 --Make our head face the camera if we are looking at ourself local LookingAtSelf = CameraCFrame.LookVector:Dot(HeadCFrame.LookVector)<0 --Make our head face the camera if we are looking at ourself
@@ -88,13 +88,14 @@ local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFir
Neck*=CFrame.Angles(0, HeadCrossDelta, 0) Neck*=CFrame.Angles(0, HeadCrossDelta, 0)
Waist*=CFrame.Angles(0, LookingAtSelf and TorsoCrossDelta or -TorsoCrossDelta, 0) Waist*=CFrame.Angles(0, LookingAtSelf and TorsoCrossDelta or -TorsoCrossDelta, 0)
end end
return { return {
Neck = Neck, Neck = Neck,
Waist = Waist Waist = Waist
} }
end end
@native
function Spine:Move(CameraCFrame, IsFirstPerson) function Spine:Move(CameraCFrame, IsFirstPerson)
local SpineIK = SpineMovement(self, CameraCFrame, IsFirstPerson) local SpineIK = SpineMovement(self, CameraCFrame, IsFirstPerson)

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Shadows = require(script:WaitForChild("Shadows")) local Shadows = require(script:WaitForChild("Shadows"))
@@ -52,7 +51,7 @@ Character.KeyBinds = {
function Character.constructor(CharacterModel) function Character.constructor(CharacterModel)
local Player = Players:GetPlayerFromCharacter(CharacterModel) local Player = Players:GetPlayerFromCharacter(CharacterModel)
local self = {} local self = {}
self.CharacterShared = Instance.new("Folder") self.CharacterShared = Instance.new("Folder")
self.CharacterShared.Name = "shared" self.CharacterShared.Name = "shared"

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type Users = { type Users = {

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
type Character = Model type Character = Model
@@ -31,7 +30,7 @@ return Players.PlayerAdded:Connect(function(Player: Player)
break break
end end
end end
LoadCharacter(Player) LoadCharacter(Player)
else else
Player:Kick() Player:Kick()

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ParentDir = script.Parent local ParentDir = script.Parent

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local DoorEnums = {} local DoorEnums = {}

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local SoundEnums = {} local SoundEnums = {}

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local ShowEditorEntities = true local ShowEditorEntities = true

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Camera = {} local Camera = {}
@@ -51,7 +50,7 @@ function Camera:ZoomIn(Vignette: Vignette?, Crosshair: Crosshair?)
if Camera.VignetteEnabled then if Camera.VignetteEnabled then
if Vignette then if Vignette then
Vignette.Screen.Enabled = true Vignette.Screen.Enabled = true
VignetteTween:Start(Vignette.Icon, { VignetteTween:Start(Vignette.Icon, {
ImageTransparency = 0 ImageTransparency = 0
}, TweenInfo.new(Camera.FOV.Speed.In, Camera.EffectsEase)) }, TweenInfo.new(Camera.FOV.Speed.In, Camera.EffectsEase))
@@ -79,7 +78,7 @@ function Camera:ZoomOut(Vignette: Vignette?, Crosshair: Crosshair?)
if Camera.VignetteEnabled then if Camera.VignetteEnabled then
if Vignette then if Vignette then
Vignette.Screen.Enabled = true Vignette.Screen.Enabled = true
VignetteTween:Start(Vignette.Icon, { VignetteTween:Start(Vignette.Icon, {
ImageTransparency = 1 ImageTransparency = 1
}, TweenInfo.new(Camera.FOV.Speed.Out, Camera.EffectsEase)) }, TweenInfo.new(Camera.FOV.Speed.Out, Camera.EffectsEase))
@@ -87,7 +86,7 @@ function Camera:ZoomOut(Vignette: Vignette?, Crosshair: Crosshair?)
warn("Camera: no Vignette object was provided for the camera", debug.traceback()) warn("Camera: no Vignette object was provided for the camera", debug.traceback())
end end
end end
if Camera.CrosshairEffect then if Camera.CrosshairEffect then
if Crosshair then if Crosshair then
VignetteTween:Start(Crosshair.Icon, { VignetteTween:Start(Crosshair.Icon, {

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
--Couldn't get ContextActionService to work how i wanted --Couldn't get ContextActionService to work how i wanted
@@ -46,7 +45,7 @@ function BindLink.constructor(gameProcessing: boolean) --Allow multiple bindings
Began = {}, Began = {},
Ended = {} Ended = {}
} }
--Return these for convenience --Return these for convenience
self.InputBegan = UIS.InputBegan:Connect(function(input, gameProcessedEvent) self.InputBegan = UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessing and gameProcessedEvent or not gameProcessedEvent then if gameProcessing and gameProcessedEvent or not gameProcessedEvent then

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Delta = { local Delta = {

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local Enums = {} local Enums = {}

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
local RunService = game:GetService("RunService") local RunService = game:GetService("RunService")

View File

@@ -1,3 +1,2 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict

View File

@@ -1,5 +1,4 @@
--!optimize 2 --!optimize 2
--!native
--!strict --!strict
--Weird type hack for allowing more than 1 property to be defined inside a tween --Weird type hack for allowing more than 1 property to be defined inside a tween