update
|
@ -4,4 +4,4 @@ description=Core system for realistic trains in Minetest
|
||||||
author=orwell96
|
author=orwell96
|
||||||
|
|
||||||
depends=serialize_lib
|
depends=serialize_lib
|
||||||
optional_depends=mesecons,digtron
|
optional_depends=mesecons,mesecons_switch,digtron
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
-- p_mesecon_iface.lua
|
-- p_mesecon_iface.lua
|
||||||
-- Mesecons interface by overriding the switch
|
-- Mesecons interface by overriding the switch
|
||||||
|
|
||||||
if not mesecon then return end
|
if minetest.get_modpath("mesecons_switch") == nil then return end
|
||||||
|
|
||||||
minetest.override_item("mesecons_switch:mesecon_switch_off", {
|
minetest.override_item("mesecons_switch:mesecon_switch_off", {
|
||||||
groups = {
|
groups = {
|
||||||
|
|
|
@ -200,17 +200,17 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
ok = true -- everything starts off ok
|
ok = true -- everything starts off ok
|
||||||
|
|
||||||
-- stop current sound if another set active or gain changed
|
-- are we playing something already?
|
||||||
if playing[player_name]
|
if playing[player_name]
|
||||||
and playing[player_name].handler then
|
and playing[player_name].handler then
|
||||||
|
|
||||||
|
-- stop current sound if another set active or gain changed
|
||||||
if playing[player_name].set ~= set_name
|
if playing[player_name].set ~= set_name
|
||||||
or (playing[player_name].set == set_name
|
or playing[player_name].gain ~= MORE_GAIN then
|
||||||
and playing[player_name].gain ~= MORE_GAIN) then
|
|
||||||
|
|
||||||
--print ("-- change stop", set_name, playing[player_name].old_handler)
|
--print ("-- change stop", set_name, playing[player_name].handler)
|
||||||
|
|
||||||
minetest.sound_stop(playing[player_name].old_handler)
|
minetest.sound_stop(playing[player_name].handler)
|
||||||
|
|
||||||
playing[player_name].set = nil
|
playing[player_name].set = nil
|
||||||
playing[player_name].handler = nil
|
playing[player_name].handler = nil
|
||||||
|
@ -220,11 +220,9 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set random chance and reset seed
|
-- set random chance
|
||||||
chance = random(1, 1000)
|
chance = random(1, 1000)
|
||||||
|
|
||||||
math.randomseed(tod + chance)
|
|
||||||
|
|
||||||
-- if chance is lower than set frequency then select set
|
-- if chance is lower than set frequency then select set
|
||||||
if ok and set_name and chance < sound_sets[set_name].frequency then
|
if ok and set_name and chance < sound_sets[set_name].frequency then
|
||||||
|
|
||||||
|
@ -249,8 +247,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
-- set what player is currently listening to
|
-- set what player is currently listening to
|
||||||
playing[player_name] = {
|
playing[player_name] = {
|
||||||
set = set_name, gain = MORE_GAIN,
|
set = set_name, gain = MORE_GAIN, handler = handler
|
||||||
handler = handler, old_handler = handler
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- set timer to stop sound
|
-- set timer to stop sound
|
||||||
|
@ -261,17 +258,15 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- make sure we are stopping same sound we started
|
-- make sure we are stopping same sound we started
|
||||||
if playing[player_name]
|
if playing[player_name]
|
||||||
and playing[player_name].handler
|
and playing[player_name].handler
|
||||||
and playing[player_name].old_handler == handler then
|
and playing[player_name].handler == handler then
|
||||||
|
|
||||||
--print("-- timed stop", set_name, handler)
|
--print("-- timed stop", set_name, handler)
|
||||||
|
|
||||||
--minetest.sound_stop(playing[player_name].handler)
|
|
||||||
minetest.sound_stop(handler)
|
minetest.sound_stop(handler)
|
||||||
|
|
||||||
-- reset player variables and backup handler
|
-- reset player variables and backup handler
|
||||||
playing[player_name] = {
|
playing[player_name] = {
|
||||||
set = nil, gain = nil,
|
set = nil, gain = nil, handler = nil
|
||||||
handler = nil, old_handler = nil
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -5,3 +5,4 @@ ethereal?
|
||||||
moreores?
|
moreores?
|
||||||
3d_armor?
|
3d_armor?
|
||||||
xanadu?
|
xanadu?
|
||||||
|
mobs?
|
||||||
|
|
|
@ -141,7 +141,43 @@ if minetest.get_modpath("3d_armor") then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("shields") then
|
||||||
|
|
||||||
|
if armor.materials.steel then
|
||||||
|
add_tool("shields:shield_steel", "default:steel_ingot", 7)
|
||||||
|
end
|
||||||
|
|
||||||
|
if armor.materials.bronze then
|
||||||
|
add_tool("shields:shield_bronze", "default:bronze_ingot", 7)
|
||||||
|
end
|
||||||
|
|
||||||
|
if armor.materials.diamond then
|
||||||
|
add_tool("shields:shield_diamond", "default:diamond", 7)
|
||||||
|
end
|
||||||
|
|
||||||
|
if armor.materials.gold then
|
||||||
|
add_tool("shields:shield_gold", "default:gold_ingot", 7)
|
||||||
|
end
|
||||||
|
|
||||||
|
if armor.materials.mithril then
|
||||||
|
add_tool("shields:shield_mithril", "moreores:mithril_ingot", 7)
|
||||||
|
end
|
||||||
|
|
||||||
|
if armor.materials.crystal then
|
||||||
|
add_tool("shields:shield_crystal", "ethereal:crystal_ingot", 7)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if minetest.get_modpath("mobs_monster") then
|
||||||
|
add_tool("mobs:pick_lava", "mobs:lava_orb", 3, true)
|
||||||
|
end
|
||||||
|
|
||||||
-- Xanadu mod
|
-- Xanadu mod
|
||||||
if minetest.get_modpath("xanadu") then
|
if minetest.get_modpath("xanadu") then
|
||||||
add_tool("xanadu:axe_super", "default:diamond", 18, true)
|
add_tool("xanadu:axe_super", "default:diamond", 18, true)
|
||||||
|
add_tool("mobs:pick_lava", "mobs:lava_orb", 3, true)
|
||||||
|
add_tool("xanadu:helmet_ccrystal", "ethereal:crystal_ingot", 5)
|
||||||
|
add_tool("xanadu:chestplate_ccrystal", "ethereal:crystal_ingot", 8)
|
||||||
|
add_tool("xanadu:leggings_ccrystal", "ethereal:crystal_ingot", 7)
|
||||||
|
add_tool("xanadu:boots_ccrystal", "ethereal:crystal_ingot", 4)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
default
|
|
||||||
intllib?
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- Biome library mod by Vanessa Ezekowitz
|
-- Biome library mod by VanessaE
|
||||||
--
|
--
|
||||||
-- I got the temperature map idea from "hmmmm", values used for it came from
|
-- I got the temperature map idea from "hmmmm", values used for it came from
|
||||||
-- Splizard's snow mod.
|
-- Splizard's snow mod.
|
||||||
|
@ -395,7 +395,7 @@ end
|
||||||
-- a surface during the initial map read stage.
|
-- a surface during the initial map read stage.
|
||||||
|
|
||||||
function biome_lib:generate_block_with_air_checking()
|
function biome_lib:generate_block_with_air_checking()
|
||||||
if #biome_lib.blocklist_aircheck == 0 then
|
if not biome_lib.blocklist_aircheck[1] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -407,30 +407,13 @@ function biome_lib:generate_block_with_air_checking()
|
||||||
|
|
||||||
local blockhash = minetest.hash_node_position(minp)
|
local blockhash = minetest.hash_node_position(minp)
|
||||||
|
|
||||||
if not biome_lib.surface_nodes_aircheck.blockhash then
|
if not biome_lib.surface_nodes_aircheck.blockhash then -- read it into the block cache
|
||||||
|
biome_lib.surface_nodes_aircheck.blockhash =
|
||||||
if type(minetest.find_nodes_in_area_under_air) == "function" then -- use newer API call
|
minetest.find_nodes_in_area_under_air(minp, maxp, biome_lib.surfaceslist_aircheck)
|
||||||
biome_lib.surface_nodes_aircheck.blockhash =
|
|
||||||
minetest.find_nodes_in_area_under_air(minp, maxp, biome_lib.surfaceslist_aircheck)
|
|
||||||
else
|
|
||||||
local search_area = minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_aircheck)
|
|
||||||
|
|
||||||
-- search the generated block for air-bounded surfaces the slow way.
|
|
||||||
|
|
||||||
biome_lib.surface_nodes_aircheck.blockhash = {}
|
|
||||||
|
|
||||||
for i = 1, #search_area do
|
|
||||||
local pos = search_area[i]
|
|
||||||
local p_top = { x=pos.x, y=pos.y+1, z=pos.z }
|
|
||||||
if minetest.get_node(p_top).name == "air" then
|
|
||||||
biome_lib.surface_nodes_aircheck.blockhash[#biome_lib.surface_nodes_aircheck.blockhash + 1] = pos
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
biome_lib.actioncount_aircheck.blockhash = 1
|
biome_lib.actioncount_aircheck.blockhash = 1
|
||||||
|
|
||||||
else
|
else
|
||||||
if biome_lib.actioncount_aircheck.blockhash <= #biome_lib.actionslist_aircheck then
|
if biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash] then
|
||||||
-- [1] is biome, [2] is node/function/model
|
-- [1] is biome, [2] is node/function/model
|
||||||
biome_lib:populate_surfaces(
|
biome_lib:populate_surfaces(
|
||||||
biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][1],
|
biome_lib.actionslist_aircheck[biome_lib.actioncount_aircheck.blockhash][1],
|
||||||
|
@ -438,10 +421,9 @@ function biome_lib:generate_block_with_air_checking()
|
||||||
biome_lib.surface_nodes_aircheck.blockhash, true)
|
biome_lib.surface_nodes_aircheck.blockhash, true)
|
||||||
biome_lib.actioncount_aircheck.blockhash = biome_lib.actioncount_aircheck.blockhash + 1
|
biome_lib.actioncount_aircheck.blockhash = biome_lib.actioncount_aircheck.blockhash + 1
|
||||||
else
|
else
|
||||||
if biome_lib.surface_nodes_aircheck.blockhash then
|
table.remove(biome_lib.blocklist_aircheck, 1)
|
||||||
table.remove(biome_lib.blocklist_aircheck, 1)
|
biome_lib.surface_nodes_aircheck.blockhash = nil
|
||||||
biome_lib.surface_nodes_aircheck.blockhash = nil
|
biome_lib.actioncount_aircheck.blockhash = nil
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -450,7 +432,7 @@ end
|
||||||
-- checking for air during the initial map read stage.
|
-- checking for air during the initial map read stage.
|
||||||
|
|
||||||
function biome_lib:generate_block_no_aircheck()
|
function biome_lib:generate_block_no_aircheck()
|
||||||
if #biome_lib.blocklist_no_aircheck == 0 then
|
if not biome_lib.blocklist_no_aircheck[1] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -460,25 +442,21 @@ function biome_lib:generate_block_no_aircheck()
|
||||||
local blockhash = minetest.hash_node_position(minp)
|
local blockhash = minetest.hash_node_position(minp)
|
||||||
|
|
||||||
if not biome_lib.surface_nodes_no_aircheck.blockhash then
|
if not biome_lib.surface_nodes_no_aircheck.blockhash then
|
||||||
|
|
||||||
-- directly read the block to be searched into the chunk cache
|
|
||||||
|
|
||||||
biome_lib.surface_nodes_no_aircheck.blockhash =
|
biome_lib.surface_nodes_no_aircheck.blockhash =
|
||||||
minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_no_aircheck)
|
minetest.find_nodes_in_area(minp, maxp, biome_lib.surfaceslist_no_aircheck)
|
||||||
biome_lib.actioncount_no_aircheck.blockhash = 1
|
biome_lib.actioncount_no_aircheck.blockhash = 1
|
||||||
|
|
||||||
else
|
else
|
||||||
if biome_lib.actioncount_no_aircheck.blockhash <= #biome_lib.actionslist_no_aircheck then
|
if biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash] then
|
||||||
biome_lib:populate_surfaces(
|
biome_lib:populate_surfaces(
|
||||||
biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][1],
|
biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][1],
|
||||||
biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][2],
|
biome_lib.actionslist_no_aircheck[biome_lib.actioncount_no_aircheck.blockhash][2],
|
||||||
biome_lib.surface_nodes_no_aircheck.blockhash, false)
|
biome_lib.surface_nodes_no_aircheck.blockhash, false)
|
||||||
biome_lib.actioncount_no_aircheck.blockhash = biome_lib.actioncount_no_aircheck.blockhash + 1
|
biome_lib.actioncount_no_aircheck.blockhash = biome_lib.actioncount_no_aircheck.blockhash + 1
|
||||||
else
|
else
|
||||||
if biome_lib.surface_nodes_no_aircheck.blockhash then
|
table.remove(biome_lib.blocklist_no_aircheck, 1)
|
||||||
table.remove(biome_lib.blocklist_no_aircheck, 1)
|
biome_lib.surface_nodes_no_aircheck.blockhash = nil
|
||||||
biome_lib.surface_nodes_no_aircheck.blockhash = nil
|
biome_lib.actioncount_no_aircheck.blockhash = nil
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
name = biome_lib
|
name = biome_lib
|
||||||
min_minetest_version = 5.2.0
|
min_minetest_version = 5.2.0
|
||||||
|
depends = default
|
||||||
|
optional_depends = intllib
|
||||||
|
|
|
@ -52,9 +52,23 @@ function biome_lib:find_open_side(pos)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- "Record" the chunks being generated by the core mapgen
|
-- "Record" the map chunks being generated by the core mapgen,
|
||||||
|
-- split into individual mapblocks to reduce lag
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { minp, maxp }
|
for x = 0, 5 do
|
||||||
biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { minp, maxp }
|
local minx = minp.x + x*16
|
||||||
|
for y = 0, 5 do
|
||||||
|
local miny = minp.y + y*16
|
||||||
|
for z = 0, 5 do
|
||||||
|
local minz = minp.z + z*16
|
||||||
|
|
||||||
|
local bmin = {x=minx, y=miny, z=minz}
|
||||||
|
local bmax = {x=minx + 15, y=miny + 15, z=minz + 15}
|
||||||
|
|
||||||
|
biome_lib.blocklist_aircheck[#biome_lib.blocklist_aircheck + 1] = { bmin, bmax }
|
||||||
|
biome_lib.blocklist_no_aircheck[#biome_lib.blocklist_no_aircheck + 1] = { bmin, bmax }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
name = carts
|
name = carts
|
||||||
description = Carts (formerly boost_cart)
|
description = Carts (formerly boost_cart)
|
||||||
depends = default, player_api
|
depends = default, player_api
|
||||||
optional_depends = dungeon_loot
|
optional_depends = dungeon_loot, mesecons
|
||||||
|
|
|
@ -556,6 +556,7 @@ minetest.register_craft({
|
||||||
"group:food_egg", "group:food_egg", "farming:vanilla_extract"
|
"group:food_egg", "group:food_egg", "farming:vanilla_extract"
|
||||||
},
|
},
|
||||||
replacements = {
|
replacements = {
|
||||||
|
{"cucina_vegana:soy_milk", "vessels:drinking_glass"},
|
||||||
{"group:food_milk", "bucket:bucket_empty"},
|
{"group:food_milk", "bucket:bucket_empty"},
|
||||||
{"farming:vanilla_extract", "vessels:glass_bottle"}
|
{"farming:vanilla_extract", "vessels:glass_bottle"}
|
||||||
}
|
}
|
||||||
|
@ -599,3 +600,42 @@ minetest.register_craft({
|
||||||
{"farming:pot", "farming:pot"},
|
{"farming:pot", "farming:pot"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Onigiri
|
||||||
|
|
||||||
|
minetest.register_craftitem("farming:onigiri", {
|
||||||
|
description = S("Onirigi"),
|
||||||
|
inventory_image = "farming_onigiri.png",
|
||||||
|
on_use = minetest.item_eat(2),
|
||||||
|
groups = {flammable = 2},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "farming:onigiri",
|
||||||
|
recipe = {
|
||||||
|
"group:food_rice", "group:food_rice", "group:food_seaweed", "group:food_salt"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Gyoza
|
||||||
|
|
||||||
|
minetest.register_craftitem("farming:gyoza", {
|
||||||
|
description = S("Gyoza"),
|
||||||
|
inventory_image = "farming_gyoza.png",
|
||||||
|
on_use = minetest.item_eat(4),
|
||||||
|
groups = {flammable = 2},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "farming:gyoza 4",
|
||||||
|
recipe = {
|
||||||
|
"group:food_cabbage", "group:food_garlic_clove", "group:food_onion",
|
||||||
|
"group:food_meat_raw", "group:food_salt", "group:food_skillet",
|
||||||
|
"group:food_flour"
|
||||||
|
},
|
||||||
|
replacements = {
|
||||||
|
{"group:food_skillet", "farming:skillet"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
BIN
mods/farming/textures/farming_gyoza.png
Normal file
After Width: | Height: | Size: 603 B |
BIN
mods/farming/textures/farming_onigiri.png
Normal file
After Width: | Height: | Size: 204 B |
|
@ -334,3 +334,34 @@ if minetest.get_modpath("technic") then
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "gloopblocks:concrete_sidewalk",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"streets:slab_concrete_2",
|
||||||
|
"default:dirt",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "gloopblocks:concrete_sidewalk 2",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"streets:slab_concrete_quarter",
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "gloopblocks:concrete_sidewalk 4",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"streets:slab_concrete",
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt",
|
||||||
|
"default:dirt"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
default
|
|
||||||
basic_materials
|
|
||||||
moreblocks?
|
|
||||||
stairs?
|
|
||||||
glooptest?
|
|
||||||
gloopores?
|
|
||||||
intllib?
|
|
||||||
wool?
|
|
||||||
xdecor?
|
|
||||||
caverealms?
|
|
||||||
technic?
|
|
||||||
nyancat?
|
|
||||||
usesdirt?
|
|
||||||
worldedit?
|
|
||||||
signs_lib?
|
|
||||||
bakedclay?
|
|
||||||
farming?
|
|
||||||
wool?
|
|
||||||
bushes_classic?
|
|
||||||
dryplants?
|
|
||||||
bedrock?
|
|
||||||
cottages?
|
|
|
@ -34,6 +34,7 @@ minetest.register_node("gloopblocks:evil_block", {
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky=2},
|
groups = {cracky=2},
|
||||||
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -130,6 +131,30 @@ minetest.register_node("gloopblocks:scaffolding", {
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("gloopblocks:concrete_sidewalk", {
|
||||||
|
description = S("Concrete sidewalk"),
|
||||||
|
tiles = {
|
||||||
|
"basic_materials_concrete_block.png",
|
||||||
|
"basic_materials_concrete_block.png^gloopblocks_concrete_sidewalk_overlay.png",
|
||||||
|
"gloopblocks_packed_dirt.png"
|
||||||
|
},
|
||||||
|
drawtype = "mesh",
|
||||||
|
mesh = "gloopblocks_sidewalk.obj",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
||||||
|
},
|
||||||
|
collision_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5625, 0.5 }
|
||||||
|
},
|
||||||
|
on_rotate = screwdriver.rotate_simple,
|
||||||
|
groups = {cracky=2},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_alias("moreblocks:oerkkiblock", "gloopblocks:oerkki_block")
|
minetest.register_alias("moreblocks:oerkkiblock", "gloopblocks:oerkki_block")
|
||||||
minetest.register_alias("gloopblocks:obsidian", "default:obsidian")
|
minetest.register_alias("gloopblocks:obsidian", "default:obsidian")
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
name = gloopblocks
|
name = gloopblocks
|
||||||
min_minetest_version = 5.2.0
|
min_minetest_version = 5.2.0
|
||||||
|
depends = default, basic_materials
|
||||||
|
optional_depends = screwdriver, stairs, wool, moreblocks, glooptest, gloopores, intllib, xdecor, caverealms, technic, nyancat, usesdirt, worldedit, signs_lib, bakedclay, farming, bushes_classic, dryplants, bedrock, cottages
|
||||||
|
|
119
mods/gloopblocks/models/gloopblocks_sidewalk.obj
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
# Blender v2.83.5 OBJ File: 'gloopblocks sidewalk.blend'
|
||||||
|
# www.blender.org
|
||||||
|
o Cube_Cube.001
|
||||||
|
v -0.500000 -0.500000 0.500000
|
||||||
|
v -0.500000 -0.500000 -0.500000
|
||||||
|
v 0.500000 -0.500000 0.500000
|
||||||
|
v 0.500000 -0.500000 -0.500000
|
||||||
|
v -0.500000 0.437500 -0.500000
|
||||||
|
v -0.498047 0.445310 -0.498047
|
||||||
|
v -0.500000 0.437500 0.500000
|
||||||
|
v -0.498047 0.445310 0.498047
|
||||||
|
v 0.500000 0.437500 0.500000
|
||||||
|
v 0.498047 0.445310 0.498047
|
||||||
|
v 0.498047 0.445310 -0.498047
|
||||||
|
v 0.500000 0.437500 -0.500000
|
||||||
|
v -0.498047 0.531250 -0.498047
|
||||||
|
v -0.466425 0.562500 -0.466425
|
||||||
|
v 0.466425 0.562500 -0.466425
|
||||||
|
v 0.498047 0.531250 -0.498047
|
||||||
|
v -0.466425 0.562500 0.466425
|
||||||
|
v -0.498047 0.531250 0.498047
|
||||||
|
v 0.498047 0.531250 0.498047
|
||||||
|
v 0.466425 0.562500 0.466425
|
||||||
|
vt 0.001953 0.968750
|
||||||
|
vt 0.001953 0.882810
|
||||||
|
vt 0.998046 0.882810
|
||||||
|
vt 0.998046 0.968750
|
||||||
|
vt 0.998046 0.968750
|
||||||
|
vt 0.001953 0.968750
|
||||||
|
vt 0.001953 0.882810
|
||||||
|
vt 0.998046 0.882810
|
||||||
|
vt 0.998047 0.882810
|
||||||
|
vt 0.998047 0.968750
|
||||||
|
vt 0.001953 0.968750
|
||||||
|
vt 0.001953 0.882810
|
||||||
|
vt 0.001954 0.998047
|
||||||
|
vt 0.998047 0.998047
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.998047 0.001953
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.001954 0.001953
|
||||||
|
vt 0.033575 0.966425
|
||||||
|
vt 0.033575 0.033575
|
||||||
|
vt 0.966425 0.033575
|
||||||
|
vt 0.966425 0.966425
|
||||||
|
vt 0.998047 0.998046
|
||||||
|
vt 0.001953 0.998047
|
||||||
|
vt 0.033575 0.966425
|
||||||
|
vt 0.966425 0.966425
|
||||||
|
vt 0.033575 0.966425
|
||||||
|
vt 0.966425 0.966425
|
||||||
|
vt 0.998047 0.998047
|
||||||
|
vt 0.001953 0.998047
|
||||||
|
vt 0.998046 0.968750
|
||||||
|
vt 0.001953 0.968750
|
||||||
|
vt 0.001953 0.882810
|
||||||
|
vt 0.998046 0.882810
|
||||||
|
vt 0.033575 0.966425
|
||||||
|
vt 0.966425 0.966425
|
||||||
|
vt 0.998047 0.998047
|
||||||
|
vt 0.001953 0.998047
|
||||||
|
vt 0.998047 0.998047
|
||||||
|
vt 0.001954 0.998047
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 0.2426 -0.9701
|
||||||
|
vn 0.9701 0.2426 0.0000
|
||||||
|
vn 0.0000 0.2426 0.9701
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn -0.9701 0.2426 0.0000
|
||||||
|
vn -0.7029 0.7113 0.0000
|
||||||
|
vn 0.7029 0.7113 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 0.0000 0.7113 0.7029
|
||||||
|
vn 0.0000 0.7113 -0.7029
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
g Cube_Cube.001_concrete_top
|
||||||
|
s off
|
||||||
|
f 13/1/1 6/2/1 8/3/1 18/4/1
|
||||||
|
f 16/5/2 19/6/2 10/7/2 11/8/2
|
||||||
|
f 10/9/3 19/10/3 18/11/3 8/12/3
|
||||||
|
f 6/13/4 11/14/4 12/15/4 5/16/4
|
||||||
|
f 11/14/5 10/17/5 9/18/5 12/15/5
|
||||||
|
f 7/19/6 9/18/6 10/17/6 8/20/6
|
||||||
|
f 14/21/7 17/22/7 20/23/7 15/24/7
|
||||||
|
f 8/20/8 6/13/8 5/16/8 7/19/8
|
||||||
|
f 13/25/9 18/26/9 17/27/9 14/28/9
|
||||||
|
f 15/29/10 20/30/10 19/31/10 16/32/10
|
||||||
|
f 13/33/11 16/34/11 11/35/11 6/36/11
|
||||||
|
g Cube_Cube.001_concrete_edges
|
||||||
|
f 20/37/12 17/38/12 18/39/12 19/40/12
|
||||||
|
f 14/21/13 15/24/13 16/41/13 13/42/13
|
||||||
|
g Cube_Cube.001_dirt
|
||||||
|
f 1/43/3 3/44/3 9/45/3 7/46/3
|
||||||
|
f 4/47/14 3/48/14 1/49/14 2/50/14
|
||||||
|
f 4/51/11 2/52/11 5/53/11 12/54/11
|
||||||
|
f 3/55/2 4/47/2 12/56/2 9/57/2
|
||||||
|
f 5/58/1 2/50/1 1/59/1 7/60/1
|
After Width: | Height: | Size: 73 B |
BIN
mods/gloopblocks/textures/gloopblocks_packed_dirt.png
Normal file
After Width: | Height: | Size: 417 B |
|
@ -239,9 +239,7 @@ local function taps_on_rightclick(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
|
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
if below and
|
if below and
|
||||||
below.name == "homedecor:shower_tray" or
|
below.name == "homedecor:shower_tray" or
|
||||||
below.name == "homedecor:sink" or
|
string.find(below.name, "homedecor:.*sink") then
|
||||||
below.name == "homedecor:kitchen_cabinet_with_sink" or
|
|
||||||
below.name == "homedecor:kitchen_cabinet_with_sink_locked" then
|
|
||||||
local particledef = {
|
local particledef = {
|
||||||
outlet = { x = 0, y = -0.44, z = 0.28 },
|
outlet = { x = 0, y = -0.44, z = 0.28 },
|
||||||
velocity_x = { min = -0.1, max = 0.1 },
|
velocity_x = { min = -0.1, max = 0.1 },
|
||||||
|
|
|
@ -9,16 +9,17 @@ homedecor.box = {
|
||||||
-- bottom slab (starting from -y) with height optionally shifted upwards
|
-- bottom slab (starting from -y) with height optionally shifted upwards
|
||||||
slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end,
|
slab_y = function(height, shift) return { -0.5, -0.5+(shift or 0), -0.5, 0.5, -0.5+height+(shift or 0), 0.5 } end,
|
||||||
-- slab starting from -z (+z with negative depth)
|
-- slab starting from -z (+z with negative depth)
|
||||||
slab_z = function(depth)
|
slab_z = function(depth, shift)
|
||||||
-- for consistency with the other functions here, we have to assume that a "z" slab starts from -z and extends by depth,
|
-- for consistency with the other functions here, we have to assume that a "z" slab starts from -z and extends by depth,
|
||||||
-- but since conventionally a lot of nodes place slabs against +z for player convenience, we define
|
-- but since conventionally a lot of nodes place slabs against +z for player convenience, we define
|
||||||
-- a "negative" depth as a depth extending from the other side, i.e. +z
|
-- a "negative" depth as a depth extending from the other side, i.e. +z
|
||||||
|
local s = shift or 0
|
||||||
if depth > 0 then
|
if depth > 0 then
|
||||||
-- slab starting from -z
|
-- slab starting from -z
|
||||||
return { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5+depth }
|
return { -0.5, -0.5, -0.5+s, 0.5, 0.5, -0.5+depth+s }
|
||||||
else
|
else
|
||||||
-- slab starting from +z (z1=0.5-(-depth))
|
-- slab starting from +z (z1=0.5-(-depth))
|
||||||
return { -0.5, -0.5, 0.5+depth, 0.5, 0.5, 0.5 }
|
return { -0.5, -0.5, 0.5+depth+s, 0.5, 0.5, 0.5+s }
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
bar_y = function(radius) return {-radius, -0.5, -radius, radius, 0.5, radius} end,
|
bar_y = function(radius) return {-radius, -0.5, -radius, radius, 0.5, radius} end,
|
||||||
|
|
|
@ -1,38 +1,5 @@
|
||||||
local S = minetest.get_translator("homedecor_furniture")
|
local S = minetest.get_translator("homedecor_furniture")
|
||||||
|
|
||||||
local table_colors = {
|
|
||||||
{ "", S("Table"), homedecor.plain_wood },
|
|
||||||
{ "_mahogany", S("Mahogany Table"), homedecor.mahogany_wood },
|
|
||||||
{ "_white", S("White Table"), homedecor.white_wood }
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, t in ipairs(table_colors) do
|
|
||||||
local suffix, desc, texture = unpack(t)
|
|
||||||
|
|
||||||
homedecor.register("table"..suffix, {
|
|
||||||
description = desc,
|
|
||||||
tiles = { texture },
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -0.4, -0.5, -0.4, -0.3, 0.4, -0.3 },
|
|
||||||
{ 0.3, -0.5, -0.4, 0.4, 0.4, -0.3 },
|
|
||||||
{ -0.4, -0.5, 0.3, -0.3, 0.4, 0.4 },
|
|
||||||
{ 0.3, -0.5, 0.3, 0.4, 0.4, 0.4 },
|
|
||||||
{ -0.5, 0.4, -0.5, 0.5, 0.5, 0.5 },
|
|
||||||
{ -0.4, -0.2, -0.3, -0.3, -0.1, 0.3 },
|
|
||||||
{ 0.3, -0.2, -0.4, 0.4, -0.1, 0.3 },
|
|
||||||
{ -0.3, -0.2, -0.4, 0.4, -0.1, -0.3 },
|
|
||||||
{ -0.3, -0.2, 0.3, 0.3, -0.1, 0.4 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local ob_cbox = {
|
local ob_cbox = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }
|
fixed = { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }
|
||||||
|
@ -69,224 +36,3 @@ homedecor.register("wall_shelf", {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Crafts
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:table",
|
|
||||||
recipe = {
|
|
||||||
{ "group:wood","group:wood", "group:wood" },
|
|
||||||
{ "group:stick", "", "group:stick" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:table_mahogany",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:table",
|
|
||||||
"dye:brown",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:table_mahogany",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:table",
|
|
||||||
"unifieddyes:dark_orange",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "homedecor:table_white",
|
|
||||||
recipe = {
|
|
||||||
"homedecor:table",
|
|
||||||
"dye:white",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:table",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:table_mahogany",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:table_white",
|
|
||||||
burntime = 30,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:standing_lamp_off",
|
|
||||||
recipe = {
|
|
||||||
{"homedecor:table_lamp_off"},
|
|
||||||
{"group:stick"},
|
|
||||||
{"group:stick"},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
unifieddyes.register_color_craft({
|
|
||||||
output = "homedecor:standing_lamp_off",
|
|
||||||
palette = "extended",
|
|
||||||
type = "shapeless",
|
|
||||||
neutral_node = "homedecor:standing_lamp_off",
|
|
||||||
recipe = {
|
|
||||||
"NEUTRAL_NODE",
|
|
||||||
"MAIN_DYE"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "fuel",
|
|
||||||
recipe = "homedecor:table_lamp_off",
|
|
||||||
burntime = 10,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:table_lamp_off",
|
|
||||||
recipe = {
|
|
||||||
{ "wool:white", "default:torch", "wool:white"},
|
|
||||||
{ "", "group:stick", ""},
|
|
||||||
{ "", "stairs:slab_wood", "" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:table_lamp_off",
|
|
||||||
recipe = {
|
|
||||||
{ "cottages:wool", "default:torch", "cottages:wool"},
|
|
||||||
{ "", "group:stick", ""},
|
|
||||||
{ "", "stairs:slab_wood", "" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:table_lamp_off",
|
|
||||||
recipe = {
|
|
||||||
{ "wool:white", "default:torch", "wool:white"},
|
|
||||||
{ "", "group:stick", ""},
|
|
||||||
{ "", "moreblocks:slab_wood", "" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:table_lamp_off",
|
|
||||||
recipe = {
|
|
||||||
{ "cottages:wool", "default:torch", "cottages:wool"},
|
|
||||||
{ "", "group:stick", ""},
|
|
||||||
{ "", "moreblocks:slab_wood", "" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
unifieddyes.register_color_craft({
|
|
||||||
output = "homedecor:table_lamp_off",
|
|
||||||
palette = "extended",
|
|
||||||
type = "shapeless",
|
|
||||||
neutral_node = "homedecor:table_lamp_off",
|
|
||||||
recipe = {
|
|
||||||
"NEUTRAL_NODE",
|
|
||||||
"MAIN_DYE"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:toilet",
|
|
||||||
recipe = {
|
|
||||||
{ "","","bucket:bucket_water"},
|
|
||||||
{ "group:marble","group:marble", "group:marble" },
|
|
||||||
{ "", "bucket:bucket_empty", "" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:sink",
|
|
||||||
recipe = {
|
|
||||||
{ "group:marble","bucket:bucket_empty", "group:marble" },
|
|
||||||
{ "", "group:marble", "" }
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:taps",
|
|
||||||
recipe = {
|
|
||||||
{ "default:steel_ingot","bucket:bucket_water", "default:steel_ingot" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:taps_brass",
|
|
||||||
recipe = {
|
|
||||||
{ "technic:brass_ingot","bucket:bucket_water", "technic:brass_ingot" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:shower_tray",
|
|
||||||
recipe = {
|
|
||||||
{ "group:marble","bucket:bucket_empty", "group:marble" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:shower_head",
|
|
||||||
recipe = {
|
|
||||||
{"default:steel_ingot", "bucket:bucket_water"},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:bathtub_clawfoot_brass_taps",
|
|
||||||
recipe = {
|
|
||||||
{ "homedecor:taps_brass", "", "" },
|
|
||||||
{ "group:marble", "", "group:marble" },
|
|
||||||
{"default:steel_ingot", "group:marble", "default:steel_ingot"},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:bathtub_clawfoot_chrome_taps",
|
|
||||||
recipe = {
|
|
||||||
{ "homedecor:taps", "", "" },
|
|
||||||
{ "group:marble", "", "group:marble" },
|
|
||||||
{"default:steel_ingot", "group:marble", "default:steel_ingot"},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:bars 6",
|
|
||||||
recipe = {
|
|
||||||
{ "default:steel_ingot","default:steel_ingot","default:steel_ingot" },
|
|
||||||
{ "homedecor:pole_wrought_iron","homedecor:pole_wrought_iron","homedecor:pole_wrought_iron" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:L_binding_bars 3",
|
|
||||||
recipe = {
|
|
||||||
{ "homedecor:bars","" },
|
|
||||||
{ "homedecor:bars","homedecor:bars" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "homedecor:torch_wall 10",
|
|
||||||
recipe = {
|
|
||||||
{ "default:coal_lump" },
|
|
||||||
{ "default:steel_ingot" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Aliases for 3dforniture mod.
|
|
||||||
|
|
||||||
minetest.register_alias("3dforniture:table", "homedecor:table")
|
|
||||||
minetest.register_alias('table', 'homedecor:table')
|
|
||||||
|
|
|
@ -57,6 +57,24 @@ homedecor.register("chains", {
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Crafts
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "homedecor:bars 6",
|
||||||
|
recipe = {
|
||||||
|
{ "default:steel_ingot","default:steel_ingot","default:steel_ingot" },
|
||||||
|
{ "homedecor:pole_wrought_iron","homedecor:pole_wrought_iron","homedecor:pole_wrought_iron" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "homedecor:L_binding_bars 3",
|
||||||
|
recipe = {
|
||||||
|
{ "homedecor:bars","" },
|
||||||
|
{ "homedecor:bars","homedecor:bars" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_alias("3dforniture:bars", "homedecor:bars")
|
minetest.register_alias("3dforniture:bars", "homedecor:bars")
|
||||||
minetest.register_alias("3dforniture:L_binding_bars", "homedecor:L_binding_bars")
|
minetest.register_alias("3dforniture:L_binding_bars", "homedecor:L_binding_bars")
|
||||||
minetest.register_alias("3dforniture:chains", "homedecor:chains")
|
minetest.register_alias("3dforniture:chains", "homedecor:chains")
|
||||||
|
|
|
@ -137,43 +137,159 @@ homedecor.register("dishwasher_"..m, {
|
||||||
end
|
end
|
||||||
|
|
||||||
local cabinet_sides = "(default_wood.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"
|
local cabinet_sides = "(default_wood.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"
|
||||||
local cabinet_bottom = "(default_wood.png^[colorize:#000000:100)"
|
local cabinet_sides_colored = "(homedecor_generic_wood_plain.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"
|
||||||
.."^(homedecor_kitchen_cabinet_bevel.png^[colorize:#46321580)"
|
|
||||||
|
local ic_cabinet_sides = string.gsub(cabinet_sides, "%^", "&")
|
||||||
|
local ic_cabinet_sides_colored = string.gsub(cabinet_sides_colored, "%^", "&")
|
||||||
|
|
||||||
|
local cabinet_bottom = "(default_wood.png^[colorize:#000000:100)^homedecor_kitchen_cabinet_bevel.png"
|
||||||
|
local cabinet_bottom_colored = "homedecor_generic_wood_plain.png^homedecor_kitchen_cabinet_bevel.png"
|
||||||
|
|
||||||
local function N_(x) return x end
|
local function N_(x) return x end
|
||||||
|
|
||||||
local counter_materials = { "", N_("granite"), N_("marble"), N_("steel") }
|
local counter_materials = { "", N_("granite"), N_("marble"), N_("steel") }
|
||||||
|
|
||||||
|
homedecor.kitchen_convert_nodes = {}
|
||||||
|
|
||||||
for _, mat in ipairs(counter_materials) do
|
for _, mat in ipairs(counter_materials) do
|
||||||
|
|
||||||
local desc = S("Kitchen Cabinet")
|
local desc = S("Kitchen Cabinet")
|
||||||
|
local desc2 = S("Kitchen Cabinet with drawers")
|
||||||
local material = ""
|
local material = ""
|
||||||
|
|
||||||
if mat ~= "" then
|
if mat ~= "" then
|
||||||
desc = S("Kitchen Cabinet (@1 top)", S(mat))
|
desc = S("Kitchen Cabinet (@1 top)", S(mat))
|
||||||
|
desc2 = S("Kitchen Cabinet with drawers (@1 top)", S(mat))
|
||||||
material = "_"..mat
|
material = "_"..mat
|
||||||
end
|
end
|
||||||
|
|
||||||
homedecor.register("kitchen_cabinet"..material, {
|
homedecor.register("kitchen_cabinet_colorable"..material, {
|
||||||
description = desc,
|
description = desc,
|
||||||
tiles = { 'homedecor_kitchen_cabinet_top'..material..'.png',
|
tiles = {
|
||||||
cabinet_bottom,
|
'homedecor_kitchen_cabinet_top'..material..'.png',
|
||||||
cabinet_sides,
|
cabinet_bottom,
|
||||||
cabinet_sides,
|
cabinet_sides,
|
||||||
cabinet_sides,
|
cabinet_sides,
|
||||||
'homedecor_kitchen_cabinet_front.png'},
|
cabinet_sides,
|
||||||
groups = { snappy = 3 },
|
'homedecor_kitchen_cabinet_front.png^homedecor_kitchen_cabinet_bevel.png'
|
||||||
|
},
|
||||||
|
inventory_image = "[inventorycube"
|
||||||
|
.."{homedecor_kitchen_cabinet_top"..material..".png"
|
||||||
|
.."{homedecor_kitchen_cabinet_front.png"
|
||||||
|
.."{"..ic_cabinet_sides,
|
||||||
|
mesh = "homedecor_kitchen_cabinet.obj",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
airbrush_replacement_node = "homedecor:kitchen_cabinet_colored"..material,
|
||||||
|
place_param2 = 0,
|
||||||
|
groups = { snappy = 3, ud_param2_colorable = 1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
infotext=S("Kitchen Cabinet"),
|
infotext=S("Kitchen Cabinet"),
|
||||||
inventory = {
|
inventory = {
|
||||||
size=24,
|
size=24,
|
||||||
lockable=true,
|
lockable=true,
|
||||||
},
|
},
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
homedecor.register("kitchen_cabinet_colored"..material, {
|
||||||
|
description = desc,
|
||||||
|
tiles = {
|
||||||
|
{name = 'homedecor_kitchen_cabinet_top'..material..'.png', color = 0xFFFFFFFF},
|
||||||
|
{name = cabinet_bottom, color = 0xFFFFFFFF },
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
'homedecor_kitchen_cabinet_colored_front.png^homedecor_kitchen_cabinet_bevel.png'
|
||||||
|
},
|
||||||
|
inventory_image = "[inventorycube"
|
||||||
|
.."{homedecor_kitchen_cabinet_top"..material..".png"
|
||||||
|
.."{homedecor_kitchen_cabinet_front.png"
|
||||||
|
.."{"..ic_cabinet_sides_colored,
|
||||||
|
mesh = "homedecor_kitchen_cabinet.obj",
|
||||||
|
paramtype2 = "colorwallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 },
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
infotext=S("Kitchen Cabinet"),
|
||||||
|
inventory = {
|
||||||
|
size=24,
|
||||||
|
lockable=true,
|
||||||
|
},
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
homedecor.register("kitchen_cabinet_colorable_with_drawers"..material, {
|
||||||
|
description = desc2,
|
||||||
|
tiles = {
|
||||||
|
'homedecor_kitchen_cabinet_top'..material..'.png',
|
||||||
|
cabinet_bottom,
|
||||||
|
cabinet_sides,
|
||||||
|
cabinet_sides,
|
||||||
|
cabinet_sides,
|
||||||
|
'homedecor_kitchen_cabinet_front_with_drawers.png^homedecor_kitchen_cabinet_bevel.png'
|
||||||
|
},
|
||||||
|
inventory_image = "[inventorycube"
|
||||||
|
.."{homedecor_kitchen_cabinet_top"..material..".png"
|
||||||
|
.."{homedecor_kitchen_cabinet_front_with_drawers.png"
|
||||||
|
.."{"..ic_cabinet_sides,
|
||||||
|
mesh = "homedecor_kitchen_cabinet.obj",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
airbrush_replacement_node = "homedecor:kitchen_cabinet_colored_with_drawers"..material,
|
||||||
|
groups = { snappy = 3, ud_param2_colorable = 1},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
infotext=S("Kitchen Cabinet with drawers"),
|
||||||
|
inventory = {
|
||||||
|
size=24,
|
||||||
|
lockable=true,
|
||||||
|
},
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
homedecor.register("kitchen_cabinet_colored_with_drawers"..material, {
|
||||||
|
description = desc2,
|
||||||
|
tiles = {
|
||||||
|
{name = 'homedecor_kitchen_cabinet_top'..material..'.png', color = 0xFFFFFFFF},
|
||||||
|
{name = cabinet_bottom, color = 0xFFFFFFFF },
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
'homedecor_kitchen_cabinet_colored_front_with_drawers.png^homedecor_kitchen_cabinet_bevel.png'
|
||||||
|
},
|
||||||
|
inventory_image = "[inventorycube"
|
||||||
|
.."{homedecor_kitchen_cabinet_top"..material..".png"
|
||||||
|
.."{homedecor_kitchen_cabinet_colored_front_with_drawers.png"
|
||||||
|
.."{"..ic_cabinet_sides_colored,
|
||||||
|
mesh = "homedecor_kitchen_cabinet.obj",
|
||||||
|
paramtype2 = "colorwallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 },
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
infotext=S("Kitchen Cabinet with drawers"),
|
||||||
|
inventory = {
|
||||||
|
size=24,
|
||||||
|
lockable=true,
|
||||||
|
},
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet"..material
|
||||||
|
homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_locked"..material
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local kitchen_cabinet_half_box = homedecor.nodebox.slab_y(0.5, 0.5)
|
local kitchen_cabinet_half_box = homedecor.nodebox.slab_z(0.5, 0.5)
|
||||||
homedecor.register("kitchen_cabinet_half", {
|
|
||||||
|
homedecor.register("kitchen_cabinet_colorable_half", {
|
||||||
description = S('Half-height Kitchen Cabinet (on ceiling)'),
|
description = S('Half-height Kitchen Cabinet (on ceiling)'),
|
||||||
tiles = {
|
tiles = {
|
||||||
cabinet_sides,
|
cabinet_sides,
|
||||||
|
@ -181,29 +297,77 @@ homedecor.register("kitchen_cabinet_half", {
|
||||||
cabinet_sides,
|
cabinet_sides,
|
||||||
cabinet_sides,
|
cabinet_sides,
|
||||||
cabinet_sides,
|
cabinet_sides,
|
||||||
'homedecor_kitchen_cabinet_front_half.png'
|
'homedecor_kitchen_cabinet_front_half.png^homedecor_kitchen_cabinet_half_bevel.png'
|
||||||
},
|
},
|
||||||
|
mesh = "homedecor_kitchen_cabinet_half.obj",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
airbrush_replacement_node = "homedecor:kitchen_cabinet_colored_half",
|
||||||
|
place_param2 = 0,
|
||||||
selection_box = kitchen_cabinet_half_box,
|
selection_box = kitchen_cabinet_half_box,
|
||||||
node_box = kitchen_cabinet_half_box,
|
node_box = kitchen_cabinet_half_box,
|
||||||
groups = { snappy = 3 },
|
groups = { snappy = 3, ud_param2_colorable = 1 },
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
infotext=S("Kitchen Cabinet"),
|
infotext=S("Kitchen Cabinet"),
|
||||||
inventory = {
|
inventory = {
|
||||||
size=12,
|
size=12,
|
||||||
lockable=true,
|
lockable=true,
|
||||||
},
|
},
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
homedecor.register("kitchen_cabinet_with_sink", {
|
homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_half"
|
||||||
|
homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_half_locked"
|
||||||
|
|
||||||
|
homedecor.register("kitchen_cabinet_colored_half", {
|
||||||
|
description = S('Half-height Kitchen Cabinet (on ceiling)'),
|
||||||
|
tiles = {
|
||||||
|
{ name = cabinet_sides, color = 0xFFFFFFFF },
|
||||||
|
cabinet_bottom_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
'homedecor_kitchen_cabinet_colored_front_half.png^homedecor_kitchen_cabinet_half_bevel.png'
|
||||||
|
},
|
||||||
|
mesh = "homedecor_kitchen_cabinet_half.obj",
|
||||||
|
paramtype2 = "colorwallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
selection_box = kitchen_cabinet_half_box,
|
||||||
|
node_box = kitchen_cabinet_half_box,
|
||||||
|
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 },
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
infotext=S("Kitchen Cabinet"),
|
||||||
|
inventory = {
|
||||||
|
size=12,
|
||||||
|
lockable=true,
|
||||||
|
},
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
homedecor.register("kitchen_cabinet_colorable_with_sink", {
|
||||||
description = S("Kitchen Cabinet with sink"),
|
description = S("Kitchen Cabinet with sink"),
|
||||||
mesh = "homedecor_kitchen_sink.obj",
|
mesh = "homedecor_kitchen_sink.obj",
|
||||||
tiles = {
|
tiles = {
|
||||||
"homedecor_kitchen_sink_top.png",
|
"homedecor_kitchen_sink_top.png",
|
||||||
"homedecor_kitchen_cabinet_front.png",
|
cabinet_bottom,
|
||||||
cabinet_sides,
|
cabinet_sides,
|
||||||
cabinet_bottom
|
cabinet_sides,
|
||||||
|
cabinet_sides,
|
||||||
|
"homedecor_kitchen_cabinet_front.png^homedecor_kitchen_cabinet_bevel.png"
|
||||||
},
|
},
|
||||||
groups = { snappy = 3 },
|
inventory_image = "[inventorycube"
|
||||||
|
.."{homedecor_kitchen_sink_top.png"
|
||||||
|
.."{homedecor_kitchen_cabinet_front.png"
|
||||||
|
.."{"..ic_cabinet_sides,
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
airbrush_replacement_node = "homedecor:kitchen_cabinet_colored_with_sink",
|
||||||
|
place_param2 = 0,
|
||||||
|
groups = { snappy = 3, ud_param2_colorable = 1 },
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
infotext=S("Under-sink cabinet"),
|
infotext=S("Under-sink cabinet"),
|
||||||
inventory = {
|
inventory = {
|
||||||
|
@ -222,6 +386,54 @@ homedecor.register("kitchen_cabinet_with_sink", {
|
||||||
},
|
},
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z})
|
homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
|
end,
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_with_sink"
|
||||||
|
homedecor.kitchen_convert_nodes[#homedecor.kitchen_convert_nodes + 1] = "homedecor:kitchen_cabinet_with_sink_locked"
|
||||||
|
|
||||||
|
homedecor.register("kitchen_cabinet_colored_with_sink", {
|
||||||
|
description = S("Kitchen Cabinet with sink"),
|
||||||
|
mesh = "homedecor_kitchen_sink.obj",
|
||||||
|
tiles = {
|
||||||
|
{ name = "homedecor_kitchen_sink_top.png", color = 0xFFFFFFFF },
|
||||||
|
{ name = cabinet_bottom, color = 0xFFFFFFFF},
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
cabinet_sides_colored,
|
||||||
|
"homedecor_kitchen_cabinet_colored_front.png^homedecor_kitchen_cabinet_bevel.png",
|
||||||
|
},
|
||||||
|
inventory_image = "[inventorycube"
|
||||||
|
.."{homedecor_kitchen_sink_top.png"
|
||||||
|
.."{homedecor_kitchen_cabinet_front.png"
|
||||||
|
.."{"..ic_cabinet_sides_colored,
|
||||||
|
paramtype2 = "colorwallmounted",
|
||||||
|
palette = "unifieddyes_palette_colorwallmounted.png",
|
||||||
|
groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = 1 },
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
infotext=S("Under-sink cabinet"),
|
||||||
|
inventory = {
|
||||||
|
size=16,
|
||||||
|
lockable=true,
|
||||||
|
},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{ -8/16, -8/16, -8/16, 8/16, 6/16, 8/16 },
|
||||||
|
{ -8/16, 6/16, -8/16, -6/16, 8/16, 8/16 },
|
||||||
|
{ 6/16, 6/16, -8/16, 8/16, 8/16, 8/16 },
|
||||||
|
{ -8/16, 6/16, -8/16, 8/16, 8/16, -6/16 },
|
||||||
|
{ -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 },
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_destruct = function(pos)
|
||||||
|
homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
|
end,
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -257,10 +469,7 @@ homedecor.register("kitchen_faucet", {
|
||||||
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
|
on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
|
local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
|
||||||
if below and
|
if below and string.find(below.name, "homedecor:.*sink") then
|
||||||
below.name == "homedecor:sink" or
|
|
||||||
below.name == "homedecor:kitchen_cabinet_with_sink" or
|
|
||||||
below.name == "homedecor:kitchen_cabinet_with_sink_locked" then
|
|
||||||
local particledef = {
|
local particledef = {
|
||||||
outlet = { x = 0, y = -0.19, z = 0.13 },
|
outlet = { x = 0, y = -0.19, z = 0.13 },
|
||||||
velocity_x = { min = -0.05, max = 0.05 },
|
velocity_x = { min = -0.05, max = 0.05 },
|
||||||
|
@ -555,3 +764,29 @@ minetest.register_craft({
|
||||||
{ "homedecor:toilet_paper", "homedecor:toilet_paper" }
|
{ "homedecor:toilet_paper", "homedecor:toilet_paper" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
name = ":homedecor:convert_kitchen_cabinets",
|
||||||
|
label = "Convert homedecor kitchen cabinets to use [color]wallmounted",
|
||||||
|
run_at_every_load = false,
|
||||||
|
nodenames = homedecor.kitchen_convert_nodes,
|
||||||
|
action = function(pos, node)
|
||||||
|
local name = node.name
|
||||||
|
local newname = string.gsub(name, "_cabinet", "_cabinet_colorable")
|
||||||
|
|
||||||
|
local old_fdir = math.floor(node.param2 % 32)
|
||||||
|
local new_fdir = 3
|
||||||
|
|
||||||
|
if old_fdir == 0 then
|
||||||
|
new_fdir = 3
|
||||||
|
elseif old_fdir == 1 then
|
||||||
|
new_fdir = 4
|
||||||
|
elseif old_fdir == 2 then
|
||||||
|
new_fdir = 2
|
||||||
|
elseif old_fdir == 3 then
|
||||||
|
new_fdir = 5
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.swap_node(pos, { name = newname, param2 = new_fdir })
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
# Blender v2.83.5 OBJ File: 'kitchen_cabinet.blend'
|
||||||
|
# www.blender.org
|
||||||
|
o Cube_Cube.001
|
||||||
|
v 0.500000 -0.500000 -0.500000
|
||||||
|
v 0.500000 -0.500000 0.500000
|
||||||
|
v -0.500000 -0.500000 -0.500000
|
||||||
|
v -0.500000 -0.500000 0.500000
|
||||||
|
v 0.500000 0.500000 -0.500000
|
||||||
|
v 0.500000 0.500000 0.500000
|
||||||
|
v -0.500000 0.500000 -0.500000
|
||||||
|
v -0.500000 0.500000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
g Cube_Cube.001_top
|
||||||
|
s off
|
||||||
|
f 8/1/1 4/2/1 2/3/1 6/4/1
|
||||||
|
g Cube_Cube.001_bottom
|
||||||
|
f 7/5/2 5/6/2 1/7/2 3/8/2
|
||||||
|
g Cube_Cube.001_right
|
||||||
|
f 5/9/3 7/5/3 8/1/3 6/10/3
|
||||||
|
g Cube_Cube.001_left
|
||||||
|
f 4/2/4 3/8/4 1/11/4 2/12/4
|
||||||
|
g Cube_Cube.001_back
|
||||||
|
f 7/13/5 3/14/5 4/15/5 8/16/5
|
||||||
|
g Cube_Cube.001_front
|
||||||
|
f 6/17/6 2/18/6 1/19/6 5/20/6
|
|
@ -0,0 +1,52 @@
|
||||||
|
# Blender v2.83.5 OBJ File: 'kitchen_cabinet_half.blend'
|
||||||
|
# www.blender.org
|
||||||
|
o Cube_Cube.001
|
||||||
|
v 0.500000 -0.500000 0.500000
|
||||||
|
v -0.500000 -0.500000 -0.000000
|
||||||
|
v -0.500000 -0.500000 0.500000
|
||||||
|
v 0.500000 0.500000 -0.000000
|
||||||
|
v 0.500000 0.500000 0.500000
|
||||||
|
v -0.500000 0.500000 -0.000000
|
||||||
|
v -0.500000 0.500000 0.500000
|
||||||
|
v 0.500000 -0.500000 0.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 -0.0000 -1.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 1.0000 -0.0000 0.0000
|
||||||
|
g Cube_Cube.001_top
|
||||||
|
s off
|
||||||
|
f 1/1/1 5/2/1 7/3/1 3/4/1
|
||||||
|
g Cube_Cube.001_bottom
|
||||||
|
f 2/5/2 6/6/2 4/7/2 8/8/2
|
||||||
|
g Cube_Cube.001_right
|
||||||
|
f 7/3/3 5/9/3 4/10/3 6/11/3
|
||||||
|
g Cube_Cube.001_left
|
||||||
|
f 1/12/4 3/4/4 2/13/4 8/14/4
|
||||||
|
g Cube_Cube.001_back
|
||||||
|
f 3/15/5 7/16/5 6/17/5 2/18/5
|
||||||
|
g Cube_Cube.001_front
|
||||||
|
f 5/19/6 1/20/6 8/21/6 4/22/6
|
|
@ -1,101 +1,166 @@
|
||||||
v -0.5 -0.5 -0.5
|
# Blender v2.83.5 OBJ File: 'kitchen_sink.blend'
|
||||||
v 0.5 -0.5 -0.5
|
# www.blender.org
|
||||||
v 0.5 -0.5 0.5
|
o Cube_Cube.001
|
||||||
v -0.5 -0.5 0.5
|
v 0.500000 -0.500000 -0.500000
|
||||||
v -0.5 0.5 0.5
|
v 0.500000 -0.500000 0.500000
|
||||||
v -0.5 0.5 -0.5
|
v -0.500000 -0.500000 -0.500000
|
||||||
v 0.5 0.5 -0.5
|
v -0.500000 -0.500000 0.500000
|
||||||
v 0.5 0.5 0.5
|
v 0.500000 0.500000 -0.500000
|
||||||
v -0.387 0.5 0.388
|
v 0.500000 0.500000 0.500000
|
||||||
v -0.387 0.5 -0.387
|
v -0.500000 0.500000 -0.500000
|
||||||
v 0.388 0.5 -0.387
|
v -0.500000 0.500000 0.500000
|
||||||
v 0.388 0.5 0.388
|
v 0.000000 -0.500000 0.500000
|
||||||
v -0.387 0.4 0.388
|
v 0.000000 0.500000 0.500000
|
||||||
v -0.387 0.4 -0.387
|
v 0.000000 0.062500 0.437500
|
||||||
v 0.388 0.4 -0.387
|
v -0.062500 0.062500 0.375000
|
||||||
v 0.388 0.4 0.388
|
v 0.062500 0.062500 0.375000
|
||||||
v 0.063 0.4 -0.062
|
v 0.062500 -0.062500 0.437500
|
||||||
v 0.063 0.4 0.063
|
v 0.000000 -0.062500 0.437500
|
||||||
v -0.062 0.4 -0.062
|
v 0.062500 -0.062500 0.375000
|
||||||
v -0.062 0.4 0.063
|
v -0.062500 -0.062500 0.437500
|
||||||
v 0.063 0.313 0.063
|
v -0.062500 0.062500 0.437500
|
||||||
v 0.063 0.313 -0.062
|
v -0.062500 -0.062500 0.375000
|
||||||
v -0.062 0.313 0.063
|
v 0.000000 0.375000 0.437500
|
||||||
v -0.062 0.313 -0.062
|
v 0.062500 0.062500 0.437500
|
||||||
vt 0.469 0.906
|
v 0.000000 -0.375000 0.437500
|
||||||
vt 0.469 0.531
|
v -0.375000 -0.375000 0.437500
|
||||||
vt 0.531 0.469
|
v -0.375000 0.375000 0.500000
|
||||||
vt 0.531 0.969
|
v -0.375000 0.375000 0.437500
|
||||||
vt 0.031 0.969
|
v 0.375000 0.375000 0.437500
|
||||||
vt 0.094 0.906
|
v 0.000000 0.375000 0.500000
|
||||||
vt 0.031 0.469
|
v 0.375000 0.375000 0.500000
|
||||||
vt 0.094 0.531
|
v 0.000000 -0.375000 0.500000
|
||||||
vt 0.813 0.5
|
v 0.375000 -0.375000 0.500000
|
||||||
vt 0.813 0.938
|
v 0.375000 -0.375000 0.437500
|
||||||
vt 0.781 0.938
|
v -0.375000 -0.375000 0.500000
|
||||||
vt 0.781 0.5
|
vt 0.437500 0.375000
|
||||||
vt 0.688 0.5
|
vt 0.562500 0.437500
|
||||||
vt 0.719 0.5
|
vt 0.437500 0.437500
|
||||||
vt 0.719 0.938
|
vt 0.125000 0.875000
|
||||||
vt 0.688 0.938
|
vt 0.875000 0.875000
|
||||||
vt 0.906 0.5
|
vt 1.000000 1.000000
|
||||||
vt 0.906 0.938
|
vt 0.625000 0.500000
|
||||||
vt 0.875 0.938
|
vt 0.625000 0.562500
|
||||||
vt 0.875 0.5
|
vt 0.562500 0.562500
|
||||||
vt 0.594 0.5
|
vt 0.875000 0.062500
|
||||||
vt 0.625 0.5
|
vt 0.125000 0.125000
|
||||||
vt 0.625 0.938
|
vt 0.125000 0.062500
|
||||||
vt 0.594 0.938
|
vt 0.875000 0.875000
|
||||||
vt 0.313 0.75
|
vt 0.437500 0.562500
|
||||||
vt 0.313 0.688
|
vt 0.562500 0.562500
|
||||||
vt 0.25 0.688
|
vt 0.875000 0.125000
|
||||||
vt 0.25 0.75
|
vt 0.125000 0.125000
|
||||||
vt 0.219 0.375
|
vt 0.000000 0.000000
|
||||||
vt 0.219 0.313
|
vt 0.375000 0.500000
|
||||||
vt 0.25 0.313
|
vt 0.375000 0.437500
|
||||||
vt 0.25 0.375
|
vt 0.437500 0.625000
|
||||||
vt 0.25 0.406
|
vt 0.437500 0.562500
|
||||||
vt 0.313 0.375
|
vt 0.875000 0.500000
|
||||||
vt 0.313 0.406
|
vt 0.875000 0.125000
|
||||||
vt 0.313 0.313
|
vt 0.937500 0.500000
|
||||||
vt 0.344 0.313
|
vt 0.125000 0.500000
|
||||||
vt 0.344 0.375
|
vt 0.125000 0.875000
|
||||||
vt 0.25 0.281
|
vt 0.062500 0.875000
|
||||||
vt 0.313 0.281
|
vt 0.562500 0.437500
|
||||||
vt 0 0
|
vt 0.437500 0.437500
|
||||||
vt 1 0
|
vt 0.125000 0.937500
|
||||||
vt 1 1
|
vt 0.875000 0.937500
|
||||||
vt 0 1
|
vt 0.937500 0.125000
|
||||||
vn 0 1 0
|
vt 0.937500 0.875000
|
||||||
vn -1 0 0
|
vt 0.062500 0.500000
|
||||||
vn 0 0 -1
|
vt 0.062500 0.125000
|
||||||
vn 1 0 0
|
vt 0.562500 0.375000
|
||||||
vn 0 0 1
|
vt 0.625000 0.437500
|
||||||
vn 0 -1 0
|
vt 0.375000 0.562500
|
||||||
g 1
|
vt 0.562500 0.625000
|
||||||
|
vt 0.562500 0.500000
|
||||||
|
vt 0.437500 0.500000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 0.125000 0.500000
|
||||||
|
vt 0.875000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 1.000000 0.000000
|
||||||
|
vt 0.500000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.000000
|
||||||
|
vt 0.500000 1.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn -0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 -0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
g Cube_Cube.001_top
|
||||||
s off
|
s off
|
||||||
f 9/1/1 10/2/1 6/3/1 5/4/1
|
f 14/1/1 13/2/1 16/3/1
|
||||||
f 5/4/1 8/5/1 12/6/1 9/1/1
|
f 32/4/2 24/5/2 8/6/2
|
||||||
f 7/7/1 6/3/1 10/2/1 11/8/1
|
f 11/7/3 18/8/3 12/9/3
|
||||||
f 8/5/1 7/7/1 11/8/1 12/6/1
|
f 28/10/1 31/11/1 30/12/1
|
||||||
f 15/9/2 16/10/2 12/11/2 11/12/2
|
f 25/13/2 17/14/2 18/15/2
|
||||||
f 16/13/3 13/14/3 9/15/3 12/16/3
|
f 28/16/2 30/17/2 2/18/2
|
||||||
f 13/17/4 14/18/4 10/19/4 9/20/4
|
f 15/19/4 14/20/4 16/3/4
|
||||||
f 14/21/5 15/22/5 11/23/5 10/24/5
|
f 12/9/5 17/21/5 19/22/5
|
||||||
f 13/2/1 16/1/1 18/25/1 20/26/1
|
f 20/23/3 26/24/3 27/25/3
|
||||||
f 19/27/1 14/8/1 13/2/1 20/26/1
|
f 22/26/4 23/27/4 32/28/4
|
||||||
f 17/28/1 15/6/1 14/8/1 19/27/1
|
f 26/24/2 21/29/2 14/30/2
|
||||||
f 16/1/1 15/6/1 17/28/1 18/25/1
|
f 32/31/5 25/13/5 24/32/5
|
||||||
f 17/29/2 22/30/2 21/31/2 18/32/2
|
f 12/9/2 19/22/2 16/3/2 13/2/2
|
||||||
f 18/33/3 21/32/3 23/34/3 20/35/3
|
f 28/10/1 26/24/1 31/11/1
|
||||||
f 20/34/4 23/36/4 24/37/4 19/38/4
|
f 26/24/3 28/33/3 27/25/3
|
||||||
f 19/31/5 24/39/5 22/40/5 17/36/5
|
f 27/25/3 24/34/3 20/23/3
|
||||||
f 24/27/1 23/26/1 21/25/1 22/28/1
|
f 24/34/3 25/13/3 20/23/3
|
||||||
g 2
|
f 32/28/4 29/35/4 22/26/4
|
||||||
f 2/41/3 1/42/3 6/43/3 7/44/3
|
f 29/35/4 30/36/4 22/26/4
|
||||||
g 3
|
f 30/36/4 31/11/4 22/26/4
|
||||||
f 1/41/2 4/42/2 5/43/2 6/44/2
|
f 32/31/5 23/27/5 25/13/5
|
||||||
f 2/42/4 7/43/4 8/44/4 3/41/4
|
f 14/1/1 21/37/1 13/2/1
|
||||||
f 4/41/5 3/42/5 8/43/5 5/44/5
|
f 12/9/3 13/2/3 11/7/3
|
||||||
g 4
|
f 13/2/3 21/38/3 11/7/3
|
||||||
f 1/43/6 2/44/6 3/41/6 4/42/6
|
f 16/3/4 19/22/4 15/19/4
|
||||||
|
f 19/22/4 17/39/4 15/19/4
|
||||||
|
f 12/9/5 18/40/5 17/21/5
|
||||||
|
f 11/41/2 20/23/2 18/15/2
|
||||||
|
f 20/23/2 25/13/2 18/15/2
|
||||||
|
f 25/13/2 23/27/2 17/14/2
|
||||||
|
f 23/27/2 22/26/2 17/14/2
|
||||||
|
f 22/26/2 15/42/2 17/14/2
|
||||||
|
f 14/30/2 15/42/2 22/26/2
|
||||||
|
f 22/26/2 31/11/2 14/30/2
|
||||||
|
f 31/11/2 26/24/2 14/30/2
|
||||||
|
f 26/24/2 20/23/2 21/29/2
|
||||||
|
f 20/23/2 11/41/2 21/29/2
|
||||||
|
f 4/43/2 9/44/2 32/4/2
|
||||||
|
f 9/44/2 29/45/2 32/4/2
|
||||||
|
f 27/46/2 10/47/2 24/5/2
|
||||||
|
f 10/47/2 8/6/2 24/5/2
|
||||||
|
f 4/43/2 32/4/2 8/6/2
|
||||||
|
f 6/48/2 10/47/2 28/16/2
|
||||||
|
f 10/47/2 27/46/2 28/16/2
|
||||||
|
f 29/45/2 9/44/2 30/17/2
|
||||||
|
f 9/44/2 2/18/2 30/17/2
|
||||||
|
f 6/48/2 28/16/2 2/18/2
|
||||||
|
g Cube_Cube.001_bottom
|
||||||
|
f 5/49/6 1/50/6 3/51/6 7/52/6
|
||||||
|
g Cube_Cube.001_right
|
||||||
|
f 8/6/4 10/53/4 6/54/4 5/55/4 7/52/4
|
||||||
|
g Cube_Cube.001_left
|
||||||
|
f 9/56/3 4/43/3 3/51/3 1/57/3 2/58/3
|
||||||
|
g Cube_Cube.001_back
|
||||||
|
f 7/59/1 3/60/1 4/61/1 8/62/1
|
||||||
|
g Cube_Cube.001_front
|
||||||
|
f 1/63/5 5/64/5 6/65/5 2/66/5
|
||||||
|
|
Before Width: | Height: | Size: 87 B After Width: | Height: | Size: 112 B |
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 381 B |
After Width: | Height: | Size: 561 B |
After Width: | Height: | Size: 109 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 286 B |
|
@ -1789,6 +1789,14 @@ unifieddyes.register_color_craft({
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "homedecor:torch_wall 10",
|
||||||
|
recipe = {
|
||||||
|
{ "default:coal_lump" },
|
||||||
|
{ "default:steel_ingot" },
|
||||||
|
},
|
||||||
|
})
|
||||||
-- aliases
|
-- aliases
|
||||||
|
|
||||||
minetest.register_alias("chains:chain_top", "homedecor:chain_steel_top")
|
minetest.register_alias("chains:chain_top", "homedecor:chain_steel_top")
|
||||||
|
|
|
@ -2,25 +2,58 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("homedecor_tables")
|
local S = minetest.get_translator("homedecor_tables")
|
||||||
|
|
||||||
local materials = {
|
-- Various kinds of table legs
|
||||||
|
|
||||||
|
local table_shapes = {"large_square", "small_square", "small_round"}
|
||||||
|
|
||||||
|
local tabletop_materials = {
|
||||||
{ "glass",
|
{ "glass",
|
||||||
S("Small square glass table"),
|
S("Small square glass tabletop"),
|
||||||
S("Small round glass table"),
|
S("Small round glass tabletop"),
|
||||||
S("Large glass table piece"),
|
S("Large glass tabletop piece"),
|
||||||
},
|
},
|
||||||
{ "wood",
|
{ "wood",
|
||||||
S("Small square wooden table"),
|
S("Small square wooden tabletop"),
|
||||||
S("Small round wooden table"),
|
S("Small round wooden tabletop"),
|
||||||
S("Large wooden table piece"),
|
S("Large wooden tabletop piece"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leg_materials = {
|
||||||
|
{ "brass", S("brass") },
|
||||||
|
{ "wrought_iron", S("wrought iron") },
|
||||||
|
{ "wood", S("wood") }
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, t in ipairs(leg_materials) do
|
||||||
|
local name, desc = unpack(t)
|
||||||
|
homedecor.register("table_legs_"..name, {
|
||||||
|
description = S("Table Legs (@1)", desc),
|
||||||
|
drawtype = "plantlike",
|
||||||
|
tiles = {"homedecor_table_legs_"..name..".png"},
|
||||||
|
inventory_image = "homedecor_table_legs_"..name..".png",
|
||||||
|
wield_image = "homedecor_table_legs_"..name..".png",
|
||||||
|
walkable = false,
|
||||||
|
groups = {snappy=3},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 }
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_alias("homedecor:utility_table_legs", "homedecor:table_legs_wood")
|
||||||
|
minetest.register_alias("homedecor:utility_table_top", "homedecor:wood_table_small_square")
|
||||||
|
|
||||||
|
-- table tops and combined tables
|
||||||
|
|
||||||
local tables_cbox = {
|
local tables_cbox = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, mat in ipairs(materials) do
|
for i, mat in ipairs(tabletop_materials) do
|
||||||
local m, small_s, small_r, large = unpack(mat)
|
local m, small_s, small_r, large = unpack(mat)
|
||||||
local s
|
local s
|
||||||
|
|
||||||
|
@ -30,179 +63,102 @@ for i, mat in ipairs(materials) do
|
||||||
s = default.node_sound_wood_defaults()
|
s = default.node_sound_wood_defaults()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- small square tables
|
for _, shape in ipairs(table_shapes) do
|
||||||
|
|
||||||
homedecor.register(m.."_table_small_square", {
|
homedecor.register(m.."_table_"..shape, {
|
||||||
description = small_s,
|
description = shape.." "..m.." tabletop",
|
||||||
mesh = "homedecor_table_small_square.obj",
|
mesh = "homedecor_table_"..shape..".obj",
|
||||||
tiles = { 'homedecor_'..m..'_table_small_square.png' },
|
tiles = {
|
||||||
wield_image = 'homedecor_'..m..'_table_small_square_inv.png',
|
'homedecor_'..m..'_table_'..shape..'.png',
|
||||||
inventory_image = 'homedecor_'..m..'_table_small_square_inv.png',
|
'homedecor_'..m..'_table_edges.png',
|
||||||
groups = { snappy = 3 },
|
'homedecor_blanktile.png',
|
||||||
sounds = s,
|
'homedecor_blanktile.png',
|
||||||
selection_box = tables_cbox,
|
'homedecor_blanktile.png',
|
||||||
collision_box = tables_cbox,
|
},
|
||||||
on_place = minetest.rotate_node
|
wield_image = 'homedecor_'..m..'_table_'..shape..'_inv.png',
|
||||||
})
|
groups = { snappy = 3 },
|
||||||
|
sounds = s,
|
||||||
|
selection_box = tables_cbox,
|
||||||
|
collision_box = tables_cbox,
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
local player_name = placer:get_player_name()
|
||||||
|
if minetest.is_protected(pointed_thing.under, player_name) then return end
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
if string.find(node.name, "homedecor:table_legs") then
|
||||||
|
local newname = string.format("homedecor:%s_table_%s_with_%s_legs",
|
||||||
|
m, shape, string.sub(node.name, 22))
|
||||||
|
minetest.set_node(pointed_thing.under, {name = newname})
|
||||||
|
if not creative.is_enabled_for(player_name) then
|
||||||
|
itemstack:take_item()
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return minetest.rotate_node(itemstack, placer, pointed_thing)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- small round tables
|
for _, l in ipairs(leg_materials) do
|
||||||
|
local leg_mat, desc = unpack(l)
|
||||||
|
|
||||||
homedecor.register(m..'_table_small_round', {
|
homedecor.register(string.format("%s_table_%s_with_%s_legs", m, shape, leg_mat), {
|
||||||
description = small_r,
|
description = string.format("%s %s table with %s legs", shape, m, leg_mat),
|
||||||
mesh = "homedecor_table_small_round.obj",
|
mesh = "homedecor_table_"..shape..".obj",
|
||||||
tiles = { "homedecor_"..m.."_table_small_round.png" },
|
tiles = {
|
||||||
wield_image = 'homedecor_'..m..'_table_small_round_inv.png',
|
'homedecor_blanktile.png',
|
||||||
inventory_image = 'homedecor_'..m..'_table_small_round_inv.png',
|
'homedecor_blanktile.png',
|
||||||
groups = { snappy = 3 },
|
'homedecor_'..m..'_table_'..shape..'.png',
|
||||||
sounds = s,
|
'homedecor_'..m..'_table_edges.png',
|
||||||
selection_box = tables_cbox,
|
"homedecor_table_legs_"..leg_mat..".png",
|
||||||
collision_box = tables_cbox,
|
},
|
||||||
on_place = minetest.rotate_node
|
groups = { snappy = 3 },
|
||||||
})
|
sounds = s,
|
||||||
|
})
|
||||||
-- Large square table pieces
|
end
|
||||||
|
end
|
||||||
homedecor.register(m..'_table_large', {
|
|
||||||
description = large,
|
|
||||||
tiles = {
|
|
||||||
'homedecor_'..m..'_table_large_tb.png',
|
|
||||||
'homedecor_'..m..'_table_large_tb.png',
|
|
||||||
'homedecor_'..m..'_table_large_edges.png',
|
|
||||||
'homedecor_'..m..'_table_large_edges.png',
|
|
||||||
'homedecor_'..m..'_table_large_edges.png',
|
|
||||||
'homedecor_'..m..'_table_large_edges.png'
|
|
||||||
},
|
|
||||||
wield_image = 'homedecor_'..m..'_table_large_inv.png',
|
|
||||||
inventory_image = 'homedecor_'..m..'_table_large_inv.png',
|
|
||||||
groups = { snappy = 3 },
|
|
||||||
sounds = s,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
||||||
},
|
|
||||||
selection_box = tables_cbox,
|
|
||||||
on_place = minetest.rotate_node
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_alias('homedecor:'..m..'_table_large_b', 'homedecor:'..m..'_table_large')
|
minetest.register_alias('homedecor:'..m..'_table_large_b', 'homedecor:'..m..'_table_large')
|
||||||
minetest.register_alias('homedecor:'..m..'_table_small_square_b', 'homedecor:'..m..'_table_small_square')
|
minetest.register_alias('homedecor:'..m..'_table_small_square_b', 'homedecor:'..m..'_table_small_square')
|
||||||
minetest.register_alias('homedecor:'..m..'_table_small_round_b', 'homedecor:'..m..'_table_small_round')
|
minetest.register_alias('homedecor:'..m..'_table_small_round_b', 'homedecor:'..m..'_table_small_round')
|
||||||
|
minetest.register_alias('homedecor:'..m..'_table_large', 'homedecor:'..m..'_table_large_square')
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- conversion routines for old non-6dfacedir tables
|
-- old-style tables that used to be from 3dforniture.
|
||||||
|
|
||||||
local tlist_s = {}
|
local table_colors = {
|
||||||
local tlist_t = {}
|
{ "", S("Table"), homedecor.plain_wood },
|
||||||
local dirs2 = { 9, 18, 7, 12 }
|
{ "_mahogany", S("Mahogany Table"), homedecor.mahogany_wood },
|
||||||
|
{ "_white", S("White Table"), homedecor.white_wood }
|
||||||
for i in ipairs(materials) do
|
|
||||||
local m = materials[i][1]
|
|
||||||
table.insert(tlist_s, "homedecor:"..m.."_table_large_s")
|
|
||||||
table.insert(tlist_s, "homedecor:"..m.."_table_small_square_s")
|
|
||||||
table.insert(tlist_s, "homedecor:"..m.."_table_small_round_s")
|
|
||||||
|
|
||||||
table.insert(tlist_t, "homedecor:"..m.."_table_large_t")
|
|
||||||
table.insert(tlist_t, "homedecor:"..m.."_table_small_square_t")
|
|
||||||
table.insert(tlist_t, "homedecor:"..m.."_table_small_round_t")
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = tlist_s,
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local newnode = string.sub(node.name, 1, -3) -- strip the "_s" from the name
|
|
||||||
local fdir = node.param2 or 0
|
|
||||||
minetest.set_node(pos, {name = newnode, param2 = dirs2[fdir+1]})
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = tlist_t,
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local newnode = string.sub(node.name, 1, -3) -- strip the "_t" from the name
|
|
||||||
minetest.set_node(pos, { name = newnode, param2 = 20 })
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- other tables
|
|
||||||
|
|
||||||
homedecor.register("utility_table_top", {
|
|
||||||
description = S("Utility Table"),
|
|
||||||
tiles = {
|
|
||||||
'homedecor_utility_table_tb.png',
|
|
||||||
'homedecor_utility_table_tb.png',
|
|
||||||
'homedecor_utility_table_edges.png',
|
|
||||||
'homedecor_utility_table_edges.png',
|
|
||||||
'homedecor_utility_table_edges.png',
|
|
||||||
'homedecor_utility_table_edges.png'
|
|
||||||
},
|
|
||||||
wield_image = 'homedecor_utility_table_tb.png',
|
|
||||||
inventory_image = 'homedecor_utility_table_tb.png',
|
|
||||||
groups = { snappy = 3 },
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
node_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
||||||
wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 },
|
|
||||||
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 },
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
wall_bottom = { -0.5, -0.5, -0.5, 0.5, -0.4375, 0.5 },
|
|
||||||
wall_top = { -0.5, 0.4375, -0.5, 0.5, 0.5, 0.5 },
|
|
||||||
wall_side = { -0.5, -0.5, -0.5, -0.4375, 0.5, 0.5 },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Various kinds of table legs
|
|
||||||
|
|
||||||
-- local above
|
|
||||||
materials = {
|
|
||||||
{ "brass", S("brass") },
|
|
||||||
{ "wrought_iron", S("wrought iron") },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, t in ipairs(materials) do
|
for _, t in ipairs(table_colors) do
|
||||||
local name, desc = unpack(t)
|
local suffix, desc, texture = unpack(t)
|
||||||
homedecor.register("table_legs_"..name, {
|
|
||||||
description = S("Table Legs (@1)", desc),
|
homedecor.register("table"..suffix, {
|
||||||
drawtype = "plantlike",
|
description = desc,
|
||||||
tiles = {"homedecor_table_legs_"..name..".png"},
|
tiles = { texture },
|
||||||
inventory_image = "homedecor_table_legs_"..name..".png",
|
node_box = {
|
||||||
wield_image = "homedecor_table_legs_"..name..".png",
|
type = "fixed",
|
||||||
walkable = false,
|
fixed = {
|
||||||
groups = {snappy=3},
|
{ -0.4, -0.5, -0.4, -0.3, 0.4, -0.3 },
|
||||||
sounds = default.node_sound_wood_defaults(),
|
{ 0.3, -0.5, -0.4, 0.4, 0.4, -0.3 },
|
||||||
selection_box = {
|
{ -0.4, -0.5, 0.3, -0.3, 0.4, 0.4 },
|
||||||
type = "fixed",
|
{ 0.3, -0.5, 0.3, 0.4, 0.4, 0.4 },
|
||||||
fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 }
|
{ -0.5, 0.4, -0.5, 0.5, 0.5, 0.5 },
|
||||||
},
|
{ -0.4, -0.2, -0.3, -0.3, -0.1, 0.3 },
|
||||||
})
|
{ 0.3, -0.2, -0.4, 0.4, -0.1, 0.3 },
|
||||||
|
{ -0.3, -0.2, -0.4, 0.4, -0.1, -0.3 },
|
||||||
|
{ -0.3, -0.2, 0.3, 0.3, -0.1, 0.4 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
homedecor.register("utility_table_legs", {
|
|
||||||
description = S("Legs for Utility Table"),
|
|
||||||
drawtype = "plantlike",
|
|
||||||
tiles = { 'homedecor_utility_table_legs.png' },
|
|
||||||
inventory_image = 'homedecor_utility_table_legs_inv.png',
|
|
||||||
wield_image = 'homedecor_utility_table_legs.png',
|
|
||||||
walkable = false,
|
|
||||||
groups = { snappy = 3 },
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = { -0.37, -0.5, -0.37, 0.37, 0.5, 0.37 }
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- crafting
|
-- crafting
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "homedecor:glass_table_small_round_b 15",
|
output = "homedecor:glass_table_small_round_b 15",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -226,8 +182,6 @@ minetest.register_craft( {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
--
|
|
||||||
|
|
||||||
minetest.register_craft( {
|
minetest.register_craft( {
|
||||||
output = "homedecor:wood_table_small_round_b 15",
|
output = "homedecor:wood_table_small_round_b 15",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -305,7 +259,73 @@ minetest.register_craft({
|
||||||
burntime = 30,
|
burntime = 30,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
for _, shape in ipairs (table_shapes) do
|
||||||
|
for _, leg in ipairs(leg_materials) do
|
||||||
|
for _, mat in ipairs(tabletop_materials) do
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "homedecor:"..mat[1].."_table_"..shape.."_with_"..leg[1].."_legs",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = {
|
||||||
|
"homedecor:"..mat[1].."_table_"..shape,
|
||||||
|
"homedecor:table_legs_"..leg[1]
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "homedecor:table",
|
||||||
|
recipe = {
|
||||||
|
{ "group:wood","group:wood", "group:wood" },
|
||||||
|
{ "group:stick", "", "group:stick" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "homedecor:table_mahogany",
|
||||||
|
recipe = {
|
||||||
|
"homedecor:table",
|
||||||
|
"dye:brown",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "homedecor:table_mahogany",
|
||||||
|
recipe = {
|
||||||
|
"homedecor:table",
|
||||||
|
"unifieddyes:dark_orange",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "homedecor:table_white",
|
||||||
|
recipe = {
|
||||||
|
"homedecor:table",
|
||||||
|
"dye:white",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "homedecor:table",
|
||||||
|
burntime = 30,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "homedecor:table_mahogany",
|
||||||
|
burntime = 30,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "homedecor:table_white",
|
||||||
|
burntime = 30,
|
||||||
|
})
|
||||||
|
|
||||||
-- recycling
|
-- recycling
|
||||||
|
|
||||||
|
@ -368,3 +388,8 @@ minetest.register_craft({
|
||||||
"homedecor:wood_table_large"
|
"homedecor:wood_table_large"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Aliases for the above 3dforniture-like tables
|
||||||
|
|
||||||
|
minetest.register_alias("3dforniture:table", "homedecor:table")
|
||||||
|
minetest.register_alias('table', 'homedecor:table')
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
name = homedecor_tables
|
name = homedecor_tables
|
||||||
description = Homedecor mod: tables
|
description = Homedecor mod: tables
|
||||||
depends = homedecor_common, default, basic_materials
|
depends = homedecor_common, default, basic_materials
|
||||||
|
optional_depends = creative
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
# Blender v2.83.5 OBJ File: 'homedecor table with legs.blend'
|
||||||
|
# www.blender.org
|
||||||
|
o Cube_Cube.001
|
||||||
|
v -0.500000 -0.500000 0.500000
|
||||||
|
v 0.500000 -0.500000 -0.500000
|
||||||
|
v 0.500000 0.500000 0.500000
|
||||||
|
v 0.500000 0.500000 -0.500000
|
||||||
|
v -0.500000 0.437500 -0.500000
|
||||||
|
v -0.353553 -0.500000 0.353554
|
||||||
|
v -0.353553 0.437515 0.353554
|
||||||
|
v 0.353553 -0.500000 -0.353553
|
||||||
|
v 0.353553 0.437515 -0.353553
|
||||||
|
v 0.500000 -0.500000 0.500000
|
||||||
|
v 0.500000 -0.437500 -0.500000
|
||||||
|
v 0.500000 -0.437500 0.500000
|
||||||
|
v -0.500000 -0.437500 -0.500000
|
||||||
|
v -0.500000 -0.500000 -0.500000
|
||||||
|
v -0.500000 -0.437500 0.500000
|
||||||
|
v 0.500000 0.437500 -0.500000
|
||||||
|
v 0.500000 0.437500 0.500000
|
||||||
|
v -0.500000 0.500000 -0.500000
|
||||||
|
v -0.500000 0.437500 0.500000
|
||||||
|
v -0.500000 0.500000 0.500000
|
||||||
|
v 0.353553 -0.500000 0.353554
|
||||||
|
v 0.353553 0.437515 0.353554
|
||||||
|
v -0.353553 -0.500000 -0.353553
|
||||||
|
v -0.353553 0.437515 -0.353553
|
||||||
|
vt -0.000000 -0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 0.000000 -0.000000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt -0.000000 1.000000
|
||||||
|
vt -0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn 0.7071 0.0000 -0.7071
|
||||||
|
vn 0.7071 0.0000 0.7071
|
||||||
|
g Cube_Cube.001_top-bottom
|
||||||
|
s off
|
||||||
|
f 14/1/1 2/2/1 10/3/1 1/4/1
|
||||||
|
f 11/5/2 13/6/2 15/7/2 12/8/2
|
||||||
|
g Cube_Cube.001_edges
|
||||||
|
f 11/5/3 12/9/3 10/10/3 2/11/3
|
||||||
|
f 13/6/4 14/12/4 1/13/4 15/14/4
|
||||||
|
f 12/15/5 15/16/5 1/17/5 10/18/5
|
||||||
|
f 13/19/6 11/20/6 2/21/6 14/22/6
|
||||||
|
g Cube_Cube.001_top-bot_with_legs
|
||||||
|
f 20/23/2 3/24/2 4/25/2 18/26/2
|
||||||
|
f 16/27/1 17/28/1 19/29/1 5/30/1
|
||||||
|
g Cube_Cube.001_edges_with_legs
|
||||||
|
f 20/31/5 19/32/5 17/33/5 3/34/5
|
||||||
|
f 4/25/3 3/35/3 17/36/3 16/37/3
|
||||||
|
f 19/38/4 20/39/4 18/26/4 5/40/4
|
||||||
|
f 4/41/6 16/42/6 5/43/6 18/44/6
|
||||||
|
g Cube_Cube.001_legs
|
||||||
|
f 21/45/7 23/46/7 24/47/7 22/48/7
|
||||||
|
f 6/49/8 8/50/8 9/51/8 7/52/8
|
|
@ -1,43 +1,139 @@
|
||||||
v 0.499 -0.499 -0.499
|
# Blender v2.83.5 OBJ File: 'homedecor small square table with legs.blend'
|
||||||
v 0.499 -0.499 0.499
|
# www.blender.org
|
||||||
v -0.499 -0.499 0.499
|
o Cube_Cube.001
|
||||||
v -0.499 -0.499 -0.499
|
v -0.500000 -0.500000 0.500000
|
||||||
v 0.499 -0.469 -0.499
|
v 0.500000 -0.500000 -0.500000
|
||||||
v 0.499 -0.469 0.499
|
v -0.500000 0.437500 -0.500000
|
||||||
v -0.499 -0.469 0.499
|
v -0.353553 -0.500000 0.353554
|
||||||
v -0.499 -0.469 -0.499
|
v -0.353553 0.437515 0.353554
|
||||||
v 0.469 -0.437 -0.469
|
v 0.353553 -0.500000 -0.353553
|
||||||
v 0.469 -0.437 0.469
|
v 0.353553 0.437515 -0.353553
|
||||||
v -0.469 -0.437 0.469
|
v 0.500000 -0.500000 0.500000
|
||||||
v -0.469 -0.437 -0.469
|
v -0.500000 -0.500000 -0.500000
|
||||||
vt 0.5 0.029
|
v 0.500000 0.437500 -0.500000
|
||||||
vt 0.971 0.029
|
v 0.500000 0.437500 0.500000
|
||||||
vt 0.971 0.5
|
v -0.500000 0.437500 0.500000
|
||||||
vt 0.5 0.5
|
v 0.353553 -0.500000 0.353554
|
||||||
vt 0.015 0.985
|
v 0.353553 0.437515 0.353554
|
||||||
vt 0.015 0.515
|
v -0.353553 -0.500000 -0.353553
|
||||||
vt 0.029 0.529
|
v -0.353553 0.437515 -0.353553
|
||||||
vt 0.029 0.971
|
v 0.468750 0.500000 0.468750
|
||||||
vt 0.985 0.5
|
v 0.500000 0.468750 0.500000
|
||||||
vt 0.985 0.029
|
v 0.500000 0.468750 -0.500000
|
||||||
vt 0.5 0.515
|
v 0.468750 0.500000 -0.468750
|
||||||
vt 0.971 0.515
|
v 0.500000 -0.468750 -0.500000
|
||||||
vt 0.485 0.029
|
v 0.468750 -0.437500 -0.468750
|
||||||
vt 0.485 0.5
|
v 0.500000 -0.468750 0.500000
|
||||||
vt 0.971 0.015
|
v 0.468750 -0.437500 0.468750
|
||||||
vt 0.5 0.015
|
v -0.500000 -0.468750 -0.500000
|
||||||
vt 0.471 0.971
|
v -0.468750 -0.437500 -0.468750
|
||||||
vt 0.471 0.529
|
v -0.468750 -0.437500 0.468750
|
||||||
vt 0.485 0.515
|
v -0.500000 -0.468750 0.500000
|
||||||
vt 0.485 0.985
|
v -0.468750 0.500000 -0.468750
|
||||||
|
v -0.500000 0.468750 -0.500000
|
||||||
|
v -0.468750 0.500000 0.468750
|
||||||
|
v -0.500000 0.468750 0.500000
|
||||||
|
vt -0.000000 -0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt -0.000000 0.500000
|
||||||
|
vt 0.968750 0.984375
|
||||||
|
vt 0.031250 0.984375
|
||||||
|
vt 0.031250 0.515625
|
||||||
|
vt 0.968750 0.515625
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 0.000000 -0.000000
|
||||||
|
vt 0.031250 0.515625
|
||||||
|
vt 0.968750 0.515625
|
||||||
|
vt 0.968750 0.984375
|
||||||
|
vt 0.031250 0.984375
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt 0.000000 0.500000
|
||||||
|
vt 1.000000 0.500000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.968750
|
||||||
|
vt 0.000000 0.968750
|
||||||
|
vt 0.000000 0.937500
|
||||||
|
vt 1.000000 0.937500
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vt -0.000000 0.000000
|
||||||
|
vt 1.000000 -0.000000
|
||||||
|
vt 1.000000 1.000000
|
||||||
|
vt 0.000000 1.000000
|
||||||
|
vn 0.0000 -1.0000 0.0000
|
||||||
|
vn 0.0000 1.0000 0.0000
|
||||||
|
vn 0.0000 0.7071 0.7071
|
||||||
|
vn 0.7071 0.7071 0.0000
|
||||||
|
vn 0.0000 0.7071 -0.7071
|
||||||
|
vn -0.7071 0.7071 0.0000
|
||||||
|
vn 0.0000 0.0000 1.0000
|
||||||
|
vn 0.0000 0.0000 -1.0000
|
||||||
|
vn -1.0000 0.0000 0.0000
|
||||||
|
vn 1.0000 0.0000 0.0000
|
||||||
|
vn 0.7071 0.0000 -0.7071
|
||||||
|
vn 0.7071 0.0000 0.7071
|
||||||
|
g Cube_Cube.001_top-bottom
|
||||||
s off
|
s off
|
||||||
f 1/1 2/2 3/3 4/4
|
f 9/1/1 2/2/1 8/3/1 1/4/1
|
||||||
f 8/5 7/6 11/7 12/8
|
f 22/5/2 26/6/2 27/7/2 24/8/2
|
||||||
f 1/9 5/3 6/2 2/10
|
f 24/8/3 27/7/3 28/9/3 23/10/3
|
||||||
f 2/11 6/4 7/3 3/12
|
f 22/5/4 24/8/4 23/10/4 21/11/4
|
||||||
f 3/13 7/1 8/4 4/14
|
f 26/6/5 22/5/5 21/11/5 25/12/5
|
||||||
f 5/15 1/2 4/1 8/16
|
f 27/7/6 26/6/6 25/12/6 28/9/6
|
||||||
f 9/17 12/8 11/7 10/18
|
g Cube_Cube.001_edges
|
||||||
f 7/6 6/19 10/18 11/7
|
f 23/13/7 28/14/7 1/15/7 8/16/7
|
||||||
f 5/20 8/5 12/8 9/17
|
f 25/17/8 21/18/8 2/19/8 9/20/8
|
||||||
f 6/19 5/20 9/17 10/18
|
f 25/21/9 9/22/9 1/23/9 28/24/9
|
||||||
|
f 21/25/10 23/26/10 8/27/10 2/28/10
|
||||||
|
g Cube_Cube.001_top-bot_with_legs
|
||||||
|
f 10/29/1 11/30/1 12/31/1 3/32/1
|
||||||
|
f 31/33/2 17/34/2 20/35/2 29/36/2
|
||||||
|
f 31/33/6 29/36/6 30/37/6 32/38/6
|
||||||
|
f 20/35/4 17/34/4 18/39/4 19/40/4
|
||||||
|
f 17/34/3 31/33/3 32/38/3 18/39/3
|
||||||
|
f 29/36/5 20/35/5 19/40/5 30/37/5
|
||||||
|
g Cube_Cube.001_edges_with_legs
|
||||||
|
f 32/41/7 12/42/7 11/43/7 18/44/7
|
||||||
|
f 19/45/8 10/46/8 3/47/8 30/48/8
|
||||||
|
f 12/49/9 32/50/9 30/51/9 3/52/9
|
||||||
|
f 19/53/10 18/54/10 11/55/10 10/56/10
|
||||||
|
g Cube_Cube.001_legs
|
||||||
|
f 13/57/11 15/58/11 16/59/11 14/60/11
|
||||||
|
f 4/61/12 6/62/12 7/63/12 5/64/12
|
||||||
|
|
Before Width: | Height: | Size: 74 B |
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 604 B |
After Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 597 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 713 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 642 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 476 B |
After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 573 B After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 901 B |
|
@ -1,4 +1,5 @@
|
||||||
local S = minetest.get_translator("skinsdb")
|
local S = minetest.get_translator("skinsdb")
|
||||||
|
local ui = unified_inventory
|
||||||
|
|
||||||
function skins.get_formspec_context(player)
|
function skins.get_formspec_context(player)
|
||||||
if player then
|
if player then
|
||||||
|
@ -11,7 +12,7 @@ function skins.get_formspec_context(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Show skin info
|
-- Show skin info
|
||||||
function skins.get_skin_info_formspec(skin)
|
function skins.get_skin_info_formspec(skin, perplayer_formspec)
|
||||||
local texture = skin:get_texture()
|
local texture = skin:get_texture()
|
||||||
local m_name = skin:get_meta_string("name")
|
local m_name = skin:get_meta_string("name")
|
||||||
local m_author = skin:get_meta_string("author")
|
local m_author = skin:get_meta_string("author")
|
||||||
|
@ -20,30 +21,82 @@ function skins.get_skin_info_formspec(skin)
|
||||||
-- overview page
|
-- overview page
|
||||||
local raw_size = m_format == "1.8" and "2,2" or "2,1"
|
local raw_size = m_format == "1.8" and "2,2" or "2,1"
|
||||||
|
|
||||||
local formspec = "image[0.8,.6;1,2;"..minetest.formspec_escape(skin:get_preview()).."]"
|
local lxoffs = 0.8
|
||||||
|
local cxoffs = 2
|
||||||
|
local rxoffs = 5.5
|
||||||
|
|
||||||
|
if type(perplayer_formspec) == "table" then -- we're using Unified Inventory
|
||||||
|
lxoffs = 1.5
|
||||||
|
cxoffs = 3.75
|
||||||
|
rxoffs = 7.5
|
||||||
|
end
|
||||||
|
|
||||||
|
local formspec = "image["..lxoffs..",.6;1,2;"..minetest.formspec_escape(skin:get_preview()).."]"
|
||||||
if texture then
|
if texture then
|
||||||
formspec = formspec.."label[6,.5;"..S("Raw texture")..":]"
|
formspec = formspec.."label["..rxoffs..",.5;"..S("Raw texture")..":]"
|
||||||
.."image[6,1;"..raw_size..";"..texture.."]"
|
.."image["..rxoffs..",1;"..raw_size..";"..texture.."]"
|
||||||
end
|
end
|
||||||
if m_name ~= "" then
|
if m_name ~= "" then
|
||||||
formspec = formspec.."label[2,.5;"..S("Name")..": "..minetest.formspec_escape(m_name).."]"
|
formspec = formspec.."label["..cxoffs..",.5;"..S("Name")..": "..minetest.formspec_escape(m_name).."]"
|
||||||
end
|
end
|
||||||
if m_author ~= "" then
|
if m_author ~= "" then
|
||||||
formspec = formspec.."label[2,1;"..S("Author")..": "..minetest.formspec_escape(m_author).."]"
|
formspec = formspec.."label["..cxoffs..",1;"..S("Author")..": "..minetest.formspec_escape(m_author).."]"
|
||||||
end
|
end
|
||||||
if m_license ~= "" then
|
if m_license ~= "" then
|
||||||
formspec = formspec.."label[2,1.5;"..S("License")..": "..minetest.formspec_escape(m_license).."]"
|
formspec = formspec.."label["..cxoffs..",1.5;"..S("License")..": "..minetest.formspec_escape(m_license).."]"
|
||||||
end
|
end
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
function skins.get_skin_selection_formspec(player, context, y_delta)
|
function skins.get_skin_selection_formspec(player, context, perplayer_formspec)
|
||||||
context.skins_list = skins.get_skinlist_for_player(player:get_player_name())
|
context.skins_list = skins.get_skinlist_for_player(player:get_player_name())
|
||||||
context.total_pages = 1
|
context.total_pages = 1
|
||||||
|
local xoffs = 0
|
||||||
|
local yoffs = 4
|
||||||
|
local xspc = 1
|
||||||
|
local yspc = 2
|
||||||
|
local skinwidth = 1
|
||||||
|
local skinheight = 2
|
||||||
|
local xscale = 1
|
||||||
|
local btn_y = 8.15
|
||||||
|
local drop_y = 8
|
||||||
|
local btn_width = 1
|
||||||
|
local droppos = 1
|
||||||
|
local droplen = 6.25
|
||||||
|
local btn_right = 7
|
||||||
|
local maxdisp = 16
|
||||||
|
|
||||||
|
local ctrls_height = 0.5
|
||||||
|
|
||||||
|
if type(perplayer_formspec) == "table" then -- it's being used under Unified Inventory
|
||||||
|
xoffs = perplayer_formspec.std_inv_x
|
||||||
|
xspc = ui.imgscale
|
||||||
|
yspc = ui.imgscale*2
|
||||||
|
skinwidth = ui.imgscale*0.9
|
||||||
|
skinheight = ui.imgscale*1.9
|
||||||
|
xscale = ui.imgscale
|
||||||
|
btn_width = ui.imgscale
|
||||||
|
droppos = xoffs + btn_width + 0.1
|
||||||
|
droplen = ui.imgscale * 6 - 0.2
|
||||||
|
btn_right = droppos + droplen + 0.1
|
||||||
|
|
||||||
|
if perplayer_formspec.pagecols == 4 then -- and we're in lite mode
|
||||||
|
yoffs = 1
|
||||||
|
maxdisp = 8
|
||||||
|
drop_y = yoffs + skinheight + 0.1
|
||||||
|
else
|
||||||
|
yoffs = 0.2
|
||||||
|
drop_y = yoffs + skinheight*2 + 0.2
|
||||||
|
end
|
||||||
|
|
||||||
|
btn_y = drop_y
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
for i, skin in ipairs(context.skins_list ) do
|
for i, skin in ipairs(context.skins_list ) do
|
||||||
local page = math.floor((i-1) / 16)+1
|
local page = math.floor((i-1) / maxdisp)+1
|
||||||
skin:set_meta("inv_page", page)
|
skin:set_meta("inv_page", page)
|
||||||
skin:set_meta("inv_page_index", (i-1)%16+1)
|
skin:set_meta("inv_page_index", (i-1)%maxdisp+1)
|
||||||
context.total_pages = page
|
context.total_pages = page
|
||||||
end
|
end
|
||||||
context.skins_page = context.skins_page or skins.get_player_skin(player):get_meta("inv_page") or 1
|
context.skins_page = context.skins_page or skins.get_player_skin(player):get_meta("inv_page") or 1
|
||||||
|
@ -51,22 +104,25 @@ function skins.get_skin_selection_formspec(player, context, y_delta)
|
||||||
|
|
||||||
local page = context.skins_page
|
local page = context.skins_page
|
||||||
local formspec = ""
|
local formspec = ""
|
||||||
for i = (page-1)*16+1, page*16 do
|
|
||||||
|
for i = (page-1)*maxdisp+1, page*maxdisp do
|
||||||
local skin = context.skins_list[i]
|
local skin = context.skins_list[i]
|
||||||
if not skin then
|
if not skin then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
local index_p = skin:get_meta("inv_page_index")
|
local index_p = skin:get_meta("inv_page_index")
|
||||||
local x = (index_p-1) % 8
|
local x = ((index_p-1) % 8) * xspc + xoffs
|
||||||
local y
|
local y
|
||||||
if index_p > 8 then
|
if index_p > 8 then
|
||||||
y = y_delta + 1.9
|
y = yoffs + yspc
|
||||||
else
|
else
|
||||||
y = y_delta
|
y = yoffs
|
||||||
end
|
end
|
||||||
formspec = formspec.."image_button["..x..","..y..";1,2;"..
|
formspec = formspec..
|
||||||
minetest.formspec_escape(skin:get_preview())..";skins_set$"..i..";]"..
|
string.format("image_button[%f,%f;%f,%f;%s;skins_set$%i;]",
|
||||||
|
x, y, skinwidth, skinheight,
|
||||||
|
minetest.formspec_escape(skin:get_preview()), i)..
|
||||||
"tooltip[skins_set$"..i..";"..minetest.formspec_escape(skin:get_meta_string("name")).."]"
|
"tooltip[skins_set$"..i..";"..minetest.formspec_escape(skin:get_meta_string("name")).."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,10 +143,13 @@ function skins.get_skin_selection_formspec(player, context, y_delta)
|
||||||
if pg > 1 then page_list = page_list.."," end
|
if pg > 1 then page_list = page_list.."," end
|
||||||
page_list = page_list..pagename
|
page_list = page_list..pagename
|
||||||
end
|
end
|
||||||
formspec = formspec
|
formspec = formspec..
|
||||||
.."button[0,"..(y_delta+4.0)..";1,.5;skins_page$"..page_prev..";<<]"
|
string.format("button[%f,%f;%f,%f;skins_page$%i;<<]",
|
||||||
.."dropdown[0.9,"..(y_delta+3.88)..";6.5,.5;skins_selpg;"..page_list..";"..page.."]"
|
xoffs, btn_y, btn_width, ctrls_height, page_prev)..
|
||||||
.."button[7,"..(y_delta+4.0)..";1,.5;skins_page$"..page_next..";>>]"
|
string.format("button[%f,%f;%f,%f;skins_page$%i;>>]",
|
||||||
|
btn_right, btn_y, btn_width, ctrls_height, page_next)..
|
||||||
|
string.format("dropdown[%f,%f;%f,%f;skins_selpg;%s;%i]",
|
||||||
|
droppos, drop_y, droplen, ctrls_height, page_list, page)
|
||||||
end
|
end
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,3 +2,4 @@ name = skinsdb
|
||||||
description = Player skin mod, supporting unified_inventory, sfinv and smart_inventory
|
description = Player skin mod, supporting unified_inventory, sfinv and smart_inventory
|
||||||
depends = player_api
|
depends = player_api
|
||||||
optional_depends = unified_inventory,3d_armor,clothing,sfinv
|
optional_depends = unified_inventory,3d_armor,clothing,sfinv
|
||||||
|
min_minetest_version = 5.4.0
|
||||||
|
|
Before Width: | Height: | Size: 6 KiB |
|
@ -1,10 +1,13 @@
|
||||||
local S = minetest.get_translator("skinsdb")
|
local S = minetest.get_translator("skinsdb")
|
||||||
|
|
||||||
unified_inventory.register_page("skins", {
|
unified_inventory.register_page("skins", {
|
||||||
get_formspec = function(player)
|
get_formspec = function(player, perplayer_formspec)
|
||||||
local skin = skins.get_player_skin(player)
|
local skin = skins.get_player_skin(player)
|
||||||
local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"..skins.get_skin_info_formspec(skin)..
|
local boffs = (type(perplayer_formspec) == "table") and 2 or 0.75
|
||||||
"button[.75,3;6.5,.5;skins_page;"..S("Change").."]"
|
|
||||||
|
local formspec = perplayer_formspec.standard_inv_bg..
|
||||||
|
skins.get_skin_info_formspec(skin, perplayer_formspec)..
|
||||||
|
"button["..boffs..",3;6.5,.5;skins_page;"..S("Change").."]"
|
||||||
return {formspec=formspec}
|
return {formspec=formspec}
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -15,16 +18,16 @@ unified_inventory.register_button("skins", {
|
||||||
tooltip = S("Skins"),
|
tooltip = S("Skins"),
|
||||||
})
|
})
|
||||||
|
|
||||||
local function get_formspec(player)
|
local function get_formspec(player, perplayer_formspec)
|
||||||
local context = skins.get_formspec_context(player)
|
local context = skins.get_formspec_context(player)
|
||||||
local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"..
|
local formspec = perplayer_formspec.standard_inv_bg..
|
||||||
skins.get_skin_selection_formspec(player, context, -0.2)
|
skins.get_skin_selection_formspec(player, context, perplayer_formspec)
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
|
|
||||||
unified_inventory.register_page("skins_page", {
|
unified_inventory.register_page("skins_page", {
|
||||||
get_formspec = function(player)
|
get_formspec = function(player, perplayer_formspec)
|
||||||
return {formspec=get_formspec(player)}
|
return {formspec=get_formspec(player, perplayer_formspec)}
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,8 @@ local ui = unified_inventory
|
||||||
ui.style_full = {
|
ui.style_full = {
|
||||||
formspec_x = 1,
|
formspec_x = 1,
|
||||||
formspec_y = 1,
|
formspec_y = 1,
|
||||||
|
formw = 17.75,
|
||||||
|
formh = 12.25,
|
||||||
pagecols = 8,
|
pagecols = 8,
|
||||||
pagerows = 10,
|
pagerows = 10,
|
||||||
page_x = 10.75,
|
page_x = 10.75,
|
||||||
|
@ -80,6 +82,8 @@ ui.style_full = {
|
||||||
ui.style_lite = {
|
ui.style_lite = {
|
||||||
formspec_x = 0.6,
|
formspec_x = 0.6,
|
||||||
formspec_y = 0.6,
|
formspec_y = 0.6,
|
||||||
|
formw = 14,
|
||||||
|
formh = 9.75,
|
||||||
pagecols = 4,
|
pagecols = 4,
|
||||||
pagerows = 6,
|
pagerows = 6,
|
||||||
page_x = 10.5,
|
page_x = 10.5,
|
||||||
|
|
|
@ -42,16 +42,13 @@ function ui.get_formspec(player, page)
|
||||||
end
|
end
|
||||||
|
|
||||||
local formspec = {
|
local formspec = {
|
||||||
"formspec_version[4]size[17.75,12.25]",
|
"formspec_version[4]",
|
||||||
|
"size["..ui_peruser.formw..","..ui_peruser.formh.."]",
|
||||||
pagedef.formspec_prepend and "" or "no_prepend[]",
|
pagedef.formspec_prepend and "" or "no_prepend[]",
|
||||||
ui.standard_background -- Background
|
ui.standard_background
|
||||||
}
|
}
|
||||||
local n = 4
|
|
||||||
|
|
||||||
if draw_lite_mode then
|
local n = 5
|
||||||
formspec[1] = "formspec_version[4]size[14,9.75]"
|
|
||||||
formspec[3] = ui.standard_background
|
|
||||||
end
|
|
||||||
|
|
||||||
local perplayer_formspec = ui.get_per_player_formspec(player_name)
|
local perplayer_formspec = ui.get_per_player_formspec(player_name)
|
||||||
local fsdata = pagedef.get_formspec(player, perplayer_formspec)
|
local fsdata = pagedef.get_formspec(player, perplayer_formspec)
|
||||||
|
|
498
mods/unifieddyes/airbrush.lua
Normal file
|
@ -0,0 +1,498 @@
|
||||||
|
-- This file supplies all the code related to the airbrush
|
||||||
|
|
||||||
|
local S = minetest.get_translator("unifieddyes")
|
||||||
|
|
||||||
|
function unifieddyes.on_airbrush(itemstack, player, pointed_thing)
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
local painting_with = nil
|
||||||
|
|
||||||
|
if unifieddyes.player_current_dye[player_name] then
|
||||||
|
painting_with = unifieddyes.player_current_dye[player_name]
|
||||||
|
end
|
||||||
|
|
||||||
|
if not painting_with then
|
||||||
|
minetest.chat_send_player(player_name, "*** You need to set a color first.")
|
||||||
|
minetest.chat_send_player(player_name, "*** Right-click any random node to open the color selector,")
|
||||||
|
minetest.chat_send_player(player_name, "*** or shift+right-click a colorized node to use its color.")
|
||||||
|
minetest.chat_send_player(player_name, "*** Be sure to click \"Accept\", or the color you select will be ignored.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
|
if not pos then
|
||||||
|
local look_angle = player:get_look_vertical()
|
||||||
|
if look_angle > -1.55 then
|
||||||
|
minetest.chat_send_player(player_name, "*** No node selected")
|
||||||
|
else
|
||||||
|
local hexcolor = unifieddyes.get_color_from_dye_name(painting_with)
|
||||||
|
if hexcolor then
|
||||||
|
local r = tonumber(string.sub(hexcolor,1,2),16)
|
||||||
|
local g = tonumber(string.sub(hexcolor,3,4),16)
|
||||||
|
local b = tonumber(string.sub(hexcolor,5,6),16)
|
||||||
|
player:set_sky({r=r,g=g,b=b,a=255},"plain")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local def = minetest.registered_items[node.name]
|
||||||
|
if not def then return end
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, player_name) then
|
||||||
|
minetest.chat_send_player(player_name, "*** Sorry, someone else owns that node.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not (def.groups and def.groups.ud_param2_colorable and def.groups.ud_param2_colorable > 0) then
|
||||||
|
minetest.chat_send_player(player_name, "*** That node can't be colored.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local palette = nil
|
||||||
|
local fdir = 0
|
||||||
|
if not def or not def.palette then
|
||||||
|
minetest.chat_send_player(player_name, "*** That node can't be colored -- it's either undefined or has no palette.")
|
||||||
|
return
|
||||||
|
elseif def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
palette = "extended"
|
||||||
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
palette = "wallmounted"
|
||||||
|
fdir = node.param2 % 8
|
||||||
|
elseif def.palette ~= "unifieddyes_palette_extended.png"
|
||||||
|
and def.palette ~= "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and string.find(def.palette, "unifieddyes_palette_") then
|
||||||
|
palette = "split"
|
||||||
|
fdir = node.param2 % 32
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, "*** That node can't be colored -- it has an invalid color mode.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local idx, hue = unifieddyes.getpaletteidx(painting_with, palette)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
if (not creative or not creative.is_enabled_for(player_name)) and not inv:contains_item("main", painting_with) then
|
||||||
|
local suff = ""
|
||||||
|
if not idx then
|
||||||
|
suff = " Besides, "..string.sub(painting_with, 5).." can't be applied to that node."
|
||||||
|
end
|
||||||
|
minetest.chat_send_player(player_name, "*** You're in survival mode, and you're out of "..string.sub(painting_with, 5).."."..suff)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not idx then
|
||||||
|
minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local oldidx = node.param2 - fdir
|
||||||
|
local name = def.airbrush_replacement_node or node.name
|
||||||
|
|
||||||
|
if palette == "split" then
|
||||||
|
|
||||||
|
local modname = string.sub(name, 1, string.find(name, ":")-1)
|
||||||
|
local nodename2 = string.sub(name, string.find(name, ":")+1)
|
||||||
|
local oldcolor = "snozzberry"
|
||||||
|
local newcolor = "razzberry" -- intentionally misspelled ;-)
|
||||||
|
|
||||||
|
if def.ud_color_start and def.ud_color_end then
|
||||||
|
oldcolor = string.sub(node.name, def.ud_color_start, def.ud_color_end)
|
||||||
|
newcolor = string.sub(painting_with, 5)
|
||||||
|
else
|
||||||
|
if hue ~= 0 then
|
||||||
|
newcolor = unifieddyes.HUES_EXTENDED[hue][1]
|
||||||
|
else
|
||||||
|
newcolor = "grey"
|
||||||
|
end
|
||||||
|
|
||||||
|
if def.airbrush_replacement_node then
|
||||||
|
oldcolor = "grey"
|
||||||
|
else
|
||||||
|
local s = string.sub(def.palette, 21)
|
||||||
|
oldcolor = string.sub(s, 1, string.find(s, "s.png")-1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
name = modname..":"..string.gsub(nodename2, oldcolor, newcolor)
|
||||||
|
|
||||||
|
if not minetest.registered_items[name] then
|
||||||
|
minetest.chat_send_player(player_name, "*** "..string.sub(painting_with, 5).." can't be applied to that node.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
elseif idx == oldidx then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos, {name = name, param2 = fdir + idx})
|
||||||
|
if not creative or not creative.is_enabled_for(player_name) then
|
||||||
|
inv:remove_item("main", painting_with)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local hps = 0.6 -- horizontal position scale
|
||||||
|
local vps = 1.3 -- vertical position scale
|
||||||
|
local vs = 0.1 -- vertical shift/offset
|
||||||
|
|
||||||
|
local color_button_size = ";0.75,0.75;"
|
||||||
|
local color_square_size = ";0.69,0.69;"
|
||||||
|
|
||||||
|
function unifieddyes.make_readable_color(color)
|
||||||
|
-- is this a low saturation color?
|
||||||
|
local has_low_saturtation = string.find(color, "s50");
|
||||||
|
|
||||||
|
-- remove _s50 tag, we care about that later again
|
||||||
|
local s = string.gsub(color, "_s50", "")
|
||||||
|
|
||||||
|
-- replace underscores with spaces to make it look nicer
|
||||||
|
local s = string.gsub(s, "_", " ")
|
||||||
|
|
||||||
|
-- capitalize words, you know, looks nicer ;)
|
||||||
|
s = string.gsub(s, "(%l)(%w*)", function(a,b) return string.upper(a)..b end)
|
||||||
|
|
||||||
|
-- add the word dye, this is what the translations expect
|
||||||
|
s = s.." Dye"
|
||||||
|
|
||||||
|
-- if it is a low sat color, append an appropriate string
|
||||||
|
if has_low_saturtation then
|
||||||
|
s = s.." (low saturation)"
|
||||||
|
end
|
||||||
|
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.make_colored_square(hexcolor, colorname, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
|
||||||
|
|
||||||
|
local dye = "dye:"..colorname
|
||||||
|
|
||||||
|
local overlay = ""
|
||||||
|
local colorize = minetest.formspec_escape("^[colorize:#"..hexcolor..":255")
|
||||||
|
|
||||||
|
if not creative and inv:contains_item("main", dye) then
|
||||||
|
overlay = "^unifieddyes_onhand_overlay.png"
|
||||||
|
end
|
||||||
|
|
||||||
|
local unavail_overlay = ""
|
||||||
|
if not showall and not unifieddyes.palette_has_color[nodepalette.."_"..colorname]
|
||||||
|
or (explist and not explist[colorname]) then
|
||||||
|
if overlay == "" then
|
||||||
|
unavail_overlay = "^unifieddyes_unavailable_overlay.png"
|
||||||
|
else
|
||||||
|
unavail_overlay = "^unifieddyes_onhand_unavailable_overlay.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local tooltip = "tooltip["..colorname..";"..
|
||||||
|
S(unifieddyes.make_readable_color(colorname))..
|
||||||
|
"\n(dye:"..colorname..")]"
|
||||||
|
|
||||||
|
if dye == painting_with then
|
||||||
|
overlay = "^unifieddyes_select_overlay.png"
|
||||||
|
selindic = "unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..tooltip
|
||||||
|
end
|
||||||
|
|
||||||
|
local form
|
||||||
|
if unavail_overlay == "" then
|
||||||
|
form = "image_button["..
|
||||||
|
(hp*hps)..","..(v2*vps+vs)..
|
||||||
|
color_button_size..
|
||||||
|
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay..";"..
|
||||||
|
colorname..";]"..
|
||||||
|
tooltip
|
||||||
|
else
|
||||||
|
form = "image["..
|
||||||
|
(hp*hps)..","..(v2*vps+vs)..
|
||||||
|
color_square_size..
|
||||||
|
"unifieddyes_white_square.png"..colorize..overlay..unavail_overlay.."]"..
|
||||||
|
tooltip
|
||||||
|
end
|
||||||
|
|
||||||
|
return form, selindic
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.show_airbrush_form(player)
|
||||||
|
if not player then return end
|
||||||
|
|
||||||
|
local t = {}
|
||||||
|
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
local painting_with = unifieddyes.player_selected_dye[player_name] or unifieddyes.player_current_dye[player_name]
|
||||||
|
local creative = creative and creative.is_enabled_for(player_name)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local nodepalette = "extended"
|
||||||
|
local showall = unifieddyes.player_showall[player_name]
|
||||||
|
|
||||||
|
t[1] = "size[14.5,8.5]label[7,-0.3;"..S("Select a color:").."]"
|
||||||
|
local selindic = "unifieddyes_select_overlay.png^unifieddyes_question.png]"
|
||||||
|
|
||||||
|
local last_right_click = unifieddyes.player_last_right_clicked[player_name]
|
||||||
|
if last_right_click then
|
||||||
|
if last_right_click.def and last_right_click.def.palette then
|
||||||
|
if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
nodepalette = "wallmounted"
|
||||||
|
elseif last_right_click.def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node that supports all 256 colors, showing them all)").."]"
|
||||||
|
showall = true
|
||||||
|
elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png"
|
||||||
|
and last_right_click.def.palette ~= "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and string.find(last_right_click.def.palette, "unifieddyes_palette_") then
|
||||||
|
nodepalette = "split"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not last_right_click.def.groups
|
||||||
|
or not last_right_click.def.groups.ud_param2_colorable
|
||||||
|
or not last_right_click.def.palette
|
||||||
|
or not string.find(last_right_click.def.palette, "unifieddyes_palette_") then
|
||||||
|
t[#t+1] = "label[0.5,8.25;"..S("(Right-clicked a node not supported by the Airbrush, showing all colors)").."]"
|
||||||
|
end
|
||||||
|
|
||||||
|
local explist = last_right_click.def.explist
|
||||||
|
|
||||||
|
for v = 0, 6 do
|
||||||
|
local val = unifieddyes.VALS_EXTENDED[v+1]
|
||||||
|
|
||||||
|
local sat = ""
|
||||||
|
local v2=(v/2)
|
||||||
|
|
||||||
|
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
local hue = h[1]
|
||||||
|
local hp=hi-1
|
||||||
|
|
||||||
|
local r = h[2]
|
||||||
|
local g = h[3]
|
||||||
|
local b = h[4]
|
||||||
|
|
||||||
|
local factor = 40
|
||||||
|
if v > 3 then
|
||||||
|
factor = 75
|
||||||
|
v2 = (v-2)
|
||||||
|
end
|
||||||
|
|
||||||
|
local r2 = math.max(math.min(r + (4-v)*factor, 255), 0)
|
||||||
|
local g2 = math.max(math.min(g + (4-v)*factor, 255), 0)
|
||||||
|
local b2 = math.max(math.min(b + (4-v)*factor, 255), 0)
|
||||||
|
|
||||||
|
local hexcolor = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2)
|
||||||
|
local f
|
||||||
|
f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
|
||||||
|
t[#t+1] = f
|
||||||
|
end
|
||||||
|
|
||||||
|
if v > 3 then
|
||||||
|
sat = "_s50"
|
||||||
|
v2 = (v-1.5)
|
||||||
|
|
||||||
|
for hi, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
local hue = h[1]
|
||||||
|
local hp=hi-1
|
||||||
|
|
||||||
|
local r = h[2]
|
||||||
|
local g = h[3]
|
||||||
|
local b = h[4]
|
||||||
|
|
||||||
|
local factor = 75
|
||||||
|
|
||||||
|
local pr = 0.299
|
||||||
|
local pg = 0.587
|
||||||
|
local pb = 0.114
|
||||||
|
|
||||||
|
local r2 = math.max(math.min(r + (4-v)*factor, 255), 0)
|
||||||
|
local g2 = math.max(math.min(g + (4-v)*factor, 255), 0)
|
||||||
|
local b2 = math.max(math.min(b + (4-v)*factor, 255), 0)
|
||||||
|
|
||||||
|
local p = math.sqrt(r2*r2*pr + g2*g2*pg + b2*b2*pb)
|
||||||
|
local r3 = math.floor(p+(r2-p)*0.5)
|
||||||
|
local g3 = math.floor(p+(g2-p)*0.5)
|
||||||
|
local b3 = math.floor(p+(b2-p)*0.5)
|
||||||
|
|
||||||
|
local hexcolor = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3)
|
||||||
|
local f
|
||||||
|
f, selindic = unifieddyes.make_colored_square(hexcolor, val..hue..sat, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
|
||||||
|
t[#t+1] = f
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local v2=5
|
||||||
|
for y = 0, 15 do
|
||||||
|
|
||||||
|
local hp=15-y
|
||||||
|
|
||||||
|
local hexgrey = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17)
|
||||||
|
local grey = "grey_"..y
|
||||||
|
|
||||||
|
if y == 0 then grey = "black"
|
||||||
|
elseif y == 4 then grey = "dark_grey"
|
||||||
|
elseif y == 8 then grey = "grey"
|
||||||
|
elseif y == 11 then grey = "light_grey"
|
||||||
|
elseif y == 15 then grey = "white"
|
||||||
|
end
|
||||||
|
|
||||||
|
local f
|
||||||
|
f, selindic = unifieddyes.make_colored_square(hexgrey, grey, showall, creative, painting_with, nodepalette, hp, v2, selindic, inv, explist)
|
||||||
|
t[#t+1] = f
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if not creative then
|
||||||
|
t[#t+1] = "image[10,"
|
||||||
|
t[#t+1] = (vps*5.55+vs)
|
||||||
|
t[#t+1] = color_button_size
|
||||||
|
t[#t+1] = "unifieddyes_onhand_overlay.png]label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.51+vs)
|
||||||
|
t[#t+1] = ";"..S("Dyes").."]"
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.67+vs)
|
||||||
|
t[#t+1] = ";on hand]"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
t[#t+1] = "image[10,"
|
||||||
|
t[#t+1] = (vps*5+vs)
|
||||||
|
t[#t+1] = color_button_size
|
||||||
|
t[#t+1] = selindic
|
||||||
|
|
||||||
|
if painting_with then
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*4.90+vs)
|
||||||
|
t[#t+1] = ";"..S("Your selection:").."]"
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.07+vs)
|
||||||
|
t[#t+1] = ";"
|
||||||
|
t[#t+1] = S(unifieddyes.make_readable_color(string.sub(painting_with, 5)))
|
||||||
|
t[#t+1] = "]label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.24+vs)
|
||||||
|
t[#t+1] = ";("
|
||||||
|
t[#t+1] = painting_with
|
||||||
|
t[#t+1] = ")]"
|
||||||
|
else
|
||||||
|
t[#t+1] = "label[10.7,"
|
||||||
|
t[#t+1] = (vps*5.07+vs)
|
||||||
|
t[#t+1] = ";"..S("Your selection").."]"
|
||||||
|
end
|
||||||
|
|
||||||
|
t[#t+1] = "button_exit[10.5,8;2,1;cancel;"..S("Cancel").."]button_exit[12.5,8;2,1;accept;"..S("Accept").."]"
|
||||||
|
|
||||||
|
|
||||||
|
if last_right_click and last_right_click.def and nodepalette ~= "extended" then
|
||||||
|
if showall then
|
||||||
|
t[#t+1] = "button[0,8;2,1;show_avail;"..S("Show Available").."]"
|
||||||
|
t[#t+1] = "label[2,8.25;"..S("(Currently showing all 256 colors)").."]"
|
||||||
|
else
|
||||||
|
t[#t+1] = "button[0,8;2,1;show_all;"..S("Show All Colors").."]"
|
||||||
|
t[#t+1] = "label[2,8.25;"..S("(Currently only showing what the right-clicked node can use)").."]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.show_formspec(player_name, "unifieddyes:dye_select_form", table.concat(t))
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
|
||||||
|
if formname == "unifieddyes:dye_select_form" then
|
||||||
|
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
local nodepalette = "extended"
|
||||||
|
local showall = unifieddyes.player_showall[player_name]
|
||||||
|
|
||||||
|
local last_right_click = unifieddyes.player_last_right_clicked[player_name]
|
||||||
|
if last_right_click and last_right_click.def then
|
||||||
|
if last_right_click.def.palette then
|
||||||
|
if last_right_click.def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
nodepalette = "wallmounted"
|
||||||
|
elseif last_right_click.def.palette ~= "unifieddyes_palette_extended.png" then
|
||||||
|
nodepalette = "split"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if fields.show_all then
|
||||||
|
unifieddyes.player_showall[player_name] = true
|
||||||
|
unifieddyes.show_airbrush_form(player)
|
||||||
|
return
|
||||||
|
elseif fields.show_avail then
|
||||||
|
unifieddyes.player_showall[player_name] = false
|
||||||
|
unifieddyes.show_airbrush_form(player)
|
||||||
|
return
|
||||||
|
elseif fields.quit then
|
||||||
|
if fields.accept then
|
||||||
|
local dye = unifieddyes.player_selected_dye[player_name]
|
||||||
|
if not dye then
|
||||||
|
minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but no color was selected!")
|
||||||
|
return
|
||||||
|
elseif not showall
|
||||||
|
and not unifieddyes.palette_has_color[nodepalette.."_"..string.sub(dye, 5)] then
|
||||||
|
minetest.chat_send_player(player_name, "*** Clicked \"Accept\", but the selected color can't be used on the")
|
||||||
|
minetest.chat_send_player(player_name, "*** node that was right-clicked (and \"Show All\" wasn't in effect).")
|
||||||
|
if unifieddyes.player_current_dye[player_name] then
|
||||||
|
minetest.chat_send_player(player_name, "*** Ignoring it and sticking with "..string.sub(unifieddyes.player_current_dye[player_name], 5)..".")
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, "*** Ignoring it.")
|
||||||
|
end
|
||||||
|
return
|
||||||
|
else
|
||||||
|
unifieddyes.player_current_dye[player_name] = dye
|
||||||
|
unifieddyes.player_selected_dye[player_name] = nil
|
||||||
|
minetest.chat_send_player(player_name, "*** Selected "..string.sub(dye, 5).." for the airbrush.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else -- assume "Cancel" or Esc.
|
||||||
|
unifieddyes.player_selected_dye[player_name] = nil
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local s1 = string.sub(minetest.serialize(fields), 11)
|
||||||
|
local s3 = string.sub(s1,1, string.find(s1, '"')-1)
|
||||||
|
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
local creative = creative and creative.is_enabled_for(player_name)
|
||||||
|
local dye = "dye:"..s3
|
||||||
|
|
||||||
|
if (showall or unifieddyes.palette_has_color[nodepalette.."_"..s3]) and
|
||||||
|
(minetest.registered_items[dye] and (creative or inv:contains_item("main", dye))) then
|
||||||
|
unifieddyes.player_selected_dye[player_name] = dye
|
||||||
|
unifieddyes.show_airbrush_form(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
minetest.register_tool("unifieddyes:airbrush", {
|
||||||
|
description = S("Dye Airbrush"),
|
||||||
|
inventory_image = "unifieddyes_airbrush.png",
|
||||||
|
use_texture_alpha = true,
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval=0.1,
|
||||||
|
},
|
||||||
|
range = 12,
|
||||||
|
on_use = unifieddyes.on_airbrush,
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
local keys = placer:get_player_control()
|
||||||
|
local player_name = placer:get_player_name()
|
||||||
|
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||||
|
local node
|
||||||
|
local def
|
||||||
|
|
||||||
|
if pos then node = minetest.get_node(pos) end
|
||||||
|
if node then def = minetest.registered_items[node.name] end
|
||||||
|
|
||||||
|
unifieddyes.player_last_right_clicked[player_name] = {pos = pos, node = node, def = def}
|
||||||
|
|
||||||
|
if not keys.aux1 then
|
||||||
|
unifieddyes.show_airbrush_form(placer)
|
||||||
|
elseif keys.aux1 then
|
||||||
|
if not pos or not def then return end
|
||||||
|
local newcolor = unifieddyes.color_to_name(node.param2, def)
|
||||||
|
|
||||||
|
if newcolor and string.find(def.paramtype2, "color") then
|
||||||
|
minetest.chat_send_player(player_name, "*** Switching to "..newcolor.." for the airbrush, to match that node.")
|
||||||
|
unifieddyes.player_current_dye[player_name] = "dye:"..newcolor
|
||||||
|
else
|
||||||
|
minetest.chat_send_player(player_name, "*** That node is uncolored.")
|
||||||
|
end
|
||||||
|
elseif def.on_rightclick then
|
||||||
|
return def.on_rightclick(pos, node, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
23
mods/unifieddyes/aliases.lua
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
minetest.register_alias("dye:light_red", "dye:pink")
|
||||||
|
minetest.register_alias("dye:medium_orange", "dye:brown")
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:black", "dye:black")
|
||||||
|
minetest.register_alias("unifieddyes:dark_grey", "dye:dark_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey", "dye:grey")
|
||||||
|
minetest.register_alias("unifieddyes:light_grey", "dye:light_grey")
|
||||||
|
minetest.register_alias("unifieddyes:white", "dye:white")
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:grey_0", "dye:black")
|
||||||
|
minetest.register_alias("unifieddyes:grey_4", "dye:dark_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_8", "dye:grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_11", "dye:light_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_15", "dye:white")
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:white_paint", "dye:white")
|
||||||
|
minetest.register_alias("unifieddyes:titanium_dioxide", "dye:white")
|
||||||
|
minetest.register_alias("unifieddyes:lightgrey_paint", "dye:light_grey")
|
||||||
|
minetest.register_alias("unifieddyes:grey_paint", "dye:grey")
|
||||||
|
minetest.register_alias("unifieddyes:darkgrey_paint", "dye:dark_grey")
|
||||||
|
minetest.register_alias("unifieddyes:carbon_black", "dye:black")
|
||||||
|
|
||||||
|
minetest.register_alias("unifieddyes:brown", "dye:brown")
|
494
mods/unifieddyes/api.lua
Normal file
|
@ -0,0 +1,494 @@
|
||||||
|
-- This file supplies the majority of Unified Dyes' API
|
||||||
|
|
||||||
|
local S = minetest.get_translator("unifieddyes")
|
||||||
|
|
||||||
|
unifieddyes.player_current_dye = {}
|
||||||
|
unifieddyes.player_selected_dye = {}
|
||||||
|
unifieddyes.player_last_right_clicked = {}
|
||||||
|
unifieddyes.palette_has_color = {}
|
||||||
|
unifieddyes.player_showall = {}
|
||||||
|
|
||||||
|
-- if a node with a palette is placed in the world,
|
||||||
|
-- but the itemstack used to place it has no palette_index (color byte),
|
||||||
|
-- create something appropriate to make it officially white.
|
||||||
|
|
||||||
|
minetest.register_on_placenode(
|
||||||
|
function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||||
|
local def = minetest.registered_items[newnode.name]
|
||||||
|
|
||||||
|
if not def
|
||||||
|
or not def.palette
|
||||||
|
or def.after_place_node
|
||||||
|
or not placer then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local param2
|
||||||
|
if not string.find(itemstack:to_string(), "palette_index") then
|
||||||
|
if def.palette == "unifieddyes_palette_extended.png"
|
||||||
|
and def.paramtype2 == "color" then
|
||||||
|
param2 = 240
|
||||||
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png"
|
||||||
|
and def.paramtype2 == "colorwallmounted" then
|
||||||
|
param2 = newnode.param2 % 8
|
||||||
|
elseif string.find(def.palette, "unifieddyes_palette_")
|
||||||
|
and def.paramtype2 == "colorfacedir" then -- it's a split palette
|
||||||
|
param2 = newnode.param2 % 32
|
||||||
|
end
|
||||||
|
|
||||||
|
if param2 then
|
||||||
|
minetest.swap_node(pos, {name = newnode.name, param2 = param2})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if def.palette ~= "" then
|
||||||
|
minetest.get_meta(pos):set_int("palette_index", param2 or 240)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- The complementary function: strip-off the color if the node being dug is still white/neutral
|
||||||
|
|
||||||
|
local function move_item(item, pos, inv, digger, fix_color)
|
||||||
|
if not (digger and digger:is_player()) then return end
|
||||||
|
local creative = creative_mode or minetest.check_player_privs(digger, "creative")
|
||||||
|
item = unifieddyes.fix_bad_color_info(item, fix_color)
|
||||||
|
if inv:room_for_item("main", item)
|
||||||
|
and (not creative or not inv:contains_item("main", item, true)) then
|
||||||
|
inv:add_item("main", item)
|
||||||
|
elseif not creative then
|
||||||
|
minetest.item_drop(ItemStack(item), digger, pos)
|
||||||
|
end
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.on_dig(pos, node, digger)
|
||||||
|
if not digger then return end
|
||||||
|
local playername = digger:get_player_name()
|
||||||
|
if minetest.is_protected(pos, playername) then
|
||||||
|
minetest.record_protection_violation(pos, playername)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local oldparam2 = minetest.get_node(pos).param2
|
||||||
|
local def = minetest.registered_items[node.name]
|
||||||
|
local fix_color
|
||||||
|
|
||||||
|
if def.paramtype2 == "color" and oldparam2 == 240 and def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
fix_color = 240
|
||||||
|
elseif def.paramtype2 == "color" and oldparam2 == 0 and def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
fix_color = 0
|
||||||
|
elseif def.paramtype2 == "colorwallmounted" and math.floor(oldparam2 / 8) == 0 and def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
fix_color = 0
|
||||||
|
elseif def.paramtype2 == "colorfacedir" and math.floor(oldparam2 / 32) == 0 and string.find(def.palette, "unifieddyes_palette_") then
|
||||||
|
fix_color = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
local inv = digger:get_inventory()
|
||||||
|
if fix_color then
|
||||||
|
move_item(node.name, pos, inv, digger, fix_color)
|
||||||
|
else
|
||||||
|
return minetest.node_dig(pos, node, digger)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- just stubs to keep old mods from crashing when expecting auto-coloring
|
||||||
|
-- or getting back the dye on dig.
|
||||||
|
|
||||||
|
function unifieddyes.recolor_on_place(foo)
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.after_dig_node(foo)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This helper function creates multiple copies of the passed node,
|
||||||
|
-- for the split palette - one per hue, plus grey - and assigns
|
||||||
|
-- proper palettes and other attributes
|
||||||
|
|
||||||
|
function unifieddyes.generate_split_palette_nodes(name, def, drop)
|
||||||
|
for _, color in ipairs(unifieddyes.HUES_WITH_GREY) do
|
||||||
|
local def2 = table.copy(def)
|
||||||
|
local desc_color = string.gsub(string.upper(string.sub(color, 1, 1))..string.sub(color, 2), "_", " ")
|
||||||
|
if string.sub(def2.description, -1) == ")" then
|
||||||
|
def2.description = string.sub(def2.description, 1, -2)..", "..desc_color.." shades)"
|
||||||
|
else
|
||||||
|
def2.description = def2.description.."("..desc_color.." shades)"
|
||||||
|
end
|
||||||
|
def2.palette = "unifieddyes_palette_"..color.."s.png"
|
||||||
|
def2.paramtype2 = "colorfacedir"
|
||||||
|
def2.groups.ud_param2_colorable = 1
|
||||||
|
|
||||||
|
if drop then
|
||||||
|
def2.drop = {
|
||||||
|
items = {
|
||||||
|
{items = {drop.."_"..color}, inherit_color = true },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node(":"..name.."_"..color, def2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This helper function creates a colored itemstack
|
||||||
|
|
||||||
|
function unifieddyes.fix_bad_color_info(item, paletteidx)
|
||||||
|
local stack=minetest.itemstring_with_color(item, paletteidx)
|
||||||
|
return string.gsub(stack, "u0001color", "u0001palette_index")
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.make_colored_itemstack(item, palette, color)
|
||||||
|
local paletteidx = unifieddyes.getpaletteidx(color, palette)
|
||||||
|
return unifieddyes.fix_bad_color_info(item, paletteidx), paletteidx
|
||||||
|
end
|
||||||
|
|
||||||
|
-- these helper functions register all of the recipes needed to create colored
|
||||||
|
-- nodes with any of the dyes supported by that node's palette.
|
||||||
|
|
||||||
|
local function register_c(craft, h, sat, val)
|
||||||
|
local hue = (type(h) == "table") and h[1] or h
|
||||||
|
local color = ""
|
||||||
|
if val then
|
||||||
|
if craft.palette == "wallmounted" then
|
||||||
|
color = val..hue..sat
|
||||||
|
else
|
||||||
|
color = val..hue..sat
|
||||||
|
end
|
||||||
|
else
|
||||||
|
color = hue -- if val is nil, then it's grey.
|
||||||
|
end
|
||||||
|
|
||||||
|
local dye = "dye:"..color
|
||||||
|
local recipe = minetest.serialize(craft.recipe)
|
||||||
|
recipe = string.gsub(recipe, "MAIN_DYE", dye)
|
||||||
|
recipe = string.gsub(recipe, "NEUTRAL_NODE", craft.neutral_node)
|
||||||
|
local newrecipe = minetest.deserialize(recipe)
|
||||||
|
|
||||||
|
local coutput = craft.output or ""
|
||||||
|
local output = coutput
|
||||||
|
if craft.output_prefix then
|
||||||
|
if craft.palette ~= "split" then
|
||||||
|
output = craft.output_prefix..color..craft.output_suffix..coutput
|
||||||
|
else
|
||||||
|
if hue == "white" or hue == "black" or string.find(hue, "grey") then
|
||||||
|
output = craft.output_prefix.."grey"..craft.output_suffix..coutput
|
||||||
|
elseif hue == "pink" then
|
||||||
|
dye = "dye:light_red"
|
||||||
|
output = craft.output_prefix.."red"..craft.output_suffix..coutput
|
||||||
|
else
|
||||||
|
output = craft.output_prefix..hue..craft.output_suffix..coutput
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local colored_itemstack =
|
||||||
|
unifieddyes.make_colored_itemstack(output, craft.palette, dye)
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = colored_itemstack,
|
||||||
|
type = craft.type,
|
||||||
|
recipe = newrecipe
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.register_color_craft(craft)
|
||||||
|
local hues_table = unifieddyes.HUES_EXTENDED
|
||||||
|
local sats_table = unifieddyes.SATS
|
||||||
|
local vals_table = unifieddyes.VALS_SPLIT
|
||||||
|
local greys_table = unifieddyes.GREYS
|
||||||
|
|
||||||
|
if craft.palette == "wallmounted" then
|
||||||
|
register_c(craft, "green", "", "light_")
|
||||||
|
register_c(craft, "blue", "", "light_")
|
||||||
|
hues_table = unifieddyes.HUES_WALLMOUNTED
|
||||||
|
sats_table = {""}
|
||||||
|
vals_table = unifieddyes.VALS
|
||||||
|
elseif craft.palette == "extended" then
|
||||||
|
vals_table = unifieddyes.VALS_EXTENDED
|
||||||
|
greys_table = unifieddyes.GREYS_EXTENDED
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, hue in ipairs(hues_table) do
|
||||||
|
for _, val in ipairs(vals_table) do
|
||||||
|
for _, sat in ipairs(sats_table) do
|
||||||
|
|
||||||
|
if sat == "_s50" and val ~= "" and val ~= "medium_" and val ~= "dark_" then break end
|
||||||
|
register_c(craft, hue, sat, val)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, grey in ipairs(greys_table) do
|
||||||
|
register_c(craft, grey)
|
||||||
|
end
|
||||||
|
|
||||||
|
register_c(craft, "pink")
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- code borrowed from homedecor
|
||||||
|
-- call this function to reset the rotation of a "wallmounted" object on place
|
||||||
|
|
||||||
|
function unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local colorbits = node.param2 - (node.param2 % 8)
|
||||||
|
|
||||||
|
local yaw = placer:get_look_horizontal()
|
||||||
|
local dir = minetest.yaw_to_dir(yaw) -- -1.5)
|
||||||
|
local pitch = placer:get_look_vertical()
|
||||||
|
|
||||||
|
local fdir = minetest.dir_to_wallmounted(dir)
|
||||||
|
|
||||||
|
if pitch < -(math.pi/8) then
|
||||||
|
fdir = 0
|
||||||
|
elseif pitch > math.pi/8 then
|
||||||
|
fdir = 1
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- use this when you have a "wallmounted" node that should never be oriented
|
||||||
|
-- to floor or ceiling...
|
||||||
|
|
||||||
|
function unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local colorbits = node.param2 - (node.param2 % 8)
|
||||||
|
local yaw = placer:get_look_horizontal()
|
||||||
|
local dir = minetest.yaw_to_dir(yaw+1.5)
|
||||||
|
local fdir = minetest.dir_to_wallmounted(dir)
|
||||||
|
|
||||||
|
minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ... and use this one to force that kind of node off of floor/ceiling
|
||||||
|
-- orientation after the screwdriver rotates it.
|
||||||
|
|
||||||
|
function unifieddyes.fix_after_screwdriver_nsew(pos, node, user, mode, new_param2)
|
||||||
|
local new_fdir = new_param2 % 8
|
||||||
|
local color = new_param2 - new_fdir
|
||||||
|
if new_fdir < 2 then
|
||||||
|
new_fdir = 2
|
||||||
|
minetest.swap_node(pos, { name = node.name, param2 = new_fdir + color })
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.is_buildable_to(placer_name, ...)
|
||||||
|
for _, pos in ipairs({...}) do
|
||||||
|
local node = minetest.get_node_or_nil(pos)
|
||||||
|
local def = node and minetest.registered_nodes[node.name]
|
||||||
|
if not (def and def.buildable_to) or minetest.is_protected(pos, placer_name) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.get_hsv(name) -- expects a node/item name
|
||||||
|
local hue = ""
|
||||||
|
local a,b
|
||||||
|
for _, i in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
a,b = string.find(name, "_"..i[1])
|
||||||
|
if a then
|
||||||
|
hue = i[1]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if string.find(name, "_light_grey") then hue = "light_grey"
|
||||||
|
elseif string.find(name, "_lightgrey") then hue = "light_grey"
|
||||||
|
elseif string.find(name, "_dark_grey") then hue = "dark_grey"
|
||||||
|
elseif string.find(name, "_darkgrey") then hue = "dark_grey"
|
||||||
|
elseif string.find(name, "_grey") then hue = "grey"
|
||||||
|
elseif string.find(name, "_white") then hue = "white"
|
||||||
|
elseif string.find(name, "_black") then hue = "black"
|
||||||
|
end
|
||||||
|
|
||||||
|
local sat = ""
|
||||||
|
if string.find(name, "_s50") then sat = "_s50" end
|
||||||
|
|
||||||
|
local val = ""
|
||||||
|
if string.find(name, "dark_") then val = "dark_" end
|
||||||
|
if string.find(name, "medium_") then val = "medium_" end
|
||||||
|
if string.find(name, "light_") then val = "light_" end
|
||||||
|
|
||||||
|
return hue, sat, val
|
||||||
|
end
|
||||||
|
|
||||||
|
-- code partially borrowed from cheapie's plasticbox mod
|
||||||
|
|
||||||
|
-- in the function below, color is just a color string, while
|
||||||
|
-- palette_type can be:
|
||||||
|
--
|
||||||
|
-- "extended" = 256 color palette
|
||||||
|
-- "split" = 200 color palette split into pieces for colorfacedir
|
||||||
|
-- "wallmounted" = 32-color abridged palette
|
||||||
|
|
||||||
|
function unifieddyes.getpaletteidx(color, palette_type)
|
||||||
|
|
||||||
|
local origcolor = color
|
||||||
|
|
||||||
|
if string.sub(color,1,4) == "dye:" then
|
||||||
|
color = string.sub(color,5,-1)
|
||||||
|
elseif string.sub(color,1,12) == "unifieddyes:" then
|
||||||
|
color = string.sub(color,13,-1)
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if palette_type == "wallmounted" then
|
||||||
|
if unifieddyes.gpidx_grayscale_wallmounted[color] then
|
||||||
|
return (unifieddyes.gpidx_grayscale_wallmounted[color] * 8), 0
|
||||||
|
end
|
||||||
|
elseif palette_type == "split" then
|
||||||
|
if unifieddyes.gpidx_grayscale[color] then
|
||||||
|
return (unifieddyes.gpidx_grayscale[color] * 32), 0
|
||||||
|
end
|
||||||
|
elseif palette_type == "extended" then
|
||||||
|
if unifieddyes.gpidx_grayscale_extended[color] then
|
||||||
|
return unifieddyes.gpidx_grayscale_extended[color]+240, 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local shade = "" -- assume full
|
||||||
|
if string.sub(color,1,6) == "faint_" then
|
||||||
|
shade = "faint"
|
||||||
|
color = string.sub(color,7,-1)
|
||||||
|
elseif string.sub(color,1,7) == "pastel_" then
|
||||||
|
shade = "pastel"
|
||||||
|
color = string.sub(color,8,-1)
|
||||||
|
elseif string.sub(color,1,6) == "light_" then
|
||||||
|
shade = "light"
|
||||||
|
color = string.sub(color,7,-1)
|
||||||
|
elseif string.sub(color,1,7) == "bright_" then
|
||||||
|
shade = "bright"
|
||||||
|
color = string.sub(color,8,-1)
|
||||||
|
elseif string.sub(color,1,7) == "medium_" then
|
||||||
|
shade = "medium"
|
||||||
|
color = string.sub(color,8,-1)
|
||||||
|
elseif string.sub(color,1,5) == "dark_" then
|
||||||
|
shade = "dark"
|
||||||
|
color = string.sub(color,6,-1)
|
||||||
|
end
|
||||||
|
if string.sub(color,-4,-1) == "_s50" then
|
||||||
|
shade = shade.."s50"
|
||||||
|
color = string.sub(color,1,-5)
|
||||||
|
end
|
||||||
|
|
||||||
|
if palette_type == "wallmounted" then
|
||||||
|
if color == "green" and shade == "light" then return 48,3
|
||||||
|
elseif color == "brown" then return 17,1
|
||||||
|
elseif color == "pink" then return 56,7
|
||||||
|
elseif color == "blue" and shade == "light" then return 40,5
|
||||||
|
elseif unifieddyes.gpidx_hues_wallmounted[color] and unifieddyes.gpidx_shades_wallmounted[shade] then
|
||||||
|
return (unifieddyes.gpidx_shades_wallmounted[shade] * 64 + unifieddyes.gpidx_hues_wallmounted[color] * 8), unifieddyes.gpidx_hues_wallmounted[color]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if color == "brown" then
|
||||||
|
color = "orange"
|
||||||
|
shade = "medium"
|
||||||
|
elseif color == "pink" then
|
||||||
|
color = "red"
|
||||||
|
shade = "light"
|
||||||
|
end
|
||||||
|
if palette_type == "split" then -- it's colorfacedir
|
||||||
|
if unifieddyes.gpidx_hues_extended[color] and unifieddyes.gpidx_shades_split[shade] then
|
||||||
|
return (unifieddyes.gpidx_shades_split[shade] * 32), unifieddyes.gpidx_hues_extended[color]+1
|
||||||
|
end
|
||||||
|
elseif palette_type == "extended" then
|
||||||
|
if unifieddyes.gpidx_hues_extended[color] and unifieddyes.gpidx_shades_extended[shade] then
|
||||||
|
return (unifieddyes.gpidx_hues_extended[color] + unifieddyes.gpidx_shades_extended[shade]*24), unifieddyes.gpidx_hues_extended[color]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function unifieddyes.get_color_from_dye_name(name)
|
||||||
|
if name == "dye:black" then
|
||||||
|
return "000000"
|
||||||
|
elseif name == "dye:white" then
|
||||||
|
return "ffffff"
|
||||||
|
end
|
||||||
|
local item = minetest.registered_items[name]
|
||||||
|
if not item then return end
|
||||||
|
local inv_image = item.inventory_image
|
||||||
|
if not inv_image then return end
|
||||||
|
return string.match(inv_image,"colorize:#(......):200")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get a node's dye color based on its palette and param2
|
||||||
|
|
||||||
|
function unifieddyes.color_to_name(param2, def)
|
||||||
|
if not param2 or not def or not def.palette then return end
|
||||||
|
|
||||||
|
if def.palette == "unifieddyes_palette_extended.png" then
|
||||||
|
local color = param2
|
||||||
|
|
||||||
|
local v = 0
|
||||||
|
local s = 1
|
||||||
|
if color < 24 then v = 1
|
||||||
|
elseif color > 23 and color < 48 then v = 2
|
||||||
|
elseif color > 47 and color < 72 then v = 3
|
||||||
|
elseif color > 71 and color < 96 then v = 4
|
||||||
|
elseif color > 95 and color < 120 then v = 5
|
||||||
|
elseif color > 119 and color < 144 then v = 5 s = 2
|
||||||
|
elseif color > 143 and color < 168 then v = 6
|
||||||
|
elseif color > 167 and color < 192 then v = 6 s = 2
|
||||||
|
elseif color > 191 and color < 216 then v = 7
|
||||||
|
elseif color > 215 and color < 240 then v = 7 s = 2
|
||||||
|
end
|
||||||
|
|
||||||
|
if color > 239 then
|
||||||
|
if color == 240 then return "white"
|
||||||
|
elseif color == 244 then return "light_grey"
|
||||||
|
elseif color == 247 then return "grey"
|
||||||
|
elseif color == 251 then return "dark_grey"
|
||||||
|
elseif color == 255 then return "black"
|
||||||
|
else return "grey_"..15-(color-240)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local h = color - math.floor(color/24)*24
|
||||||
|
return unifieddyes.VALS_EXTENDED[v]..unifieddyes.HUES_EXTENDED[h+1][1]..unifieddyes.SATS[s]
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif def.palette == "unifieddyes_palette_colorwallmounted.png" then
|
||||||
|
local color = math.floor(param2 / 8)
|
||||||
|
if color == 0 then return "white"
|
||||||
|
elseif color == 1 then return "light_grey"
|
||||||
|
elseif color == 2 then return "grey"
|
||||||
|
elseif color == 3 then return "dark_grey"
|
||||||
|
elseif color == 4 then return "black"
|
||||||
|
elseif color == 5 then return "light_blue"
|
||||||
|
elseif color == 6 then return "light_green"
|
||||||
|
elseif color == 7 then return "pink"
|
||||||
|
end
|
||||||
|
local v = math.floor(color/8)
|
||||||
|
local h = color - v * 8
|
||||||
|
return unifieddyes.VALS[v]..unifieddyes.HUES_WALLMOUNTED[h+1]
|
||||||
|
|
||||||
|
elseif string.find(def.palette, "unifieddyes_palette") then -- it's the split palette
|
||||||
|
-- palette names in this mode are always "unifieddyes_palette_COLORs.png"
|
||||||
|
|
||||||
|
local s = string.sub(def.palette, 21)
|
||||||
|
local color = string.sub(s, 1, string.find(s, "s.png")-1)
|
||||||
|
|
||||||
|
local v = math.floor(param2/32)
|
||||||
|
if color ~= "grey" then
|
||||||
|
if v == 0 then return "faint_"..color
|
||||||
|
elseif v == 1 then return color
|
||||||
|
elseif v == 2 then return color.."_s50"
|
||||||
|
elseif v == 3 then return "light_"..color
|
||||||
|
elseif v == 4 then return "medium_"..color
|
||||||
|
elseif v == 5 then return "medium_"..color.."_s50"
|
||||||
|
elseif v == 6 then return "dark_"..color
|
||||||
|
elseif v == 7 then return "dark_"..color.."_s50"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if v > 0 and v < 6 then return unifieddyes.GREYS[v]
|
||||||
|
else return "white"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
237
mods/unifieddyes/color-tables.lua
Normal file
|
@ -0,0 +1,237 @@
|
||||||
|
|
||||||
|
-- the names of the various colors here came from http://www.procato.com/rgb+index/
|
||||||
|
|
||||||
|
unifieddyes.HUES_EXTENDED = {
|
||||||
|
{ "red", 0xff, 0x00, 0x00 },
|
||||||
|
{ "vermilion", 0xff, 0x40, 0x00 },
|
||||||
|
{ "orange", 0xff, 0x80, 0x00 },
|
||||||
|
{ "amber", 0xff, 0xbf, 0x00 },
|
||||||
|
{ "yellow", 0xff, 0xff, 0x00 },
|
||||||
|
{ "lime", 0xbf, 0xff, 0x00 },
|
||||||
|
{ "chartreuse", 0x80, 0xff, 0x00 },
|
||||||
|
{ "harlequin", 0x40, 0xff, 0x00 },
|
||||||
|
{ "green", 0x00, 0xff, 0x00 },
|
||||||
|
{ "malachite", 0x00, 0xff, 0x40 },
|
||||||
|
{ "spring", 0x00, 0xff, 0x80 },
|
||||||
|
{ "turquoise", 0x00, 0xff, 0xbf },
|
||||||
|
{ "cyan", 0x00, 0xff, 0xff },
|
||||||
|
{ "cerulean", 0x00, 0xbf, 0xff },
|
||||||
|
{ "azure", 0x00, 0x80, 0xff },
|
||||||
|
{ "sapphire", 0x00, 0x40, 0xff },
|
||||||
|
{ "blue", 0x00, 0x00, 0xff },
|
||||||
|
{ "indigo", 0x40, 0x00, 0xff },
|
||||||
|
{ "violet", 0x80, 0x00, 0xff },
|
||||||
|
{ "mulberry", 0xbf, 0x00, 0xff },
|
||||||
|
{ "magenta", 0xff, 0x00, 0xff },
|
||||||
|
{ "fuchsia", 0xff, 0x00, 0xbf },
|
||||||
|
{ "rose", 0xff, 0x00, 0x80 },
|
||||||
|
{ "crimson", 0xff, 0x00, 0x40 }
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.HUES_WITH_GREY = {}
|
||||||
|
|
||||||
|
for _,i in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
table.insert(unifieddyes.HUES_WITH_GREY, i[1])
|
||||||
|
end
|
||||||
|
table.insert(unifieddyes.HUES_WITH_GREY, "grey")
|
||||||
|
|
||||||
|
unifieddyes.HUES_WALLMOUNTED = {
|
||||||
|
"red",
|
||||||
|
"orange",
|
||||||
|
"yellow",
|
||||||
|
"green",
|
||||||
|
"cyan",
|
||||||
|
"blue",
|
||||||
|
"violet",
|
||||||
|
"magenta"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.SATS = {
|
||||||
|
"",
|
||||||
|
"_s50"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.VALS = {
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.VALS_SPLIT = {
|
||||||
|
"faint_",
|
||||||
|
"light_",
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.VALS_EXTENDED = {
|
||||||
|
"faint_",
|
||||||
|
"pastel_",
|
||||||
|
"light_",
|
||||||
|
"bright_",
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.GREYS = {
|
||||||
|
"white",
|
||||||
|
"light_grey",
|
||||||
|
"grey",
|
||||||
|
"dark_grey",
|
||||||
|
"black"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.GREYS_EXTENDED = table.copy(unifieddyes.GREYS)
|
||||||
|
|
||||||
|
for i = 1, 14 do
|
||||||
|
if i ~= 0 and i ~= 4 and i ~= 8 and i ~= 11 and i ~= 15 then
|
||||||
|
table.insert(unifieddyes.GREYS_EXTENDED, "grey_"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local default_dyes = {
|
||||||
|
"black",
|
||||||
|
"blue",
|
||||||
|
"brown",
|
||||||
|
"cyan",
|
||||||
|
"dark_green",
|
||||||
|
"dark_grey",
|
||||||
|
"green",
|
||||||
|
"grey",
|
||||||
|
"magenta",
|
||||||
|
"orange",
|
||||||
|
"pink",
|
||||||
|
"red",
|
||||||
|
"violet",
|
||||||
|
"white",
|
||||||
|
"yellow"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- reverse lookups for getpaletteidx()
|
||||||
|
|
||||||
|
unifieddyes.gpidx_aliases = {
|
||||||
|
["pink"] = "light_red",
|
||||||
|
["brown"] = "medium_orange",
|
||||||
|
["azure"] = "light_blue"
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_grayscale = {
|
||||||
|
["white"] = 1,
|
||||||
|
["light_grey"] = 2,
|
||||||
|
["grey"] = 3,
|
||||||
|
["dark_grey"] = 4,
|
||||||
|
["black"] = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_grayscale_extended = {
|
||||||
|
["white"] = 0,
|
||||||
|
["grey_14"] = 1,
|
||||||
|
["grey_13"] = 2,
|
||||||
|
["grey_12"] = 3,
|
||||||
|
["light_grey"] = 4,
|
||||||
|
["grey_11"] = 4,
|
||||||
|
["grey_10"] = 5,
|
||||||
|
["grey_9"] = 6,
|
||||||
|
["grey_8"] = 7,
|
||||||
|
["grey"] = 7,
|
||||||
|
["grey_7"] = 8,
|
||||||
|
["grey_6"] = 9,
|
||||||
|
["grey_5"] = 10,
|
||||||
|
["grey_4"] = 11,
|
||||||
|
["dark_grey"] = 11,
|
||||||
|
["grey_3"] = 12,
|
||||||
|
["grey_2"] = 13,
|
||||||
|
["grey_1"] = 14,
|
||||||
|
["black"] = 15,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_grayscale_wallmounted = {
|
||||||
|
["white"] = 0,
|
||||||
|
["light_grey"] = 1,
|
||||||
|
["grey"] = 2,
|
||||||
|
["dark_grey"] = 3,
|
||||||
|
["black"] = 4,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_hues_extended = {
|
||||||
|
["red"] = 0,
|
||||||
|
["vermilion"] = 1,
|
||||||
|
["orange"] = 2,
|
||||||
|
["amber"] = 3,
|
||||||
|
["yellow"] = 4,
|
||||||
|
["lime"] = 5,
|
||||||
|
["chartreuse"] = 6,
|
||||||
|
["harlequin"] = 7,
|
||||||
|
["green"] = 8,
|
||||||
|
["malachite"] = 9,
|
||||||
|
["spring"] = 10,
|
||||||
|
["aqua"] = 10,
|
||||||
|
["turquoise"] = 11,
|
||||||
|
["cyan"] = 12,
|
||||||
|
["cerulean"] = 13,
|
||||||
|
["azure"] = 14,
|
||||||
|
["skyblue"] = 14,
|
||||||
|
["sapphire"] = 15,
|
||||||
|
["blue"] = 16,
|
||||||
|
["indigo"] = 17,
|
||||||
|
["violet"] = 18,
|
||||||
|
["mulberry"] = 19,
|
||||||
|
["magenta"] = 20,
|
||||||
|
["fuchsia"] = 21,
|
||||||
|
["rose"] = 22,
|
||||||
|
["redviolet"] = 22,
|
||||||
|
["crimson"] = 23,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_hues_wallmounted = {
|
||||||
|
["red"] = 0,
|
||||||
|
["orange"] = 1,
|
||||||
|
["yellow"] = 2,
|
||||||
|
["green"] = 3,
|
||||||
|
["cyan"] = 4,
|
||||||
|
["blue"] = 5,
|
||||||
|
["violet"] = 6,
|
||||||
|
["magenta"] = 7
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades = {
|
||||||
|
[""] = 1,
|
||||||
|
["s50"] = 2,
|
||||||
|
["light"] = 3,
|
||||||
|
["medium"] = 4,
|
||||||
|
["mediums50"] = 5,
|
||||||
|
["dark"] = 6,
|
||||||
|
["darks50"] = 7,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades_split = {
|
||||||
|
["faint"] = 0,
|
||||||
|
[""] = 1,
|
||||||
|
["s50"] = 2,
|
||||||
|
["light"] = 3,
|
||||||
|
["medium"] = 4,
|
||||||
|
["mediums50"] = 5,
|
||||||
|
["dark"] = 6,
|
||||||
|
["darks50"] = 7,
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades_extended = {
|
||||||
|
["faint"] = 0,
|
||||||
|
["pastel"] = 1,
|
||||||
|
["light"] = 2,
|
||||||
|
["bright"] = 3,
|
||||||
|
[""] = 4,
|
||||||
|
["s50"] = 5,
|
||||||
|
["medium"] = 6,
|
||||||
|
["mediums50"] = 7,
|
||||||
|
["dark"] = 8,
|
||||||
|
["darks50"] = 9
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.gpidx_shades_wallmounted = {
|
||||||
|
[""] = 1,
|
||||||
|
["medium"] = 2,
|
||||||
|
["dark"] = 3
|
||||||
|
}
|
309
mods/unifieddyes/dyes-crafting.lua
Normal file
|
@ -0,0 +1,309 @@
|
||||||
|
-- crafting!
|
||||||
|
|
||||||
|
-- Generate all dyes that are not part of the default minetest_game dyes mod
|
||||||
|
|
||||||
|
local S = minetest.get_translator("unifieddyes")
|
||||||
|
|
||||||
|
for _, h in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
local hue = h[1]
|
||||||
|
local r = h[2]
|
||||||
|
local g = h[3]
|
||||||
|
local b = h[4]
|
||||||
|
|
||||||
|
for v = 0, 6 do
|
||||||
|
local val = unifieddyes.VALS_EXTENDED[v+1]
|
||||||
|
|
||||||
|
local factor = 40
|
||||||
|
if v > 3 then factor = 75 end
|
||||||
|
|
||||||
|
local r2 = math.max(math.min(r + (4-v)*factor, 255), 0)
|
||||||
|
local g2 = math.max(math.min(g + (4-v)*factor, 255), 0)
|
||||||
|
local b2 = math.max(math.min(b + (4-v)*factor, 255), 0)
|
||||||
|
|
||||||
|
-- full-sat color
|
||||||
|
|
||||||
|
local desc = hue:gsub("%a", string.upper, 1).." Dye"
|
||||||
|
|
||||||
|
if val ~= "" then
|
||||||
|
desc = val:sub(1, -2):gsub("%a", string.upper, 1) .." "..desc
|
||||||
|
end
|
||||||
|
|
||||||
|
local color = string.format("%02x", r2)..string.format("%02x", g2)..string.format("%02x", b2)
|
||||||
|
if minetest.registered_items["dye:"..val..hue] then
|
||||||
|
minetest.override_item("dye:"..val..hue, {
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200",
|
||||||
|
})
|
||||||
|
else
|
||||||
|
if (val..hue) ~= "medium_orange"
|
||||||
|
and (val..hue) ~= "light_red" then
|
||||||
|
minetest.register_craftitem(":dye:"..val..hue, {
|
||||||
|
description = S(desc),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.register_alias("unifieddyes:"..val..hue, "dye:"..val..hue)
|
||||||
|
|
||||||
|
if v > 3 then -- also register the low-sat version
|
||||||
|
|
||||||
|
local pr = 0.299
|
||||||
|
local pg = 0.587
|
||||||
|
local pb = 0.114
|
||||||
|
|
||||||
|
local p = math.sqrt(r2*r2*pr + g2*g2*pg + b2*b2*pb)
|
||||||
|
local r3 = math.floor(p+(r2-p)*0.5)
|
||||||
|
local g3 = math.floor(p+(g2-p)*0.5)
|
||||||
|
local b3 = math.floor(p+(b2-p)*0.5)
|
||||||
|
|
||||||
|
local color = string.format("%02x", r3)..string.format("%02x", g3)..string.format("%02x", b3)
|
||||||
|
|
||||||
|
minetest.register_craftitem(":dye:"..val..hue.."_s50", {
|
||||||
|
description = S(desc.." (low saturation)"),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..color..":200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
minetest.register_alias("unifieddyes:"..val..hue.."_s50", "dye:"..val..hue.."_s50")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- register the greyscales too :P
|
||||||
|
|
||||||
|
for y = 1, 14 do -- colors 0 and 15 are black and white, default dyes
|
||||||
|
|
||||||
|
if y ~= 4 and y ~= 8 and y~= 11 then -- don't register the three greys, they're done separately.
|
||||||
|
|
||||||
|
local rgb = string.format("%02x", y*17)..string.format("%02x", y*17)..string.format("%02x", y*17)
|
||||||
|
local name = "grey_"..y
|
||||||
|
local desc = "Grey Dye #"..y
|
||||||
|
|
||||||
|
minetest.register_craftitem(":dye:"..name, {
|
||||||
|
description = S(desc),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#"..rgb..":200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
minetest.register_alias("unifieddyes:"..name, "dye:"..name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.override_item("dye:grey", {
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#888888:200",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.override_item("dye:dark_grey", {
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#444444:200",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem(":dye:light_grey", {
|
||||||
|
description = S("Light grey Dye"),
|
||||||
|
inventory_image = "unifieddyes_dye.png^[colorize:#cccccc:200",
|
||||||
|
groups = { dye=1, not_in_creative_inventory=1 },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- build a table of color <-> palette associations to reduce the need for
|
||||||
|
-- realtime lookups with getpaletteidx()
|
||||||
|
|
||||||
|
for _, palette in ipairs({"extended", "split", "wallmounted"}) do
|
||||||
|
local palette2 = palette
|
||||||
|
|
||||||
|
for i in ipairs(unifieddyes.SATS) do
|
||||||
|
local sat = (palette == "wallmounted") and "" or unifieddyes.SATS[i]
|
||||||
|
for _, hue in ipairs(unifieddyes.HUES_EXTENDED) do
|
||||||
|
for _, val in ipairs(unifieddyes.VALS_EXTENDED) do
|
||||||
|
local color = val..hue[1]..sat
|
||||||
|
if unifieddyes.getpaletteidx("dye:"..color, palette2) then
|
||||||
|
unifieddyes.palette_has_color[palette.."_"..color] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for y = 0, 15 do
|
||||||
|
local grey = "grey_"..y
|
||||||
|
|
||||||
|
if y == 0 then grey = "black"
|
||||||
|
elseif y == 4 then grey = "dark_grey"
|
||||||
|
elseif y == 8 then grey = "grey"
|
||||||
|
elseif y == 11 then grey = "light_grey"
|
||||||
|
elseif y == 15 then grey = "white"
|
||||||
|
end
|
||||||
|
if unifieddyes.getpaletteidx("dye:"..grey, palette2) then
|
||||||
|
unifieddyes.palette_has_color[palette.."_"..grey] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
unifieddyes.palette_has_color["wallmounted_light_red"] = true
|
||||||
|
|
||||||
|
unifieddyes.base_color_crafts = {
|
||||||
|
{ "red", "flowers:rose", nil, nil, nil, nil, 4 },
|
||||||
|
{ "vermilion", "dye:red", "dye:orange", nil, nil, nil, 3 },
|
||||||
|
{ "orange", "flowers:tulip", nil, nil, nil, nil, 4 },
|
||||||
|
{ "orange", "dye:red", "dye:yellow", nil, nil, nil, 2 },
|
||||||
|
{ "amber", "dye:orange", "dye:yellow", nil, nil, nil, 2 },
|
||||||
|
{ "yellow", "flowers:dandelion_yellow", nil, nil, nil, nil, 4 },
|
||||||
|
{ "lime", "dye:yellow", "dye:chartreuse", nil, nil, nil, 2 },
|
||||||
|
{ "lime", "dye:yellow", "dye:yellow", "dye:green", nil, nil, 3 },
|
||||||
|
{ "chartreuse", "dye:yellow", "dye:green", nil, nil, nil, 2 },
|
||||||
|
{ "harlequin", "dye:chartreuse", "dye:green", nil, nil, nil, 2 },
|
||||||
|
{ "harlequin", "dye:yellow", "dye:green", "dye:green", nil, nil, 3 },
|
||||||
|
{ "green", "default:cactus", nil, nil, nil, nil, 4 },
|
||||||
|
{ "green", "dye:yellow", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "malachite", "dye:green", "dye:spring", nil, nil, nil, 2 },
|
||||||
|
{ "malachite", "dye:green", "dye:green", "dye:cyan", nil, nil, 3 },
|
||||||
|
{ "malachite", "dye:green", "dye:green", "dye:green", "dye:blue", nil, 4 },
|
||||||
|
{ "spring", "dye:green", "dye:cyan", nil, nil, nil, 2 },
|
||||||
|
{ "spring", "dye:green", "dye:green", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "turquoise", "dye:spring", "dye:cyan", nil, nil, nil, 2 },
|
||||||
|
{ "turquoise", "dye:green", "dye:cyan", "dye:cyan", nil, nil, 3 },
|
||||||
|
{ "turquoise", "dye:green", "dye:green", "dye:green", "dye:blue", "dye:blue", 5 },
|
||||||
|
{ "cyan", "dye:green", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "cerulean", "dye:cyan", "dye:azure", nil, nil, nil, 2 },
|
||||||
|
{ "cerulean", "dye:cyan", "dye:cyan", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "cerulean", "dye:green", "dye:green", "dye:blue", "dye:blue", "dye:blue", 5 },
|
||||||
|
{ "azure", "dye:cyan", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "azure", "dye:green", "dye:blue", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "sapphire", "dye:azure", "dye:blue", nil, nil, nil, 2 },
|
||||||
|
{ "sapphire", "dye:cyan", "dye:blue", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "sapphire", "dye:green", "dye:blue", "dye:blue", "dye:blue", nil, 4 },
|
||||||
|
{ "blue", "flowers:geranium", nil, nil, nil, nil, 4 },
|
||||||
|
{ "indigo", "dye:blue", "dye:violet", nil, nil, nil, 2 },
|
||||||
|
{ "violet", "flowers:viola", nil, nil, nil, nil, 4 },
|
||||||
|
{ "violet", "dye:blue", "dye:magenta", nil, nil, nil, 2 },
|
||||||
|
{ "mulberry", "dye:violet", "dye:magenta", nil, nil, nil, 2 },
|
||||||
|
{ "mulberry", "dye:violet", "dye:blue", "dye:red", nil, nil, 3 },
|
||||||
|
{ "magenta", "dye:blue", "dye:red", nil, nil, nil, 2 },
|
||||||
|
{ "fuchsia", "dye:magenta", "dye:rose", nil, nil, nil, 2 },
|
||||||
|
{ "fuchsia", "dye:blue", "dye:red", "dye:rose", nil, nil, 3 },
|
||||||
|
{ "fuchsia", "dye:red", "dye:violet", nil, nil, nil, 2 },
|
||||||
|
{ "rose", "dye:magenta", "dye:red", nil, nil, nil, 2 },
|
||||||
|
{ "rose", "dye:red", "dye:red", "dye:blue", nil, nil, 3 },
|
||||||
|
{ "crimson", "dye:rose", "dye:red", nil, nil, nil, 2 },
|
||||||
|
{ "crimson", "dye:magenta", "dye:red", "dye:red", nil, nil, 3 },
|
||||||
|
{ "crimson", "dye:red", "dye:red", "dye:red", "dye:blue", nil, 4 },
|
||||||
|
|
||||||
|
{ "black", "default:coal_lump", nil, nil, nil, nil, 4 },
|
||||||
|
{ "white", "flowers:dandelion_white", nil, nil, nil, nil, 4 },
|
||||||
|
}
|
||||||
|
|
||||||
|
unifieddyes.shade_crafts = {
|
||||||
|
{ "faint_", "", "dye:white", "dye:white", "dye:white", 4 },
|
||||||
|
{ "pastel_", "", "dye:white", "dye:white", nil, 3 },
|
||||||
|
{ "light_", "", "dye:white", nil, nil, 2 },
|
||||||
|
{ "bright_", "", "color", "dye:white", nil, 3 },
|
||||||
|
{ "", "_s50", "dye:light_grey", nil, nil, 2 },
|
||||||
|
{ "", "_s50", "dye:black", "dye:white", "dye:white", 3 },
|
||||||
|
{ "medium_", "", "dye:black", nil, nil, 2 },
|
||||||
|
{ "medium_", "_s50", "dye:grey", nil, nil, 2 },
|
||||||
|
{ "medium_", "_s50", "dye:black", "dye:white", nil, 3 },
|
||||||
|
{ "dark_", "", "dye:black", "dye:black", nil, 3 },
|
||||||
|
{ "dark_", "_s50", "dye:dark_grey", nil, nil, 2 },
|
||||||
|
{ "dark_", "_s50", "dye:black", "dye:black", "dye:white", 4 },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _,i in ipairs(unifieddyes.base_color_crafts) do
|
||||||
|
local color = i[1]
|
||||||
|
local yield = i[7]
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:"..color.." "..yield,
|
||||||
|
recipe = {
|
||||||
|
i[2],
|
||||||
|
i[3],
|
||||||
|
i[4],
|
||||||
|
i[5],
|
||||||
|
i[6],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
for _,j in ipairs(unifieddyes.shade_crafts) do
|
||||||
|
local firstdye = j[3]
|
||||||
|
if firstdye == "color" then firstdye = "dye:"..color end
|
||||||
|
|
||||||
|
-- ignore black, white, anything containing the word "grey"
|
||||||
|
|
||||||
|
if color ~= "black" and color ~= "white" and not string.find(color, "grey") then
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:"..j[1]..color..j[2].." "..j[6],
|
||||||
|
recipe = {
|
||||||
|
"dye:"..color,
|
||||||
|
firstdye,
|
||||||
|
j[4],
|
||||||
|
j[5]
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- greys
|
||||||
|
|
||||||
|
unifieddyes.greymixes = {
|
||||||
|
{ 1, "dye:black", "dye:black", "dye:black", "dye:dark_grey", 4 },
|
||||||
|
{ 2, "dye:black", "dye:black", "dye:dark_grey", nil, 3 },
|
||||||
|
{ 3, "dye:black", "dye:dark_grey", nil, nil, 2 },
|
||||||
|
{ 4, "dye:white", "dye:black", "dye:black", nil, 3 },
|
||||||
|
{ 5, "dye:dark_grey", "dye:dark_grey", "dye:grey", nil, 3 },
|
||||||
|
{ 6, "dye:dark_grey", "dye:grey", nil, nil, 2 },
|
||||||
|
{ 7, "dye:dark_grey", "dye:grey", "dye:grey", nil, 3 },
|
||||||
|
{ 8, "dye:white", "dye:black", nil, nil, 2 },
|
||||||
|
{ 9, "dye:grey", "dye:grey", "dye:light_grey", nil, 3 },
|
||||||
|
{ 10, "dye:grey", "dye:light_grey", "dye:light_grey", nil, 3 },
|
||||||
|
{ 11, "dye:white", "dye:white", "dye:black", nil, 3 },
|
||||||
|
{ 12, "dye:light_grey", "dye:light_grey", "dye:white", nil, 3 },
|
||||||
|
{ 13, "dye:light_grey", "dye:white", nil, nil, 2 },
|
||||||
|
{ 14, "dye:white", "dye:white", "dye:light_grey", nil, 3 },
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, i in ipairs(unifieddyes.greymixes) do
|
||||||
|
local shade = i[1]
|
||||||
|
local dye1 = i[2]
|
||||||
|
local dye2 = i[3]
|
||||||
|
local dye3 = i[4]
|
||||||
|
local dye4 = i[5]
|
||||||
|
local yield = i[6]
|
||||||
|
local color = "grey_"..shade
|
||||||
|
if shade == 4 then
|
||||||
|
color = "dark_grey"
|
||||||
|
elseif shade == 8 then
|
||||||
|
color = "grey"
|
||||||
|
elseif shade == 11 then
|
||||||
|
color = "light_grey"
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:"..color.." "..yield,
|
||||||
|
recipe = {
|
||||||
|
dye1,
|
||||||
|
dye2,
|
||||||
|
dye3,
|
||||||
|
dye4,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- other crafts
|
||||||
|
-- we can't make dark orange anymore because brown/medium orange conflicts
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
type = "shapeless",
|
||||||
|
output = "dye:dark_orange",
|
||||||
|
recipe = {
|
||||||
|
"dye:brown",
|
||||||
|
"dye:brown"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft( {
|
||||||
|
output = "unifieddyes:airbrush",
|
||||||
|
recipe = {
|
||||||
|
{ "basic_materials:brass_ingot", "", "basic_materials:plastic_sheet" },
|
||||||
|
{ "", "default:steel_ingot", "" },
|
||||||
|
{ "", "", "default:steel_ingot" }
|
||||||
|
},
|
||||||
|
})
|