mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
Maxmin and IsEven, work on getting doors functional again
This commit is contained in:
@@ -46,13 +46,13 @@ export type DoorConstructor = ClassConstructor
|
|||||||
local Doors = {} :: Impl_Constructor
|
local Doors = {} :: Impl_Constructor
|
||||||
Doors.__index = Doors
|
Doors.__index = Doors
|
||||||
|
|
||||||
Doors.Closed = true
|
Doors.Closed = true
|
||||||
Doors.Sensors = true
|
Doors.Sensors = true
|
||||||
Doors.Door1Stopped_X = Vector3.xAxis*2.9
|
Doors.Door1Stopped_X = Vector3.xAxis*2.9
|
||||||
Doors.Door2Stopped_X = Vector3.xAxis*5.8
|
Doors.Door2Stopped_X = Vector3.xAxis*5.8
|
||||||
Doors.ElevatorDoorTime = 5
|
Doors.ElevatorDoorTime = 5
|
||||||
Doors.ElevatorDoorStyle = Enum.EasingStyle.Quad
|
Doors.ElevatorDoorStyle = Enum.EasingStyle.Quad
|
||||||
Doors.__DontLeakMemory = nil
|
Doors.__DontLeakMemory = nil
|
||||||
|
|
||||||
function Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
|
function Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
|
||||||
local DoorTween1 = Tween.constructor(nil, ElevatorDoor1)
|
local DoorTween1 = Tween.constructor(nil, ElevatorDoor1)
|
||||||
@@ -168,7 +168,8 @@ raycastParams.FilterType = Enum.RaycastFilterType.Exclude
|
|||||||
local RayIgnoring = {}
|
local RayIgnoring = {}
|
||||||
local workspace_items = workspace:GetChildren()
|
local workspace_items = workspace:GetChildren()
|
||||||
for n: number = 1, #workspace_items do
|
for n: number = 1, #workspace_items do
|
||||||
if workspace_items[n]:IsA("Folder") then
|
local Inst = workspace_items[n]
|
||||||
|
if Inst:IsA("Folder") or Inst:IsA("BasePart") then
|
||||||
table.insert(RayIgnoring, workspace_items[n])
|
table.insert(RayIgnoring, workspace_items[n])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -215,6 +216,7 @@ function Doors:Opening(opening)
|
|||||||
|
|
||||||
local Door1Tween, Door2Tween = DoorsAnimation(self, opening)
|
local Door1Tween, Door2Tween = DoorsAnimation(self, opening)
|
||||||
Door2Tween.Completed:Wait()
|
Door2Tween.Completed:Wait()
|
||||||
|
|
||||||
if Doors.__DontLeakMemory then
|
if Doors.__DontLeakMemory then
|
||||||
Doors.__DontLeakMemory:Disconnect()
|
Doors.__DontLeakMemory:Disconnect()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Otis1960_ShaftGovernor
|
--Otis1960_ShaftGovernor
|
||||||
self.__MovingConnection = RS.Stepped:Connect(function(_delta, _dt) --Not safe for parallel
|
self.__MovingConnection = RS.Heartbeat:Connect(function(_dt) --Not safe for parallel
|
||||||
RotationDelta+=1
|
RotationDelta+=1
|
||||||
Otis1960.__Moving = true
|
Otis1960.__Moving = true
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
|||||||
|
|
||||||
--Kill the connection
|
--Kill the connection
|
||||||
if GoingUp then
|
if GoingUp then
|
||||||
if ElevatorPosition.Y>=self.BoxAlignPosition.Position.Y-4 then
|
if ElevatorPosition.Y>=self.BoxAlignPosition.Position.Y-1 then
|
||||||
self.BoxAlignPosition.MaxVelocity = .35
|
self.BoxAlignPosition.MaxVelocity = .35
|
||||||
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
||||||
end
|
end
|
||||||
@@ -228,7 +228,7 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
|||||||
self.LanternsConstructor:Reset()
|
self.LanternsConstructor:Reset()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+4 then
|
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+1 then
|
||||||
self.BoxAlignPosition.MaxVelocity = .35
|
self.BoxAlignPosition.MaxVelocity = .35
|
||||||
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ function Character.constructor(CharacterModel)
|
|||||||
self.Spine:Move(CameraPosition, IsFirstPerson)
|
self.Spine:Move(CameraPosition, IsFirstPerson)
|
||||||
else
|
else
|
||||||
--reset
|
--reset
|
||||||
print("TODO reached -", script.Name..".lua")
|
warn("TODO reached -", script.Name..".lua")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Messenger:Kick(`"{Messenger.Name}", {Messenger.UserId} r="{self.Spine.Remote.Name}", 1="{tostring(CameraPosition)}", 2="{tostring(IsFirstPerson)}"`)
|
Messenger:Kick(`"{Messenger.Name}", {Messenger.UserId} r="{self.Spine.Remote.Name}", 1="{tostring(CameraPosition)}", 2="{tostring(IsFirstPerson)}"`)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export type Math = {
|
|||||||
InOutBack: EaseFunction,
|
InOutBack: EaseFunction,
|
||||||
OutBounce: EaseFunction,
|
OutBounce: EaseFunction,
|
||||||
InQuad: EaseFunction,
|
InQuad: EaseFunction,
|
||||||
|
IsOdd: (n: number) -> boolean,
|
||||||
IsEven: (n: number) -> boolean,
|
IsEven: (n: number) -> boolean,
|
||||||
RotationMatrix: (X: number, Y: number, Z: number) -> RotationMatrix,
|
RotationMatrix: (X: number, Y: number, Z: number) -> RotationMatrix,
|
||||||
Scalar: (X1: number, Y1: number, X2: number, Y2: number) -> Scalar,
|
Scalar: (X1: number, Y1: number, X2: number, Y2: number) -> Scalar,
|
||||||
@@ -36,10 +37,14 @@ export type Math = {
|
|||||||
|
|
||||||
local Math = {} :: Math
|
local Math = {} :: Math
|
||||||
|
|
||||||
function Math.IsEven(n)
|
function Math.IsOdd(n)
|
||||||
return bit32.btest(bit32.band(n, 1))
|
return bit32.btest(bit32.band(n, 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Math.IsEven(n)
|
||||||
|
return not Math.IsOdd(n)
|
||||||
|
end
|
||||||
|
|
||||||
function Math.maxmin(min, n, max)
|
function Math.maxmin(min, n, max)
|
||||||
return math.max(min, math.min(n, max))
|
return math.max(min, math.min(n, max))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user