mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:51:55 +00:00
work on door floors
This commit is contained in:
@@ -45,6 +45,8 @@ type Impl_Static_Props = {
|
||||
LanternDisplayColorOff: Color3,
|
||||
LanternChimeDirection: rbxassetid,
|
||||
LanternChimeLanding: rbxassetid,
|
||||
FloorLevelingDistance: number,
|
||||
LeveledDistance: number,
|
||||
__Moving: boolean,
|
||||
__CurrentFloor: number
|
||||
}
|
||||
@@ -81,6 +83,8 @@ type ButtonFunctions = {
|
||||
local Otis1960 = {} :: Impl_Constructor
|
||||
Otis1960.__index = Otis1960
|
||||
|
||||
Otis1960.FloorLevelingDistance = 2.5
|
||||
Otis1960.LeveledDistance = 0.5
|
||||
Otis1960.Responsiveness = 50
|
||||
Otis1960.MaxVelocity = 10
|
||||
Otis1960.ButtonActivatedColor = Color3.fromRGB(180,0,0)
|
||||
@@ -185,6 +189,21 @@ function Otis1960.constructor(TagsConstructor, ButtonsTags, LanternsTags)
|
||||
return ClassConstructor
|
||||
end
|
||||
|
||||
local function FloorLeveling(self: ClassConstructor, RequestedLevel: number)
|
||||
self.BoxAlignPosition.MaxVelocity = 1
|
||||
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
||||
end
|
||||
|
||||
local function FloorLeveled(self: ClassConstructor, RequestedLevel: number)
|
||||
(self.__MovingConnection :: RBXScriptConnection):Disconnect()
|
||||
|
||||
Otis1960.__Moving = false
|
||||
Otis1960.__CurrentFloor = RequestedLevel
|
||||
self.BoxAlignPosition.MaxVelocity = Otis1960.MaxVelocity
|
||||
|
||||
self.LanternsConstructor:Reset()
|
||||
end
|
||||
|
||||
function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
||||
local RotationDelta = 0
|
||||
local ElevatorBoxCurrentPos = self.ElevatorBox_1960.Position
|
||||
@@ -214,34 +233,20 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
||||
|
||||
--Kill the connection
|
||||
if GoingUp then
|
||||
if ElevatorPosition.Y>=self.BoxAlignPosition.Position.Y-1 then
|
||||
self.BoxAlignPosition.MaxVelocity = .35
|
||||
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
||||
if ElevatorPosition.Y>=self.BoxAlignPosition.Position.Y-Otis1960.FloorLevelingDistance then
|
||||
FloorLeveling(self, RequestedLevel)
|
||||
end
|
||||
|
||||
if ElevatorPosition.Y>=self.BoxAlignPosition.Position.Y-.5 then
|
||||
(self.__MovingConnection :: RBXScriptConnection):Disconnect()
|
||||
|
||||
Otis1960.__Moving = false
|
||||
Otis1960.__CurrentFloor = RequestedLevel
|
||||
self.BoxAlignPosition.MaxVelocity = Otis1960.MaxVelocity
|
||||
|
||||
self.LanternsConstructor:Reset()
|
||||
|
||||
if ElevatorPosition.Y>=self.BoxAlignPosition.Position.Y-Otis1960.LeveledDistance then
|
||||
FloorLeveled(self, RequestedLevel)
|
||||
end
|
||||
else
|
||||
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+1 then
|
||||
self.BoxAlignPosition.MaxVelocity = .35
|
||||
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
||||
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+Otis1960.FloorLevelingDistance then
|
||||
FloorLeveling(self, RequestedLevel)
|
||||
end
|
||||
|
||||
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+.5 then
|
||||
(self.__MovingConnection :: RBXScriptConnection):Disconnect()
|
||||
|
||||
Otis1960.__Moving = false
|
||||
Otis1960.__CurrentFloor = RequestedLevel
|
||||
self.BoxAlignPosition.MaxVelocity = Otis1960.MaxVelocity
|
||||
|
||||
self.LanternsConstructor:Reset()
|
||||
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+Otis1960.LeveledDistance then
|
||||
FloorLeveled(self, RequestedLevel)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user