More work being done. And... bugs.
All checks were successful
Error Check / luacheck_errcheck (push) Successful in 37s
Unit Tests / busted_unit_test (push) Successful in 48s

This commit is contained in:
DesertMermaid 2024-12-11 14:47:15 -08:00
parent 0242488c9e
commit a260c4a33a
20 changed files with 1102 additions and 80 deletions

View file

@ -0,0 +1,152 @@
# Vox Coloring Mod
The `vox_coloring` mod is a dynamic and robust system for adding colorable items, blocks, and decorations to your Minetest game. It enables automatic registration of dyeable variants, recipes for applying and removing dyes, and integration with other mods.
---
## Features
- **Dynamic Dye Registration**:
- Automatically generates colorable variants of nodes and items.
- Uses a neutral "template" texture for consistent colorization.
- **Custom Recipes**:
- Recipes for dyeing nodes and items.
- Recipes for reverting dyed objects to their original state.
- **Spraygun Tool**:
- Dye objects directly in the world with a spraygun.
- **Cleaning Station**:
- Revert dyed objects in bulk using the cleaning station.
- **Mod Integration**:
- Other mods can easily register their own dyeable items.
---
## How to Use
### Registering Dyeable Items/Blocks
To register a dyeable item or block, call the `register_dyeable` function in your mod:
```lua
-- List of dyeable things
local dyeable_blocks = {"sand", "terracotta", "marble", "cobblestone", "sandstone"}
-- Register base things their dyeable variants
for _, base_block in ipairs(dyeable_blocks) do
vox_coloring.register_dyeable("vox_worldblocks", base_block)
end
```
Parameters:
```plaintext
modname: The name of your mod (e.g., vox_worldblocks).
base_item: The name of the base item/block to make dyeable.
```
Example:
```lua
vox_coloring.register_dyeable("vox_worldblocks", "sand")
```
### Objects Added
#### Cleaning Solvent
```plaintext
Soap | Bucket of Water | Salt
Ash
```
#### Cleaning Station
```plaintext
Iron Ingot | Bucket of Water | Iron Ingot
Stone | Soap | Stone
Stone | Empty | Stone
```
Our recipe expects these to exist, but you can edit things to suit your game.
```lua
-- Ash
minetest.register_craftitem("vox_mats:ash", {
description = "Ash",
inventory_image = "ash.png",
groups = {crumbly = 3},
})
-- Salt
minetest.register_craftitem("vox_mats:salt", {
description = "Salt",
inventory_image = "salt.png",
})
-- Lye
minetest.register_craftitem("vox_mats:lye", {
description = "Lye",
inventory_image = "lye.png",
})
minetest.register_craft({
output = "vox_mats:lye",
recipe = {
{"vox_mats:ash", "bucket:water_bucket"},
},
replacements = {{"bucket:water_bucket", "bucket:bucket"}},
})
-- Soap
minetest.register_craftitem("vox_mats:soap", {
description = "Soap",
inventory_image = "soap.png",
})
minetest.register_craft({
output = "vox_mats:soap",
recipe = {
{"vox_mobdrops:fat", "vox_mats:lye", "vox_mats:salt"},
},
})
```
We also expect colors to be registered somewhere. Our personal example:
Not full file, but vox_colors contains this part vox_coloring needs...
```lua
vox_colors = {
WHITE = "#FFFFFF",
LIGHTGREY = "#D3D3D3",
SILVER = "#C0C0C0",
GREY = "#808080",
BLACK = "#000000",
RED = "#FF0000",
DARK_RED = "#8B0000",
YELLOW = "#FFFF00",
GOLD = "#FFD700",
ORANGE = "#FFA500",
PUMPKIN = "#FF7518",
CREAM = "#FFFDD0",
TAN = "#D2B48C",
BROWN = "#A52A2A",
DARK_BROWN = "#8B4513",
LIME = "#00FF00",
MINT = "#98FF98",
EMERALD = "#50C878",
DARK_GREEN = "#006400",
TURQUOISE = "#40E0D0",
TEAL = "#008080",
CYAN = "#00FFFF",
BLUE = "#0000FF",
NAVY = "#000080",
MAGENTA = "#FF00FF",
VIOLET = "#EE82EE",
PURPLE = "#800080",
INDIGO = "#4B0082",
PINK = "#FF69B4",
FLAMINGO = "#FC8EAC",
}
```

