forked from mad-star-studio/Voxelis
Last night's work
This commit is contained in:
parent
a260c4a33a
commit
1708e2d461
45 changed files with 1359 additions and 1347 deletions
|
@ -0,0 +1,37 @@
|
|||
-- Voxelis: vox_fabric
|
||||
-- Dynamic fabric and pattern system for Minetest
|
||||
|
||||
-- Initialize the global table for the mod
|
||||
vox_fabric = {}
|
||||
|
||||
-- Dependencies
|
||||
local modpath = minetest.get_modpath("vox_fabric")
|
||||
dofile(modpath .. "/fabric_dying_bench.lua")
|
||||
dofile(modpath .. "/fabric_patterns.lua")
|
||||
|
||||
-- Fabric Registry
|
||||
local fabric_registry = {}
|
||||
|
||||
-- Register a fabric application
|
||||
function vox_fabric.register_application(modname, base_item, description, base_texture)
|
||||
fabric_registry[modname] = fabric_registry[modname] or {}
|
||||
table.insert(fabric_registry[modname], base_item)
|
||||
|
||||
minetest.register_node(modname .. ":" .. base_item, {
|
||||
description = description,
|
||||
tiles = {base_texture},
|
||||
groups = {fabric = 1},
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
-- Interaction logic for applying patterns
|
||||
local meta = itemstack:get_meta()
|
||||
local pattern_id = meta:get_string("pattern_id")
|
||||
if pattern_id and pattern_id ~= "" then
|
||||
local new_texture = "generated_patterns/" .. pattern_id .. ".png"
|
||||
minetest.swap_node(pos, {name = modname .. ":" .. base_item, tiles = {new_texture}})
|
||||
minetest.chat_send_player(clicker:get_player_name(), "Applied pattern: " .. pattern_id)
|
||||
else
|
||||
minetest.chat_send_player(clicker:get_player_name(), "No pattern found on the template.")
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue