CityRP Documentation Repository

cityrp.weed

Weed growing: client bootstrap + market sync.

Functions

Sharedcityrp.weed.ApplyWetInventoryRot(quality, harvestedAt) → number, numberSource ☍

Applies inventory rot to a wet-bud quality given when it was harvested. Same shape as overripe plant bleed: grace window, then points lost per minute.

Parameters

  • qualitynumberBase quality 0-100.
  • harvestedAtnumber?Unix timestamp from wet_bud meta.

Returns

  1. 1numberRot-adjusted quality.
  2. 2numberPoints lost to rot (0 if still in grace).
Sharedcityrp.weed.CanPotGrow(pot) → boolean, (string|Entity)?Source ☍

Returns whether a pot is allowed to grow at its current position.

Parameters

Returns

  1. 1boolean
  2. 2(string|Entity)?
Servercityrp.weed.ConsumeBaggedForCook(ply, amount) → boolean, number?, string?Source ☍

Consumes bagged weed for cooking, worst-quality first. Returns weighted average quality and majority strain among units taken (ties broken by first stack encountered).

Parameters

  • plyPlayer
  • amountnumberUnits to remove.

Returns

  1. 1boolean
  2. 2number?Averaged quality (nil if failed).
  3. 3string?Majority strain id.
Sharedcityrp.weed.CountPotsInTent(tent) → numberSource ☍

Counts weed pots currently within radius of a tent.

Parameters

Returns

  1. number
Servercityrp.weed.DetachTentMounts(tent)Source ☍

Releases parented pot/UV from a tent without deleting them (e.g. tent destroyed).

Parameters

Servercityrp.weed.DumpMarketToChat(ply)Source ☍

Dumps today's rolled weed market to the caller's chat (beta debug helper).

Parameters

Sharedcityrp.weed.FindNearestTent(pot) → Entity?Source ☍

Finds the nearest grow tent within TentRadius of the pot (nil if none). Prefers an active weld mount over distance.

Parameters

Returns

  1. Entity?
Sharedcityrp.weed.FormatDemandMult(mult) → stringSource ☍

Formats a demand multiplier for UI (e.g. "1.10× (+10%)").

Parameters

  • multnumber

Returns

  1. string
Sharedcityrp.weed.GetBaseUnitPrice(quality) → numberSource ☍

Quality-only unit price (no strain demand) — what Stormzy calls the "usual cut".

Parameters

  • qualitynumber?Quality 0-100.

Returns

  1. number
Sharedcityrp.weed.GetBrowniePrice(quality, strainId) → numberSource ☍

Stormzy unit price for one pot brownie (quality + strain demand, premium over bagged weed). Uses the same demand curve as bagged weed. Legacy (no quality) prices as ~40% quality.

Parameters

  • qualitynumber?Quality 0-100.
  • strainIdstring?Strain id.

Returns

  1. number
Sharedcityrp.weed.GetDemandMultiplier(strainId) → numberSource ☍

Parameters

  • strainIdstring?

Returns

  1. number
Sharedcityrp.weed.GetDemandPitch(plyName) → stringSource ☍

In-character blurb about hidden daily demand (no strain names).

Parameters

  • plyNamestring?

Returns

  1. string
Servercityrp.weed.GetLawDestroyer(dmg) → Player?Source ☍

Resolves the law-enforcement player who dealt the killing damage (ram FireBullets path).

Parameters

Returns

  1. Player?
Sharedcityrp.weed.GetLocalBaggedBatches() → table[]Source ☍

Client-side: lists bagged weed batches with quality, strain and price breakdown for the sell UI.

Returns

  1. table[]{ metaKey, amount, quality, strain, basePrice, demandMult?, unitPrice?, demandKnown, hot }
Sharedcityrp.weed.GetLocalBaggedTotal() → numberSource ☍

Client-side: sums bagged weed across every meta stack in the local inventory mirror.

Returns

  1. number
Sharedcityrp.weed.GetLocalBrownieBatches() → table[]Source ☍

Client-side: lists pot brownie batches with quality, strain and price breakdown for the sell UI.

Returns

  1. table[]{ metaKey, amount, quality, strain, basePrice, demandMult?, unitPrice?, demandKnown, hot }
Sharedcityrp.weed.GetLocalBrownieTotal() → numberSource ☍

Client-side: sums pot brownies across every meta stack in the local inventory mirror.

Returns

  1. number
Sharedcityrp.weed.GetMoistureBand() → number, numberSource ☍

Today's ideal moisture band (server roll). Clients never receive this.

Returns

  1. 1number
  2. 2number
Sharedcityrp.weed.GetPlantStartMoisture() → numberSource ☍

Moisture a newly planted pot starts at: the top of today's ideal band. A fixed 55 started floor-band days above the HQ window after the grace expired.

Returns

  1. number
Sharedcityrp.weed.GetPotTent(pot) → boolean, Entity?Source ☍

Returns the tent a pot is currently near (live distance check).

Parameters

Returns

  1. 1boolean
  2. 2Entity?
Sharedcityrp.weed.GetSeedItemID(strainId) → stringSource ☍

Parameters

  • strainIdstring?

Returns

  1. string
Sharedcityrp.weed.GetStrainByIndex(index) → stringSource ☍

Parameters

  • indexnumber

Returns

  1. string
Sharedcityrp.weed.GetStrainIndex(strainId) → numberSource ☍

@return — 1-based index into StrainOrder

Parameters

  • strainIdstring?

Returns

  1. number1-based index into StrainOrder
Sharedcityrp.weed.GetStrainName(strainId) → stringSource ☍

Parameters

  • strainIdstring?

Returns

  1. string
Sharedcityrp.weed.GetTotalBagged(ply) → numberSource ☍

