mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51:55 +00:00
rename everything to .luau extension
This commit is contained in:
53
src/server/main/Elevators/TractionRopes.luau
Normal file
53
src/server/main/Elevators/TractionRopes.luau
Normal file
@@ -0,0 +1,53 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type RopeTags = {Instance}
|
||||
type Leveling = {number}
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Move: (self: ClassConstructor, Offset: number, ElevatorPosition: Vector3) -> (),
|
||||
Stopped: (self: ClassConstructor) -> (),
|
||||
}
|
||||
|
||||
type Constructor_Fun = (RopeTags: RopeTags, ElevatorBox: UnionOperation, Leveling: Leveling) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
Ropes: RopeTags,
|
||||
Leveling: Leveling,
|
||||
BiggestRopeLength: number,
|
||||
}
|
||||
|
||||
export type TractionRopesConstructor = ClassConstructor
|
||||
|
||||
local TractionRopes = {} :: Impl_Constructor
|
||||
TractionRopes.__index = TractionRopes
|
||||
|
||||
function TractionRopes.constructor(RopeTags, ElevatorBox, Leveling)
|
||||
local ArbitraryRopeContact = RopeTags[1].Parent :: BasePart
|
||||
local HighestLevel = Leveling[#Leveling]
|
||||
local BiggestRopeLength = HighestLevel-(ArbitraryRopeContact.Position.Y-HighestLevel)
|
||||
|
||||
return setmetatable({
|
||||
Ropes = RopeTags,
|
||||
Leveling = Leveling,
|
||||
BiggestRopeLength = BiggestRopeLength
|
||||
}, TractionRopes)
|
||||
end
|
||||
|
||||
function TractionRopes:Move(Offset, ElevatorPosition)
|
||||
local l = self.BiggestRopeLength-ElevatorPosition.Y+Offset
|
||||
|
||||
for i: number = 1, #self.Ropes do
|
||||
(self.Ropes[i] :: RopeConstraint).Length = l
|
||||
end
|
||||
end
|
||||
|
||||
function TractionRopes:Stopped()
|
||||
|
||||
end
|
||||
|
||||
return TractionRopes
|
||||
Reference in New Issue
Block a user