View file

@ -0,0 +1,212 @@
-- Vox Coloring System
-- Register dyes dynamically based on vox_colors
for color_name, color_hex in pairs(vox_colors) do
if type(color_hex) == "string" and vox_colors.validate(color_hex) then
minetest.register_craftitem("vox_coloring:dye_" .. color_name:lower(), {
description = color_name .. " Dye",
inventory_image = "dye_template.png^[multiply:" .. color_hex,
groups = {dye = 1},
})
end
end
-- Table to hold registered dyeable items
local dyeable_registry = {}
-- Function for other mods to register colorable items or blocks
function vox_coloring.register_dyeable(modname, base_item)
dyeable_registry[modname] = dyeable_registry[modname] or {}
table.insert(dyeable_registry[modname], base_item)
-- Get the original node definition
local base_item_full = modname .. ":" .. base_item
local base_def = minetest.registered_nodes[base_item_full]
if not base_def then
minetest.log("error", "[vox_coloring] Failed to register dyeable item: " .. base_item_full .. " does not exist.")
return
end
-- Derive the template texture by appending `_colorize` to the base texture filename
local base_texture = base_def.tiles and base_def.tiles[1]
if not base_texture then
minetest.log("error", "[vox_coloring] No texture found for " .. base_item_full)
return
end
local colorize_texture = base_texture:gsub("%.png$", "_colorize.png")
-- Iterate over all colors and register dyeable variants
for color_name, color_hex in pairs(vox_colors) do
if type(color_hex) == "string" then
local colored_item = modname .. ":" .. base_item .. "_" .. color_name:lower()
-- Register the colored version of the item/block
minetest.register_node(colored_item, {
description = base_def.description .. " (" .. color_name .. ")",
tiles = {colorize_texture .. "^[multiply:" .. color_hex},
groups = base_def.groups or {},
})
-- Register recipe to dye the item/block
minetest.register_craft({
output = colored_item,
recipe = {
{base_item_full, "vox_coloring:dye_" .. color_name:lower()},
},
})
-- Register recipe to undye the item/block
minetest.register_craft({
output = base_item_full,
recipe = {
{colored_item, "vox_coloring:cleaning_solvent"},
},
replacements = {{"vox_coloring:cleaning_solvent", "bucket:bucket"}},
})
end
end
end
-- Function to unregister a dyeable item or block
function vox_coloring.unregister_dyeable(modname, base_item)
if not dyeable_registry[modname] then return end
for i, item in ipairs(dyeable_registry[modname]) do
if item == base_item then
table.remove(dyeable_registry[modname], i)
break
end
end
-- Remove all colored variants and recipes
for color_name, _ in pairs(vox_colors) do
local colored_item = modname .. ":" .. base_item .. "_" .. color_name:lower()
minetest.unregister_item(colored_item)
end
end
-- Spraygun Tool
minetest.register_tool("vox_coloring:spraygun", {
description = "Spraygun",
inventory_image = "spraygun.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
local meta = itemstack:get_meta()
local dye_color = meta:get_string("dye_color")
if dye_color and vox_colors[dye_color:upper()] then
local modname, item_base = node.name:match("^(.-):(.*)")
if modname and item_base then
local colored_item = modname .. ":" .. item_base .. "_" .. dye_color:lower()
if minetest.registered_nodes[colored_item] then
minetest.swap_node(pointed_thing.under, {name = colored_item})
itemstack:add_wear(65535 / 100) -- Simulate durability loss
minetest.chat_send_player(user:get_player_name(), "Dyed with " .. dye_color .. "!")
else
minetest.chat_send_player(user:get_player_name(), "Cannot dye this object.")
end
else
minetest.chat_send_player(user:get_player_name(), "No valid target for dye.")
end
else
minetest.chat_send_player(user:get_player_name(), "No valid dye loaded in the spraygun.")
end
end
return itemstack
end,
})
-- Add dye to the spraygun
minetest.register_craftitem("vox_coloring:dye_cartridge", {
description = "Dye Cartridge",
inventory_image = "dye_cartridge.png",
on_place = function(itemstack, user, pointed_thing)
local wielded = user:get_wielded_item()
if wielded:get_name() == "vox_coloring:spraygun" then
local meta = wielded:get_meta()
local dye_color = itemstack:get_name():match("vox_coloring:dye_(%w+)")
if dye_color then
meta:set_string("dye_color", dye_color)
minetest.chat_send_player(user:get_player_name(), "Spraygun loaded with " .. dye_color .. " dye!")
return itemstack:take_item()
else
minetest.chat_send_player(user:get_player_name(), "Failed to load dye into the spraygun.")
end
end
return itemstack
end,
})
-- Cleaning Solvent
minetest.register_craftitem("vox_coloring:cleaning_solvent", {
description = "Cleaning Solvent",
inventory_image = "cleaning_solvent.png",
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
local node = minetest.get_node(pointed_thing.under)
local modname, item_base = node.name:match("^(.-):(.*)")
if modname and item_base then
local base_item = item_base:match("^(.-)_")
if base_item then
local original_item = modname .. ":" .. base_item
if minetest.registered_nodes[original_item] then
minetest.swap_node(pointed_thing.under, {name = original_item})
itemstack:take_item()
minetest.chat_send_player(user:get_player_name(), "Reverted to original state.")
else
minetest.chat_send_player(user:get_player_name(), "This block cannot be cleaned.")
end
else
minetest.chat_send_player(user:get_player_name(), "No dye detected on this block.")
end
else
minetest.chat_send_player(user:get_player_name(), "No dye detected on this block.")
end
end
return itemstack
end,
})
-- Recipe for Cleaning Solvent
minetest.register_craft({
output = "vox_coloring:cleaning_solvent",
recipe = {
{"vox_mats:soap", "bucket:water_bucket", "vox_mats:salt"},
{"vox_mats:ash", "", ""},
},
replacements = {{"bucket:water_bucket", "bucket:bucket"}},
})
-- Cleaning Station
minetest.register_node("vox_coloring:cleaning_station", {
description = "Cleaning Station",
tiles = {"cleaning_station_top.png", "cleaning_station_side.png"},
groups = {cracky = 2},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local inv = player:get_inventory()
if inv:contains_item("main", "vox_coloring:cleaning_solvent") then
local node_name = minetest.get_node(pointed_thing.under).name
local modname, item_base = node_name:match("^(.-):(.*)")
if modname and item_base then
local base_item = item_base:match("^(.-)_")
if base_item then
local original_item = modname .. ":" .. base_item
if minetest.registered_nodes[original_item] then
minetest.swap_node(pointed_thing.under, {name = original_item})
inv:remove_item("main", "vox_coloring:cleaning_solvent")
minetest.chat_send_player(player:get_player_name(), "Reverted to original state.")
else
minetest.chat_send_player(player:get_player_name(), "This block cannot be cleaned.")
end
else
minetest.chat_send_player(player:get_player_name(), "No dye detected on this block.")
end
else
minetest.chat_send_player(player:get_player_name(), "No dye detected on this block.")
end
else
minetest.chat_send_player(player:get_player_name(), "You need cleaning solvent to clean blocks.")
end
end,
})

