compatibility layer to work with MT 0.4.16 engine

* use intlib if present if not mock the translation function
* do not miss thirth parameter in the force register function of nodes
* better (in sync with minenux) description
* add depends.txt and description.txt files with such information for 0.4
* lower the requirements in mod.conf file so
* minor update to README then
master
mckaygerhard 2023-06-06 13:43:00 -04:00
parent 8b614b3513
commit bfee841c7a
15 changed files with 58 additions and 21 deletions

View File

@ -7,7 +7,8 @@ It adds a bunch of cute cubes, various mechanisms and stuff for [cutting](https:
This mod is a lightweight alternative to HomeDecor and MoreBlocks.
### Requirements ###
This mod requires at least version 5.1 of Minetest.
This mod requires at least version 0.4.16 of Minetest.
### Credits ###

10
depends.txt Normal file
View File

@ -0,0 +1,10 @@
default
bucket
doors
farming
stairs
xpanes
fire?
oresplus?
moreblocks?
mesecons?

1
description.txt Normal file
View File

@ -0,0 +1 @@
HOME decoration mod meant to be simple

View File

@ -3,6 +3,31 @@
xdecor = {}
local modpath = minetest.get_modpath("xdecor")
-- Intllib
local S
if minetest.get_translator ~= nil then
S = minetest.get_translator("xdecor") -- 5.x translation function
else
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib") .. "/init.lua")
if intllib.make_gettext_pair then
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
else
gettext = intllib.Getter() -- old text file method
end
S = gettext
else -- boilerplate function
S = function(str, ...)
local args = {...}
return str:gsub("@%d+", function(match)
return args[tonumber(match:sub(2))]
end)
end
end
end
xdecor.S = S
dofile(modpath .. "/handlers/animations.lua")
dofile(modpath .. "/handlers/helpers.lua")
dofile(modpath .. "/handlers/nodeboxes.lua")

View File

@ -1,5 +1,5 @@
name = xdecor
description = A decoration mod meant to be simple and well-featured.
description = HOME decoration mod meant to be simple
depends = default, bucket, doors, farming, stairs, xpanes
optional_depends = fire, oresplus, moreblocks, mesecons
min_minetest_version = 5.1.0
min_minetest_version = 0.4.16

View File

@ -1,5 +1,5 @@
local realchess = {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
local FS = function(...) return minetest.formspec_escape(S(...)) end
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
screwdriver = screwdriver or {}

View File

@ -1,5 +1,5 @@
local cauldron, sounds = {}, {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
-- Add more ingredients here that make a soup.
local ingredients_list = {

View File

@ -1,5 +1,5 @@
screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
local FS = function(...) return minetest.formspec_escape(S(...)) end
local ceil, abs, random = math.ceil, math.abs, math.random
local reg_tools = minetest.registered_tools

View File

@ -1,5 +1,5 @@
local hive = {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
local FS = function(...) return minetest.formspec_escape(S(...)) end
local honey_max = 16

View File

@ -1,5 +1,5 @@
local itemframe, tmp = {}, {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
screwdriver = screwdriver or {}
local function remove_item(pos, node)

View File

@ -1,6 +1,6 @@
local mailbox = {}
screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
local FS = function(...) return minetest.formspec_escape(S(...)) end
local function get_img(img)

View File

@ -3,7 +3,7 @@
local plate = {}
screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
local function door_toggle(pos_actuator, pos_door, player)

View File

@ -1,5 +1,5 @@
screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
local ALPHA_CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true
local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false
@ -540,7 +540,7 @@ xdecor.register("stonepath", {
})
local function register_hard_node(name, desc, def)
def = def or {}
if def == nil then def = { groups = {cracky=1}, sounds = default.node_sound_stone_defaults() } end
xdecor.register(name, {
description = desc,
tiles = {"xdecor_" .. name .. ".png"},
@ -549,13 +549,13 @@ local function register_hard_node(name, desc, def)
})
end
register_hard_node("cactusbrick", S("Cactus Brick"))
register_hard_node("coalstone_tile", S("Coal Stone Tile"))
register_hard_node("desertstone_tile", S("Desert Stone Tile"))
register_hard_node("hard_clay", S("Hardened Clay"))
register_hard_node("moonbrick", S("Moon Brick"))
register_hard_node("stone_tile", S("Stone Tile"))
register_hard_node("stone_rune", S("Runestone"))
register_hard_node("cactusbrick", S("Cactus Brick"), { groups = {cracky = 1}, sounds = default.node_sound_stone_defaults() })
register_hard_node("coalstone_tile", S("Coal Stone Tile"), { groups = {cracky = 1}, sounds = default.node_sound_stone_defaults() })
register_hard_node("desertstone_tile", S("Desert Stone Tile"), { groups = {cracky = 1}, sounds = default.node_sound_stone_defaults() })
register_hard_node("hard_clay", S("Hardened Clay"), { groups = {cracky = 1}, sounds = default.node_sound_stone_defaults() })
register_hard_node("moonbrick", S("Moon Brick"), { groups = {cracky = 1}, sounds = default.node_sound_stone_defaults() })
register_hard_node("stone_tile", S("Stone Tile"), { groups = {cracky = 1}, sounds = default.node_sound_stone_defaults() })
register_hard_node("stone_rune", S("Runestone"), { groups = {cracky = 1}, sounds = default.node_sound_stone_defaults() })
register_hard_node("packed_ice", S("Packed Ice"), {
groups = {cracky = 1, puts_out_fire = 1, slippery = 3},

View File

@ -1,5 +1,5 @@
local rope = {}
local S = minetest.get_translator("xdecor")
local S = xdecor.S
-- Code by Mirko K. (modified by Temperest, Wulfsdad and kilbith) (License: GPL).
function rope.place(itemstack, placer, pointed_thing)

View File

@ -3,7 +3,7 @@ local nodes = {}
screwdriver = screwdriver or {}
local min, ceil = math.min, math.ceil
local S = minetest.get_translator("xdecor")
local S = xdecor.S
local FS = function(...) return minetest.formspec_escape(S(...)) end
-- Nodes allowed to be cut