Configuration

9 min readUpdated 2 weeks ago

Overview

  • shared/config.lua: language, theme, limits, growth, ground rules, streaming, plant panel, skills, battlepass and logs
  • shared/zones.lua: growth zones with multipliers and blips
  • shared/data/props.lua: prop models offered in the plant editor
  • server/config_server.lua: Discord webhooks

Plant types, categories, seed items and growth settings live in the database and are edited from the admin panel.

General

shared/config.lua
1Config.Language = 'en'
2Config.Debug = false
3Config.Theme = 'default'
4Config.AdminCommand = 'plantadmin'
5Config.Admin.MinimizeKey = 'F9'
6Config.GlobalGrowTime = 30
7Config.SeedDefaultPlants = true
  • Language: language file loaded from the locales/ folder
  • Debug: prints extra console output
  • Theme: theme of the plant panels in the world. 'default', 'wasteland', 'cyberpunk', 'noir' or 'fantasy'
  • AdminCommand: opens the admin panel. Admin permission required
  • MinimizeKey: hides and restores the admin panel. F1 to F12, or a single letter or digit
  • GlobalGrowTime: base grow time in minutes. Each plant type can set its own
  • SeedDefaultPlants: on the first start, fills the panel with example plants (cannabis and coca). They never come back once any plant type exists. false starts with the default categories only

UI Theme

shared/config.lua
1Config.UITheme = {
2    preset = nil,
3    colors = {
4        primary = nil,
5        accent = nil,
6        background = nil,
7        surface = nil,
8        text = nil,
9    },
10}
  • preset: theme preset of the admin panel. nil follows the shared theme set in ml_bridge
  • colors: CSS hex values for single colors. Any nil value follows the shared theme

Limits and Placement

shared/config.lua
1Config.PlayerPlantLimit = 10
2Config.PlantLimitOverrides = {}
3Config.PlantDistance = 1.5
4Config.PlantDistanceOverrides = {}
5Config.RayCastDistance = 7.0
6Config.DefaultSharedInteraction = true
  • PlayerPlantLimit: plants one player can have at once
  • PlantLimitOverrides: a lower limit per seed item, such as ['weed_seed'] = 4. PlayerPlantLimit is checked first, so an override cannot raise it. A limit set on the plant type or its category in the panel wins over this table
  • PlantDistance: smallest distance in meters between two plants
  • PlantDistanceOverrides: a wider spacing per seed item, such as ['weed_seed'] = 2.0. The server always checks PlantDistance as well, so a value below it has no effect
  • RayCastDistance: how far from the player a plant can be placed. The server checks the same distance
  • DefaultSharedInteraction: used when a plant type or category has no rule of its own. true lets any nearby player water and harvest, false only the owner and admins

Growth

shared/config.lua
1Config.HealthBaseDecay = { 7, 10 }
2Config.WaterDecay = 1.0
3Config.FertilizerDecay = 0.7
4Config.WaterThreshold = 10
5Config.FireTime = 5000
6Config.DeadPlantTimeout = 10
  • HealthBaseDecay: health lost per minute while water is at or below WaterThreshold, a random value between the two numbers
  • WaterDecay: water lost per minute. It runs on real time, so plants dry out while the server is down too
  • FertilizerDecay: fertilizer lost per minute. Only the part above 50 speeds growth up
  • WaterThreshold: water level at or below which the plant loses health. At 0 the damage doubles and growth stops
  • FireTime: milliseconds of the fire when a plant is burned
  • DeadPlantTimeout: minutes before a dead plant is removed. 0 removes it at once

Ground Rules

shared/config.lua
1Config.OnlyAllowedGrounds = false
2Config.AllowedGrounds = {
3    1333033863,
4    -1885547121,
5    -700658213,
6}
  • OnlyAllowedGrounds: true allows planting only on the surfaces in AllowedGrounds
  • AllowedGrounds: ground material hashes. The shipped list covers grass, bushes, sand, dirt, gravel, mud, soil, clay, leaves, woodchips and marsh
  • Config.GroundMaterials: names and hashes of the materials offered in the editor

Plant types and categories can carry their own surface list in the admin panel, which wins over the global rule.

Streaming

shared/config.lua
1Config.ChunkSize = 100.0
2Config.StreamRadius = 150.0
3Config.StreamOutRadius = 200.0
4Config.MaxPropsPerFrame = 3
5Config.PlantInteractionRadius = 1.0
  • ChunkSize: size in meters of the map chunks plants are grouped in
  • StreamRadius: plants within this distance are loaded for the player
  • StreamOutRadius: plants beyond this distance are removed. Keep it larger than StreamRadius
  • MaxPropsPerFrame: plant props spawned per frame while loading
  • PlantInteractionRadius: radius of the interaction zone of each plant

Plant Panel

A panel drawn in the world on the plants: a small badge on the plants around the player, and a full readout with keys on the closest one. It is off by default. When on, it replaces the target option with keys.

