Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- enabled = true,
- ["gm_construct_flatgrass_v6-2"] = {
- enabled = true,
- sun = {
- ["sun_dir"] = Vector(0.81231, -0.58252, 0.02858),
- ["sunsize"] = 33,
- ["overlaysize"] = 0,
- ["suncolor"] = Color(249, 224, 196),
- ["overlaycolor"] = Color(255, 221, 163),
- },
- sky = {
- ["topcolor"] = Color(0, 7, 15),
- ["bottomcolor"] = Color(94, 66, 153),
- ["fadebias"] = 0.25,
- ["hdrscale"] = 0.66,
- ["drawstars"] = true,
- ["startexture"] = "skybox/starfield",
- ["starlayers"] = 1,
- ["starscale"] = 1.03,
- ["starfade"] = 0.65,
- ["starspeed"] = 0.01,
- ["duskintensity"] = 1.44,
- ["duskscale"] = 0.84,
- ["duskcolor"] = Color(255, 40, 0),
- ["sunsize"] = 0.37,
- ["suncolor"] = Color(255, 119, 0),
- }
- },
- ["gm_flatgrass"] = {
- enabled = true,
- sun = {
- ["sun_dir"] = Vector(-0.938096, -0.343581, 0.043908),
- ["sunsize"] = 33,
- ["overlaysize"] = 0,
- ["suncolor"] = Color(249, 224, 196),
- ["overlaycolor"] = Color(255, 221, 163),
- },
- sky = {
- ["topcolor"] = Color(0, 7, 15),
- ["bottomcolor"] = Color(94, 66, 153),
- ["fadebias"] = 0.25,
- ["hdrscale"] = 0.66,
- ["drawstars"] = true,
- ["startexture"] = "skybox/starfield",
- ["starlayers"] = 1,
- ["starscale"] = 1.03,
- ["starfade"] = 0.65,
- ["starspeed"] = 0.01,
- ["duskintensity"] = 1.44,
- ["duskscale"] = 0.84,
- ["duskcolor"] = Color(255, 40, 0),
- ["sunsize"] = 0.37,
- ["suncolor"] = Color(255, 119, 0),
- }
- }
- }
- local sun, sky
- local map
- local function setKeys(ent, name)
- if not IsValid(ent) then
- print("Custom Sky: Error customizing - entity not valid")
- return
- end
- print("Custom Sky: Editing "..name)
- for k, v in pairs(config[map][name]) do
- local t = type(v)
- local val
- if t == "number"then
- val = tostring(v)
- elseif t == "boolean" then
- val = (v == true and "1" or "0")
- elseif t == "Vector" then
- val = Format("%f %f %f", v.x, v.y, v.z)
- elseif t == "table" then
- val = Format("%f %f %f", v.r/255, v.g/255, v.b/255)
- else
- val = v
- end
- ent:SetKeyValue(k, val)
- end
- end
- local function findFirst(name)
- local findList = ents.FindByClass(name)
- if(#findList > 0) then
- return findList[1]
- end
- end
- local function init()
- if not config.enabled then return end
- sun = findFirst("env_sun")
- sky = findFirst("env_skypaint")
- map = game.GetMap()
- local cfg = config[map]
- if cfg then
- if not cfg.enabled then return end
- if cfg.sun then
- setKeys(sun, "sun")
- end
- if cfg.sky then
- setKeys(sky, "sky")
- end
- else
- --print("Custom Sky: Config not set for "..map)
- end
- end
- init()
- hook.Add("Initialize", "psb_customsky", function()
- timer.Simple(1, function()
- init()
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment