Defines the cw.blueprints library of the Craft plugin, which creates, registers and looks up the blueprints players craft at crafting stations.

A blueprint made with cw.blueprints:New inherits the base blueprint's defaults and accessors; its craftplace is the class of the station that lists it, recipe the materials it consumes, required the tools it needs, reqatt and updatt the attributes it requires and progresses, and finish the items it produces. The files in the plugin's system folder each register one blueprint, and cw.blueprints:FindByID and cw.blueprints:GetAll are how the craft menu and the Craft::CraftItem Cable message find them.

Summary

Methods

Finds a blueprint by unique ID or by part of its name.
GetAll()shared
Returns every registered blueprint.
New()shared
Creates a new blueprint object with the base blueprint defaults.
Registers a blueprint so it shows up in the craft menu of its craftplace station.

Methods

Finds a blueprint by unique ID or by part of its name.

An exact unique ID match wins; otherwise the blueprint with the shortest name containing identifier (case-insensitive) is returned.

Parameters

  • identifier String Unique ID or part of the blueprint's name

Returns

  • Map The blueprint, or nil when none matches or identifier is empty, 0 or a boolean

Returns every registered blueprint.

Returns

  • Map Blueprints keyed by unique ID

Creates a new blueprint object with the base blueprint defaults.

Fill in its fields (name, uniqueID, craftplace, recipe, finish...) and call its Register method.

local BLUEPRINT = cw.blueprints:New()
BLUEPRINT.name = '#Blueprint_Weld_Name'
BLUEPRINT.craftplace = 'cw_craft_wep'
BLUEPRINT.recipe = { { 'scrap_metal', 2 } }
BLUEPRINT.finish = { { 'weld', 1 } }
BLUEPRINT:Register()

Returns

  • Map The new blueprint

Registers a blueprint so it shows up in the craft menu of its craftplace station.

The unique ID defaults to the name with spaces replaced by underscores, and is lowercased with quotes and dots removed. On the server the blueprint's model is added to the client downloads.

Parameters

Defined in