shared/config.lua
1Config.PlantPanel = {
2    Enabled          = false,
3    Style            = 'minimal',
4    MiniDistance     = 25.0,
5    FullDistance     = 3.0,
6    MaxMiniSurfaces  = 6,
7    OcclusionCheck   = true,
8    RefreshMs        = 3000,
9    MiniScale        = 0.045,
10    FullScale        = 0.14,
11    HeightOffset     = 0.7,
12    DestroyHoldMs    = 1500,
13    Keys = {
14        Water     = { control = 38, label = 'E', also = { 51 } },
15        Fertilize = { control = 47, label = 'G' },
16        Harvest   = { control = 74, label = 'H' },
17        CycleItem = { control = 73, label = 'X' },
18        Destroy   = { control = 45, label = 'R', also = { 140, 263 } },
19    },
20}
  • Enabled: true replaces the target option with the panel and its keys
  • Style: 'minimal' is white and transparent, 'themed' uses Config.Theme
  • MiniDistance: meters at which the badge appears
  • FullDistance: meters at which the closest plant shows the full panel
  • MaxMiniSurfaces: plants that can show a badge at once, closest first
  • OcclusionCheck: hides the panel of plants behind walls or terrain
  • RefreshMs: milliseconds between two updates of water and growth
  • MiniScale, FullScale: width of the badge and the panel as a share of the screen. Larger values blur the text
  • HeightOffset: height above the base of the plant. It stays the same at every growth stage
  • DestroyHoldMs: milliseconds the destroy key must be held
  • Keys: control is the FiveM control ID, label the key shown on the panel. also lists other controls bound to the same key, which are blocked while the panel is up. Change both when you rebind an action

Skills

shared/config.lua
1Config.ExternalSkills = {
2    Enabled = true,
3    Resource = 'ml_skills',
4    XpMultiplier = 1.0,
5    MaxXpPerHarvest = 500,
6}
  • Enabled: false ignores every skill requirement and gives no XP
  • Resource: name of the skills resource
  • XpMultiplier: multiplier on every XP reward
  • MaxXpPerHarvest: highest XP of one award after the multipliers, for planting, watering, fertilizing and harvesting alike. 0 for no limit

Requirements and XP are set in the plant editor under Skill Integration, with one tab each for Plant, Water, Fertilize and Harvest. Each tab has a required skill and minimum level, and an XP reward with its skill or category. Harvest XP grows with the plant health and the zone yield. Categories carry the same block, and a plant type uses its category unless its own Override is on.

Skills Are Optional

With ml_skills stopped or Enabled = false, every requirement passes and no XP is given. Plants never become unplantable because of it.

Battlepass

shared/config.lua
1Config.Battlepass = { Enabled = true }
  • Enabled: with ml_battlepass running, harvests advance battlepass objectives. false turns it off. Without ml_battlepass this setting does nothing

Animations

shared/config.lua
1Config.AnimationsList = {
2    { label = 'Plant (Kneel)', anim = 'base', dict = 'amb@medic@standing@kneel@base' },
3}
4
5Config.CareAnimations = {
6    {
7        label = 'Watering can',
8        dict = 'missfbi3_waterboard', anim = 'waterboard_loop_player', flag = 1,
9        prop = 'prop_wateringcan', bone = 18905,
10        offset = { x = 0.19, y = -0.2, z = -0.11 }, rotation = { x = 257.5, y = -284.65, z = -18.5 },
11    },
12}
  • AnimationsList: planting and harvest animations offered in the editor
  • CareAnimations: watering and fertilizing animations offered in the editor. prop, bone, offset and rotation attach a prop to the hand

Growth Zones

Zones make plants grow faster and yield more. Add them in shared/zones.lua or draw them in the admin panel. Zones in the file are written to the database on every start and replace a zone with the same ID. Zones made in the panel stay.

shared/zones.lua
1Config.Zones = {
2    ['weed_zone_one'] = {
3        points = {
4            vec3(2031.0, 4853.0, 43.0),
5            vec3(2007.0, 4877.0, 43.0),
6            vec3(1981.0, 4903.0, 43.0),
7        },
8        thickness = 4.0,
9        growMultiplier = 2.0,
10        yieldMultiplier = 1.0,
11        allowlist = {},
12        blocklist = {},
13        plantLimitOverride = nil,
14        blip = {
15            display = true,
16            sprite = 469,
17            color = 2,
18            text = 'Cannabis Zone',
19        },
20    },
21}
  • points, thickness: corners and height of the zone
  • growMultiplier: growth speed inside the zone. 2.0 is twice as fast
  • yieldMultiplier: multiplier on harvested amounts
  • allowlist, blocklist: seeds allowed or refused in the zone
  • plantLimitOverride: highest number of plants in the zone
  • healthDecayMult, waterDecayMult, fertDecayMult: optional multipliers on health, water and fertilizer loss inside the zone
  • blip: map blip. display = false hides it

Logs

shared/config.lua
1Config.Log = {
2    Plant        = true,
3    Water        = true,
4    Fertilize    = true,
5    Harvest      = true,
6    Destroy      = true,
7    AdminDestroy = true,
8    Death        = true,
9    AdminPanel   = true,
10    AdminConfig  = true,
11}
  • Each key turns one log on or off: planting, watering, fertilizing, harvests with the full reward list, a player burning their own plant, an admin destroying a plant, plants dying, an admin opening the panel, and admin edits of plant types, categories and zones
server/config_server.lua
1ServerConfig.DiscordWebhook = {
2    Default      = '',
3    Plant        = '',
4    Water        = '',
5    Fertilize    = '',
6    Harvest      = '',
7    Destroy      = '',
8    Death        = '',
9    AdminDestroy = '',
10    AdminPanel   = '',
11    AdminConfig  = '',
12    AntiExploit  = '',
13}
  • Each key is the webhook of one action from Config.Log. AntiExploit logs failed server checks
  • Default: used for every action whose own webhook is empty

Leave an action and Default both empty to skip that log.

Item Usage

The plant editor sets what happens to items in two places.

  • Harvest tools work the same way on the harvest: Check Only, Consume or Degrade
  • Required items are the tools needed to plant the seed. Each one is Check Only (must be carried, nothing taken), Consume (taken when the seed goes in) or Degrade (loses durability, with an option to remove it at zero)
  • Water and fertilizer items each have a Consume item on use switch. On, the item is taken and an optional Return item is given back. Off, the item is only checked
Reusable Tools

Leave the switch off for a watering can or any tool players keep. Turn it on for a water bottle or a bag of fertilizer.