====== NPC Supply Chains ====== CoalGov NPCs use Citizens. They are server-side entities, so players do not need client mods. NPCs are managed with: /cgnpc ===== NPC Types ===== * Trader - stores goods, has a coal account, and can haggle with players. * Worker - patrols an assigned NPC zone and performs configured labor. Workers and traders have their own persisted CoalGov inventories. Supply chains move items between those inventories before goods reach players. ===== Zones ===== NPCs work inside polygon zones. Use the claim wand to mark points around the work area: /claim wand /cgnpc zone create Create NPCs while standing where they should spawn: /cgnpc create worker /cgnpc create trader ===== Farm-To-Market Example ===== Select a polygon around the farm with ''/claim wand'', then create an NPC zone: /cgnpc zone create farm Create workers and a trader in that zone: /cgnpc create worker Farmer farm /cgnpc create worker Baker farm /cgnpc create trader Marketman farm The default supply chain is: * Farmer scans the farm zone for mature WHEAT, CARROTS, POTATOES, and BEETROOTS. * Farmer walks to mature crops, harvests drops into NPC inventory, and replants if it has the seed or crop item. * Baker pulls WHEAT from same-zone NPC inventories. * Baker consumes 3 WHEAT to produce 2 BREAD. * Workers keep a reserve and move surplus output to same-zone traders. * Players can haggle with traders for stocked goods. Example player trade: /cgnpc list /cgnpc haggle buy BREAD 8 8 ===== Farm Workers ===== Farm workers use real world blocks. They scan their NPC zone for mature crops, walk to the crop, harvest it, collect the drops into NPC inventory, and replant if they have the correct seed or crop item. Default supported crops: * WHEAT, replanted with WHEAT_SEEDS * CARROTS, replanted with CARROT * POTATOES, replanted with POTATO * BEETROOTS, replanted with BEETROOT_SEEDS If a worker cannot replant, check its inventory and seed stock: /cgnpc stock WHEAT_SEEDS 64 ===== Traders ===== Traders sell from their own inventory. Workers in the same zone can stock traders automatically up to the configured restock target. Players haggle with: /cgnpc haggle buy Admins can add starting goods or coal: /cgnpc stock BREAD 64 /cgnpc funds 100 ===== Configuration ===== Worker roles are matched by NPC name under ''npc.worker.roles''. For example, an NPC named ''Farmer Joe'' uses the ''farmer'' role. npc: worker: tick_interval_seconds: 20 roles: farmer: behavior: FARM output_material: WHEAT output_amount: 4 crops: - WHEAT - CARROTS - POTATOES - BEETROOTS replant: true baker: behavior: CRAFT output_material: BREAD output_amount: 2 inputs: WHEAT: 3 farm: action_distance: 3.0 max_scan_blocks: 512 supply_chain: max_transfer_per_tick: 64 source_reserve: 16 worker_output_reserve: 16 traders_accept_outputs: true trader_restock_target: 256 Admins can seed inventories with: /cgnpc stock and fund trader purchases with: /cgnpc funds