# Config

```lua
Config = {}

-- 🔧 Commands & permissions
Config.CommandMenu = 'weathermenu'
Config.CommandPanel = 'weather' -- Anyone with any of these perms below can use the panel
Config.CommandMenuAce = "NLRP.Developer"
Config.ViewPanelAce = "NLRP.Everyone" -- This is for anyone that you want to let ONLY view the panel
Config.TimeAce = "NLRP.Weather.Time" -- Time only
Config.WeatherAce = "NLRP.Weather.Weather" -- Weather only
Config.FullAccessPerm = "NLRP.Developer" -- Full Access to panel
Config.UseokokNotify = true
Config.UseokokNotifySound = false
Config.NotifyDuration = {
    success = 1500, info = 1500, warning = 1500, weatherchange  = 500,
    add = 250, delete = 500, edit = 500, reorder = 1500, duration = 500,
    typechange = 500, skip = 500, timescale = 100, time = 100, realtimeOn = 250,
    realtimeOff = 250, dayScaleOn = 250, dayScaleOff = 250, nightScaleOn = 250,
    nightScaleOff = 250, blackout = 250, blackoutOff = 250, blackoutVehicles = 250,
    blackoutVehiclesOff = 250, groundsnow = 500, snowoff = 250, freezetime = 250,
}
Config.Debug = {
    PermissionsDenied = false,
    PermissionsAllow = false,
    QueueSkipped = false, -- Shows console log of "Player queue skipped; now: Current Weather"
    StartupTimescale = false, -- Shows current state of timescale on resource start
    RealTimeSync = false, -- Shows when Real Time Sync is toggled
    MegaStorm = false, -- Shows debug for Mega Storm weather
    Advanced = {
        ConsoleClientEnable = true, -- Enables command below
        ConsoleClientCommand = "nlrp_weather_clients", -- Prints every players weather states
        -- Add arg "queue" or "q" in command to recieve weather queue as well
        -- put "nlrp_weather_clients queue" or "nlrp_weather_clients q" in server console
        ConsoleServerEnable = true, -- Enables command below
        ConsoleServerCommand = "nlrp_weather_state", -- Prints server weather states
    },
}
-- 🕒 Time
Config.Time = {
    startUpTime    = { hour = 12, minute = 0 },
    timeScale      = 2000, -- 2 seconds IRL per 1 in game minute
    useRealTime    = false,
    timeScaleRealTime = 60000, -- 60 seconds IRL per 1 in game minute (Real Life...)
    realTimeOffsetHours = 1, -- offset from os.date
    useDayScale    = false,
    useNightScale  = false,
    timeScaleDay   = 5000,  -- ms per minute (day)
    timeScaleNight = 8000,  -- ms per minute (night)
    dayTime   = { beginning = 7, ending = 22 },  -- 7 → 22
    nightTime = { beginning = 22, ending = 6 },  -- 22 → 6
    quickTimes = {
        { label = "Sunrise", time = {6, 0, 0} },
        { label = "Morning", time = {9, 0, 0} },
        { label = "Noon",    time = {12, 0, 0} },
        { label = "Evening", time = {18, 0, 0} },
        { label = "Night",   time = {22, 0, 0} },
    },
}

Config.WeatherTypes = {
  { code = "CLEAR", icon = "☀️", label = "Clear", enabled = true },
  { code = "EXTRASUNNY", icon = "🌞", label = "Extra Sunny", enabled = true },
  { code = "CLOUDS", icon = "☁️", label = "Cloudy", enabled = true },
  { code = "OVERCAST", icon = "🌥️", label = "Overcast", enabled = true },
  { code = "CLEARING", icon = "🌦️", label = "Clearing", enabled = true },
  { code = "RAIN", icon = "🌧️", label = "Rain", enabled = true },
  { code = "THUNDER", icon = "⛈️", label = "Thunder", enabled = true },
  { code = "MEGASTORM", icon = "⚡", label = "MegaStorm", enabled = true },
  { code = "FOGGY", icon = "🌫️", label = "Foggy", enabled = true },
  { code = "SMOG", icon = "🌁", label = "Smog", enabled = true },
  { code = "SNOWLIGHT", icon = "❄️", label = "Light Snow", enabled = true },
  { code = "SNOW", icon = "❄️", label = "Snow", enabled = false },
  { code = "BLIZZARD", icon = "🌨️", label = "Blizzard", enabled = false },
  { code = "XMAS", icon = "🎄", label = "Christmas", enabled = true },
  { code = "HALLOWEEN", icon = "🎃", label = "Halloween", enabled = true },
  --{ code = "NEUTRAL", icon = "➖", label = "Neutral", enabled = false },
}

Config.MegaStorm = {
    -- Only run blackout pulser during real MegaStorms (metadata.megastorm)
    -- If false, THUNDER weather will also trigger pulsing (current default).
    restrictToMegaOnly = true,
    CameraShake = 0.15,
    
    ---------------------------------------------------------------------
    -- BLACKOUT PATTERN CHANCES
    -- These control what *type* of blackout happens each cycle.
    -- The script randomly picks ONE of these behaviors:
    --
    -- • Flicker Sequence (rapid on/off pulses)
    -- • Long Outage      (extended full blackout)
    -- • Short Burst      (your original quick blackout pulse)
    --
    -- Values are probabilities (0.0–1.0).
    -- Any leftover probability becomes the Short Burst chance.
    ---------------------------------------------------------------------
    flickerChance    = 0.40,  -- 40% chance the cycle creates rapid flickering
    longOutageChance = 0.30,  -- 30% chance the cycle triggers a long outage
    -- remaining 30% (1.0 - above) = chance of normal short burst

    idleMinMs  = 15000,  -- minimum time lights stay ON between pulses
    idleMaxMs  = 300000, -- maximum time lights stay ON between pulses
    ---------------------------------------------------------------------
    -- SHORT BURST (your existing blackout behavior)
    -- The system waits between idleMinMs–idleMaxMs with lights ON,
    -- then cuts the power for burstMinMs–burstMaxMs.
    ---------------------------------------------------------------------
    burstMinMs = 2500,   -- minimum blackout duration
    burstMaxMs = 35000,  -- maximum blackout duration

    ---------------------------------------------------------------------
    -- FLICKER SEQUENCE (rapid multiple ON/OFF pulses)
    -- This creates a chaotic lightning-induced flicker effect.
    ---------------------------------------------------------------------
    flickerCountMin   = 2,   -- minimum number of flickers per sequence
    flickerCountMax   = 6,   -- maximum number of flickers per sequence
    flickerOnMinMs    = 500, -- minimum blackout time per flicker pulse
    flickerOnMaxMs    = 750, -- maximum blackout time per flicker pulse
    flickerOffMinMs   = 120, -- minimum lights-ON time between flickers
    flickerOffMaxMs   = 600, -- maximum lights-ON time between flickers

    ---------------------------------------------------------------------
    -- LONG OUTAGE (extended full blackout)
    -- Used to simulate a major grid failure during extreme storms.
    ---------------------------------------------------------------------
    longOutageMinMs   = 55000, -- minimum duration of a long blackout
    longOutageMaxMs   = 300000, -- maximum duration of a long blackout
}

-- 🌦️ Weather
Config.Weather = {
    serverDuration = 14, -- How many hours will the server run before restarting?, if a server restarts every 8 hours put this to 9 etc.
    weatherCycletimer = 12, -- How many minutes between weather changes (Only works with static weather)
    timeBetweenRain = 30, -- How many minutes between rain events (Only works with static weather)
    rainAfterRestart = 25, -- How many minutes AFTER a server restart before rain will start to show?
    defaultForceGroundSnow = false, -- enables ground snow by default
    decemberSnow = false, -- if turned on means that only xmas will happen in december

    RainWeatherTypes = { -- Weather types that get added to time inbetween rain events
        "CLEARING",
        "RAIN",
        "THUNDER",
    },

    GroundSnow = {  -- Weather events that have ground snow on by default (this supports any weather type)
        SNOW       = false,
        SNOWLIGHT  = false,
        BLIZZARD   = false,
    },

    useStaticWeather = false,
    staticWeather = {
        ['EXTRASUNNY'] = 0.4, -- 40% chance
        ['CLEAR'] = 0.3, -- 20% chance
        ['CLOUDS'] = 0.1, -- 20% chance
        ['OVERCAST'] = 0.1,
        ['CLEARING'] = 0.01, -- 01% chance
        ['RAIN'] = 0.02,
        ['THUNDER'] = 0.02,
        ['FOGGY'] = 0.05,
        ['SMOG'] = 0.02,
        ['SNOW'] = 0.0,
        ['SNOWLIGHT'] = 0.0,
        ['BLIZZARD'] = 0.0, --0% chance (disabled)
        ['XMAS'] = 0.0,
        ['NEUTRAL'] = 0.0,
        ['HALLOWEEN'] = 0.0
    },

    useWeatherSequences = true,
    weatherSequences = {
        {
            probability = 0.25, -- 25%
            events = {
                { weather = 'CLEAR', time = {5, 10}, windSpeed = 0.1 },
                { weather = 'EXTRASUNNY', time = {6, 13}, windSpeed = 0.05,}
            },
        },
        { -- cloudy
            probability = 0.13, -- 13%
            events = {
                { weather = 'OVERCAST', time = {5, 10}, windSpeed = 0.1 },
                { weather = 'CLOUDS', time = {3, 10}, windSpeed = 0.05,}
            },
        },
        { -- foggy
            probability = 0.08, -- 8%
            events = {
                { weather = 'OVERCAST', time = {5, 10}, windSpeed = 0.1 },
                { weather = 'FOGGY', time = {6, 10}, windSpeed = 0.05 },
            },
        },
        { -- smog
            probability = 0.04, -- 4%
            events = {
                { weather = 'OVERCAST', time = {5, 10}, windSpeed = 0.1 },
                { weather = 'SMOG', time = {4, 10}, windSpeed = 0.05,}
            },
        },
        { -- snowing
            probability = 0.15, -- 30%
            month = {11, 12, 1, 2}, -- What month can there be snow?
            events = {
                { weather = 'OVERCAST', time = {5, 10}, windSpeed = 0.0 },
                { weather = 'SNOWLIGHT', time = {5, 10}, windSpeed = 0.1 },
                { weather = 'SNOWLIGHT', time = {3, 12}, windSpeed = 0.3 },
                { weather = 'OVERCAST', time = {3, 7}, windSpeed = 0.0 },
                { weather = 'CLOUDS', time = {3, 7}, windSpeed = 0.0 },
            },
        },
        { -- snowstorm
            probability = 0.15, -- 30%
            windDirection = 120.0, -- Storms come from the south
            month = 12, -- What month can there be snow?
            events = {
                { weather = 'OVERCAST', time = {5, 10}, windSpeed = 0.5 },
                { weather = 'SNOWLIGHT', time = {7, 18}, windSpeed = 1.0 },
                { weather = 'SNOWLIGHT', time = {8, 20}, windSpeed = 1.0, hasSnow = true },
                { weather = 'OVERCAST', time = {5, 10}, windSpeed = 0.5, hasSnow = true },
                { weather = 'CLOUDS', time = {5, 10}, windSpeed = 0.5, hasSnow = true },
                { weather = 'CLEAR', time = {5, 10}, windSpeed = 0.5, hasSnow = true },
                { weather = 'EXTRASUNNY', time = {5, 10}, windSpeed = 0.5 },
            },
        },
        { -- rainshower
            probability = 0.02, -- 2%
            windDirection = 240.0, -- Storms come from the south
            events = {
                { weather = 'CLOUDS', time = {3, 7}, windSpeed = 0.5 },
                { weather = 'OVERCAST', time = {3, 7}, windSpeed = 1.0 },
                { weather = 'RAIN', time = {5, 10}, windSpeed = 2.0 },
                { weather = 'CLEARING', time = {3, 7}, windSpeed = 1.0 },
                { weather = 'EXTRASUNNY', time = {5, 10}, windSpeed = 0.0 },
            },
        },
        { -- rainstorm
            probability = 0.02, -- 2%
            windDirection = 280.0, -- Storms come from the south
            events = {
                { weather = 'CLOUDS', time = {3, 7}, windSpeed = 0.5 },
                { weather = 'OVERCAST', time = {3, 7}, windSpeed = 1.0 },
                { weather = 'RAIN', time = {5, 10}, windSpeed = 3.5 },
                { weather = 'CLEARING', time = {3, 7}, windSpeed = 1.5 },
            },
        },
        { -- smallstorm
            probability = 0.02, -- 2%
            windDirection = 120.0, -- Storms come from the south
            events = {
                { weather = 'CLOUDS', time = {3, 7}, windSpeed = 0.5 },
                { weather = 'RAIN', time = {3, 7}, windSpeed = 1.0 },
                { weather = 'THUNDER', time = {3, 7}, windSpeed = 3.0 },
                { weather = 'RAIN', time = {5, 10}, windSpeed = 2.0 },
                { weather = 'CLEARING', time = {3, 7}, windSpeed = 1.0 },
                { weather = 'EXTRASUNNY', time = {5, 10}, windSpeed = 0.5 },
            },
        },
        { -- bigstorm
            probability = 0.02, -- 2%
            windDirection = 180.0, -- Storms come from the south
            events = {
                { weather = 'OVERCAST', time = {3, 7}, windSpeed = 4.0 },
                { weather = 'RAIN', time = {3, 7}, windSpeed = 8.0 },
                { weather = 'THUNDER', time = {3, 7}, windSpeed = 12.0 },
                { weather = 'RAIN', time = {3, 7}, windSpeed = 12.0 },
                { weather = 'THUNDER', time = {3, 7}, windSpeed = 12.0 },
                { weather = 'CLEARING', time = {3, 7}, windSpeed = 3.0 },
                { weather = 'EXTRASUNNY', time = {3, 7}, windSpeed = 0.0 },
            },
        },
        { -- Megastorm
            probability = 0.005,
            windDirection = 180.0, -- Storms come from the south
            events = {
                { weather = 'RAIN', time = {2, 7}, windSpeed = 8.0 },
                { weather = 'MEGASTORM', time = {8, 18}, windSpeed = 30.0 },
                { weather = 'THUNDER', time = {2, 6}, windSpeed = 12.0 },
            },
        },
    }
}
```
