1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-22 16:10:18 +01:00

replace hardcoded game agnostic texture support and homedecor.textures to xcompat (#66)

* switch existing to xcompat textures

* replace the rest of the hard coded texture conversions to use homedecor.textures
This commit is contained in:
wsor4035 2024-03-03 15:52:58 -05:00 committed by GitHub
parent 080551e647
commit 0d5cab9455
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 40 additions and 80 deletions

View File

@ -76,10 +76,11 @@ building_blocks_stairs("building_blocks:Adobe", {
key = "node_sound_stone_defaults", key = "node_sound_stone_defaults",
}, },
}) })
local grasstex = {"[combine:16x16^[noalpha^[colorize:#006400"} local grasstex = {
if minetest.get_modpath("default") then homedecor.textures.grass.top,
grasstex = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"} homedecor.textures.grass.dirt,
end homedecor.textures.grass.side
}
building_blocks_stairs("building_blocks:fakegrass", { building_blocks_stairs("building_blocks:fakegrass", {
tiles = grasstex, tiles = grasstex,
description = S("Fake Grass"), description = S("Fake Grass"),
@ -147,10 +148,7 @@ minetest.register_node("building_blocks:brobble_spread", {
}) })
if not minetest.get_modpath("moreblocks") or not minetest.get_modpath("gloopblocks") then if not minetest.get_modpath("moreblocks") or not minetest.get_modpath("gloopblocks") then
local graveltex = "[combine:16x16^[noalpha^[colorize:#3a3b3c" local graveltex = homedecor.textures.gravel
if minetest.get_modpath("default") then
graveltex = "default_gravel.png"
end
minetest.register_node("building_blocks:gravel_spread", { minetest.register_node("building_blocks:gravel_spread", {
drawtype = "raillike", drawtype = "raillike",
description = S("Gravel Spread"), description = S("Gravel Spread"),

View File

@ -178,7 +178,7 @@ local sbox = {
fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16}, fixed = { -8/16, -8/16, -8/16, 8/16, -6/16, 8/16},
} }
local wtex = homedecor.textures.default_junglewood local wtex = homedecor.textures.wood.jungle.planks
minetest.register_node("fake_fire:fancy_fire", { minetest.register_node("fake_fire:fancy_fire", {
inventory_image = "fancy_fire_inv.png", inventory_image = "fancy_fire_inv.png",

View File

@ -2,8 +2,8 @@ local S = minetest.get_translator("homedecor_bathroom")
local sc_disallow = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil local sc_disallow = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil
local wood_tex = homedecor.textures.default_wood local wood_tex = homedecor.textures.wood.apple.planks
local water_tex = homedecor.textures.water local water_tex = homedecor.textures.water.tile
homedecor.register("bathroom_tiles_dark", { homedecor.register("bathroom_tiles_dark", {
description = S("Bathroom/kitchen tiles (dark)"), description = S("Bathroom/kitchen tiles (dark)"),

View File

@ -2,7 +2,7 @@ local S = minetest.get_translator("homedecor_bedroom")
local sc_disallow = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil local sc_disallow = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil
local wood_tex, wool_tex = homedecor.textures.default_wood, homedecor.textures.wool_white local wood_tex, wool_tex = homedecor.textures.wood.apple.planks, homedecor.textures.wool.white
local bed_sbox = { local bed_sbox = {
type = "wallmounted", type = "wallmounted",

View File

@ -7,7 +7,7 @@ homedecor.register("air_conditioner", {
mesh = "homedecor_ac.obj", mesh = "homedecor_ac.obj",
tiles = { tiles = {
"homedecor_ac.png", "homedecor_ac.png",
homedecor.textures.glass homedecor.textures.glass.pane
}, },
groups = { snappy = 3, dig_stone = 3 }, groups = { snappy = 3, dig_stone = 3 },
use_texture_alpha = "clip", use_texture_alpha = "clip",

View File

@ -1,12 +1,6 @@
local S = minetest.get_translator("homedecor_clocks") local S = minetest.get_translator("homedecor_clocks")
local wood local wood = homedecor.textures.wood.apple.planks
if minetest.get_modpath("default") then
wood = "default_wood.png"
else
wood = "[combine:16x16^[noalpha^[colorize:#563d2d"
end
local plastic_craft = { local plastic_craft = {
output = "homedecor:analog_clock_plastic 2", output = "homedecor:analog_clock_plastic 2",
@ -135,7 +129,7 @@ homedecor.register("grandfather_clock", {
description = S("Grandfather Clock"), description = S("Grandfather Clock"),
mesh = "homedecor_grandfather_clock.obj", mesh = "homedecor_grandfather_clock.obj",
tiles = { tiles = {
homedecor.textures.glass, homedecor.textures.glass.pane,
"homedecor_grandfather_clock_face.png", "homedecor_grandfather_clock_face.png",
homedecor.lux_wood, homedecor.lux_wood,
"homedecor_grandfather_clock_face_edge.png", "homedecor_grandfather_clock_face_edge.png",

View File

@ -54,8 +54,7 @@ homedecor.color_dark_grey = 0xff606060
homedecor.color_med_grey = 0xffa0a0a0 homedecor.color_med_grey = 0xffa0a0a0
-- load different handler subsystems -- load different handler subsystems
dofile(modpath.."/textures.lua") dofile(modpath.."/xcompat.lua")
dofile(modpath.."/materials.lua")
dofile(modpath.."/nodeboxes.lua") dofile(modpath.."/nodeboxes.lua")
dofile(modpath.."/expansion.lua") dofile(modpath.."/expansion.lua")
dofile(modpath.."/furnaces.lua") dofile(modpath.."/furnaces.lua")

View File

@ -1 +0,0 @@
homedecor.materials = xcompat.materials

View File

@ -1,34 +0,0 @@
homedecor.plain_wood = { name = "homedecor_generic_wood_plain.png", color = 0xffa76820 }
homedecor.mahogany_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff7d2506 }
homedecor.white_wood = "homedecor_generic_wood_plain.png"
homedecor.dark_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff39240f }
homedecor.lux_wood = { name = "homedecor_generic_wood_luxury.png", color = 0xff643f23 }
homedecor.textures = {
glass =
"[combine:16x16:" ..
"0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff",
default_wood = "[combine:16x16^[noalpha^[colorize:#654321",
default_junglewood = "[combine:16x16^[noalpha^[colorize:#563d2d",
water = "[combine:16x16^[noalpha^[colorize:#00008b",
wool_white = "[combine:16x16^[noalpha^[colorize:#ffffff",
wool_black = "[combine:16x16^[noalpha^[colorize:#000000",
wool_grey = "[combine:16x16^[noalpha^[colorize:#313b3c",
wool_dark_grey = "[combine:16x16^[noalpha^[colorize:#313b3c",
}
if minetest.get_modpath("default") then
homedecor.textures = {
glass = "default_glass.png",
default_wood = "default_wood.png",
default_junglewood = "default_junglewood.png",
water = "default_water.png",
wool_white = "wool_white.png",
wool_black = "wool_black.png",
wool_grey = "wool_grey.png",
wool_dark_grey = "wool_dark_grey.png",
}
end

View File

@ -0,0 +1,8 @@
homedecor.plain_wood = { name = "homedecor_generic_wood_plain.png", color = 0xffa76820 }
homedecor.mahogany_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff7d2506 }
homedecor.white_wood = "homedecor_generic_wood_plain.png"
homedecor.dark_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff39240f }
homedecor.lux_wood = { name = "homedecor_generic_wood_luxury.png", color = 0xff643f23 }
homedecor.materials = xcompat.materials
homedecor.textures = xcompat.textures

View File

@ -43,7 +43,7 @@ homedecor.register("barbecue", {
minetest.register_alias("homedecor:barbecue_meat", "air") minetest.register_alias("homedecor:barbecue_meat", "air")
local wood_tex = homedecor.textures.default_wood local wood_tex = homedecor.textures.wood.apple.planks
homedecor.register("doghouse", { homedecor.register("doghouse", {
mesh = "homedecor_doghouse.obj", mesh = "homedecor_doghouse.obj",
@ -288,8 +288,7 @@ homedecor.register("swing_rope", {
selection_box = homedecor.nodebox.null selection_box = homedecor.nodebox.null
}) })
local water_tex = "default_water.png" local water_tex = homedecor.textures.water.tile
if not minetest.get_modpath("default") then water_tex = "[combine:16x16^[noalpha^[colorize:#00008b" end
local cobble_tex = minetest.registered_nodes["mapgen_stone"].tiles[1] local cobble_tex = minetest.registered_nodes["mapgen_stone"].tiles[1]
local stone_drop = minetest.registered_nodes["mapgen_stone"].drop local stone_drop = minetest.registered_nodes["mapgen_stone"].drop
if stone_drop and type(stone_drop) == "string" then if stone_drop and type(stone_drop) == "string" then

View File

@ -5,7 +5,7 @@ local ob_cbox = {
fixed = { -0.5, -0.5, 0, 0.5, 0.5, 0.5 } fixed = { -0.5, -0.5, 0, 0.5, 0.5, 0.5 }
} }
local wood_tex = homedecor.textures.default_wood local wood_tex = homedecor.textures.wood.apple.planks
homedecor.register("openframe_bookshelf", { homedecor.register("openframe_bookshelf", {
description = S("Bookshelf (open-frame)"), description = S("Bookshelf (open-frame)"),

View File

@ -145,7 +145,7 @@ homedecor.register("dishwasher_"..m, {
}) })
end end
local wood_tex = homedecor.textures.default_wood local wood_tex = homedecor.textures.wood.apple.planks
local cabinet_sides = "("..wood_tex.."^[transformR90)^homedecor_kitchen_cabinet_bevel.png" local cabinet_sides = "("..wood_tex.."^[transformR90)^homedecor_kitchen_cabinet_bevel.png"
local cabinet_sides_colored = "(homedecor_generic_wood_plain.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png" local cabinet_sides_colored = "(homedecor_generic_wood_plain.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"

View File

@ -80,8 +80,7 @@ local ib_cbox = {
fixed = { -6/16, -8/16, -4/16, 17/16, 4/16, 4/16 } fixed = { -6/16, -8/16, -4/16, 17/16, 4/16, 4/16 }
} }
local wool_tex = "wool_grey.png" local wool_tex = homedecor.textures.wool.grey
if not minetest.get_modpath("wool") then wool_tex = "[combine:16x16^[noalpha^[colorize:#3A3B3C" end
homedecor.register("ironing_board", { homedecor.register("ironing_board", {
description = S("Ironing board"), description = S("Ironing board"),

View File

@ -452,7 +452,7 @@ for brightness_level = 0, 14 do
lighttex = "homedecor_plasma_lamp_off.png" lighttex = "homedecor_plasma_lamp_off.png"
end end
local gtex=minetest.get_modpath("default") and "default_gold_block.png" or "[combine:16x16^[noalpha^[colorize:#FFD700" local gtex=homedecor.textures.metal.gold.block
homedecor.register("plasma_lamp_"..brightness_level, { homedecor.register("plasma_lamp_"..brightness_level, {
description = S("Plasma Lamp/Light"), description = S("Plasma Lamp/Light"),
drawtype = "mesh", drawtype = "mesh",
@ -703,8 +703,7 @@ for brightness_level = 0, 14 do
fixed = { -0.25, -0.5, -0.25, 0.25, 1.5, 0.25 } fixed = { -0.25, -0.5, -0.25, 0.25, 1.5, 0.25 }
} }
local wool_brightened=(minetest.get_modpath("wool") and "wool_grey.png" or "[combine:16x16^[noalpha6[colorize:#A9A9A9") local wool_brightened=homedecor.textures.wool.grey .. "^[colorize:#ffffff:"..(brightness_level * 15)
.. "^[colorize:#ffffff:"..(brightness_level * 15)
homedecor.register("table_lamp_"..brightness_level, { homedecor.register("table_lamp_"..brightness_level, {
description = S("Table Lamp/Light"), description = S("Table Lamp/Light"),

View File

@ -11,8 +11,8 @@ local S = minetest.get_translator("homedecor_misc")
homedecor_misc = {} homedecor_misc = {}
local wool_black, wool_grey = homedecor.textures.wool_black, homedecor.textures.wool_grey local wool_black, wool_grey = homedecor.textures.wool.black, homedecor.textures.wool.grey
local wood_tex = homedecor.textures.default_wood local wood_tex = homedecor.textures.wood.apple.planks
homedecor.register("ceiling_paint", { homedecor.register("ceiling_paint", {
description = S("Textured Ceiling Paint"), description = S("Textured Ceiling Paint"),

View File

@ -1,6 +1,6 @@
local S = minetest.get_translator("homedecor_pictures_and_paintings") local S = minetest.get_translator("homedecor_pictures_and_paintings")
local wood_tex = homedecor.textures.default_wood local wood_tex = homedecor.textures.wood.apple.planks
local pframe_cbox = { local pframe_cbox = {
type = "fixed", type = "fixed",

View File

@ -5,8 +5,8 @@ homedecor_roofing = {}
minetest.register_node(":homedecor:skylight", { minetest.register_node(":homedecor:skylight", {
description = S("Glass Skylight"), description = S("Glass Skylight"),
drawtype = "raillike", drawtype = "raillike",
tiles = { homedecor.textures.glass }, tiles = { homedecor.textures.glass.pane },
wield_image = homedecor.textures.glass, wield_image = homedecor.textures.glass.pane,
inventory_image = "homedecor_skylight_inv.png", inventory_image = "homedecor_skylight_inv.png",
groups = { snappy = 3, dig_tree = 2 , axey=5}, groups = { snappy = 3, dig_tree = 2 , axey=5},
is_ground_content = false, is_ground_content = false,
@ -336,8 +336,7 @@ homedecor_roofing.register_slope("homedecor", "glass",
S("Glass Shingles") S("Glass Shingles")
) )
local brick_tex = "default_brick.png" local brick_tex = homedecor.textures.brick
if not minetest.get_modpath("default") then brick_tex = "[combine:16x16^[noalpha^[colorize:#AA4A44" end
homedecor.register("chimney", { homedecor.register("chimney", {
description = S("Chimney"), description = S("Chimney"),

View File

@ -40,9 +40,9 @@ homedecor.register("armchair", {
description = S("Armchair"), description = S("Armchair"),
mesh = "forniture_armchair.obj", mesh = "forniture_armchair.obj",
tiles = { tiles = {
homedecor.textures.wool_white, homedecor.textures.wool.white,
{ name = homedecor.textures.wool_dark_grey, color = 0xffffffff }, { name = homedecor.textures.wool.dark_grey, color = 0xffffffff },
{ name = homedecor.textures.default_wood, color = 0xffffffff } { name = homedecor.textures.wood.apple.planks, color = 0xffffffff }
}, },
inventory_image = "homedecor_armchair_inv.png", inventory_image = "homedecor_armchair_inv.png",
paramtype2 = "colorwallmounted", paramtype2 = "colorwallmounted",

View File

@ -162,7 +162,7 @@ homedecor.register("kitchen_chair_padded", {
mesh = "homedecor_kitchen_chair.obj", mesh = "homedecor_kitchen_chair.obj",
tiles = { tiles = {
homedecor.plain_wood, homedecor.plain_wood,
homedecor.textures.wool_white, homedecor.textures.wool.white,
}, },
inventory_image = "homedecor_chair_padded_inv.png", inventory_image = "homedecor_chair_padded_inv.png",
paramtype2 = "colorwallmounted", paramtype2 = "colorwallmounted",

View File

@ -161,7 +161,7 @@ homedecor.register("curtain_open", {
local mats = { local mats = {
{ "brass", S("brass"), "homedecor_generic_metal_brass.png" }, { "brass", S("brass"), "homedecor_generic_metal_brass.png" },
{ "wrought_iron", S("wrought iron"), "homedecor_generic_metal_wrought_iron.png" }, { "wrought_iron", S("wrought iron"), "homedecor_generic_metal_wrought_iron.png" },
{ "wood", S("wood"), homedecor.textures.default_wood } { "wood", S("wood"), homedecor.textures.wood.apple.planks }
} }
for _, m in ipairs(mats) do for _, m in ipairs(mats) do