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:
@@ -108,18 +108,16 @@ local armor_textures = setmetatable({}, {
|
||||
end
|
||||
})
|
||||
|
||||
armor = {
|
||||
local armor_fields = {
|
||||
timer = 0,
|
||||
elements = {"head", "torso", "legs", "feet"},
|
||||
physics = {"jump", "speed", "gravity"},
|
||||
attributes = {"heal", "fire", "water", "feather"},
|
||||
formspec = "image[2.5,0;2,4;armor_preview]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
default.get_hotbar_bg(0, 4.7)..
|
||||
"list[current_player;main;0,4.7;8,1;]"..
|
||||
"list[current_player;main;0,5.85;8,3;8]",
|
||||
formspec = (
|
||||
"image[2.5,0;2,4;armor_preview]" ..
|
||||
armor.add_formspec_list("current_player", "main", 0, 4.7, 8, 1) ..
|
||||
armor.add_formspec_list("current_player", "main", 0, 5.85, 8, 3, 8)
|
||||
),
|
||||
def = armor_def,
|
||||
textures = armor_textures,
|
||||
default_skin = "character",
|
||||
@@ -156,10 +154,13 @@ armor = {
|
||||
on_destroy = {},
|
||||
},
|
||||
migrate_old_inventory = true,
|
||||
version = "0.4.13",
|
||||
get_translator = S
|
||||
}
|
||||
|
||||
for k, v in pairs(armor_fields) do
|
||||
armor[k] = v
|
||||
end
|
||||
|
||||
armor.config = {
|
||||
init_delay = 2,
|
||||
bones_delay = 1,
|
||||
|
||||
41
3d_armor/gamecompat.lua
Normal file
41
3d_armor/gamecompat.lua
Normal 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
|
||||
@@ -8,6 +8,11 @@ local worldpath = minetest.get_worldpath()
|
||||
local last_punch_time = {}
|
||||
local timer = 0
|
||||
|
||||
armor = {
|
||||
version = "0.4.13"
|
||||
}
|
||||
|
||||
dofile(modpath.."/gamecompat.lua")
|
||||
dofile(modpath.."/api.lua")
|
||||
|
||||
-- local functions
|
||||
@@ -480,10 +485,12 @@ end)
|
||||
|
||||
if armor.config.fire_protect == true then
|
||||
|
||||
-- make torches hurt
|
||||
minetest.override_item("default:torch", {damage_per_second = 1})
|
||||
minetest.override_item("default:torch_wall", {damage_per_second = 1})
|
||||
minetest.override_item("default:torch_ceiling", {damage_per_second = 1})
|
||||
if core.get_modpath("default") then
|
||||
-- make torches hurt
|
||||
minetest.override_item("default:torch", {damage_per_second = 1})
|
||||
minetest.override_item("default:torch_wall", {damage_per_second = 1})
|
||||
minetest.override_item("default:torch_ceiling", {damage_per_second = 1})
|
||||
end
|
||||
|
||||
-- check player damage for any hot nodes we may be protected against
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, reason)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name = 3d_armor
|
||||
depends = default, player_api
|
||||
optional_depends = player_monoids, armor_monoid, pova, moreores
|
||||
depends = player_api
|
||||
optional_depends = default, player_monoids, armor_monoid, pova, moreores
|
||||
description = Adds craftable armor that is visible to other players.
|
||||
min_minetest_version = 5.4
|
||||
|
||||
BIN
3d_armor/sounds/armor_glass_break.ogg
Normal file
BIN
3d_armor/sounds/armor_glass_break.ogg
Normal file
Binary file not shown.
BIN
3d_armor/sounds/armor_glass_hit.ogg
Normal file
BIN
3d_armor/sounds/armor_glass_hit.ogg
Normal file
Binary file not shown.
BIN
3d_armor/sounds/armor_metal_break.ogg
Normal file
BIN
3d_armor/sounds/armor_metal_break.ogg
Normal file
Binary file not shown.
BIN
3d_armor/sounds/armor_metal_dig.ogg
Normal file
BIN
3d_armor/sounds/armor_metal_dig.ogg
Normal file
Binary file not shown.
BIN
3d_armor/sounds/armor_wood_walk.ogg
Normal file
BIN
3d_armor/sounds/armor_wood_walk.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user