mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 14:51: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
|
||||
Doors.__index = Doors
|
||||
|
||||
Doors.Closed = true
|
||||
Doors.Sensors = true
|
||||
Doors.Door1Stopped_X = Vector3.xAxis*2.9
|
||||
Doors.Door2Stopped_X = Vector3.xAxis*5.8
|
||||
Doors.ElevatorDoorTime = 5
|
||||
Doors.Closed = true
|
||||
Doors.Sensors = true
|
||||
Doors.Door1Stopped_X = Vector3.xAxis*2.9
|
||||
Doors.Door2Stopped_X = Vector3.xAxis*5.8
|
||||
Doors.ElevatorDoorTime = 5
|
||||
Doors.ElevatorDoorStyle = Enum.EasingStyle.Quad
|
||||
Doors.__DontLeakMemory = nil
|
||||
Doors.__DontLeakMemory = nil
|
||||
|
||||
function Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
|
||||
local DoorTween1 = Tween.constructor(nil, ElevatorDoor1)
|
||||
@@ -168,7 +168,8 @@ raycastParams.FilterType = Enum.RaycastFilterType.Exclude
|
||||
local RayIgnoring = {}
|
||||
local workspace_items = workspace:GetChildren()
|
||||
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])
|
||||
end
|
||||
end
|
||||
@@ -215,6 +216,7 @@ function Doors:Opening(opening)
|
||||
|
||||
local Door1Tween, Door2Tween = DoorsAnimation(self, opening)
|
||||
Door2Tween.Completed:Wait()
|
||||
|
||||
if Doors.__DontLeakMemory then
|
||||
Doors.__DontLeakMemory:Disconnect()
|
||||
end
|
||||
|
||||
@@ -201,7 +201,7 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
||||
end
|
||||
|
||||
--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
|
||||
Otis1960.__Moving = true
|
||||
|
||||
@@ -213,7 +213,7 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
||||
|
||||
--Kill the connection
|
||||
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.LanternsConstructor:Toggle(true, RequestedLevel)
|
||||
end
|
||||
@@ -228,7 +228,7 @@ function Otis1960:__MoveFloors(GoalLevelVEC, RequestedLevel, GoingUp)
|
||||
self.LanternsConstructor:Reset()
|
||||
end
|
||||
else
|
||||
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+4 then
|
||||
if ElevatorPosition.Y<=self.BoxAlignPosition.Position.Y+1 then
|
||||
self.BoxAlignPosition.MaxVelocity = .35
|
||||
self.LanternsConstructor:Toggle(true, RequestedLevel)
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ function Character.constructor(CharacterModel)
|
||||
self.Spine:Move(CameraPosition, IsFirstPerson)
|
||||
else
|
||||
--reset
|
||||
print("TODO reached -", script.Name..".lua")
|
||||
warn("TODO reached -", script.Name..".lua")
|
||||
end
|
||||
else
|
||||
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,
|
||||
OutBounce: EaseFunction,
|
||||
InQuad: EaseFunction,
|
||||
IsOdd: (n: number) -> boolean,
|
||||
IsEven: (n: number) -> boolean,
|
||||
RotationMatrix: (X: number, Y: number, Z: number) -> RotationMatrix,
|
||||
Scalar: (X1: number, Y1: number, X2: number, Y2: number) -> Scalar,
|
||||
@@ -36,10 +37,14 @@ export type Math = {
|
||||
|
||||
local Math = {} :: Math
|
||||
|
||||
function Math.IsEven(n)
|
||||
function Math.IsOdd(n)
|
||||
return bit32.btest(bit32.band(n, 1))
|
||||
end
|
||||
|
||||
function Math.IsEven(n)
|
||||
return not Math.IsOdd(n)
|
||||
end
|
||||
|
||||
function Math.maxmin(min, n, max)
|
||||
return math.max(min, math.min(n, max))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user