View file

@ -0,0 +1,2 @@
name = vox_coloring
description = Voxelis - coloring. Adds dynamic dyes, dynamically adds dyed (fill in the blanks) from mods that call upon the function, adds other things that are helpful.

View file

View file

@ -0,0 +1,2 @@
name = vox_fabric
description = Voxelis - Fabric. Allow players to use premade patterns (which can be dyed with vox_coloring), or allow them to make their own.

View file

@ -0,0 +1,37 @@
-- Ash
minetest.register_craftitem("vox_mats:ash", {
description = "Ash",
inventory_image = "ash.png",
groups = {crumbly = 3},
})
-- Salt
minetest.register_craftitem("vox_mats:salt", {
description = "Salt",
inventory_image = "salt.png",
})
-- Lye
minetest.register_craftitem("vox_mats:lye", {
description = "Lye",
inventory_image = "lye.png",
})
minetest.register_craft({
output = "vox_mats:lye",
recipe = {
{"vox_mats:ash", "bucket:water_bucket"},
},
replacements = {{"bucket:water_bucket", "bucket:bucket"}},
})
-- Soap
minetest.register_craftitem("vox_mats:soap", {
description = "Soap",
inventory_image = "soap.png",
})
minetest.register_craft({
output = "vox_mats:soap",
recipe = {
{"vox_mobdrops:fat", "vox_mats:lye", "vox_mats:salt"},
},
})

