Maxmin and IsEven, work on getting doors functional again

This commit is contained in:
2024-04-28 02:21:34 -04:00
parent d77778ed7d
commit ff8f3e4915
4 changed files with 19 additions and 12 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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)}"`)

View File

@@ -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