mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
optimize native scripts
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type UDP = UnreliableRemoteEvent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type AnimationsMap = {
|
||||
@@ -74,6 +73,7 @@ function Bobbing.constructor(HumanoidRootPart: HumanoidRootPart, CurrentCamera:
|
||||
}, Bobbing)
|
||||
end
|
||||
|
||||
@native
|
||||
function Animations.Idle(t: tick, dt: deltatime)
|
||||
return ANG(
|
||||
math.rad(math.cos(t/80)/(Bobbing.AnimationSpeed+50)),
|
||||
@@ -82,6 +82,7 @@ function Animations.Idle(t: tick, dt: deltatime)
|
||||
)
|
||||
end
|
||||
|
||||
@native
|
||||
function Animations.Walk(t: tick, dt: deltatime)
|
||||
-- return ANG(
|
||||
-- math.rad(-10*math.cos(t)/2),
|
||||
@@ -95,19 +96,23 @@ function Animations.Walk(t: tick, dt: deltatime)
|
||||
)
|
||||
end
|
||||
|
||||
@native
|
||||
function Animations.Stop()
|
||||
return ANG(0,0,0)
|
||||
end
|
||||
|
||||
@native
|
||||
function Animations.Falling()
|
||||
return ANG(0,0,0)
|
||||
end
|
||||
|
||||
@native
|
||||
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()
|
||||
return math.abs(math.deg(EulerY))
|
||||
end
|
||||
|
||||
@native
|
||||
local function CameraAnimation(self: ClassConstructor, dt: deltatime)
|
||||
--crying
|
||||
Bobbing.Tick += 1
|
||||
@@ -125,6 +130,7 @@ local function CameraAnimation(self: ClassConstructor, dt: deltatime)
|
||||
return Animation:Lerp(CurrentAnimation, Bobbing.AnimationAlpha)
|
||||
end
|
||||
|
||||
@native
|
||||
function Bobbing:Frame(dt)
|
||||
local Camera = self.CurrentCamera
|
||||
local Humanoid = self.Humanoid
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Bobbing = require(script:WaitForChild("Bobbing"))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type WalkSpeed = number?
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type HumanoidRootPart = BasePart
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type UDP = UnreliableRemoteEvent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local RS = game:GetService("RunService")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type CustomCoreGuiEnums = {Enum.CoreGuiType}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local GuiModule = {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Mouse = {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type rbxassetid = string
|
||||
@@ -55,11 +54,11 @@ function CrosshairModule:Change(ID: rbxassetid)
|
||||
end
|
||||
|
||||
function CrosshairModule:Jump(RootVelocity: Vector3)
|
||||
local X, Y = RootVelocity.X, RootVelocity.Y;
|
||||
self.Icon.Position = UDim2.fromScale(
|
||||
Y>1 and Algbera.Easing.Linear(.5,.5+(X/1000),.3) or .5,
|
||||
math.clamp(.4, .5-(-Y/1000), .6)
|
||||
)
|
||||
-- local X, Y = RootVelocity.X, RootVelocity.Y;
|
||||
-- self.Icon.Position = UDim2.fromScale(
|
||||
-- Y>1 and Algbera.Easing.Linear(.5,.5+(X/1000),.3) or .5,
|
||||
-- math.clamp(.4, .5-(-Y/1000), .6)
|
||||
-- )
|
||||
end
|
||||
|
||||
return CrosshairModule
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local VignetteModule = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type CurrentCamera = Camera
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
--Not a good idea to call modules from other services here
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local load_elapse_start = os.clock()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Elevators = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ElevatorDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ButtonPromptsDistance = Vector3.new(-.05,0,0)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Elevators = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
-- self.ElevatorBox_1960 = TagsConstructor:Request("ElevatorMover_1960") :: UnionOperation
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
--Slap this here
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Elevators = script.Parent
|
||||
@@ -305,6 +304,7 @@ local Debounce = {
|
||||
Leveling3Phase = false
|
||||
}
|
||||
|
||||
@native
|
||||
local function CabTraveling(self: ClassConstructor, deltaTime: number, LEVEL_VEC3_Y_WRAP: Vector3)
|
||||
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)]
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local MapDir = script.Parent.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type LightingProps = { [string]: Color3 | number | boolean | string | Enum.Technology }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
--All debugging objects such as light source indicating objects will be turned invisible
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local StarterPlayer = game:GetService("StarterPlayer")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local TagsDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type rbxassetid = string
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local CS = game:GetService("CollectionService")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
return function()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type HumanoidRootPart = BasePart
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type EventFunction = (KeyPressed: Enum.KeyCode) -> ()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type UDP = UnreliableRemoteEvent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
--This really should be only client
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type Head = BasePart
|
||||
@@ -63,6 +62,7 @@ function Spine.constructor(CharacterShared, Head, UpperTorso)
|
||||
return setmetatable(self, Spine)
|
||||
end
|
||||
|
||||
@native
|
||||
local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFirstPerson: boolean): struct_SpineMovement
|
||||
local HeadCFrame: CFrame = self.Head.CFrame
|
||||
local TorsoPosition: Vector3 = self.UpperTorso.Position
|
||||
@@ -95,6 +95,7 @@ local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFir
|
||||
}
|
||||
end
|
||||
|
||||
@native
|
||||
function Spine:Move(CameraCFrame, IsFirstPerson)
|
||||
local SpineIK = SpineMovement(self, CameraCFrame, IsFirstPerson)
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Shadows = require(script:WaitForChild("Shadows"))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type Users = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type Character = Model
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ParentDir = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local DoorEnums = {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local SoundEnums = {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local ShowEditorEntities = true
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Camera = {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
--Couldn't get ContextActionService to work how i wanted
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Delta = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Enums = {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local RunService = game:GetService("RunService")
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
--Weird type hack for allowing more than 1 property to be defined inside a tween
|
||||
|
||||
Reference in New Issue
Block a user