View file

@ -0,0 +1,2 @@
name = vox_mats
description = Voxelis - mats. in general maps that dont need to be categorized (yet)

View file

@ -0,0 +1,15 @@
-- Fat
minetest.register_craftitem("vox_mobdrops:fat", {
description = "Fat",
inventory_image = "fat.png",
})
-- Add fat drops from mobs
minetest.register_on_dieplayer(function(player)
local inventory = player:get_inventory()
if math.random(1, 5) == 1 then
inventory:add_item("main", "vox_mobdrops:fat")
end
end)
-- Leather

View file

@ -0,0 +1,2 @@
name = vox_mobdrops
description = Voxelis - mob drops

View file

View file

@ -0,0 +1,110 @@
-- Vox Structural System
local structural_shapes = {}
-- Register a new structural shape
function vox_structural.register_shape(shape_name, shape_def)
structural_shapes[shape_name] = shape_def
end
-- Register a block with structural shapes
function vox_structural.register_block_with_shapes(modname, base_block, options)
for shape_name, shape_def in pairs(structural_shapes) do
local base_node_name = modname .. ":" .. base_block
local shape_node_name = modname .. ":" .. base_block .. "_" .. shape_name
-- Create the new node definition
local new_node_def = table.copy(minetest.registered_nodes[base_node_name])
new_node_def.description = new_node_def.description .. " (" .. shape_name:gsub("_", " ") .. ")"
new_node_def.tiles = shape_def.tiles or new_node_def.tiles
new_node_def.groups = table.copy(new_node_def.groups or {})
new_node_def.groups.shape = 1 -- Add a "shape" group
-- Apply shape-specific overrides
if shape_def.override then
for key, value in pairs(shape_def.override) do
new_node_def[key] = value
end
end
-- Register the new node
minetest.register_node(shape_node_name, new_node_def)
end
end
-- ---------------------------- Basic Shapes -------------------------- --
-- Slab
vox_structural.register_shape("slab", {
tiles = nil, -- Inherit tiles from the base block
override = {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
},
},
})
-- Stairs
vox_structural.register_shape("stairs", {
tiles = nil,
override = {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, -0.5, 0.5, 0.5, 0},
},
},
},
})
-- ---------------------------- Functional -------------------------- --
-- Pressure Plate
vox_structural.register_shape("pressure_plate", {
tiles = nil,
override = {
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
},
},
},
})
-- Button
-- Post
-- ------------------
-- Register door shapes with variants
vox_structural.register_shape("door_flush", {
override = {
drawtype = "mesh",
mesh = "door_flush.obj",
},
})
vox_structural.register_shape("door_half_window", {
override = {
drawtype = "mesh",
mesh = "door_half_window.obj",
},
})
-- Add mix-and-match for window materials
local window_variants = {"glass", "colored_glass", "paper", "colored_paper"}
for _, material in ipairs(window_variants) do
vox_structural.register_shape("door_half_window_" .. material, {
override = {
drawtype = "mesh",
mesh = "door_half_window.obj",
tiles = {"window_" .. material .. ".png"},
},
})
end

