working light switch, needs modularized

This commit is contained in:
2024-04-16 22:34:00 -04:00
parent 936837eb67
commit a16c86af45
2 changed files with 68 additions and 8 deletions

View File

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