Craft
Modular 3D crafting framework for FiveM (Qbox). Two built-in table types — general crafting (GENERAL_3D_TABLE) and weapon/blueprint crafting (WEAPON_3D_TABLE) — plus a registry for adding more, a scene camera with world props and particle effects, a rotatable 3D weapon attachment lab, blueprint rarity progression, NPC barter shops, player-placed stations, a staff audit log, and a full in-game admin panel with templates and item autocomplete.
#Install
- Folder must be named
GR1M_Craft(events and NUI callbacks bind to the resource name). - Qbox only. Hard dependencies:
oxmysql,ox_lib,qbx_core,ox_inventory.ox_targetis used when started (marker + E fallback otherwise) andGR1M_Skillsprovides skill gates and craft XP. The old qb-core / ESX / standalone bridges were removed. - All tables auto-create on first boot (
sql/gr1m_craft.sqldocuments them). See Data storage. - Merge the item definitions from
items/ox_items.luaintoox_inventory/data/items.lua. Weapons andammo-9already exist in ox defaults. - Start order is in
ENSURE.cfg(afterGR1M_Skills, beforeGR1M_Parts), plus the ACE:
add_ace group.admin gr1mcraft.admin allow
#Configuration
Config is split by topic under config/ (load order is in fxmanifest.lua):
| File | Holds |
|---|---|
config/core.lua | Debug, admin ACE/commands, limits, craft XP, blueprint loot, audit console, item image aliases |
config/types_anims.lua | Crafting table types, animations, recipe animation overrides |
config/props.lua | Table display props (item → prop model rules) |
config/admin_catalogs.lua | Admin pickers (props, peds, effects), table templates |
config/curated.lua | Category labels, placeable stations, curated recipes, station assignment, curated stations |
config/seeds.lua | Seed recipes/blueprints for an empty database (shops/tables seeds are empty on purpose) |
config/skill_gates.lua | Skill gate rules applied to recipes/blueprints at boot |
config/markomods_attachments.lua | MarkoMods weapon/attachment blueprints and lab components |
Config.CraftingTypes— table type registry. Add a new entry to create a new 3D table type (allowed recipe kinds, FPV camera preset, ptfx, flags). Scene cam is eye-level looking at the table; the local ped is frozen but not hidden so other players still see the crafter.Config.Recipes/Config.Blueprints— seed data for an empty database (generated MarkoMods +Config.Blueprintsrows are insert-if-missing for new ids). Seed rarity is reapplied on every boot when it differs from config, unless the row isadminLocked.Config.Tables/Config.Shopsare intentionally empty: the database is the only source of truth for benches and shops, and an empty database migratesdata/backup/*.jsonfirst.Config.BlueprintLoot— four crate items (bp_common/bp_uncommon/bp_rare/bp_legendary). Using one rolls a loot-eligible blueprint of that rarity and unlocks the craft.autoShowUnlockedlists every learned schematic on weapon benches.Config.CuratedRecipes— synced into the database on every boot (only rows that changed are written), regardless of whether the recipes table is empty or full of imported rows. A curated recipe saved from/gcadminbecomesadminLockedand boot leaves it alone. Deleting one from the admin panel only removes it until the next restart — delete its entry from this list too if you want it gone for good.Config.CuratedStationAssignputs each recipe on a station by id prefix (zb_,drugs_,medical_, …) or exact id.Config.PlaceableStations— items that place a player-owned bench (model,recipes, optionaltype,label/name,maxPerPlayer,maxDistance,packDistance,placedText). Any number of station items can be configured; each is capped per player by its ownmaxPerPlayer.Config.Animations—tag -> { dict, anim, flag }lookup used by every recipe/blueprint's "Animation" field in/gcadmin(the dropdown there is generated from this table's keys, so a new tag shows up automatically, no other file needs touching). Beyond the defaults (table_work,weapon_bench,mixing,cutting) there'sengine_work(under-the-hood repair),mechanic(tool-bench work: wrenches, filters, tires), andelectronics(wiring/circuit-board/hacking-device work).flagis theTaskPlayAnimflag:1locks the player fully in place,49(loop + upper-body-only + movement) allows legs to keep moving for finer hand work.Config.RecipeAnimationOverrides—recipe id -> animation tagmap applied once at every boot directly against whatever's already registered inRecipes(DB-loaded, migrated, or config-seeded). It's how themechanic/engine_work/electronicstags got wired onto the ~40 relevant imported recipes (mechanic_*,electronics_*,basic_wire,basic_soldering_gun, etc.) without touching anything else about those rows. Idempotent (only re-saves a row if its tag actually changed) and a no-op for any id you've already deleted via bulk-delete, so it always respects your curation. Add moreid = 'tag'pairs here as you tag further recipes.Config.TableTemplates— one-click table presets for the admin TEMPLATES tab.recipeCategoriesauto-assigns every matching recipe at creation. Weapon benches auto-show unlocked blueprints (Config.BlueprintLoot.autoShowUnlocked).Config.PropCatalog/Config.PedCatalog— grouped model catalogs offered by the admin pickers. Invalid names fail safe (they just don't spawn), so candidates can be verified in-game freely. Includes aCrafting Machines (bzzz)group (furnace/mill/tablesaw/recycler) plus extra crate models inMisc, sourced from thebzzz_*prop packs under[assets]/— those model names only resolve if the matchingbzzz_*resource isensured.Config.Attachments— attachment item → per-weapon GTA component mapping used by the lab. The ~245 MarkoMods entries are generated byconfig/markomods_attachments.luausing the same item ids asox_inventory/data/weapons.lua(see Attachment lab → MarkoMods weapon attachments below).Config.ItemProps— exact item → prop model shown on the table surface while a unit crafts (string or{ model, zBias, fallback? }; keys matched case-insensitively). Includes MarkoMods stream models for packs under[weapons]/MarkoMods-*, andbzzz_scrap_*/bzzz_props_lockpick_*models from[assets]/bzzz_iron_scrapand[assets]/bzzz_all_free_propsfor materials/lockpicks (everybzzz_*entry has a vanillafallbackin case that resource isn't running).Config.ItemPropPatterns— ordered Lua-pattern rules tried after exact maps (e.g.^bp_→ blueprint prop withprop_architect_plans_01fallback; ammo name patterns →prop_ld_ammo_pack_01/02/03; MarkoMods slot-name patterns likescope/stock/magazine/_supp_). No catch-all^weapon_here — resolve tries the item name /markomods-*stream heuristic beforeConfig.WeaponItemPropFallback.- Recipe/blueprint Prop ID (
propName) — always shown under Name in admin. Optional table-preview override (world prop likew_pi_pistol, or leave blank and useWEAPON_*output / Weapon Type). Weapon outputs useCreateWeaponObject(same path as the attachment lab). Config.HideUnavailableRecipes—true(default) omits skill-locked recipes from the bench list. Locked blueprints still appear when the player toggles "show locked", butinputs/outputs/craftingTimeare stripped until unlocked.falseshows skill-locked recipes dimmed with the reason.- Skill gates fail closed: a non-empty
skillRequirementsorskillLockis denied withSkills system unavailableifGR1M_Skillsis not started. Empty/nil requirements still pass so ungated starter recipes keep working. adminLocked—/gcadminblueprint saves always set this; recipe/table/shop saves set it only when skill or lock fields were actually edited. Boot overlay andskill_gates.luaskipadminLockedrows so an admin-owned SPEC gate survives restart.Config.MaxCraftQueue/Config.MaxCraftAmount— craft queue size (default 5) and per-job bulk amount cap (default 50).Config.SkillResource—GR1M_Skills(optional). When started:- Gates use
GetCategoryProgress/HasUnlockedSkill/GetSkillRank - Craft duration scales with
craft_speed(capped at 50%) - Each input may roll
craft_material_saver(skip 1 of that material) - Primary output may roll
craft_yield(+1) and stampscraftedQualityfromcraft_quality - Completed units call
RecordActivity('craft_complete')with a uniqueidempotencyKeyand real duration seconds - The bench shows an XP estimate per recipe (
GRSkills.EstimateCraftXp, server-side, 2 XP per craft-second) - Registers effect consumers on boot (
craft_speed,craft_material_saver,craft_quality,craft_yield) - Replaces the old
r1z_craftingintegration entirely for this resource
- Gates use
#Commands
| Command | Who | Purpose |
|---|---|---|
/gcadmin | ACE gr1mcraft.admin | Open the admin panel (tables/templates/recipes/blueprints/shops/players CRUD) |
/gcexport | ACE gr1mcraft.admin | Copy-paste list of every live recipe (for guides) |
/gcgive <item> <n> | ACE gr1mcraft.admin | Give yourself a test item (audited) |
#Admin panel
- TABLES — full CRUD; job lock dropdown fed by your server's real qbx jobs, grouped prop model picker, and searchable, collapsible recipe/blueprint assignment grouped by category with per-group ALL/NONE.
- TEMPLATES — one-click table creation: pick a template, "CREATE AT MY POSITION" stamps a fully configured table (recipes auto-assigned by category); "USE AS BASE" pre-fills the table editor instead.
- RECIPES / BLUEPRINTS — CRUD with item autocomplete; recipes list has search (id/name/kind/category). Skill gates: category level and/or tree node rank (
skillRequirements/skillLockon tables & shops). - SHOPS — NPC sell shops (see below).
- PLAYERS — blueprint grant/revoke for online players.
- Bulk select/delete — Tables, Recipes, Blueprints and Shops lists each have a toolbar above the list: a "Select all" checkbox (respects the current search filter), "Deselect all", and "Delete selected (N)" (confirms before deleting). Useful for trimming a large imported recipe catalog down to just what you want to keep.
#Crafting UI
- Right panel: amount stepper + CRAFT enqueues a job (up to
MaxCraftQueue). Queueing takes the whole job's materials out of the inventory into a server-side escrow, so queued crafts don't count against carry weight; each unit draws its inputs from the escrow. Cancel (or removing a queued job) hands back everything still held. A disconnect parks it as a refund, and a crash or restart is caught by a boot sweep ofgr1m_craft:escrow:<citizenid>. - While a unit crafts, the primary output prop sits on the table. The progress bar is animated on the client from the unit's duration (no per-tick network traffic).
- Materials from a unit that is interrupted (disconnect, walking away, full inventory) are never lost: if they can't go straight back into the inventory they are parked and returned on the player's next login or bench visit.
#NPC sell / barter shops
Admin-placed peds that buy items for money and/or trade item-for-item:
- Create from the admin SHOPS tab: ped model, position ("MY POS"), idle scenario, pay account (
cash/bank), optional job lock, sell price list, and optional barter trades (require/rewarditem lists). - Players target the ped (ox_target, marker fallback) to open the shop panel. SELL and TRADE tabs appear only when that list is non-empty.
- Sell: per-item quantity + "SELL EVERYTHING". Trade: have/need coloring on required items → TRADE button.
- All validation is server-side (distance, membership, owned counts, config prices/trade ids). Payment goes through
GRInventory.AddMoney. Barter consumesrequirethen givesreward, refunding require if give fails. - Persisted in the
gr1m_craft_shopstable (one row per shop, migrated once fromdata/backup/shops.jsoninto an empty database); changes broadcast live to all clients. Cash selling is off (Config.DisableCashSell, sales moved to GR1M_Bins); barter trades stay.
#Blueprint unlocks
Weapon and attachment crafts are blueprints, gated per player. Rarity is common / uncommon / rare / legendary. Seeded rows follow category crates (melee common, pistols uncommon, shotguns rare, SMG/AR/sniper legendary; attachments by slot: grips/mags uncommon, stocks/scopes rare, suppressors/zoom scopes legendary). /gcadmin blueprint saves are adminLocked and keep their rarity across restarts. Weapon benches auto-show every unlocked blueprint — you do not assign them per table.
- Rarity crate — using
bp_common,bp_uncommon,bp_rare, orbp_legendaryrolls a random loot-eligible blueprint of that rarity (weapons and attachments) and unlocks that craft. It does not give the physical gun. If the player already knows every schematic in that pool, the crate is not consumed. A toast (lib.notify) shows the unlocked name and rarity. ox:server.export = 'GR1M_Craft.bp_item'. - Craft count —
unlockCondition = { type = 'craftCount', recipe = 'gun_parts', count = 5 }unlocks after crafting that recipe enough times (optional; exclude from crates with Loot Crate Eligible off). - Admin — grant/revoke a specific blueprint from the admin panel's Players tab.
MarkoMods weapons and their generated attachments are inserted as blueprints on boot if missing. Seed rarity is overlaid whenever it differs from the live row (including downgrades) so crate pools follow the category remap above. Weapon crafts need at least 5 different input items; attachments need at least 3 — boot pads older DB rows that fall short.
#Specializations: at most 2 of 6 (skill-node recipe gating)
Most skillRequirements in config/skill_gates.lua only check the player's overall crafting category level, which every character reaches just by playing — it doesn't require spending points on any particular GR1M_Skills tree node. Six tier-3 nodes on the crafting tree — Artisan, Prospector, Field Mechanic, Medic, Chemist, Gunsmith — gate an entire recipe family each and are wired into a mutual-exclusion clique so a character can hold at most 2 of the 6 at once, never all six. That's the point: nobody can craft everything alone, so you go find another crafter for the categories you didn't pick.
Mechanically this is a 2-slot system. Each specialization has a slot-A node (crf_<key>_track) and an identical slot-B twin (crf_<key>_track_ii) — see GR1M_Skills/config/trees/crafting.lua. All 6 slot-A nodes block each other, all 6 slot-B nodes block each other, and each specialization's A/B twin blocks itself both ways (so you can't spend both slots on the same one). Recipe gates don't care which slot a specialization landed in — the generic SPEC(key, level) helper in config/skill_gates.lua builds an { all = { crafting level, { any = { slot-A rank 1, slot-B rank 1 } } } } requirement, and the any clause is resolved by GRSkills.NormalizeRequirements/meetsClause in server/skills_bridge.lua.
- Artisan (
SPEC('artisan', lvl)/CA()) gates finished goods: diamond necklace/ring, gold chain, tailor parachute/armor padding, titanium/rare armor plating, attachment finishing slots (stock/scope/zoomscope/suppressor), and therare/legendaryblueprint bands. - Prospector (
SPEC('prospector', lvl)/PA()) gates the extraction/refine stage feeding Artisan's chain: gold and silver smelting (bar + ingot), titanium smelting, and reclaim-salvage recipes, plus raw jewelry stock (jewelry_gold_ingot,jewelry_cut_diamond,jewelry_diamond). - Field Mechanic (
SPEC('field_mechanic', lvl)/CM()) gates the civilianmechanic_*bench recipes (batteries, tires, brake pads, filters, spark plugs, repair kits). Unrelated to themechanicsjob skill category (duty-gated, separate tree) — this only affects the civilian repair-shop recipes GR1M_Craft exposes. - Medic (
SPEC('medic', lvl)/MD()) gates the civilianmedical_*bench recipes (adrenaline shots, IFAKs, med bags, splints, tourniquets). Unrelated to the ambulance job's medical skill tree. - Chemist (
SPEC('chemist', lvl)/CHEM()) gates thedrugs_*/weedshop_*cook-and-refine recipes. - Gunsmith (
SPEC('gunsmith', lvl)/GS()) gates the ammo-bench recipes:basic_bullet_press, brass casings, lead points, and loaded ammo boxes (weapons_box_*,pistol_ammo).
Artisan and Prospector still can't reach each other's half of the jewelry/armor chain alone — an Artisan can't smelt their own gold/silver/titanium, and a Prospector can't turn refined stock into a finished ring, necklace, or armor plate. Getting a third, fourth, fifth, or sixth specialization onto one character requires a real respec (Config.Respec) that frees a slot, or trading with a player who picked what you didn't. Every other tree node effectively only delays access (enough level + points eventually unlocks it); this 6-way/2-slot fork is the one place a skill-point choice has a permanent, felt trade-off. Follow the SPEC_NODES table and SPEC(key, level) pattern in config/skill_gates.lua to add a 7th specialization.
#Zombie border economy (GR1M_Zombies integration)
A small curated recipe set (Config.CuratedRecipes) plus a matching item pair wire GR1M_Craft's crafting into GR1M_Zombies' infection system, using raw materials scavenged from zombies north of the border:
blood_bag— raw material, dropped byGR1M_Zombies'medical/eventloot profiles (deliberately rare). No recipe produces it; it's loot-only by design.zb_carlos_blood_curerecipe (GENERAL_3D_TABLE, categorymedical) —blood_bagx2 +medkitx1 +bandagex1 →carlos_blood_curex1, a craftable transfusion that treats zombie infection.carlos_blood_cure's item definition pointsserver.exportatGR1M_Zombies.useBloodCure, which callsTreatInfection— seeGR1M_Zombies/server/infection.lua.Config.Infection.treatmentIteminGR1M_Zombies/config/infection.luais set tocarlos_blood_cureto match. The item usesconsume = 0becauseTreatInfectionremoves it from inventory itself; do not change that or it will double-consume.- Four more curated recipes (
zb_scavenged_repairkit,zb_scrap_ammo_press,zb_border_medkit,zb_smugglers_lockbox) turn the scrapGR1M_Zombiesnow drops (scrap_metal,screws,spring,steel,gunpowder,rubber,cloth) into existing useful items (repairkit,box_9,firstaid,duffel_bag) without depending on the deep ore/smelting import tree. zb_decon_boxrecipe (GENERAL_3D_TABLE, categoryscavenged) —scrap_metalx3 +clothx2 +herbsx1 →decon_boxx1. Using the item opens its ox_inventory container so contaminated zombie loot can be cleaned one slot at a time. Contaminated stacks do not count toward craft inputs.- Both
blood_bagandcarlos_blood_cureuse thexm_prop_x17_bag_med_01a(Doomsday Heist DLC, ships with the base game) 3D prop / icon — there's no native "blood bag" mesh, so this is the closest vanilla match; swapConfig.ItemPropsif a prop pack adds a better one later. - Stations come from
Config.CuratedStationAssign: mostzb_recipes on the workbench, the blood cure and border medkit on the Herbal Lab, the ammo press on the weapon bench, and the noisemaker/decoy on the electronics bench.
#Attachment lab
Open from any WEAPON_3D_TABLE. The selected weapon spawns as a 3D object in front of the scene camera — drag to rotate, scroll to zoom, hover an owned attachment to preview it live. Install/remove writes metadata.components on the weapon item via ox_inventory SetMetadata, so attachments persist and re-apply on equip. The bench's job/skill lock applies to the lab too.
The right panel has three stacked sections: INSTALLED (components on the selected weapon, with REMOVE), OWNED ATTACHMENTS (inventory attachments that fit the selected weapon, with INSTALL), and CRAFTABLE (unowned attachments that fit the selected weapon — info-only with recipe hint). Switching weapons re-filters both lists; incompatible items are hidden, not greyed.
#MarkoMods weapon attachments
config/markomods_attachments.lua (loaded after the config/*.lua files in fxmanifest.lua) is the source of truth for every MarkoMods addon-weapon attachment component GR1MCraft knows about — verified directly against each installed pack's weapons.meta/weaponcomponents.meta under [weapons]/MarkoMods-*/meta/. Structure:
Config.MarkoModsWeapons— one entry per pack (r9,x17m,agc, …) withitemPrefix(ox item stem —590for Shotgun590,revolver2for RevolverBlack),hashes(the weapon(s) it covers —dragon/x17mcover 2 each),packComponents, and optionalsharedComponentsfor packs that also referenceMarkoMods-Shared.- A generator turns those tables into
Config.Attachmentsplus blueprints (weapons and attachments) across 5 slot buckets (suppressor/scope/zoomscope/grip/stock/clip). Item ids matchox_inventory/data/weapons.luaexactly (shared_supp_03,x17m_suppressor_01,r9_clip_01, …). Do not inventatt_*aliases for MarkoMods parts. server/boot.luainserts missing MarkoMods weapon/attachment blueprints on boot and overlays seed rarity when it differs; leftover attachment recipes from the older always-craftable scheme are scrubbed.- Canonical item defs live in
ox_inventory/data/weapons.lua. The lab UI loads{item}.pngfirst, then a digit-stripped variant (for packs that shipx17m_suppressor1.png), then the slot generic (att_icon_suppressor.png, …). Config.ItemPropPatternshas slot-name rules (scope,stock,magazine,_supp_, …) so table-preview props roughly match the attachment type.
#Adding a new table type
-- config/types_anims.lua > Config.CraftingTypes
{
id = 'CHEM_LAB_TABLE',
label = 'Chemistry Lab',
allowed_recipe_kinds = { 'drug', 'consumable' },
defaultAnimationTag = 'mixing',
interactionRadius = 2.5,
allowBlueprints = false,
allowAttachmentLab = false,
camera = { lookAtHeight = 0.98, fov = 60.0, distance = 1.45, height = 1.28, sideBias = 0.0 },
effects = { crafting = { asset = 'core', name = 'ent_amb_dry_ice_area', offset = { x = 0, y = 0, z = 1.0 }, scale = 1.0 } },
},
Then create tables of that type from /gcadmin. Other resources can also call the exports: CreateTable, UpdateTable, DeleteTable, GetTable, GetTables, RegisterRecipe (memory-only), UpsertRecipe (persist to MySQL — used by GR1M_Parts), DeleteRecipe (persist delete — used by GR1M_Parts retirement), RegisterBlueprint, RegisterCraftingType. The Mechanic Parts Bench template assigns every mechanic_parts recipe.
#Data storage
Everything lives in MySQL through oxmysql; the tables auto-create on boot (server/db.lua, server/blueprints.lua, server/audit.lua). Registry rows are one JSON blob under data plus a few indexed columns.
| Table | Contents | Indexed by |
|---|---|---|
gr1m_craft_tables | World benches (admin panel and placed stations) | type |
gr1m_craft_recipes | Recipes (seeds, curated, admin, GR1M_Parts) | category, kind |
gr1m_craft_blueprint_defs | Blueprints | rarity |
gr1m_craft_shops | Barter shops | — |
gr1m_craft_categories | Recipe category names | — |
gr1m_craft_blueprints | Per-character blueprint unlocks | (citizenid, blueprint_id) |
gr1m_craft_stats | Per-character total crafts | citizenid |
gr1m_craft_recipe_stats | Per-character craft count per recipe (bumped in place; old per_recipe JSON is moved here on first load) | (citizenid, recipe_id) |
gr1m_craft_audit | Staff audit log: weapon/attachment crafts, barter trades, admin edits, grants/revokes, /gcgive, placed/packed stations | citizenid, (action, created_at) |
data/backup/*.json are only read as a migration source when the matching table is empty. Set the convar gr1m_craft_audit_webhook to also post audit lines to Discord, or Config.AuditConsole = true to print them.
One-time data fixes (GRCore.RunOnce in server/boot.lua) record a marker in the server's resource KVP store (gr1m_craft:migration:<name>), so each runs once per server. Parked refunds use gr1m_craft:refund:<citizenid>; materials held for queued crafts use gr1m_craft:escrow:<citizenid>.
GR1M