mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:51:55 +00:00
optimize native scripts
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Elevators = script.Parent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
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_Return_Props = {
|
||||
LanternsMap: Tags.Lanterns,
|
||||
AudioChimeDirection: Sound,
|
||||
LanternsMap: Tags.Lanterns,
|
||||
AudioChimeDirection: Sound,
|
||||
AudioChimeLanding: Sound,
|
||||
Colors: ElevatorButtonColors
|
||||
}
|
||||
@@ -82,7 +81,7 @@ function Lanterns.constructor(MainDisplay, LanternsMap, ElevatorSounds, Colors)
|
||||
|
||||
AudioChimeDirection.Parent = MainDisplay
|
||||
AudioChimeLanding.Parent = MainDisplay
|
||||
|
||||
|
||||
return setmetatable({
|
||||
LanternsMap = LanternsMap,
|
||||
AudioChimeDirection = AudioChimeDirection,
|
||||
@@ -162,7 +161,7 @@ end
|
||||
|
||||
function Lanterns:Toggle(Enabled, Floor)
|
||||
local FloorLantern = self.LanternsMap[Floor]
|
||||
|
||||
|
||||
if FloorLantern then
|
||||
if not Enabled then
|
||||
FloorLantern.Played = false
|
||||
|
||||
@@ -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
|
||||
@@ -65,9 +64,9 @@ local function OtimSoundAndRelayConfiguration(RelayAudioActivated: Sound, RelayA
|
||||
RelayAudioActivated.SoundGroup = SoundEffects.SoundGroup
|
||||
RelayAudioDeActivated.SoundGroup = SoundEffects.SoundGroup
|
||||
|
||||
if RelayProperties.Name == "240 V" or
|
||||
RelayProperties.Name == "440 V" or
|
||||
RelayProperties.Name == "UP" or
|
||||
if RelayProperties.Name == "240 V" or
|
||||
RelayProperties.Name == "440 V" or
|
||||
RelayProperties.Name == "UP" or
|
||||
RelayProperties.Name == "DOWN"
|
||||
then
|
||||
--Bigger relays
|
||||
@@ -120,7 +119,7 @@ function PhysicalRelay.constructor(ElevatorModel, RelayTagList)
|
||||
--Audio
|
||||
local RelayAudioActivated = Instance.new("Sound") :: Sound
|
||||
local RelayAudioDeActivated = Instance.new("Sound") :: Sound
|
||||
|
||||
|
||||
if ElevatorModel == Enums.Elevator.Otis1960 then
|
||||
if SoundEffects then
|
||||
OtimSoundAndRelayConfiguration(RelayAudioActivated, RelayAudioDeActivated, SoundEffects, RelayProperties)
|
||||
@@ -150,8 +149,8 @@ local function OtimRelayAnimation(Relay: Tags.RelayProperties, State: boolean)
|
||||
CFrame = (
|
||||
Relay.Unique and CFrame.new((Relay.Inst :: BasePart).Position) or (Relay.Inst :: BasePart).CFrame
|
||||
)*CFrame.Angles(
|
||||
math.rad(State and (Relay.Unique and 1.5 or 13) or (Relay.Unique and -15 or -13)),
|
||||
0,
|
||||
math.rad(State and (Relay.Unique and 1.5 or 13) or (Relay.Unique and -15 or -13)),
|
||||
0,
|
||||
Relay.Unique and math.rad(-90) or 0
|
||||
)
|
||||
})
|
||||
|
||||
@@ -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
|
||||
@@ -23,7 +22,7 @@ type Constructor_Fun = (Prompt: ProximityPrompt, Instance: Instance, Enabled: bo
|
||||
type Constructor_Return_Props = {
|
||||
Prompt: ProximityPrompt,
|
||||
Instance: Instance,
|
||||
|
||||
|
||||
__TriggeredCallback: PromptCallback?,
|
||||
__TriggerEndedCallback: PromptCallback?,
|
||||
__PromptConnections: {
|
||||
@@ -116,7 +115,7 @@ end
|
||||
|
||||
function Prompts:Enable()
|
||||
self.Prompt.Enabled = true
|
||||
|
||||
|
||||
if self.__TriggeredCallback and not (self.__PromptConnections.Triggered and self.__PromptConnections.Triggered.Connected) then
|
||||
self:Triggered(self.__TriggeredCallback)
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type EventFunction = (KeyPressed: Enum.KeyCode) -> ()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type UDP = UnreliableRemoteEvent
|
||||
@@ -29,7 +28,7 @@ type Impl_Static_Props = {
|
||||
type Constructor_Return_Props = {
|
||||
FlashlightPart: Part,
|
||||
SpotLight: SpotLight,
|
||||
ToggleSound: Sound
|
||||
ToggleSound: Sound
|
||||
}
|
||||
|
||||
export type FlashlightConstructor = ClassConstructor
|
||||
|
||||
@@ -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
|
||||
@@ -29,7 +28,7 @@ type Impl_Static_Props = {
|
||||
Enabled: boolean,
|
||||
Multiplier: number
|
||||
}
|
||||
type Constructor_Return_Props = {
|
||||
type Constructor_Return_Props = {
|
||||
Remote: UDP,
|
||||
Head: Head,
|
||||
UpperTorso: UpperTorso,
|
||||
@@ -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
|
||||
@@ -78,7 +78,7 @@ local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFir
|
||||
local arc = Spine.Multiplier*math.asin(HeadDelta.Y/HeadDeltaMagnitude)
|
||||
local Neck = CFrame.Angles(arc, 0, 0)
|
||||
local Waist = CFrame.Angles(arc, 0, 0)
|
||||
|
||||
|
||||
if not IsFirstPerson then
|
||||
--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
|
||||
@@ -88,13 +88,14 @@ local function SpineMovement(self: ClassConstructor, CameraCFrame: CFrame, IsFir
|
||||
Neck*=CFrame.Angles(0, HeadCrossDelta, 0)
|
||||
Waist*=CFrame.Angles(0, LookingAtSelf and TorsoCrossDelta or -TorsoCrossDelta, 0)
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
Neck = Neck,
|
||||
Waist = Waist
|
||||
}
|
||||
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"))
|
||||
@@ -52,7 +51,7 @@ Character.KeyBinds = {
|
||||
|
||||
function Character.constructor(CharacterModel)
|
||||
local Player = Players:GetPlayerFromCharacter(CharacterModel)
|
||||
|
||||
|
||||
local self = {}
|
||||
self.CharacterShared = Instance.new("Folder")
|
||||
self.CharacterShared.Name = "shared"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type Users = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type Character = Model
|
||||
@@ -31,7 +30,7 @@ return Players.PlayerAdded:Connect(function(Player: Player)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
LoadCharacter(Player)
|
||||
else
|
||||
Player:Kick()
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user