-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlighting_changer.lua
More file actions
265 lines (247 loc) · 7.69 KB
/
lighting_changer.lua
File metadata and controls
265 lines (247 loc) · 7.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
--[[ LightingChange by RedAce (thanks quat)
INSTRUCTIONS
Put a part entirely covering the area you want changed with a part in the Areas folder
Create a new table in the same name as the part, and put in your new lighting values. Make sure to follow the same format as the arrays shown
If you have lighting effects, make a folder with the same name as the part and put in your lighting effects, including those that arent changing
Make sure your default lighting is set up in the Default folder and table. Do not delete the Default folder and table.
You can have as many parts as you want as long as they are named correctly, and as many areas as you want as long as they are set up correctly.
]]
local ChangedValues = {
["Default"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 2,
OutdoorAmbient = Color3.fromRGB(70, 70, 70),
ClockTime = 12,
GeographicLatitude = 0,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 1,
EnvironmentSpecularScale = 1,
GlobalShadows = true,
ExposureCompensation = 0
},
["1-First"] = {
Ambient = Color3.fromRGB(0, 0, 0),
Brightness = 2,
OutdoorAmbient = Color3.fromRGB(0, 0, 0),
ClockTime = 12,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 1,
EnvironmentSpecularScale = 1,
GlobalShadows = true,
ExposureCompensation = 0
},
["1-Second"] = {
Ambient = Color3.fromRGB(0, 0, 0),
Brightness = 2,
OutdoorAmbient = Color3.fromRGB(0, 0, 0),
ClockTime = 12,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 1,
EnvironmentSpecularScale = 1,
GlobalShadows = true,
ExposureCompensation = 0
},
["2-First"] = {
Ambient = Color3.fromRGB(75, 75, 75),
Brightness = 1.5,
OutdoorAmbient = Color3.fromRGB(70, 70, 70),
ClockTime = 12,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 0,
EnvironmentSpecularScale = 0,
GlobalShadows = true,
ExposureCompensation = 0
},
["2-Second"] = {
Ambient = Color3.fromRGB(0, 0, 0),
Brightness = 2,
OutdoorAmbient = Color3.fromRGB(0, 0, 0),
ClockTime = 12,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 1,
EnvironmentSpecularScale = 1,
GlobalShadows = true,
ExposureCompensation = 0
},
["3-First"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 3,
OutdoorAmbient = Color3.fromRGB(140, 140, 140),
ClockTime = 15,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 0,
EnvironmentSpecularScale = 0,
GlobalShadows = true,
GeographicLatitude = 204,
ExposureCompensation = 0.2
},
["3-Second"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 3,
OutdoorAmbient = Color3.fromRGB(130, 130, 130),
ClockTime = 16.1,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 0,
EnvironmentSpecularScale = 0,
GlobalShadows = true,
GeographicLatitude = 204,
ExposureCompensation = 0.2
},
["3-Third"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 3,
OutdoorAmbient = Color3.fromRGB(120, 120, 120),
ClockTime = 17.5,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 0,
EnvironmentSpecularScale = 0,
GlobalShadows = true,
GeographicLatitude = 204,
ExposureCompensation = 0.2
},
["4-First"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 2,
OutdoorAmbient = Color3.fromRGB(70, 70, 70),
ClockTime = 16.9,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 0,
EnvironmentSpecularScale = 0,
GlobalShadows = true,
GeographicLatitude = 204,
ExposureCompensation = 0.2
},
["4-Second"] = {
Ambient = Color3.fromRGB(176, 87, 24),
Brightness = 3,
OutdoorAmbient = Color3.fromRGB(70, 70, 70),
ClockTime = 18.5,
GeographicLatitude = 204,
ColorShift_Bottom = Color3.fromRGB(165, 104, 42),
ColorShift_Top = Color3.fromRGB(165, 104, 42),
EnvironmentDiffuseScale = 0,
EnvironmentSpecularScale = 0,
GlobalShadows = false,
ExposureCompensation = 0
},
["5-First"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 5,
OutdoorAmbient = Color3.fromRGB(70, 70, 70),
ClockTime = 0,
GeographicLatitude = 75,
ColorShift_Bottom = Color3.fromRGB(170, 170, 170),
ColorShift_Top = Color3.fromRGB(170, 170, 170),
EnvironmentDiffuseScale = 0,
EnvironmentSpecularScale = 0,
GlobalShadows = true,
ExposureCompensation = 0.5
},
["6-First"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 5,
OutdoorAmbient = Color3.fromRGB(60, 60, 70),
ClockTime = 20.3,
GeographicLatitude = 28,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(255, 142, 62),
EnvironmentDiffuseScale = 1,
EnvironmentSpecularScale = 1,
GlobalShadows = true,
ExposureCompensation = 0
},
["End-First"] = {
Ambient = Color3.fromRGB(70, 70, 70),
Brightness = 2,
OutdoorAmbient = Color3.fromRGB(70, 70, 70),
ClockTime = 9.5,
GeographicLatitude = 28,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(70, 70, 70),
EnvironmentDiffuseScale = 1,
EnvironmentSpecularScale = 0,
GlobalShadows = true,
ExposureCompensation = 0
},
["Bonus-First"] = {
Ambient = Color3.fromRGB(130, 63, 18),
Brightness = 3,
OutdoorAmbient = Color3.fromRGB(70, 70, 70),
ClockTime = 12,
GeographicLatitude = 28,
ColorShift_Bottom = Color3.fromRGB(70, 70, 70),
ColorShift_Top = Color3.fromRGB(172, 96, 34),
EnvironmentDiffuseScale = 1,
EnvironmentSpecularScale = 1,
GlobalShadows = true,
ExposureCompensation = 0
},
}
local PresetsFolder = script
local lighting = game:GetService("Lighting")
local camera = workspace.CurrentCamera
local currentLighting = nil
-- pre-process lighting presets
local Presets = {}
for PresetName,Values in ChangedValues do
local PresetFolder = PresetsFolder:WaitForChild(PresetName)
local Effects = PresetFolder:GetChildren()
local Preset = {
Folder = PresetFolder,
Effects = Effects,
Values = Values,
}
-- monitor preset folder for late-loading lighting effects
PresetFolder.ChildAdded:Connect(function(Effect)
if table.find(Effects, Effect) then return end
table.insert(Effects, Effect)
-- if this is the current lighting, move the effect to lighting now
if currentLighting == Preset then
Effect.Parent = lighting
end
end)
Presets[PresetName] = Preset
end
local DefaultLighting = Presets.Default
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {PresetsFolder:WaitForChild("Areas")}
game:GetService("RunService").Heartbeat:Connect(function()
local parts = workspace:GetPartBoundsInRadius(camera.CFrame.Position, 1, params)
local newLighting = DefaultLighting
for _, part in parts do
newLighting = Presets[part.Name]
break
end
if currentLighting ~= newLighting then
if currentLighting then
-- moves the effects FROM lighting TO their folder
for _,effect in currentLighting.Effects do
effect.Parent = currentLighting.Folder
end
end
if newLighting then
-- moves the effects FROM their folder TO lighting
for _,effect in newLighting.Effects do
effect.Parent = lighting
end
-- changes the lighting properties
local Values = newLighting.Values
if Values then
for property,value in Values do
lighting[property] = value
end
end
end
currentLighting = newLighting
end
end)