module Base
{
	/* Chemistry-gated meth cook (M1). Quality, yield and botch are decided at craft time
	   by KNXDrugs.onCookMeth(items, result, player) from the crafter's Chemistry level -
	   see lua/shared/KNXDrugs_Cook.lua. The OnCreate signature (items, result, player) is
	   copied from vanilla Traps/TrapRecipeCode.lua. SkillRequired/xpAward on a custom perk
	   is the same proven pattern as KNXSkills' KNXDisinfectRagCareful.

	   STANDALONE NOTE: the Chemistry perk comes from BADLANDS Skills (KNXSkills). With that
	   mod absent the recipe is inert (perk unresolved) and meth stays loot-only; the rest of
	   BADLANDS Drugs is unaffected.

	   STATION (0.9.0): Tags = KNXCookLab binds this recipe to the Glassware Rig
	   (entities/knx_cooklab.txt, CraftBench Recipes = KNXCookLab). It no longer
	   appears in the hand-craft menu; a player cooks standing at a rig. Same
	   pairing vanilla uses for the grindstone. */
	craftRecipe CookMethBatch
	{
		time = 600,
		timedAction = Making_Surface,
		Tags = KNXCookLab,
		category = Cooking,
		SkillRequired = Chemistry:3,
		AutoLearnAll = Chemistry:3,
		xpAward = Chemistry:8,
		OnCreate = KNXDrugs.onCookMeth,
		inputs
		{
			item 2 [Base.Pills] mode:destroy,
			item 1 [Base.LighterFluid] mode:destroy,
			item 1 [Base.Battery] mode:destroy,
		}
		outputs
		{
			item 1 Base.MethBaggie,
		}
	}

	/* Vanilla Base.SuspiciousPackage is a Memento brick with no use. It already spawns in
	   DrugLabGuns/Money/Outfit/Supplies, DrugShackDrugs, PoliceEvidence (weight 10) and on
	   Outfit_Mob zombies, so it is the natural wholesale unit. Shape copied from vanilla
	   OpenBox100 (recipes_packing.txt). Crafting resolves server-side in MP, so no custom
	   client command is needed for the 50-item grant. */
	craftRecipe OpenSuspiciousPackage
	{
		timedAction = UnPackBox_Small,
		time = 40,
		Tags = InHandCraft;Packing;CanBeDoneInDark,
		category = Packing,
		inputs
		{
			item 1 [Base.SuspiciousPackage] mode:destroy flags[AllowFavorite;InheritFavorite],
		}
		outputs
		{
			item 50 Base.MethBaggie,
		}
	}

	/* ---- Glassware Rig lab work (0.9.0) -------------------------------------------------
	   All three are bound to the rig (Tags = KNXCookLab, the rig's CraftBench tag) and train
	   Chemistry through xpAward. They give the lab a reason to exist for players who never
	   cook, and a route to Chemistry 3 at the same bench.
	   Fluid inputs use vanilla's shape (DisinfectRag): "item 1 [*]" names any container,
	   the "-fluid" line under it takes that much of the named fluid out of it. Bleach and
	   CleaningLiquid are the fluids inside Base.Bleach / Base.CleaningLiquid2.
	   Drainables (baking soda) count in uses. Vanilla ids and fluids verified in pz-bible. */

	/* Practice at Chemistry 0: a bench titration that makes nothing. The reagents are the cost
	   and the only brake - no skill gate, no cooldown - so it is paid-for training. */
	craftRecipe KNXLabTitration
	{
		timedAction = Making_Surface,
		time = 120,
		Tags = KNXCookLab,
		category = Cooking,
		xpAward = Chemistry:10,
		Tooltip = Tooltip_KNXLabTitration,
		inputs
		{
			item 1 [*],
			-fluid 0.1 [Bleach;CleaningLiquid],
			item 1 [Base.BakingSoda],
		}
		outputs
		{
		}
	}

	/* A real product, so it is gated: Chemistry 2. A full strip of vanilla purification
	   tablets (20 uses) for 0.3 L of bleach and three uses of baking soda. */
	craftRecipe KNXLabPurificationTablets
	{
		timedAction = Making_Surface,
		time = 200,
		Tags = KNXCookLab,
		category = Cooking,
		SkillRequired = Chemistry:2,
		AutoLearnAll = Chemistry:2,
		xpAward = Chemistry:15,
		Tooltip = Tooltip_KNXLabPurificationTablets,
		inputs
		{
			item 1 [*],
			-fluid 0.3 [Bleach],
			item 3 [Base.BakingSoda],
		}
		outputs
		{
			item 1 Base.WaterPurificationTablets,
		}
	}

	/* Test a batch: assay a baggie's purity. The baggie is a keep input and comes back; a drop
	   of bleach is the reagent. KNXDrugs.onTestBatch reads the baggie's stamped quality and
	   says it (KNXDrugs_Cook.lua). No skill gate - anyone buying product can check it. */
	craftRecipe TestMethBatch
	{
		timedAction = Making_Surface,
		time = 90,
		Tags = KNXCookLab,
		category = Cooking,
		xpAward = Chemistry:6,
		OnCreate = KNXDrugs.onTestBatch,
		Tooltip = Tooltip_TestMethBatch,
		inputs
		{
			item 1 [Base.MethBaggie] mode:keep flags[AllowFavorite;InheritFavorite],
			item 1 [*],
			-fluid 0.05 [Bleach],
		}
		outputs
		{
		}
	}
}