Sums bagged weed across every meta stack (GetInvAmount without meta only sees "0").

Parameters

Returns

  1. number
Sharedcityrp.weed.GetTotalBrownies(ply) → numberSource ☍

Sums pot brownies across every meta stack.

Parameters

Returns

  1. number
Sharedcityrp.weed.GetUnitPrice(quality, strainId) → numberSource ☍

Stormzy unit price for bagged weed (quality² base × today's strain demand).

Parameters

  • qualitynumber?Quality 0-100.
  • strainIdstring?Strain id.

Returns

  1. number
Sharedcityrp.weed.IsDemandRevealed(strainId, ply) → booleanSource ☍

Whether this client (or the given player, server-side) has unlocked today's demand for a strain.

Parameters

  • strainIdstring?
  • plyPlayer?Server-only; ignored on client.

Returns

  1. boolean
Sharedcityrp.weed.IsGrowEquipmentItem(itemId) → booleanSource ☍

True if this inventory id is grow gear / a strain seed (event passivemode, etc.). Does not include bagged weed, buds, baggies, or brownies (those can still be sold/used).

Parameters

  • itemIdstring?

Returns

  1. boolean
Sharedcityrp.weed.IsHotStrain(strainId) → booleanSource ☍

Parameters

  • strainIdstring?

Returns

  1. boolean
Sharedcityrp.weed.IsPotNearTent(pot, tent) → booleanSource ☍

Returns whether a pot is within TentRadius of a tent (or welded into it).

Parameters

Returns

  1. boolean
Sharedcityrp.weed.IsValidStrain(strainId) → booleanSource ☍

Parameters

  • strainIdstring?

Returns

  1. boolean
Sharedcityrp.weed.MarkPotInTent(tent, pot)Source ☍

Marks a pot as inside a tent (membership cache + networked InTent).

Parameters

Sharedcityrp.weed.MarkPotLeftTent(tent, pot)Source ☍

Clears tent membership when a pot leaves proximity.

Parameters

Sharedcityrp.weed.NormalizeStrain(strainId) → stringSource ☍

Parameters

  • strainIdstring?

Returns

  1. string
Sharedcityrp.weed.Notify(ply, key, msg, ntype, cooldown) → booleanSource ☍

Cooldown-gated player notify for weed interactions (stops E-spam).

Parameters

  • plyPlayer
  • keystringCooldown bucket (e.g. "pot_use").
  • msgstring
  • ntypenumber?NOTIFY_*
  • cooldownnumber?Seconds (default 2).

Returns

  1. boolean
Servercityrp.weed.PayLawDestroyBonus(dmg, ent, kind)Source ☍

Pays a small destroy bonus to LE for active weed gear (mirrors playerDestroyContraband pay-out).

kind:
    | "pot"
    | "rack"

Parameters

Servercityrp.weed.PickupTentWithMounts(tent, ply) → boolean, string?Source ☍

Inventories mounted pot + UV with the tent (validates plant / ownership).

Parameters

Returns

  1. 1boolean
  2. 2string?
Sharedcityrp.weed.PlaceStubOnFloor(ent)Source ☍

Lifts a mid-origin stub prop so its bounding box sits on the spawn point instead of in the floor.

Parameters

Sharedcityrp.weed.PollTentMembership()Source ☍

Polls all pots against tent proximity (also covers unwelded pots near a tent).

Servercityrp.weed.RemountPotAfterModelChange(pot)Source ☍

Re-parents a pot after SetModel (physics recreate). Uses stored local pose.

Parameters

Sharedcityrp.weed.ResyncPotTent(pot)Source ☍

Syncs one pot's tent membership from mount / distance (used by the 1s poll and drops).

Parameters

Servercityrp.weed.RevealDemand(ply, strainId) → booleanSource ☍

Marks a strain's demand as known for this player today and resyncs their client market. Persists across reconnect (SteamID table); cleared on RollMarket / map change.

Parameters

Returns

  1. boolean
Servercityrp.weed.RollMarket()Source ☍

Rolls today's hot strain, hidden demand multipliers, and moisture ideal band. One hot strain at HotStrainMultiplier, one soft strain at DemandMultMin, the rest 1×. Mirrors meth: once per map/plugin load (not calendar day, not in-game day).

Servercityrp.weed.SyncMarket(ply)Source ☍

Sends per-player revealed demand multipliers only (0 = still unknown). Moisture band and unrevealed mults stay server-only.

Parameters

Servercityrp.weed.TryMountPot(tent, pot) → booleanSource ☍

Tries to mount a pot into the tent floor (one pot per tent).

Parameters

Returns

  1. boolean
Servercityrp.weed.TryMountUV(tent, light) → booleanSource ☍

Tries to mount a UV light onto the tent ceiling (one light per tent).

Parameters

Returns

  1. boolean
Servercityrp.weed.TryPlantSeed(pot, seed) → booleanSource ☍

Attempts to plant a seed entity into a mounted plantable pot. Used when pot Touch is unavailable (SetParent children often skip world collision).

Parameters

Returns

  1. boolean

Tables

Sharedcityrp.weed.ConfigSource ☍

Tunables for the weed grow / process / sell loop.

Clientcityrp.weed.MarketSource ☍
Sharedcityrp.weed.StrainOrderSource ☍

Ordered strain ids for stable iteration / net sync.

Sharedcityrp.weed.StrainsSource ☍

Strain catalogue (stable ids for items / meta / market rolls).

Classes

Sharedcityrp.weed.ConfigSource ☍

Tunables for the weed grow / process / sell loop.

Fields

Sharedcityrp.weed.DemandRevealedSource ☍

SteamID → { [strainId] = true }. Cleared on RollMarket (map/plugin load).