Remove 'default dependency

Make the 'default' dependency optional

This commit introduces compatibility functions needed by the
3d_armor mods to adapt to the game that is being used.

Added license information to LICENSE.md in the modpack folder.

Co-authored-by: Sheriff U3 <210896603+Sheriff-Unit-3@users.noreply.github.com>
This commit is contained in:
SmallJoker
2025-12-02 15:56:38 -06:00
parent 063505f9ea
commit baa16e28cb
15 changed files with 127 additions and 99 deletions

41
3d_armor/gamecompat.lua Normal file
View File

@@ -0,0 +1,41 @@
-- 3d_armor defaults to support unknown games
local sounds = {
wood = {
footstep = { name = "armor_wood_walk", gain = 0.5 },
dig = { name = "armor_wood_dig", gain = 0.5 },
dug = { name = "armor_wood_walk", gain = 0.5 }
},
metal = {
dig = { name = "armor_metal_dig", gain = 0.5 },
dug = { name = "armor_metal_break", gain = 0.5 },
},
glass = {
dig = { name = "armor_glass_hit", gain = 0.5 },
dug = { name = "armor_glass_break", gain = 0.5 },
},
}
local formspec_list_template = "list[%s;%s;%f,%f;%f,%f;%s]"
-- Allow custom slot styling
armor.add_formspec_list = function(location, listname, x, y, w, h, offset)
return formspec_list_template:format(location, listname, x, y, w, h, tostring(offset) or "")
end
if core.get_modpath("default") then
sounds = {
wood = default.node_sound_wood_defaults(),
metal = default.node_sound_metal_defaults(),
glass = default.node_sound_glass_defaults(),
}
-- armor.add_formspec_list : use formspec prepends for styling
end
-- Sanity checks
for name, def in pairs(sounds) do
assert(type(def) == "table", "Incorrect registration of sound " .. name)
end
armor.sounds = sounds