Skip to content

Commit

Permalink
replace hardcoded game agnostic texture support and homedecor.texture…
Browse files Browse the repository at this point in the history
…s to xcompat (#66)

* switch existing to xcompat textures

* replace the rest of the hard coded texture conversions to use homedecor.textures
  • Loading branch information
wsor4035 authored Mar 3, 2024
1 parent 080551e commit 0d5cab9
Show file tree
Hide file tree
Showing 21 changed files with 40 additions and 80 deletions.
14 changes: 6 additions & 8 deletions building_blocks/node_stairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ building_blocks_stairs("building_blocks:Adobe", {
key = "node_sound_stone_defaults",
},
})
local grasstex = {"[combine:16x16^[noalpha^[colorize:#006400"}
if minetest.get_modpath("default") then
grasstex = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}
end
local grasstex = {
homedecor.textures.grass.top,
homedecor.textures.grass.dirt,
homedecor.textures.grass.side
}
building_blocks_stairs("building_blocks:fakegrass", {
tiles = grasstex,
description = S("Fake Grass"),
Expand Down Expand Up @@ -147,10 +148,7 @@ minetest.register_node("building_blocks:brobble_spread", {
})

if not minetest.get_modpath("moreblocks") or not minetest.get_modpath("gloopblocks") then
local graveltex = "[combine:16x16^[noalpha^[colorize:#3a3b3c"
if minetest.get_modpath("default") then
graveltex = "default_gravel.png"
end
local graveltex = homedecor.textures.gravel
minetest.register_node("building_blocks:gravel_spread", {
drawtype = "raillike",
description = S("Gravel Spread"),
Expand Down
2 changes: 1 addition & 1 deletion fake_fire/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ local sbox = {
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", {
inventory_image = "fancy_fire_inv.png",
Expand Down
4 changes: 2 additions & 2 deletions homedecor_bathroom/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ local S = minetest.get_translator("homedecor_bathroom")

local sc_disallow = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil

local wood_tex = homedecor.textures.default_wood
local water_tex = homedecor.textures.water
local wood_tex = homedecor.textures.wood.apple.planks
local water_tex = homedecor.textures.water.tile

homedecor.register("bathroom_tiles_dark", {
description = S("Bathroom/kitchen tiles (dark)"),
Expand Down
2 changes: 1 addition & 1 deletion homedecor_bedroom/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local S = minetest.get_translator("homedecor_bedroom")

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 = {
type = "wallmounted",
Expand Down
2 changes: 1 addition & 1 deletion homedecor_climate_control/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ homedecor.register("air_conditioner", {
mesh = "homedecor_ac.obj",
tiles = {
"homedecor_ac.png",
homedecor.textures.glass
homedecor.textures.glass.pane
},
groups = { snappy = 3, dig_stone = 3 },
use_texture_alpha = "clip",
Expand Down
10 changes: 2 additions & 8 deletions homedecor_clocks/init.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
local S = minetest.get_translator("homedecor_clocks")

local wood
if minetest.get_modpath("default") then
wood = "default_wood.png"
else

wood = "[combine:16x16^[noalpha^[colorize:#563d2d"
end
local wood = homedecor.textures.wood.apple.planks

local plastic_craft = {
output = "homedecor:analog_clock_plastic 2",
Expand Down Expand Up @@ -135,7 +129,7 @@ homedecor.register("grandfather_clock", {
description = S("Grandfather Clock"),
mesh = "homedecor_grandfather_clock.obj",
tiles = {
homedecor.textures.glass,
homedecor.textures.glass.pane,
"homedecor_grandfather_clock_face.png",
homedecor.lux_wood,
"homedecor_grandfather_clock_face_edge.png",
Expand Down
3 changes: 1 addition & 2 deletions homedecor_common/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ homedecor.color_dark_grey = 0xff606060
homedecor.color_med_grey = 0xffa0a0a0

-- load different handler subsystems
dofile(modpath.."/textures.lua")
dofile(modpath.."/materials.lua")
dofile(modpath.."/xcompat.lua")
dofile(modpath.."/nodeboxes.lua")
dofile(modpath.."/expansion.lua")
dofile(modpath.."/furnaces.lua")
Expand Down
1 change: 0 additions & 1 deletion homedecor_common/materials.lua

This file was deleted.

34 changes: 0 additions & 34 deletions homedecor_common/textures.lua

This file was deleted.

8 changes: 8 additions & 0 deletions homedecor_common/xcompat.lua
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions homedecor_exterior/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ homedecor.register("barbecue", {

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", {
mesh = "homedecor_doghouse.obj",
Expand Down Expand Up @@ -288,8 +288,7 @@ homedecor.register("swing_rope", {
selection_box = homedecor.nodebox.null
})

local water_tex = "default_water.png"
if not minetest.get_modpath("default") then water_tex = "[combine:16x16^[noalpha^[colorize:#00008b" end
local water_tex = homedecor.textures.water.tile
local cobble_tex = minetest.registered_nodes["mapgen_stone"].tiles[1]
local stone_drop = minetest.registered_nodes["mapgen_stone"].drop
if stone_drop and type(stone_drop) == "string" then
Expand Down
2 changes: 1 addition & 1 deletion homedecor_furniture/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local ob_cbox = {
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", {
description = S("Bookshelf (open-frame)"),
Expand Down
2 changes: 1 addition & 1 deletion homedecor_kitchen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ homedecor.register("dishwasher_"..m, {
})
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_colored = "(homedecor_generic_wood_plain.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"

Expand Down
3 changes: 1 addition & 2 deletions homedecor_laundry/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ local ib_cbox = {
fixed = { -6/16, -8/16, -4/16, 17/16, 4/16, 4/16 }
}

local wool_tex = "wool_grey.png"
if not minetest.get_modpath("wool") then wool_tex = "[combine:16x16^[noalpha^[colorize:#3A3B3C" end
local wool_tex = homedecor.textures.wool.grey

homedecor.register("ironing_board", {
description = S("Ironing board"),
Expand Down
5 changes: 2 additions & 3 deletions homedecor_lighting/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ for brightness_level = 0, 14 do
lighttex = "homedecor_plasma_lamp_off.png"
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, {
description = S("Plasma Lamp/Light"),
drawtype = "mesh",
Expand Down Expand Up @@ -703,8 +703,7 @@ for brightness_level = 0, 14 do
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")
.. "^[colorize:#ffffff:"..(brightness_level * 15)
local wool_brightened=homedecor.textures.wool.grey .. "^[colorize:#ffffff:"..(brightness_level * 15)

homedecor.register("table_lamp_"..brightness_level, {
description = S("Table Lamp/Light"),
Expand Down
4 changes: 2 additions & 2 deletions homedecor_misc/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ local S = minetest.get_translator("homedecor_misc")

homedecor_misc = {}

local wool_black, wool_grey = homedecor.textures.wool_black, homedecor.textures.wool_grey
local wood_tex = homedecor.textures.default_wood
local wool_black, wool_grey = homedecor.textures.wool.black, homedecor.textures.wool.grey
local wood_tex = homedecor.textures.wood.apple.planks

homedecor.register("ceiling_paint", {
description = S("Textured Ceiling Paint"),
Expand Down
2 changes: 1 addition & 1 deletion homedecor_pictures_and_paintings/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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 = {
type = "fixed",
Expand Down
7 changes: 3 additions & 4 deletions homedecor_roofing/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ homedecor_roofing = {}
minetest.register_node(":homedecor:skylight", {
description = S("Glass Skylight"),
drawtype = "raillike",
tiles = { homedecor.textures.glass },
wield_image = homedecor.textures.glass,
tiles = { homedecor.textures.glass.pane },
wield_image = homedecor.textures.glass.pane,
inventory_image = "homedecor_skylight_inv.png",
groups = { snappy = 3, dig_tree = 2 , axey=5},
is_ground_content = false,
Expand Down Expand Up @@ -336,8 +336,7 @@ homedecor_roofing.register_slope("homedecor", "glass",
S("Glass Shingles")
)

local brick_tex = "default_brick.png"
if not minetest.get_modpath("default") then brick_tex = "[combine:16x16^[noalpha^[colorize:#AA4A44" end
local brick_tex = homedecor.textures.brick

homedecor.register("chimney", {
description = S("Chimney"),
Expand Down
6 changes: 3 additions & 3 deletions homedecor_seating/armchairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ homedecor.register("armchair", {
description = S("Armchair"),
mesh = "forniture_armchair.obj",
tiles = {
homedecor.textures.wool_white,
{ name = homedecor.textures.wool_dark_grey, color = 0xffffffff },
{ name = homedecor.textures.default_wood, color = 0xffffffff }
homedecor.textures.wool.white,
{ name = homedecor.textures.wool.dark_grey, color = 0xffffffff },
{ name = homedecor.textures.wood.apple.planks, color = 0xffffffff }
},
inventory_image = "homedecor_armchair_inv.png",
paramtype2 = "colorwallmounted",
Expand Down
2 changes: 1 addition & 1 deletion homedecor_seating/misc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ homedecor.register("kitchen_chair_padded", {
mesh = "homedecor_kitchen_chair.obj",
tiles = {
homedecor.plain_wood,
homedecor.textures.wool_white,
homedecor.textures.wool.white,
},
inventory_image = "homedecor_chair_padded_inv.png",
paramtype2 = "colorwallmounted",
Expand Down
2 changes: 1 addition & 1 deletion homedecor_windows_and_treatments/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ homedecor.register("curtain_open", {
local mats = {
{ "brass", S("brass"), "homedecor_generic_metal_brass.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
Expand Down

0 comments on commit 0d5cab9

Please sign in to comment.