Studios
Drugshouse-3.jpg

Examples

SoonDrugsQbox
PAGE 04 OF 07  ·  CONFIGURATION → EXAMPLES → TROUBLESHOOTINGdocs.glitchstudios.dev
Browse docs

Turn a feature off#

Set these in shared/config.lua and shared/lab.lua:

Config.Lab.enabled = false        -- no grow labs
Config.Gummies.enabled = false    -- no gummies
Config.CocaField.enabled = false  -- no coca field
Config.WeedShop.enabled = false   -- no starter shop
Config.EnableDrugs = false        -- no drug effects

Keep planting out of a city box#

Config.NoPlantAreas = {
    { min = vec2(-2200.0, -3600.0), max = vec2(1800.0, 900.0) },
}

Allow another ground type#

Stand on the ground, run /getGroundHash, and add the number to the list:

Config.AllowedGrounds = {
    1109728704, -1942898710, 510490462,
    -123456789, -- your new hash
}

Move the coke lab#

Stand where each station should go and run /cokelab. The positions are saved to data/lab.json and data/field.json, and from then on those files win over the config. The lab centre is the middle of the three stations, so the Cartel's riddle, the lab-found check, raid alerts and the tablet map move with them. Delete a file to go back to the config.

Run without the other Glitch resources#

With none of the optional resources installed, these defaults keep the whole chain reachable:

Config.Fallbacks = {
    trust      = 100,   -- contact trust
    meetCartel = true,  -- anyone may meet the Cartel
    seedLevels = false, -- seed level gates ignored
    minigame   = { difficulty = { 'easy', 'medium', 'medium' }, keys = { 'e' } },
}

Change a seed's price and add a level gate#

-- in Config.Contacts.botanist.seeds
{ item = 'weed_skunk_seed', price = 25 },

-- Config.SeedLevels (needs glitch-xpSystem)
Config.SeedLevels['weed_skunk_seed'] = 2

Read the grow labs from another resource#

local labs = exports['glitch-drugs']:GetGrowLabs()
for _, lab in ipairs(labs) do
    print(lab.id, lab.site, lab.owner, lab.beds, lab.growing, lab.ready, lab.raided)
end

Read the coke lab and field positions#

local places = exports['glitch-drugs']:GetTabletPlaces()
for _, p in ipairs(places) do
    print(p.id, p.label, p.kind, p.coords, p.radius)
end

Dialogue with rc-interactions#

Import rc-interactions/glitch_drug_contacts.json in /interactioneditor and press Save. With Config.Interactions.useRcInteractions = true, talking to a contact runs the flow first, and its shop choice fires the glitch-drugs:rc:shop event node to open the trade menu. Without rc-interactions or the flow, the menu opens straight away.

How it works#

Outdoor plants#

The server owns every plant. Each is a networked prop created by the server in the routing bucket it was planted in, so late joiners see it too. A client only gets the data of its own plants and of the plant it is standing next to, and is not told who owns someone else's plant.

Every minute the server drains water and fertilizer, updates health, swaps props when a plant reaches its next stage, runs the genetics crossing and writes all changed plants in one batched query. The values are also saved when the resource stops.

A harvest has to come after the player inspected the plant and waited out the progress bar. A plant is taken off the list before the buds are handed out, so a second harvest or a burn of the same plant finds nothing. Planting goes through only after the server saw the seed or cutting used from the inventory and the planting bar had time to run. The spot is reserved until the database row is written, and the seed and any required items are refunded if the insert fails.

Using drugs#

The server records who is high until when, and each drug's cooldown per player. The client is asked too, with a five second timeout, but its answer can only refuse a use. Stress relief is applied by the server through the player's stress state bag (Bridge.RelieveStress in bridge/server.lua). Change that function if your framework keeps stress somewhere else.

Grow labs#

The simulation runs every minute and writes changed labs once per tick. Anything that moves money or items, such as rent, bills, upgrades, loading the hopper, collecting to the stash and contracts, writes that lab straight away.