Skip to content

Commit

Permalink
Merge pull request #5 from minertestdude/master
Browse files Browse the repository at this point in the history
add compatibility to Mineclone2
  • Loading branch information
FaceDeer committed Oct 21, 2018
2 parents 11cf9a1 + caf1212 commit 469ee9c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 15 deletions.
5 changes: 4 additions & 1 deletion depends.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
default?
mcl_core?
mcl_sounds?
airtanks?
moretrees?
intllib?
doc?
doc?
70 changes: 56 additions & 14 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")

-- MCL2 compatibility
local moditems = {}

if core.get_modpath("mcl_core") and mcl_core then -- means MineClone 2 is loaded, this is its core mod
moditems.IRON_ITEM = "mcl_core:iron_ingot" -- MCL iron
else -- fallback, assume default (MineTest Game) is loaded, otherwise it will error anyway here.
moditems.IRON_ITEM = "default:steel_ingot" -- MCL iron
end


local pontoons_override_logs = minetest.settings:get_bool("pontoons_override_logs") -- default false

local pontoons_override_wood = minetest.settings:get_bool("pontoons_override_wood") -- default false
Expand Down Expand Up @@ -31,7 +41,11 @@ if pontoons_wood_pontoons then
local default_sound
local wood_burn_time
if default_modpath then
default_sound = default.node_sound_wood_defaults()
if mcl_sounds then
default_sound = mcl_sounds.node_sound_wood_defaults()
else
default_sound = default.node_sound_wood_defaults()
end
wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("group:wood")}}).time
end
if not wood_burn_time then wood_burn_time = 7 end
Expand All @@ -47,7 +61,19 @@ if pontoons_wood_pontoons then
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
sounds = default_sound,
})


-- modify recipe, if "airtank" mod is loaded as it has similar recipe and conflicts with pontoons.

if core.get_modpath("airtanks") and airtanks then
minetest.register_craft({
output = 'pontoons:wood_pontoon 4',
recipe = {
{"group:wood","group:wood","group:wood"},
{"","",""},
{"","","group:wood"},
}
})
else
minetest.register_craft({
output = 'pontoons:wood_pontoon 4',
recipe = {
Expand All @@ -56,7 +82,8 @@ if pontoons_wood_pontoons then
{"","group:wood",""},
}
})

end

minetest.register_craft({
type = "fuel",
recipe = "pontoons:wood_pontoon",
Expand All @@ -68,10 +95,14 @@ end
if pontoons_steel_pontoons then
local default_sound
if default_modpath then
if default.node_sound_metal_defaults ~= nil then
default_sound = default.node_sound_metal_defaults()
if mcl_sounds then
default_sound = mcl_sounds.node_sound_metal_defaults()
else
default_sound = default.node_sound_wood_defaults()
if default.node_sound_metal_defaults then
default_sound = default.node_sound_metal_defaults()
else
default_sound = default.node_sound_wood_defaults()
end
end
end

Expand All @@ -87,13 +118,24 @@ if pontoons_steel_pontoons then
})

if default_modpath then
minetest.register_craft({
output = 'pontoons:steel_pontoon',
recipe = {
{"","default:steel_ingot",""},
{"default:steel_ingot","","default:steel_ingot"},
{"","default:steel_ingot",""},
}
})
if core.get_modpath("airtanks") and airtanks then
minetest.register_craft({
output = 'pontoons:steel_pontoon',
recipe = {
{"",moditems.IRON_ITEM,""},
{moditems.IRON_ITEM,"",moditems.IRON_ITEM},
{"","",moditems.IRON_ITEM},
}
})
else
minetest.register_craft({
output = 'pontoons:steel_pontoon',
recipe = {
{"",moditems.IRON_ITEM,""},
{moditems.IRON_ITEM,"",moditems.IRON_ITEM},
{"",moditems.IRON_ITEM,""},
}
})
end
end
end

0 comments on commit 469ee9c

Please sign in to comment.