mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-18 03:21:54 +00:00
Tag removal and new serverside structure
This commit is contained in:
54
src/server/main/Elevators/Otis1960/main.lua
Normal file
54
src/server/main/Elevators/Otis1960/main.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
--!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
|
||||
Reference in New Issue
Block a user