Skip to content

Commit e0c919a

Browse files
fix(aliases): Minetest broke my aliases
Need to be at end.
1 parent b8a44c5 commit e0c919a

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

init.lua

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
11
local scale=2.5
2+
instant_ores.register_metal({ -- cuz eating your armor is so metal
3+
name = "chocolatestuff:chocolate",
4+
description = "Chocolate",
5+
artificial = true, -- We don't need ores.
6+
power = .5, -- So weak as to crumble after but a few real uses.
7+
color = "#653302", -- Color sampled from the chocolate color in the farming redo mod
8+
})
9+
ediblestuff.make_tools_edible("chocolatestuff","chocolate",scale)
10+
if minetest.get_modpath("3d_armor") == nil then return end
11+
local armor_types=ediblestuff.make_armor_edible_while_wearing("chocolatestuff","chocolate",scale)
12+
-- Ok, so apparently this idea for chocolate armor wasn't super original. May as well play nice.
13+
local made_aliases = false
14+
for _,armormod in ipairs{"moarmour","armor_addon"} do
15+
if minetest.get_modpath(armormod) then
16+
ediblestuff.make_armor_edible_while_wearing(armormod,"chocolate",scale)
17+
if made_aliases then break end
18+
made_aliases = true
19+
for typ,_ in pairs(armor_types) do
20+
minetest.register_alias_force("chocolatestuff:"..typ.."_chocolate", armormod..":"..typ.."_chocolate")
21+
end
22+
end
23+
end
24+
-- If neither of the other mods are present...
25+
if not made_aliases then
26+
for typ,_ in pairs(armor_types) do
27+
minetest.register_alias_force("moarmour:"..typ.."_chocolate", "chocolatestuff:"..typ.."_chocolate")
28+
minetest.register_alias_force("armor_addon:"..typ.."_chocolate", "chocolatestuff:"..typ.."_chocolate")
29+
end
30+
end
31+
-- Aliases apparently need to be _after_ everything else now. Unkown which version of minetest broke this.
232
if minetest.get_modpath("farming") ~= nil and farming.mod == "redo" then
333
minetest.register_alias_force( -- Dark chocolate sortof looks like an ingot. This is why this mod is even a thing.
434
"chocolatestuff:chocolate_ingot",
@@ -33,32 +63,3 @@ elseif minetest.get_modpath("mcl_morefood") ~= nil then
3363
else
3464
minetest.log("info","chocolatestuff: could not find source for chocolate. Chocolate armor will not be obtainable in survival.")
3565
end
36-
instant_ores.register_metal({ -- cuz eating your armor is so metal
37-
name = "chocolatestuff:chocolate",
38-
description = "Chocolate",
39-
artificial = true, -- We don't need ores.
40-
power = .5, -- So weak as to crumble after but a few real uses.
41-
color = "#653302", -- Color sampled from the chocolate color in the farming redo mod
42-
})
43-
ediblestuff.make_tools_edible("chocolatestuff","chocolate",scale)
44-
if minetest.get_modpath("3d_armor") == nil then return end
45-
local armor_types=ediblestuff.make_armor_edible_while_wearing("chocolatestuff","chocolate",scale)
46-
-- Ok, so apparently this idea for chocolate armor wasn't super original. May as well play nice.
47-
local made_aliases = false
48-
for _,armormod in ipairs{"moarmour","armor_addon"} do
49-
if minetest.get_modpath(armormod) then
50-
ediblestuff.make_armor_edible_while_wearing(armormod,"chocolate",scale)
51-
if made_aliases then break end
52-
made_aliases = true
53-
for typ,_ in pairs(armor_types) do
54-
minetest.register_alias_force("chocolatestuff:"..typ.."_chocolate", armormod..":"..typ.."_chocolate")
55-
end
56-
end
57-
end
58-
-- If neither of the other mods are present...
59-
if not made_aliases then
60-
for typ,_ in pairs(armor_types) do
61-
minetest.register_alias_force("moarmour:"..typ.."_chocolate", "chocolatestuff:"..typ.."_chocolate")
62-
minetest.register_alias_force("armor_addon:"..typ.."_chocolate", "chocolatestuff:"..typ.."_chocolate")
63-
end
64-
end

0 commit comments

Comments
 (0)