mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 21:31:54 +00:00
working light switch, needs modularized
This commit is contained in:
@@ -12,6 +12,7 @@ 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"))
|
||||
@@ -33,6 +34,40 @@ Workspace_Stuff()
|
||||
local Interactables = TagsConstructor:__Interactables()
|
||||
print("[DEBUG] Interactables=", Interactables)
|
||||
|
||||
--Temporary
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user