Skip to content

API Documentation

Evert Prants edited this page Apr 26, 2025 · 4 revisions

The basis for the fluid system is the fluid_lib mod.

Register a metal

  • fluidity.register_molten_metal(metal) - Register a new metal which can be melted.

    • metal - name of the metal
    • You're going to need three textures as well: <mod_name>_<metal>_source_animated.png, <mod_name>_<metal>_flowing_animated.png and <mod_name>_bucket_<metal>.png for the automatically registered bucket. The following nodes/items will be registered: <mod_name>:<metal>_source, <mod_name>:<metal>_flowing and <mod_name>:bucket_<metal>
  • fluidity.register_melt(item, metal, type) - Register an item that gets melted down to a metal.

    • item - meltable item
    • metal - name of the resulting metal
    • type - one of ingot, crystal, block, lump, cast, ore
    • Default melt specs are stored in millibuckets in global metal_melter.spec corresponding to the type above.

Castables

  • metal_caster.register_cast(name, data) - Register a new cast for a part.
    • name - Name of the part you're casting
    • data - See below
    • Register a new cast. Needs a texture: <mod_name>_<name>_cast.png
    • Casts are automatically registered as meltables (they melt back down to gold)
    • Cast data:
{
  -- Descriptive name of the cast
  description = "Ingot",
  
  -- Resulting part
  result = "ingot",
  
  -- Ingot cost (cost * 144 milli-buckets)
  cost = 1
}

Tool materials

Non-castable material:

local flint_modifiers = {
	cracky = {times={[1]=3.60, [2]=2.50, [3]=1.00}, uses=5, maxlevel=1},
	crumbly = {times={[1]=4.00, [2]=2.30, [3]=1.20}, uses=5, maxlevel=1},
	snappy = {times={[1]=3.80, [2]=1.30, [3]=1.00}, uses=5, maxlevel=1},
	choppy = {times={[1]=3.70, [2]=2.40, [3]=1.00}, uses=5, maxlevel=1},
	damagegroups = {fleshy = 1},
	explody = nil,

	binding = {increase = 0.00, uses = 0},
	rod = {increase = 0.00, uses = 0},
	tags = {
		{name = "cheap", description = "Cheap"}
	}
}

tinkering.register_material("flint", {
  name = "Flint",
  default = "default:flint",
  color = "#514E49",
  base = "item",
  modifier = flint_modifiers
})

Castable material:

local steel_modifiers = {
	cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=4},
	crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=4},
	snappy = {times={[1]=2.50, [2]=1.20, [3]=0.35}, uses=30, maxlevel=4},
	choppy = {times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=4},
	damagegroups = {fleshy = 6},
	explody = nil,

	binding = {increase = 0.05, uses = 3},
	rod = {increase = 0.10, uses = 5},
	tags = {
		{name = "economic", description = "Economic"},
		{name = "metal", description = "Metallic"}
	}
}

tinkering.register_material("steel", {
  name = "Steel",
  color = "#FFF",
  base = "ingot",
  cast = true,
  modifier = steel_modifiers
})

Tool parts

  • tinkering.register_component(name, data) - Register a new tool component.
    • name - Name of the component, corresponding to the result in metal_caster.register_cast if applicable.
    • Component data:
{
  -- Descriptive name of the part (as standalone)
  description = S("Tool Rod"),
  -- Descriptive name of the part (with material name)
  compose_description = function(n) return S("@1 Tool Rod", n) end,
  -- Cost to make this (in ingots if casting, in number of items if its not a cast)
  material_cost = 1,
  -- Image of the part (make it white so that a color can be multiplied onto it)
  image = "tinkering_tool_rod.png"
},

Tools

tinkering.register_tool("pick", {
        -- Name (description) of the tool
	description = "Pickaxe",
        -- Group caps that apply
	groups = {"cracky"},
        -- Amount removed from base damage group "fleshy". Negative value adds.
	fleshy_decrement = 1,
	components = {
		main    = "pickaxe_head",  -- Name of the primary component
		binding = "tool_binding",
		rod     = "tool_rod"
	},
	textures = {
		main   = "tinkering_pickaxe_head.png", -- Head (main) Texture
		second = "tinkering_overlay_handle_pickaxe.png", -- Overlay (typically a handle)
		offset = "1,-1" -- Main's offset on the texture
	}
})

Clone this wiki locally