mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-14 06:41:55 +00:00
85 lines
2.8 KiB
Lua
85 lines
2.8 KiB
Lua
--!optimize 2
|
|
--!native
|
|
--!strict
|
|
|
|
local ShowEditorEntities = game:GetService("RunService"):IsServer()
|
|
|
|
local Storage = game:GetService("ReplicatedStorage")
|
|
local Enums = require(Storage:WaitForChild("Enums"))
|
|
|
|
local Elevators = script:WaitForChild("Elevators")
|
|
local Otis1960_Module = require(Elevators:WaitForChild("Otis1960"))
|
|
|
|
local Map = script:WaitForChild("Map")
|
|
local LightSwitchesConstructor = require(Map:WaitForChild("LightSwitches"))
|
|
local PromptsConstructor = require(Map:WaitForChild("Prompts"))
|
|
|
|
local TagsModule = require(script: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 TagsConstructor = TagsModule.constructor()
|
|
print("[DEBUG] Tags=", TagsConstructor.__export)
|
|
|
|
HideEditorEntities.indexAll(ShowEditorEntities)
|
|
TagsConstructor:Nuke()
|
|
|
|
StarterPlayer_Stuff()
|
|
Lighting_Stuff()
|
|
Workspace_Stuff()
|
|
|
|
--Map
|
|
local Interactables = TagsConstructor:__Interactables()
|
|
print("[DEBUG] Interactables=", Interactables)
|
|
|
|
--Temporary
|
|
--[[
|
|
Guide for lights with toggable switches:
|
|
TODO
|
|
]]
|
|
for _, LightProperties in Interactables.LightSwitches do
|
|
if LightProperties.Prompt and LightProperties.Switch then
|
|
local Prompt = PromptsConstructor.constructor(LightProperties.Prompt, LightProperties.Switch)
|
|
local Enabled = false
|
|
|
|
if LightProperties.ColorDeactivated and LightProperties.ColorActivated and LightProperties.Prompt and LightProperties.Lights then
|
|
Prompt:AddHookTriggered(function(_Player: Player)
|
|
Enabled = not Enabled
|
|
--*Light switch animation*
|
|
if LightProperties.ClickSound then
|
|
LightProperties.ClickSound:Play()
|
|
end
|
|
|
|
for n: number = 1, #LightProperties.Lights do
|
|
local LightObj = LightProperties.Lights[n]
|
|
LightObj.PointLight.Enabled = Enabled
|
|
|
|
if Enabled then
|
|
LightObj.Color = LightProperties.ColorActivated
|
|
LightObj.Material = Enum.Material.Neon
|
|
else
|
|
LightObj.Color = LightProperties.ColorDeactivated
|
|
LightObj.Material = Enum.Material.SmoothPlastic
|
|
end
|
|
end
|
|
end)
|
|
else
|
|
warn("failed")
|
|
end
|
|
end
|
|
end
|
|
--
|
|
|
|
--local LightSwitches = LightSwitchesConstructor.constructor(Interactables.LightSwitches)
|
|
|
|
--Start the elevators
|
|
local Buttons = TagsConstructor:__ElevatorButtons()
|
|
print("[DEBUG] Buttons=", Buttons)
|
|
local Lanterns = TagsConstructor:__ElevatorLanterns()
|
|
print("[DEBUG] Lanterns=", Lanterns)
|
|
|
|
local Otis1960Lanterns = Lanterns[Enums.Elevator.Otis1960]
|
|
local Otis1960Buttons = Buttons[Enums.Elevator.Otis1960]
|
|
local Otis1960 = Otis1960_Module.constructor(TagsConstructor, Otis1960Buttons, Otis1960Lanterns) |