mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
Proximity prompt and work on elevator
This commit is contained in:
@@ -40,7 +40,7 @@ type Constructor_Return_Props = {
|
||||
Humanoid: Humanoid
|
||||
}
|
||||
|
||||
export type BobbingConstructor = ClassConstructor
|
||||
export type BobbingConstructor = Impl_Constructor
|
||||
|
||||
local Bobbing = {} :: Impl_Constructor
|
||||
Bobbing.__index = Bobbing
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
type Head = BasePart
|
||||
type Head = BasePart
|
||||
type UpperTorso = BasePart
|
||||
type Neck = Motor6D
|
||||
type Waist = Motor6D
|
||||
type NeckC0 = CFrame
|
||||
type WaistC0 = CFrame
|
||||
type UDP = UnreliableRemoteEvent
|
||||
type Neck = Motor6D
|
||||
type Waist = Motor6D
|
||||
type NeckC0 = CFrame
|
||||
type WaistC0 = CFrame
|
||||
type UDP = UnreliableRemoteEvent
|
||||
|
||||
type struct_SpineMovement = {
|
||||
Neck: CFrame,
|
||||
|
||||
@@ -5,14 +5,24 @@
|
||||
type CustomCoreGuiEnums = {Enum.CoreGuiType}
|
||||
|
||||
type Impl_Constructor = {
|
||||
On: (self: Impl_Constructor) -> (),
|
||||
Off: (self: Impl_Constructor) -> (),
|
||||
ForceOff: (self: Impl_Constructor) -> (),
|
||||
ForceOn: (self: Impl_Constructor) -> (),
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Impl_Static_Props = {
|
||||
AllowReset: boolean,
|
||||
AllowEmotes: boolean,
|
||||
AllowBackpack: boolean,
|
||||
AllowPlayerList: boolean
|
||||
}
|
||||
|
||||
local CoreGuis = {}
|
||||
local CoreGuis = {} :: Impl_Constructor
|
||||
|
||||
CoreGuis.AllowReset = false
|
||||
CoreGuis.AllowEmotes = true
|
||||
CoreGuis.AllowBackpack = false
|
||||
CoreGuis.AllowReset = false
|
||||
CoreGuis.AllowEmotes = true
|
||||
CoreGuis.AllowBackpack = false
|
||||
CoreGuis.AllowPlayerList = false
|
||||
|
||||
local SG = game:GetService("StarterGui")
|
||||
|
||||
@@ -2,21 +2,40 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local CrosshairModule = {
|
||||
Icon = "rbxassetid://12643750723"
|
||||
}
|
||||
CrosshairModule.__index = CrosshairModule
|
||||
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
local Easings = require(Storage:WaitForChild("AlgebraEasings"))
|
||||
|
||||
--Use a custom crosshair so we can do effects to it
|
||||
type rbxassetid = string
|
||||
|
||||
function CrosshairModule.constructor(PlayerGui: PlayerGui)
|
||||
local Screen = PlayerGui:WaitForChild("Crosshair")
|
||||
local Icon = Screen:WaitForChild("ImageLabel")
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Enable: (self: ClassConstructor) -> (),
|
||||
Disable: (self: ClassConstructor) -> (),
|
||||
Change: (self: ClassConstructor, ID: rbxassetid) -> (),
|
||||
Jump: (self: ClassConstructor, RootVelocity: Vector3) -> (),
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Constructor_Fun = (PlayerGui: PlayerGui) -> ClassConstructor
|
||||
type Impl_Static_Props = {
|
||||
Icon: rbxassetid
|
||||
}
|
||||
type Constructor_Return_Props = {
|
||||
Screen: ScreenGui,
|
||||
Icon: ImageLabel
|
||||
}
|
||||
|
||||
local CrosshairModule = {} :: Impl_Constructor
|
||||
CrosshairModule.__index = CrosshairModule
|
||||
|
||||
--Use a custom crosshair so we can do effects to it
|
||||
CrosshairModule.Icon = "rbxassetid://12643750723"
|
||||
|
||||
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local Easings = require(Storage:WaitForChild("AlgebraEasings"))
|
||||
|
||||
function CrosshairModule.constructor(PlayerGui: PlayerGui)
|
||||
local Screen = PlayerGui:WaitForChild("Crosshair") :: ScreenGui
|
||||
local Icon = Screen:WaitForChild("ImageLabel") :: ImageLabel
|
||||
return setmetatable({
|
||||
Screen = Screen,
|
||||
Icon = Icon
|
||||
@@ -24,21 +43,20 @@ function CrosshairModule.constructor(PlayerGui: PlayerGui)
|
||||
end
|
||||
|
||||
function CrosshairModule:Enable()
|
||||
(self.Screen :: ScreenGui).Enabled = true
|
||||
self.Screen.Enabled = true
|
||||
end
|
||||
|
||||
function CrosshairModule:Disable()
|
||||
(self.Screen :: ScreenGui).Enabled = false
|
||||
self.Screen.Enabled = false
|
||||
end
|
||||
|
||||
function CrosshairModule:Change(ID: rbxassetid)
|
||||
(self.Icon :: ImageLabel).Image = ID or CrosshairModule.Icon
|
||||
self.Icon.Image = ID or CrosshairModule.Icon
|
||||
end
|
||||
|
||||
function CrosshairModule:Jump(RootVelocity: Vector3)
|
||||
local X, Y = RootVelocity.X, RootVelocity.Y;
|
||||
|
||||
(self.Icon :: ImageLabel).Position = UDim2.fromScale(
|
||||
self.Icon.Position = UDim2.fromScale(
|
||||
Y>1 and Easings.Linear(.5,.5+(X/1000),.3) or .5,
|
||||
math.clamp(.4, .5-(-Y/1000), .6)
|
||||
)
|
||||
|
||||
@@ -2,12 +2,34 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local HealthModule = {}
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Enable: (self: ClassConstructor) -> (),
|
||||
Disable: (self: ClassConstructor) -> (),
|
||||
DisplayHealth: (self: ClassConstructor, Amount: number) -> (),
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Impl_Static_Props = {
|
||||
Enabled: boolean
|
||||
}
|
||||
|
||||
type Constructor_Fun = (PlayerGui: PlayerGui) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
HealthGui: ScreenGui,
|
||||
Amount: TextLabel
|
||||
}
|
||||
|
||||
local HealthModule = {} :: Impl_Constructor
|
||||
HealthModule.__index = HealthModule
|
||||
|
||||
HealthModule.Enabled = false
|
||||
|
||||
function HealthModule.constructor(PlayerGui: PlayerGui)
|
||||
local HealthGui = PlayerGui:WaitForChild("Health")
|
||||
local Amount = HealthGui:WaitForChild("Amount")
|
||||
local HealthGui = PlayerGui:WaitForChild("Health") :: ScreenGui
|
||||
local Amount = HealthGui:WaitForChild("Amount") :: TextLabel
|
||||
|
||||
return setmetatable({
|
||||
HealthGui = HealthGui,
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
|
||||
--All debugging objects such as light source indicating objects will be turned invisible
|
||||
|
||||
export type Entities = {IndexedEntities: {Instance}}
|
||||
|
||||
type HideEditor = (a1: BasePart | Folder, a2: boolean) -> ()
|
||||
type LuaChangeableContainer = Script | LocalScript
|
||||
|
||||
local Players = game:GetService("Players")
|
||||
local CS = game:GetService("CollectionService")
|
||||
local Players: Players = game:GetService("Players")
|
||||
local CS: CollectionService = game:GetService("CollectionService")
|
||||
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local ServerStorage = Storage:WaitForChild("Server")
|
||||
|
||||
local StudioEntities = {
|
||||
IndexedEntities = {}
|
||||
@@ -65,7 +66,7 @@ local EditorEntities = {
|
||||
["LadderContact"] = HideLadderContact,
|
||||
}
|
||||
|
||||
function StudioEntities.indexAll(enabled: boolean): Entities
|
||||
function StudioEntities.indexAll(enabled: boolean)
|
||||
if #StudioEntities.IndexedEntities == 0 then
|
||||
--Run when the server starts
|
||||
local WorkspaceEnt = workspace:GetDescendants()
|
||||
@@ -93,13 +94,13 @@ function StudioEntities.indexAll(enabled: boolean): Entities
|
||||
end
|
||||
end
|
||||
elseif Item:IsA("LuaSourceContainer") then --Cant allow scripts outside of the framework
|
||||
--mini algorthim to see if the script is part of the rhpid-framework character or not
|
||||
--mini algIsAorthim to see if the script is part of the rhpid-framework character or not
|
||||
local Model = Item:FindFirstAncestorOfClass("Model")
|
||||
|
||||
if not Players:GetPlayerFromCharacter(Model) then
|
||||
pcall(function()
|
||||
(Item :: LuaChangeableContainer).Enabled = false
|
||||
end)
|
||||
if Model and not Players:GetPlayerFromCharacter(Model) then
|
||||
if Item:IsA("Script") or Item:IsA("LocalScript") then
|
||||
Item.Enabled = false
|
||||
end
|
||||
Item:Destroy()
|
||||
warn(`Script: "{Item.Name}" ({Item.ClassName}) was removed because it was outside of the rhpid-framework boundries,`, Item:GetFullName())
|
||||
end
|
||||
@@ -120,4 +121,13 @@ function StudioEntities.indexAll(enabled: boolean): Entities
|
||||
return StudioEntities.IndexedEntities
|
||||
end
|
||||
|
||||
local EditorEntities_Remote = Instance.new("BindableFunction")
|
||||
EditorEntities_Remote.Name = "StudioIndexedEntities"
|
||||
EditorEntities_Remote.Parent = ServerStorage
|
||||
|
||||
EditorEntities_Remote.OnInvoke = function()
|
||||
return StudioEntities.IndexedEntities
|
||||
end
|
||||
|
||||
|
||||
return StudioEntities
|
||||
@@ -1,10 +0,0 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Leveling: {[number]: number} = {
|
||||
[1] = 13.205,
|
||||
[10] = 239.216
|
||||
}
|
||||
|
||||
return Leveling
|
||||
@@ -2,7 +2,7 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
return function(ElevatorBox: BasePart, StartPosition: Vector3)
|
||||
return function(ElevatorBox: BasePart, StartPosition: Vector3): (Attachment, AlignPosition, AlignOrientation)
|
||||
local BoxAttachment = Instance.new("Attachment")
|
||||
BoxAttachment.Parent = ElevatorBox
|
||||
|
||||
|
||||
@@ -2,36 +2,62 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Doors = {
|
||||
Closed = true,
|
||||
Sensors = true,
|
||||
Door1Stopped_X = Vector3.xAxis*2.9,
|
||||
Door2Stopped_X = Vector3.xAxis*5.8,
|
||||
ElevatorDoorTime = 5,
|
||||
ElevatorDoorStyle = Enum.EasingStyle.Quad,
|
||||
__DontLeakMemory = nil
|
||||
}
|
||||
Doors.__index = Doors
|
||||
|
||||
local RS = game:GetService("RunService")
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
local RS: RunService = game:GetService("RunService")
|
||||
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Tween = require(Storage:WaitForChild("Tween"))
|
||||
local Tags = require(Storage:WaitForChild("Tags"))
|
||||
|
||||
local Floor10_Door1 = Tags.ElevatorDoor_1960_Floor10_1
|
||||
local Floor10_Door2 = Tags.ElevatorDoor_1960_Floor10_2
|
||||
|
||||
type DoorSensors = {
|
||||
[string]: Instance
|
||||
[string]: BasePart
|
||||
}
|
||||
type CustomTween = Tween.TweenClass
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
DetectSensorHit: (self: ClassConstructor, DoorTween1: Tween, DoorTween2: Tween) -> RBXScriptConnection,
|
||||
Opening: (self: ClassConstructor, opening: boolean?) -> ()
|
||||
} & Impl_Static_Props
|
||||
|
||||
type Constructor_Fun = (ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder) -> ClassConstructor
|
||||
type Impl_Static_Props = {
|
||||
Closed: boolean,
|
||||
Sensors: boolean,
|
||||
Door1Stopped_X: Vector3,
|
||||
Door2Stopped_X: Vector3,
|
||||
ElevatorDoorTime: number,
|
||||
ElevatorDoorStyle: Enum.EasingStyle,
|
||||
__DontLeakMemory: RBXScriptConnection?
|
||||
}
|
||||
type Constructor_Return_Props = {
|
||||
DoorTween1: CustomTween,
|
||||
DoorTween2: CustomTween,
|
||||
DoorSensor: DoorSensors,
|
||||
ElevatorBox: BasePart,
|
||||
ElevatorDoor1: BasePart,
|
||||
ElevatorDoor2: BasePart,
|
||||
DoorClosingClick: Sound
|
||||
}
|
||||
|
||||
function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder)
|
||||
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.ElevatorDoorStyle = Enum.EasingStyle.Quad
|
||||
Doors.__DontLeakMemory = nil
|
||||
|
||||
function Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
|
||||
local DoorTween1 = Tween.constructor(nil, ElevatorDoor1)
|
||||
local DoorTween2 = Tween.constructor(nil, ElevatorDoor2)
|
||||
local DoorSensor: DoorSensors = {
|
||||
Start = ElevatorDoorSensor:WaitForChild("Start"),
|
||||
End = ElevatorDoorSensor:WaitForChild("End")
|
||||
Start = ElevatorDoorSensor:WaitForChild("Start") :: BasePart,
|
||||
End = ElevatorDoorSensor:WaitForChild("End") :: BasePart
|
||||
}
|
||||
|
||||
local DoorClosingClick = Instance.new("Sound") :: Sound
|
||||
@@ -40,12 +66,12 @@ function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, Eleva
|
||||
DoorClosingClick.Parent = ElevatorDoor2
|
||||
|
||||
return setmetatable({
|
||||
DoorTween1 = DoorTween1,
|
||||
DoorTween2 = DoorTween2,
|
||||
DoorSensor = DoorSensor,
|
||||
ElevatorBox = ElevatorBox,
|
||||
ElevatorDoor1 = ElevatorDoor1,
|
||||
ElevatorDoor2 = ElevatorDoor2,
|
||||
DoorTween1 = DoorTween1,
|
||||
DoorTween2 = DoorTween2,
|
||||
DoorSensor = DoorSensor,
|
||||
ElevatorBox = ElevatorBox,
|
||||
ElevatorDoor1 = ElevatorDoor1,
|
||||
ElevatorDoor2 = ElevatorDoor2,
|
||||
DoorClosingClick = DoorClosingClick
|
||||
}, Doors)
|
||||
end
|
||||
@@ -81,7 +107,7 @@ local function DoorsAnimationFloor(floor: number, opening: boolean?, activated_v
|
||||
return Door1Tween_Floor, Door2Tween_Floor
|
||||
end
|
||||
|
||||
local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boolean?)
|
||||
local function DoorsAnimation(self: ClassConstructor, opening: boolean?, activated_via_censor: boolean?)
|
||||
self.ElevatorBox.Anchored = true
|
||||
|
||||
local ElevatorDoor1_P: Vector3 = self.ElevatorDoor1.Position
|
||||
@@ -101,14 +127,14 @@ local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boo
|
||||
end
|
||||
end
|
||||
|
||||
local Door1Tween: Tween = self.DoorTween1:Start(nil, {
|
||||
local Door1Tween = self.DoorTween1:Start(nil, {
|
||||
Position = opening and init_closed_door1 or init_opened_door1
|
||||
}, TweenInfo.new(
|
||||
TweenTime,
|
||||
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
|
||||
Enum.EasingDirection.InOut
|
||||
))
|
||||
local Door2Tween: Tween = self.DoorTween2:Start(nil, {
|
||||
local Door2Tween = self.DoorTween2:Start(nil, {
|
||||
Position = opening and init_closed_door2 or init_opened_door2
|
||||
}, TweenInfo.new(
|
||||
TweenTime,
|
||||
@@ -145,15 +171,12 @@ for n: number = 1, #workspace_items do
|
||||
end
|
||||
end
|
||||
|
||||
type this = any --yeah,
|
||||
type PossibleStepConnection = any
|
||||
|
||||
function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal
|
||||
local Step: PossibleStepConnection = nil
|
||||
function Doors:DetectSensorHit(DoorTween1, DoorTween2)
|
||||
local Step = nil
|
||||
if Doors.Sensors and Doors.Closed then
|
||||
raycastParams.FilterDescendantsInstances = {self.ElevatorBox, table.unpack(RayIgnoring)}
|
||||
|
||||
Step = (RS :: RunService).Stepped:Connect(function(_delta, _dt)
|
||||
Step = RS.Heartbeat:ConnectParallel(function(_dt)
|
||||
local DoorSensor = workspace:Raycast(self.DoorSensor.Start.Position, self.DoorSensor.End.Position, raycastParams)
|
||||
|
||||
if DoorSensor and DoorSensor.Instance and DoorSensor.Instance:IsA("BasePart") then
|
||||
@@ -161,7 +184,7 @@ function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal
|
||||
DoorTween1:Pause()
|
||||
DoorTween2:Pause()
|
||||
task.wait(1) --elevators irl have this delay
|
||||
DoorsAnimation((self :: this), true, true)
|
||||
DoorsAnimation(self, true, true)
|
||||
-- DoorTween1:Destroy()
|
||||
-- DoorTween2:Destroy()
|
||||
end
|
||||
@@ -170,7 +193,7 @@ function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal
|
||||
return Step
|
||||
end
|
||||
|
||||
function Doors:Opening(opening: boolean?)
|
||||
function Doors:Opening(opening)
|
||||
--short circuiting central
|
||||
if opening then
|
||||
if Doors.Closed then
|
||||
|
||||
18
src/server/main/Elevators/Otis1960/Leveling.lua
Normal file
18
src/server/main/Elevators/Otis1960/Leveling.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Leveling: {[number]: number} = {
|
||||
[1] = 13.031,
|
||||
[2] = 0,
|
||||
[3] = 0,
|
||||
[4] = 0,
|
||||
[5] = 0,
|
||||
[6] = 0,
|
||||
[7] = 0,
|
||||
[8] = 0,
|
||||
[9] = 0,
|
||||
[10] = 239.245
|
||||
}
|
||||
|
||||
return Leveling
|
||||
87
src/server/main/Elevators/Otis1960/init.lua
Normal file
87
src/server/main/Elevators/Otis1960/init.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Elevators = script.Parent
|
||||
|
||||
local RS: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local TagsModule = require(RS:WaitForChild("Tags"))
|
||||
|
||||
local Leveling = require(script:WaitForChild("Leveling"))
|
||||
local Doors = require(script:WaitForChild("Doors"))
|
||||
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
|
||||
|
||||
type Tags = TagsModule.ExportedTags
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
MoveFloors: (self: ClassConstructor, Level: number) -> (),
|
||||
GoToLevel: (self: ClassConstructor, RequestedLevel: number) -> ()
|
||||
}
|
||||
|
||||
type Constructor_Fun = (Tags: Tags) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
ElevatorBox_1960: BasePart,
|
||||
ElevatorBox: BasePart,
|
||||
ElevatorDoor1: BasePart,
|
||||
ElevatorDoor2: BasePart,
|
||||
ElevatorDoorSensor: Folder,
|
||||
ProximityButtons: {Instance},
|
||||
BoxAttachment: Attachment,
|
||||
BoxAlignPosition: AlignPosition,
|
||||
BoxAlignOrientation: AlignOrientation,
|
||||
ElevatorDoors: BasePart,
|
||||
}
|
||||
|
||||
local Otis1960 = {} :: Impl_Constructor
|
||||
Otis1960.__index = Otis1960
|
||||
|
||||
local function PromptButtons(self: Constructor_Return_Props)
|
||||
for i: number = 1, #self.ProximityButtons do
|
||||
local Button = self.ProximityButtons[i]
|
||||
|
||||
local Attachment = Instance.new("Attachment") :: Attachment
|
||||
Attachment.Parent = Button
|
||||
local Prompt = Instance.new("ProximityPrompt") :: ProximityPrompt
|
||||
Prompt.MaxActivationDistance = 3
|
||||
Prompt.Parent = Attachment
|
||||
|
||||
print(`Created a ProximityPrompt @ "{Button:GetFullName()}"`)
|
||||
end
|
||||
end
|
||||
|
||||
function Otis1960.constructor(Tags)
|
||||
local self = {} :: Constructor_Return_Props
|
||||
self.ElevatorBox_1960 = Tags.ElevatorMover_1960 :: BasePart
|
||||
self.ElevatorBox = Tags.ElevatorMover_1960 :: BasePart
|
||||
self.ElevatorDoor1 = Tags.ElevatorDoor_1960_1 :: BasePart
|
||||
self.ElevatorDoor2 = Tags.ElevatorDoor_1960_2 :: BasePart
|
||||
self.ElevatorDoorSensor = Tags.ElevatorDoor_Sensor_1960 :: Folder
|
||||
self.ProximityButtons = Tags.ProximityElevatorButton :: {Instance}
|
||||
|
||||
self.BoxAttachment, self.BoxAlignPosition, self.BoxAlignOrientation = ElevatorMover(self.ElevatorBox_1960, self.ElevatorBox_1960.Position)
|
||||
self.ElevatorDoors = Doors.constructor(self.ElevatorBox, self.ElevatorDoor1, self.ElevatorDoor2, self.ElevatorDoorSensor)
|
||||
|
||||
PromptButtons(self)
|
||||
print("Otis1960 initialized and ready")
|
||||
|
||||
return setmetatable(self, Otis1960)
|
||||
end
|
||||
|
||||
function Otis1960:MoveFloors(Level)
|
||||
local ElevatorBoxCurrentPos = self.ElevatorBox.Position
|
||||
--Its gonna use raycasting inside of the shaft to detect when its near and when to stop
|
||||
self.BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, Level, ElevatorBoxCurrentPos.Z)
|
||||
end
|
||||
|
||||
function Otis1960:GoToLevel(RequestedLevel)
|
||||
local level: number = Leveling[RequestedLevel]
|
||||
if level then
|
||||
self:MoveFloors(level)
|
||||
end
|
||||
end
|
||||
|
||||
return Otis1960
|
||||
@@ -1,54 +0,0 @@
|
||||
--!optimize 2
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Otis1960_main = {}
|
||||
Otis1960_main.__index = Otis1960_main
|
||||
|
||||
local Elevator = script.Parent
|
||||
local Elevators = Elevator.Parent
|
||||
|
||||
local RS = game:GetService("ReplicatedStorage")
|
||||
|
||||
local TagsModule = require(RS:WaitForChild("Tags"))
|
||||
local Leveling = require(Elevators:WaitForChild("Leveling"))
|
||||
local Doors = require(Elevator:WaitForChild("Doors"))
|
||||
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
|
||||
|
||||
local Tags = TagsModule.constructor().Exports
|
||||
|
||||
local ElevatorBox_1960 = Tags.ElevatorMover_1960
|
||||
local ElevatorBox = Tags.ElevatorMover_1960 :: BasePart
|
||||
local ElevatorDoor1 = Tags.ElevatorDoor_1960_1 :: BasePart
|
||||
local ElevatorDoor2 = Tags.ElevatorDoor_1960_2 :: BasePart
|
||||
local ElevatorDoorSensor = Tags.ElevatorDoor_Sensor_1960 :: Folder
|
||||
|
||||
local ElevatorBoxStartPos = ElevatorBox_1960.Position
|
||||
|
||||
local _BoxAttachment, BoxAlignPosition, _BoxAlignOrientation = ElevatorMover(ElevatorBox_1960, ElevatorBoxStartPos)
|
||||
|
||||
local ElevatorDoors = Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
|
||||
|
||||
local function MoveFloors(level: number)
|
||||
local ElevatorBoxCurrentPos = ElevatorBox.Position
|
||||
--Its gonna use raycasting inside of the shaft to detect when its near and when to stop
|
||||
BoxAlignPosition.Position = Vector3.new(ElevatorBoxCurrentPos.X, level, ElevatorBoxCurrentPos.Z)
|
||||
end
|
||||
|
||||
local function GoTo_Level(requested_level: number)
|
||||
local level: number = Leveling[requested_level]
|
||||
if level then
|
||||
MoveFloors(level)
|
||||
end
|
||||
end
|
||||
|
||||
print("[DEBUG]: Tags:",Tags)
|
||||
|
||||
-- while true do
|
||||
-- task.wait(2)
|
||||
-- ElevatorDoors:Opening(true)
|
||||
-- task.wait(2)
|
||||
-- ElevatorDoors:Opening(false)
|
||||
-- end
|
||||
|
||||
return Otis1960_main
|
||||
@@ -2,35 +2,29 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local RS: RunService = game:GetService("RunService")
|
||||
local Storage: ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local Elevators = script:WaitForChild("Elevators")
|
||||
local TagsModule = require(Storage:WaitForChild("Tags"))
|
||||
|
||||
local HideEditorEntities = require(script:WaitForChild("EditorEntities"))
|
||||
local Lighting_Stuff = require(script:WaitForChild("Lighting"))
|
||||
local Workspace_Stuff = require(script:WaitForChild("Workspace"))
|
||||
local StarterPlayer_Stuff = require(script:WaitForChild("StarterPlayer"))
|
||||
|
||||
local RS = game:GetService("RunService")
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
|
||||
local TagsModule = require(Storage:WaitForChild("Tags"))
|
||||
local Otis1960_Module = require(Elevators:WaitForChild("Otis1960"))
|
||||
|
||||
local TagsConstructor = TagsModule.constructor()
|
||||
local Tags = TagsConstructor.Exports
|
||||
local Tags = TagsConstructor.Exports
|
||||
print("[DEBUG] Tags=", Tags)
|
||||
|
||||
local Elevators = script:WaitForChild("Elevators")
|
||||
local ServerStorage = Storage:WaitForChild("Server")
|
||||
|
||||
local EditorEntities = Instance.new("BindableFunction")
|
||||
EditorEntities.Name = "StudioIndexedEntities"
|
||||
EditorEntities.Parent = ServerStorage
|
||||
|
||||
local StudioEntities = HideEditorEntities.indexAll(not false)
|
||||
HideEditorEntities.indexAll(not false)
|
||||
TagsConstructor:Nuke()
|
||||
|
||||
StarterPlayer_Stuff()
|
||||
Lighting_Stuff()
|
||||
Workspace_Stuff()
|
||||
|
||||
EditorEntities.OnInvoke = function(): HideEditorEntities.Entities
|
||||
return StudioEntities.IndexedEntities
|
||||
end
|
||||
|
||||
TagsConstructor:Nuke()
|
||||
--Start the elevators
|
||||
local Otis1960 = Otis1960_Module.constructor(Tags)
|
||||
|
||||
@@ -2,15 +2,29 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Tags = {}
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Nuke: (self: ClassConstructor) -> (),
|
||||
}
|
||||
|
||||
type Constructor_Fun = () -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
Exports: ExportedTags
|
||||
}
|
||||
|
||||
export type ExportedTags = {
|
||||
[string]: Instance | {Instance}
|
||||
}
|
||||
export type TagsConstructor = ClassConstructor
|
||||
|
||||
local Tags = {} :: Impl_Constructor
|
||||
Tags.__index = Tags
|
||||
|
||||
local CS = game:GetService("CollectionService")
|
||||
|
||||
type ExportedTags = {
|
||||
[string]: Instance | {Instance}
|
||||
}
|
||||
|
||||
function Tags.constructor()
|
||||
local Exports: ExportedTags = {}
|
||||
local AllTags = CS:GetAllTags()
|
||||
|
||||
@@ -2,24 +2,42 @@
|
||||
--!native
|
||||
--!strict
|
||||
|
||||
local Tween = {}
|
||||
type TweenAnimation = {[string]: any}
|
||||
|
||||
type ClassConstructor = typeof(setmetatable({} :: Constructor_Return_Props, {} :: Impl_Constructor))
|
||||
type Impl_Constructor = {
|
||||
__index: Impl_Constructor,
|
||||
constructor: Constructor_Fun,
|
||||
--Class functions
|
||||
Start: (self: ClassConstructor, PostInstance: Instance?, PostProperties: TweenAnimation?, PostTweenSettings: TweenInfo?) -> Tween,
|
||||
}
|
||||
|
||||
type Constructor_Fun = (TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation?) -> ClassConstructor
|
||||
type Constructor_Return_Props = {
|
||||
TweenInfo: TweenInfo?,
|
||||
Instance: Instance?,
|
||||
PreProperties: TweenAnimation?,
|
||||
}
|
||||
|
||||
export type TweenClass = ClassConstructor
|
||||
export type TweenConstructor = Impl_Constructor
|
||||
|
||||
local Tween = {} :: Impl_Constructor
|
||||
Tween.__index = Tween
|
||||
|
||||
local TS = game:GetService("TweenService")
|
||||
|
||||
type TweenAnimation = {[string]: any}
|
||||
|
||||
function Tween.constructor(TweenSettings: TweenInfo?, Object: Instance?, PreProperties: TweenAnimation?)
|
||||
function Tween.constructor(TweenSettings, Object, PreProperties)
|
||||
return setmetatable({
|
||||
TweenInfo = TweenSettings,
|
||||
Instance = Object,
|
||||
TweenInfo = TweenSettings,
|
||||
Instance = Object,
|
||||
PreProperties = PreProperties
|
||||
}, Tween)
|
||||
end
|
||||
|
||||
function Tween:Start(PostInstance: Instance?, PostProperties: TweenAnimation?, PostTweenSettings: TweenInfo?): Tween
|
||||
local Props = self.PreProperties
|
||||
local Object = self.Instance
|
||||
function Tween:Start(PostInstance, PostProperties, PostTweenSettings)
|
||||
local Props = self.PreProperties
|
||||
local Object = self.Instance
|
||||
local TweenSettings = self.TweenInfo
|
||||
|
||||
if PostProperties then
|
||||
|
||||
Reference in New Issue
Block a user