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