@@ -23307,6 +23307,7 @@ if day <= 25 then
23307
23307
else
23308
23308
fraction = fraction + ((day - 25) * 5)
23309
23309
end
23310
+
23310
23311
local xmaslightbase = {
23311
23312
fraction = fraction,
23312
23313
lightType = 'point',
@@ -23329,71 +23330,73 @@ local xmaslightbase = {
23329
23330
-- White Fire Remake 1.3
23330
23331
-- Ice Scream v2.5.1
23331
23332
23332
- local snowy_tree_keys = {}-- { __tree_fir_tall_3 = 20, __tree_fir_tall_4 = 20, allpinesb_ad0_snow = 20}
23333
- local snowy_tree_keys = {allpinesb_ad0 = 60, __tree_fir_tall_3 = 60, __tree_fir_ = 60}
23334
- local xmasColors = {
23335
- [1] = {234,13,13}, -- red
23336
- [2] = {251,11,36}, -- orange
23337
- [3] = {251,242,26}, -- yellow
23338
- [4] = {36, 208, 36}, -- green
23339
- [5] = {10,83, 222}, -- blue
23340
- }
23333
+ -- add colorful xmas lights to a percentage of certain snowy trees
23334
+ if os.date("%m") == "12" and os.date("%d") >= "12" then --and os.date("%d") <= "26"
23335
+ local snowy_tree_keys = {allpinesb_ad0 = 60, __tree_fir_tall_3 = 60, __tree_fir_ = 60}
23336
+ local xmasColors = {
23337
+ [1] = {234,13,13}, -- red
23338
+ [2] = {251,11,36}, -- orange
23339
+ [3] = {251,242,26}, -- yellow
23340
+ [4] = {36, 208, 36}, -- green
23341
+ [5] = {10,83, 222}, -- blue
23342
+ }
23341
23343
23342
- for featureDefID , featureDef in pairs(FeatureDefs) do
23343
- local featureName = featureDef.name
23344
- -- Check if its a snowy tree:
23345
- -- estimate its height/ radius via model extrema
23346
- -- spawn lights in a cone shape around it
23347
- for key, count in pairs(snowy_tree_keys) do
23348
- if string.find(featureName, key, nil, true) then
23349
- --Spring.Echo("Found snowy tree: " .. featureName, key)
23344
+ for featureDefID , featureDef in pairs(FeatureDefs) do
23345
+ local featureName = featureDef.name
23346
+ -- Check if its a snowy tree:
23347
+ -- estimate its height/ radius via model extrema
23348
+ -- spawn lights in a cone shape around it
23349
+ for key, count in pairs(snowy_tree_keys) do
23350
+ if string.find(featureName, key, nil, true) then
23351
+ --Spring.Echo("Found snowy tree: " .. featureName, key)
23350
23352
23351
- featureDefLights[featureDefID] = {}
23352
- local maxy = featureDef.model.maxy
23353
- local maxx = featureDef.model.maxx
23354
- local maxz = featureDef.model.maxz
23353
+ featureDefLights[featureDefID] = {}
23354
+ local maxy = featureDef.model.maxy
23355
+ local maxx = featureDef.model.maxx
23356
+ local maxz = featureDef.model.maxz
23355
23357
23356
- for i= 1, count do
23357
- local xmaslight = table.copy(xmaslightbase)
23358
+ for i= 1, count do
23359
+ local xmaslight = table.copy(xmaslightbase)
23358
23360
23359
- local y = maxy * (math.random() * 0.8 + 0.1)
23360
- local rely = 1.0 - y / maxy
23361
+ local y = maxy * (math.random() * 0.8 + 0.1)
23362
+ local rely = 1.0 - y / maxy
23361
23363
23362
- local x = rely * maxx * (math.random() - 0.5) * 1.5
23363
- local z = rely * maxz * (math.random() - 0.5) * 1.5
23364
- --Spring.Echo(maxx, maxy, maxz, x,y,z)
23365
- xmaslight.lightConfig.posy = y
23366
- xmaslight.lightConfig.posx = x
23367
- xmaslight.lightConfig.posz = z
23364
+ local x = rely * maxx * (math.random() - 0.5) * 1.5
23365
+ local z = rely * maxz * (math.random() - 0.5) * 1.5
23366
+ --Spring.Echo(maxx, maxy, maxz, x,y,z)
23367
+ xmaslight.lightConfig.posy = y
23368
+ xmaslight.lightConfig.posx = x
23369
+ xmaslight.lightConfig.posz = z
23368
23370
23369
- local color = math.ceil(math.random() * 4)
23371
+ local color = math.ceil(math.random() * 4)
23370
23372
23371
- xmaslight.lightConfig.r = xmasColors[color][1] / 255
23372
- xmaslight.lightConfig.g = xmasColors[color][2] / 255
23373
- xmaslight.lightConfig.b = xmasColors[color][3] / 255
23373
+ xmaslight.lightConfig.r = xmasColors[color][1] / 255
23374
+ xmaslight.lightConfig.g = xmasColors[color][2] / 255
23375
+ xmaslight.lightConfig.b = xmasColors[color][3] / 255
23374
23376
23375
- xmaslight.lightConfig.color2r = xmasColors[color+1][1] /255
23376
- xmaslight.lightConfig.color2g = xmasColors[color+1][2] /255
23377
- xmaslight.lightConfig.color2b = xmasColors[color+1][3] /255
23377
+ xmaslight.lightConfig.color2r = xmasColors[color+1][1] /255
23378
+ xmaslight.lightConfig.color2g = xmasColors[color+1][2] /255
23379
+ xmaslight.lightConfig.color2b = xmasColors[color+1][3] /255
23378
23380
23379
23381
23380
- --[[
23382
+ --[[
23381
23383
23382
- xmaslight.lightConfig.r = math.random() > 0.5 and 1 or 0
23383
- xmaslight.lightConfig.g = math.random()> 0.5 and 1 or 0
23384
- xmaslight.lightConfig.b = math.random()> 0.5 and 1 or 0
23384
+ xmaslight.lightConfig.r = math.random() > 0.5 and 1 or 0
23385
+ xmaslight.lightConfig.g = math.random()> 0.5 and 1 or 0
23386
+ xmaslight.lightConfig.b = math.random()> 0.5 and 1 or 0
23385
23387
23386
- xmaslight.lightConfig.color2r = math.random() > 0.5 and 1 or 0
23387
- xmaslight.lightConfig.color2g = math.random()> 0.5 and 1 or 0
23388
- xmaslight.lightConfig.color2b = math.random()> 0.5 and 1 or 0
23389
- ]]--
23388
+ xmaslight.lightConfig.color2r = math.random() > 0.5 and 1 or 0
23389
+ xmaslight.lightConfig.color2g = math.random()> 0.5 and 1 or 0
23390
+ xmaslight.lightConfig.color2b = math.random()> 0.5 and 1 or 0
23391
+ ]]--
23390
23392
23391
- xmaslight.lightConfig.colortime = 0.005 + math.random()* 0.005
23393
+ xmaslight.lightConfig.colortime = 0.005 + math.random()* 0.005
23392
23394
23393
- featureDefLights[featureDefID]['xmaslight' .. tostring(i)] = xmaslight
23395
+ featureDefLights[featureDefID]['xmaslight' .. tostring(i)] = xmaslight
23394
23396
23397
+ end
23398
+ break
23395
23399
end
23396
- break
23397
23400
end
23398
23401
end
23399
23402
end
0 commit comments