View file

@ -0,0 +1,2 @@
name = vox_structural
description = Voxelis - structural. Adds dynamic structure pieces and assign textures to them.

View file

@ -0,0 +1,20 @@
-- ---------------------------- Dyeable Nodes -------------------------- --
-- List of dyeable things
local dyeable_blocks = {"wool, carpet"}
-- Register base things their dyeable variants
for _, base_block in ipairs(dyeable_blocks) do
vox_coloring.register_dyeable("vox_worldblocks", base_block)
end
-- ---------------------------- Basics -------------------------- --
-- "We've got wool and wool accessories.
-- String
-- Wool
-- Carpet
-- These are made from wool or from fabric

View file

@ -11,4 +11,4 @@
-- with this program; if not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------
vox_tools = { }
vox_tools = { }

View file

@ -45,15 +45,6 @@ core.register_node("vox_worldblocks:sand", {
core.register_alias("sand", "vox_worldblocks:sand")
core.register_alias("default:sand", "vox_worldblocks:sand")
-- Desert Sand
core.register_node("vox_worldblocks:desert_sand", {
description = "Desert Sand",
tiles = {"vox_desert_sand.png"},
groups = {crumbly = 3}
})
core.register_alias("desert_sand", "vox_worldblocks:desert_sand")
core.register_alias("default:desert_sand", "vox_worldblocks:desert_sand")
-- Snow
core.register_node("vox_worldblocks:snow", {
description = "Snow",
@ -63,6 +54,14 @@ core.register_node("vox_worldblocks:snow", {
core.register_alias("snow", "vox_worldblocks:snow")
core.register_alias("default:snow", "vox_worldblocks:snow")
-- Packed Snow
core.register_node("vox_worldblocks:packed_snow", {
description = "Packed Snow",
tiles = {"vox_packed_snow.png"},
groups = {crumbly = 2}
})
core.register_alias("packed_snow", "vox_worldblocks:packed_snow")
-- Ice
core.register_node("vox_worldblocks:ice", {
description = "Ice",
@ -72,6 +71,14 @@ core.register_node("vox_worldblocks:ice", {
core.register_alias("ice", "vox_worldblocks:ice")
core.register_alias("default:ice", "vox_worldblocks:ice")
-- Sulfur Crust
core.register_node("vox_worldblocks:sulfur_crust", {
description = "Sulfur Crust",
tiles = {"vox_sulfur_crust.png"},
groups = {crumbly = 3}
})
core.register_alias("sulfur_crust", "vox_worldblocks:sulfur_crust")
-- ---------------------------- Terrain Subsurface --------------------------- --
-- Bedrock
@ -83,6 +90,14 @@ core.register_node("vox_worldblocks:bedrock", {
core.register_alias("bedrock", "vox_worldblocks:bedrock")
core.register_alias("default:bedrock", "vox_worldblocks:bedrock")
-- Ash
minetest.register_node("vox_worldblocks:ash_block", {
description = "Ash Block",
tiles = {"vox_ash_block.png"},
groups = {crumbly = 3},
drop = "vox_mats:ash", -- Drops ash when broken
})
-- Gravel
core.register_node("vox_worldblocks:gravel", {
description = "Gravel",
@ -120,15 +135,6 @@ core.register_node("vox_worldblocks:sandstone", {
core.register_alias("sandstone", "vox_worldblocks:sandstone")
core.register_alias("default:sandstone", "vox_worldblocks:sandstone")
-- Red Sandstone
core.register_node("vox_worldblocks:red_sandstone", {
description = "Red Sandstone",
tiles = {"vox_red_sandstone.png"},
groups = {cracky = 2}
})
core.register_alias("red_sandstone", "vox_worldblocks:red_sandstone")
core.register_alias("default:red_sandstone", "vox_worldblocks:red_sandstone")
-- Clay
core.register_node("vox_worldblocks:clay", {
description = "Clay",
@ -155,7 +161,7 @@ core.register_node("vox_worldblocks:mud", {
})
core.register_alias("mud", "vox_worldblocks:mud")
-- More stone types: Granite, Diorite, Andesite, Basalt, Obsidian, Marble, Chalk, Limestone, Shale, Slate, Gneiss, Schist, Soapstone, Tuff, Pumice
-- Granite
core.register_node("vox_worldblocks:granite", {
description = "Granite",
tiles = {"vox_granite.png"},
@ -164,6 +170,7 @@ core.register_node("vox_worldblocks:granite", {
core.register_alias("granite", "vox_worldblocks:granite")
core.register_alias("default:granite", "vox_worldblocks:granite")
-- Diorite
core.register_node("vox_worldblocks:diorite", {
description = "Diorite",
tiles = {"vox_diorite.png"},
@ -172,6 +179,7 @@ core.register_node("vox_worldblocks:diorite", {
core.register_alias("diorite", "vox_worldblocks:diorite")
core.register_alias("default:diorite", "vox_worldblocks:diorite")
-- Andesite
core.register_node("vox_worldblocks:andesite", {
description = "Andesite",
tiles = {"vox_andesite.png"},
@ -180,6 +188,7 @@ core.register_node("vox_worldblocks:andesite", {
core.register_alias("andesite", "vox_worldblocks:andesite")
core.register_alias("default:andesite", "vox_worldblocks:andesite")
-- Basalt
core.register_node("vox_worldblocks:basalt", {
description = "Basalt",
tiles = {"vox_basalt.png"},
@ -188,6 +197,7 @@ core.register_node("vox_worldblocks:basalt", {
core.register_alias("basalt", "vox_worldblocks:basalt")
core.register_alias("default:basalt", "vox_worldblocks:basalt")
-- Obsidian
core.register_node("vox_worldblocks:obsidian", {
description = "Obsidian",
tiles = {"vox_obsidian.png"},
@ -196,6 +206,7 @@ core.register_node("vox_worldblocks:obsidian", {
core.register_alias("obsidian", "vox_worldblocks:obsidian")
core.register_alias("default:obsidian", "vox_worldblocks:obsidian")
-- Marble
core.register_node("vox_worldblocks:marble", {
description = "Marble",
tiles = {"vox_marble.png"},
@ -204,6 +215,7 @@ core.register_node("vox_worldblocks:marble", {
core.register_alias("marble", "vox_worldblocks:marble")
core.register_alias("default:marble", "vox_worldblocks:marble")
-- Chalk
core.register_node("vox_worldblocks:chalk", {
description = "Chalk",
tiles = {"vox_chalk.png"},
@ -212,6 +224,7 @@ core.register_node("vox_worldblocks:chalk", {
core.register_alias("chalk", "vox_worldblocks:chalk")
core.register_alias("default:chalk", "vox_worldblocks:chalk")
-- Limestone
core.register_node("vox_worldblocks:limestone", {
description = "Limestone",
tiles = {"vox_limestone.png"},
@ -220,6 +233,56 @@ core.register_node("vox_worldblocks:limestone", {
core.register_alias("limestone", "vox_worldblocks:limestone")
core.register_alias("default:limestone", "vox_worldblocks:limestone")
-- Glowing Moss
core.register_node("vox_worldblocks:glowing_moss", {
description = "Glowing Moss",
tiles = {"vox_glowing_moss.png"},
light_source = 8,
groups = {crumbly = 1}
})
core.register_alias("glowing_moss", "vox_worldblocks:glowing_moss")
core.register_node("vox_worldblocks:salt_crystal", {
description = "Salt Crystal",
tiles = {"vox_salt_crystal.png"},
groups = {cracky = 2}
})
core.register_alias("salt_crystal", "vox_worldblocks:salt_crystal")
core.register_node("vox_worldblocks:volcanic_rock", {
description = "Volcanic Rock",
tiles = {"vox_volcanic_rock.png"},
groups = {cracky = 3}
})
core.register_alias("volcanic_rock", "vox_worldblocks:volcanic_rock")
core.register_node("vox_worldblocks:hot_spring_stone", {
description = "Hot Spring Stone",
tiles = {"vox_hot_spring_stone.png"},
groups = {cracky = 2}
})
core.register_alias("hot_spring_stone", "vox_worldblocks:hot_spring_stone")
-- ------------------------------ Ocean ------------------------- --
--
core.register_node("vox_worldblocks:coral_red", {
description = "Red Coral",
tiles = {"vox_coral_red.png"},
groups = {crumbly = 1}
})
core.register_alias("coral_red", "vox_worldblocks:coral_red")
-- ------------------------------ Sky Island ------------------------- --
-- Cloud Block - Only pegasus can walk on it :)
-- Players may stand on it, but sink partway through. If multiple blocks are
-- stacked, you fall to the lowest block and still don't fall through.
core.register_node("vox_worldblocks:cloud", {
description = "Cloud",
tiles = {"vox_cloud.png"},
groups = {crumbly = 1}
})
core.register_alias("cloud", "vox_worldblocks:cloud")
-- -------------------------------------------------------------------------- --
-- Liquids --
@ -289,6 +352,67 @@ core.register_alias("water_flowing", "vox_worldblocks:water_flowing")
core.register_alias("default:river_water_flowing", "vox_worldblocks:water_flowing")
core.register_alias("mapgen_water_flowing", "vox_worldblocks:water_flowing")
-- Hotspring Water
core.register_node("vox_worldblocks:hotspring_water_source", {
description = "Hotspring Water Source",
drawtype = "liquid",
tiles = {
{
name = "vox_hotspring_water.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0
}
}
},
alpha = 128,
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
liquidtype = "source",
liquid_alternative_flowing = "vox_worldblocks:hotspring_water_flowing",
liquid_alternative_source = "vox_worldblocks:hotspring_water_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90}
})
core.register_alias("hotspring_water_source", "vox_worldblocks:hotspring_water_source")
core.register_alias("mapgen_hotspring_water_source", "vox_worldblocks:hotspring_water_source")
core.register_node("vox_worldblocks:hotspring_water_flowing", {
description = "Flowing Hotspring Water",
drawtype = "flowingliquid",
tiles = {"vox_hotspring_water.png"},
special_tiles = {
{
name = "vox_hotspring_water.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.8
}
}
},
alpha = 160,
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
liquidtype = "flowing",
liquid_alternative_flowing = "vox_worldblocks:hotspring_water_flowing",
liquid_alternative_source = "vox_worldblocks:hotspring_water_source",
liquid_viscosity = 1,
post_effect_color = {a = 103, r = 30, g = 60, b = 90}
})
core.register_alias("hotspring_water_flowing", "vox_worldblocks:hotspring_water_flowing")
core.register_alias("mapgen_hotspring_water_flowing", "vox_worldblocks:hotspring_water_flowing")
-- Lava
core.register_node("vox_worldblocks:lava_source", {
description = "Lava Source",
@ -357,7 +481,7 @@ core.register_alias("mapgen_lava_flowing", "vox_worldblocks:lava_flowing")
-- -------------------------------------------------------------------------- --
-- Fuel: Coal, Uranium
-- Fuel: Coal, Uranium, Peat
core.register_node("vox_worldblocks:coal_ore", {
description = "Coal Ore",
tiles = {"vox_coal_ore.png"},
@ -374,7 +498,14 @@ core.register_node("vox_worldblocks:uranium_ore", {
core.register_alias("uranium_ore", "vox_worldblocks:uranium_ore")
core.register_alias("default:stone_with_uranium", "vox_worldblocks:uranium_ore")
-- Minerals: Bone, Sulfur, Salt
core.register_node("vox_worldblocks:peat", {
description = "Peat",
tiles = {"vox_peat.png"},
groups = {crumbly = 2, flammable = 1}
})
core.register_alias("peat", "vox_worldblocks:peat")
-- Bone
core.register_node("vox_worldblocks:bone_ore", {
description = "Bone Ore",
tiles = {"vox_bone_ore.png"},
@ -383,6 +514,7 @@ core.register_node("vox_worldblocks:bone_ore", {
core.register_alias("bone_ore", "vox_worldblocks:bone_ore")
core.register_alias("default:stone_with_bone", "vox_worldblocks:bone_ore")
-- Sulfur
core.register_node("vox_worldblocks:sulfur_ore", {
description = "Sulfur Ore",
tiles = {"vox_sulfur_ore.png"},
@ -391,15 +523,16 @@ core.register_node("vox_worldblocks:sulfur_ore", {
core.register_alias("sulfur_ore", "vox_worldblocks:sulfur_ore")
core.register_alias("default:stone_with_sulfur", "vox_worldblocks:sulfur_ore")
-- Salt
core.register_node("vox_worldblocks:salt_ore", {
description = "Salt Ore",
tiles = {"vox_salt_ore.png"},
groups = {cracky = 2}
groups = {crumbly = 2},
drop = "vox_mats:salt"
})
core.register_alias("salt_ore", "vox_worldblocks:salt_ore")
core.register_alias("default:stone_with_salt", "vox_worldblocks:salt_ore")
-- Metals: Copper, Tin, Iron, Gold, Silver, Platinum, Lead, Zinc, Nickel, Cobalt, Titanium, Tungsten
core.register_node("vox_worldblocks:copper_ore", {
description = "Copper Ore",
@ -730,3 +863,43 @@ core.register_node("vox_worldblocks:carnelian_ore", {
})
core.register_alias("carnelian_ore", "vox_worldblocks:carnelian_ore")
core.register_alias("default:stone_with_carnelian", "vox_worldblocks:carnelian_ore")
-- ---------------------------- Blocks with Multiple Colors -------------------------- --
-- Register colored (fill in the blank) dynamically
for color_name, color_hex in pairs(vox_colors) do
-- Skip any non-color functions or keys
if type(color_hex) == "string" and vox_colors.validate(color_hex) then
-- Register Colored Stone variant
core.register_node("vox_worldblocks:stone_" .. color_name:lower(), {
description = color_name .. " Stone",
tiles = {"vox_stone_colorize.png^[multiply:" .. color_hex},
groups = {cracky = 2},
})
core.register_alias("stone_" .. color_name:lower(), "vox_worldblocks:stone_" .. color_name:lower())
-- Register Terracotta variant
core.register_node("vox_worldblocks:terracotta_" .. color_name:lower(), {
description = color_name .. " Terracotta",
tiles = {"vox_terracotta_colorize.png^[multiply:" .. color_hex},
groups = {cracky = 2},
})
core.register_alias("terracotta_" .. color_name:lower(), "vox_worldblocks:terracotta_" .. color_name:lower())
end
end
-- ---------------------------- Dyeable Nodes -------------------------- --
-- List of dyeable things
local dyeable_blocks = {"sand", "terracotta", "marble", "cobblestone", "sandstone"}
-- Debug: Check if dyeable_blocks is defined correctly
assert(type(dyeable_blocks) == "table", "[vox_worldblocks] 'dyeable_blocks' must be a table!")
-- Register base things and their dyeable variants
for _, base_block in pairs(dyeable_blocks) do
if type(base_block) == "string" then
vox_coloring.register_dyeable("vox_worldblocks", base_block)
else
minetest.log("error", "[vox_worldblocks] Invalid block name in dyeable_blocks: " .. tostring(base_block))
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 619 B

Before After
Before After