mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-17 02:21:54 +00:00
Light module
This commit is contained in:
@@ -10,10 +10,6 @@ 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"))
|
||||
@@ -30,67 +26,10 @@ StarterPlayer_Stuff()
|
||||
Lighting_Stuff()
|
||||
Workspace_Stuff()
|
||||
|
||||
|
||||
--Map
|
||||
local Interactables = TagsConstructor:__Interactables()
|
||||
print("[DEBUG] Interactables=", Interactables)
|
||||
|
||||
--Temporary
|
||||
--[[
|
||||
Guide for lights with toggable switches:
|
||||
TODO
|
||||
]]
|
||||
local TweenModule = require(Storage:WaitForChild("Tween"))
|
||||
local LightSwitchTween = TweenModule.constructor(TweenInfo.new(.1, Enum.EasingStyle.Linear))
|
||||
|
||||
for _, LightProperties in Interactables.LightSwitches do
|
||||
if LightProperties.Prompt and LightProperties.Switch then
|
||||
local Prompt = PromptsConstructor.constructor(LightProperties.Prompt, LightProperties.Switch)
|
||||
local LightEnabled = false
|
||||
|
||||
if LightProperties.ColorDeactivated and LightProperties.ColorActivated and LightProperties.Prompt and LightProperties.Lights then
|
||||
Prompt:AddHookTriggered(function(_Player: Player)
|
||||
LightEnabled = not LightEnabled
|
||||
|
||||
local Switch = LightProperties.Switch
|
||||
if LightEnabled then
|
||||
LightSwitchTween:Start(Switch, {
|
||||
CFrame = CFrame.new(Switch.Position)*CFrame.Angles(0,math.rad(90),0)+Vector3.new(0,.15,0)
|
||||
})
|
||||
else
|
||||
LightSwitchTween:Start(Switch, {
|
||||
CFrame = CFrame.new(Switch.Position)*CFrame.Angles(0,math.rad(90),math.rad(70))-Vector3.new(0,.15,0)
|
||||
})
|
||||
end
|
||||
|
||||
if LightProperties.ClickSound then
|
||||
LightProperties.ClickSound:Play()
|
||||
end
|
||||
|
||||
for n: number = 1, #LightProperties.Lights do
|
||||
local LightObj = LightProperties.Lights[n]
|
||||
local Light = LightObj:FindFirstChildWhichIsA("PointLight", true) or LightObj:FindFirstChildWhichIsA("SpotLight", true)
|
||||
if Light then
|
||||
Light.Enabled = LightEnabled
|
||||
end
|
||||
if LightEnabled 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)
|
||||
|
||||
Reference in New Issue
Block a user