Skip to content

np_gangs + np_drugs ​

np_gangs and np_drugs are two resources that work alone and fit together without depending on each other. The rule is simple:

  • np_drugs announces facts. It owns the product, the high, production and every sale. It offers hooks (questions other resources may answer) and fires events (things that happened). It has no gang code and does not know np_gangs exists.
  • np_gangs answers through hooks. It carries one adapter file, integrations/np_drugs.lua, that registers np_drugs' hooks, listens to its events and calls a few of its exports. The adapter only runs while np_drugs is started.

Neither is a dependency of the other. Start them in any order: np_gangs attaches when np_drugs starts (or fires np_drugs:server:ready after a restart, when hooks have to be registered again) and detaches when it stops.

The corner shift: np_gangs' screen, np_drugs' sale

Who owns what ​

Topic np_drugs np_gangs
Product Batches, purity, grades, cuts, portions, concealment, trunk wear –
Production Labs, the six lines, purity, waste, smell, power, receipts Lab slots per turf, permits, supply lines, the permit share of the yield
Stamps Reputation per stamp id, the batch table where stamps are pressed Supplies the gang stamp gang:<id> (its tag, in its bandana colour)
Selling The sale itself: item removal, payment, reputation, the sold event Corners, shifts, turf prices, the split, the outsider rule, grip per sale
Police Searches, K9s, tests, evidence, witness reports, the dispatch adapter Corner heat; patrols and raids sent through np_drugs' Dispatch; the bandana colour in witness reports
The body Everything –

The seam ​

np_drugs offers Kind np_gangs does with it
stampSource Hook Adds the gang stamp to the stamps a member wearing the bandana may press at the batch table
beforeSale Hook Sets the turf price, applies the outsider rule (alert, tax, forbid), names the payees (seller, crew, stash:<back room>). A preview = true call is a quote and is answered the same way with no side effects
beforeProduce Hook Checks lab slots and permits in the turf, takes the permit share of the yield
describe Hook Adds the bandana colour as a row to np_drugs' witness reports about a member in colours
GetPrice Export Dollars on the corner card and the trade board from the first customer on
GetLabs, GetProductionLines, GetSubstances Exports Lab rows on the trade board, supply lines, units and portions
Dispatch Export Patrols and raids at corner heat, kind corner, the turf and the colour as rows
sold Event Counts grip, raises heat on the corner, alerts on a rival stamp, fills the back room
badBatch Event Lowers the owners' mood in protected shops, keeps regulars away, shows on the trade board
seized Event Raises police attention on the turf
produced, labStarted, labStopped Events Re-reads the labs for the trade board
ready Event Registers the hooks again after np_drugs restarted

The adapter also reads GetItemInfo, GetSellable, GetStampReputation and GetDemand (what a seller carries, the word on the stamp, an area's demand). The stamp's reputation is kept in np_drugs under the id gang:<id>; np_gangs only reads it. np_drugs' default Config.TrustedResources lists np_gangs, the resources allowed to ask GetItemInfo about the contents of concealed items. Every name above is in np_drugs' Exports & hooks and Events; the adapter's declared exports are checked against np_drugs' code by np_gangs' test suite.

A sale on a corner, step by step ​

  1. A member in colours starts Work the corner in np_gangs' street menu. np_gangs runs the shift: customers, lookout, runner, the drop, heat.
  2. The seller serves a customer. np_gangs calls exports.np_drugs:Sell(src, { slot, count, channel = 'corner' }).
  3. np_drugs runs its beforeSale hooks. np_gangs' hook answers with the turf price multiplier and the payees (seller 20 %, crew 10 %, back room 70 % by default).
  4. np_drugs removes the item, pays the payees in dirty cash (the back room's share straight into its stash), moves the stamp's reputation and fires np_drugs:server:sold.
  5. np_gangs hears sold: grip for the gang, heat on the corner, an alert if a rival stamp was sold in its turf. Past the heat line it calls np_drugs' Dispatch, and a witness delay later the police get a call that names a colour.

A non-member selling in a gang's turf through np_drugs' own street sale goes through the same beforeSale hook: the gang's outsider rule taxes or forbids it, and the gang hears about it.

What each does alone ​

np_drugs without np_gangs np_gangs without np_drugs
Stamps Personal dealer stamps only (dealer:<character>) –
Selling The basic street sale to passers-by No corner row in the street menu
Labs Wherever Config.Production.sites allows No lab rows, no permits, no supply lines
Grip – Spray walls and paying shops only
Trade board – Not shown at Lester's
Editor – No np_drugs tool (demand per turf, lookout spots)

With np_gangs running, np_drugs' basic street sale steps aside (Config.Street.disableWith = { 'np_gangs' } in np_drugs) and the corners replace it. Set it to {} to keep both.

Switching it off ​

  • In np_gangs: Config.Drugs.enabled = false (or Config.Integrations.np_drugs = false). Also on np_admin's settings page Gangs → np_drugs (restart).
  • Limits the OG may choose (split, outsider rules and tax, price range, production mode, permit share) are server settings in np_gangs: Configuration → np_drugs.
  • Everything about the sale itself (price ceiling, demand areas, items per sale) stays in np_drugs: Configuration.

Other resources ​

The same hooks are open to any resource: a different gang or territory script can answer stampSource, beforeSale and beforeProduce in the same way. Register them after np_drugs:server:ready.