add mesecons mods
This commit is contained in:
parent
71a53fbef8
commit
9861939223
721 changed files with 19937 additions and 1 deletions
72
mods/mesecons/mesecons_gamecompat/compat_hades.lua
Normal file
72
mods/mesecons/mesecons_gamecompat/compat_hades.lua
Normal file
|
@ -0,0 +1,72 @@
|
|||
--Aliases
|
||||
|
||||
core.register_alias("mesecons_gamecompat:chest", "hades_chests:chest")
|
||||
core.register_alias("mesecons_gamecompat:chest_locked", "hades_chests:chest_locked")
|
||||
core.register_alias("mesecons_gamecompat:coalblock", "hades_core:coalblock")
|
||||
core.register_alias("mesecons_gamecompat:cobble", "hades_core:cobble")
|
||||
core.register_alias("mesecons_gamecompat:glass", "hades_core:glass")
|
||||
core.register_alias("mesecons_gamecompat:lava_source", "hades_core:lava_source")
|
||||
core.register_alias("mesecons_gamecompat:mese", "hades_core:mese")
|
||||
core.register_alias("mesecons_gamecompat:mese_crystal", "hades_core:mese_crystal")
|
||||
core.register_alias("mesecons_gamecompat:mese_crystal_fragment", "hades_core:mese_crystal_fragment")
|
||||
core.register_alias("mesecons_gamecompat:obsidian_glass", "hades_core:obsidian_glass")
|
||||
core.register_alias("mesecons_gamecompat:stone", "hades_core:stone")
|
||||
core.register_alias("mesecons_gamecompat:steel_ingot", "hades_core:steel_ingot")
|
||||
core.register_alias("mesecons_gamecompat:steelblock", "hades_core:steelblock")
|
||||
core.register_alias("mesecons_gamecompat:torch", "hades_torches:torch")
|
||||
|
||||
if core.get_modpath("hades_dye") then
|
||||
for _, color in ipairs(mesecon.dye_colors) do
|
||||
core.register_alias("mesecons_gamecompat:dye_" .. color, "hades_dye:" .. color)
|
||||
end
|
||||
end
|
||||
|
||||
-- Sounds
|
||||
|
||||
mesecon.node_sound.default = hades_sounds.node_sound_defaults()
|
||||
mesecon.node_sound.glass = hades_sounds.node_sound_glass_defaults()
|
||||
mesecon.node_sound.leaves = hades_sounds.node_sound_leaves_defaults()
|
||||
mesecon.node_sound.stone = hades_sounds.node_sound_stone_defaults()
|
||||
mesecon.node_sound.wood = hades_sounds.node_sound_wood_defaults()
|
||||
|
||||
if core.get_modpath("hades_fire") then
|
||||
mesecon.sound_name.fire = "fire_fire"
|
||||
end
|
||||
|
||||
if core.get_modpath("hades_tnt") then
|
||||
mesecon.sound_name.explode = "tnt_explode"
|
||||
end
|
||||
|
||||
-- Textures
|
||||
|
||||
mesecon.texture.steel_block = "default_steel_block.png"
|
||||
|
||||
-- MVPS stoppers
|
||||
|
||||
if core.get_modpath("mesecons_mvps") then
|
||||
-- All of the locked and internal nodes in Hades Revisited
|
||||
for _, name in ipairs({
|
||||
"hades_chests:chest_locked",
|
||||
"hades_chests:chest_locked_open",
|
||||
"hades_doors:hidden",
|
||||
"hades_doors:hidden_center",
|
||||
}) do
|
||||
mesecon.register_mvps_stopper(name)
|
||||
end
|
||||
core.register_on_mods_loaded(function()
|
||||
if core.get_modpath("hades_doors") then
|
||||
for _,v in pairs(core.registered_nodes) do
|
||||
if v.groups and (v.groups.door or v.groups.trapdoor) then
|
||||
mesecon.register_mvps_stopper(v.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
if core.get_modpath("hades_beds") then
|
||||
for _,v in pairs(core.registered_nodes) do
|
||||
if v.groups and v.groups.bed then
|
||||
mesecon.register_mvps_stopper(v.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
88
mods/mesecons/mesecons_gamecompat/compat_mcla.lua
Normal file
88
mods/mesecons/mesecons_gamecompat/compat_mcla.lua
Normal file
|
@ -0,0 +1,88 @@
|
|||
|
||||
--Aliases
|
||||
|
||||
minetest.register_alias("mesecons_gamecompat:chest", "mcl_chests:chest")
|
||||
minetest.register_alias("mesecons_gamecompat:chest_locked", "mcl_chests:chest")
|
||||
minetest.register_alias("mesecons_gamecompat:coalblock", "mcl_core:coalblock")
|
||||
minetest.register_alias("mesecons_gamecompat:cobble", "mcl_core:cobble")
|
||||
minetest.register_alias("mesecons_gamecompat:glass", "mcl_core:glass")
|
||||
minetest.register_alias("mesecons_gamecompat:lava_source", "mcl_core:lava_source")
|
||||
minetest.register_alias("mesecons_gamecompat:mese", "mcl_redstone_torch:redstoneblock")
|
||||
minetest.register_alias("mesecons_gamecompat:mese_crystal", "mcl_redstone:redstone")
|
||||
minetest.register_alias("mesecons_gamecompat:mese_crystal_fragment", "mcl_redstone:redstone")
|
||||
minetest.register_alias("mesecons_gamecompat:obsidian_glass", "mcl_core:glass")
|
||||
minetest.register_alias("mesecons_gamecompat:stone", "mcl_core:stone")
|
||||
minetest.register_alias("mesecons_gamecompat:steel_ingot", "mcl_core:iron_ingot")
|
||||
minetest.register_alias("mesecons_gamecompat:steelblock", "mcl_core:ironblock")
|
||||
minetest.register_alias("mesecons_gamecompat:torch", "mcl_torches:torch")
|
||||
|
||||
if minetest.get_modpath("mcl_dyes") then
|
||||
for color, def in ipairs(mcl_dyes.colors) do
|
||||
minetest.register_alias("mesecons_gamecompat:dye_" .. def.mcl2, "mcl_dyes:" .. color)
|
||||
end
|
||||
end
|
||||
|
||||
-- Sounds
|
||||
|
||||
mesecon.node_sound.default = mcl_sounds.node_sound_defaults()
|
||||
mesecon.node_sound.glass = mcl_sounds.node_sound_glass_defaults()
|
||||
mesecon.node_sound.leaves = mcl_sounds.node_sound_leaves_defaults()
|
||||
mesecon.node_sound.stone = mcl_sounds.node_sound_stone_defaults()
|
||||
mesecon.node_sound.wood = mcl_sounds.node_sound_wood_defaults()
|
||||
|
||||
if minetest.get_modpath("mcl_fire") then
|
||||
mesecon.sound_name.fire = "fire_fire"
|
||||
end
|
||||
|
||||
if minetest.get_modpath("mcl_tnt") then
|
||||
mesecon.sound_name.explode = "tnt_explode"
|
||||
end
|
||||
|
||||
-- Textures
|
||||
|
||||
mesecon.texture.steel_block = "default_steel_block.png"
|
||||
|
||||
if minetest.get_modpath("mesecons_mvps") then
|
||||
for k,v in pairs(core.registered_nodes) do
|
||||
local is_stopper = mesecon.mvps_stoppers[k]
|
||||
if v.groups and v.groups.unmovable_by_piston then
|
||||
mesecon.register_mvps_stopper(k)
|
||||
end
|
||||
if is_stopper then
|
||||
local groups = table.copy(v.groups or {})
|
||||
groups.unmovable_by_piston = 1
|
||||
v.groups = groups
|
||||
core.register_node(":"..k, v)
|
||||
end
|
||||
end
|
||||
for k,v in pairs(core.registered_entities) do
|
||||
local is_unmov = mesecon.mvps_unmov[k]
|
||||
if v._mcl_pistons_unmovable then
|
||||
mesecon.register_mvps_unmov(k)
|
||||
end
|
||||
if is_unmov then
|
||||
v._mcl_pistons_unmovable = true
|
||||
core.register_entity(":"..k, v)
|
||||
end
|
||||
end
|
||||
|
||||
core.register_on_mods_loaded(function()
|
||||
for _,v in pairs(core.registered_nodes) do
|
||||
if v.groups and v.groups.bed then
|
||||
mesecon.register_mvps_stopper(v.name)
|
||||
end
|
||||
if v.groups and v.groups.door then
|
||||
mesecon.register_mvps_stopper(v.name)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
core.register_craft({
|
||||
output = "mesecons:wire_00000000_off",
|
||||
recipe = {{"mcl_redstone:redstone"}}
|
||||
})
|
||||
core.register_craft({
|
||||
output = "mcl_redstone:redstone",
|
||||
recipe = {{"mesecons:wire_00000000_off"}}
|
||||
})
|
73
mods/mesecons/mesecons_gamecompat/compat_mtg.lua
Normal file
73
mods/mesecons/mesecons_gamecompat/compat_mtg.lua
Normal file
|
@ -0,0 +1,73 @@
|
|||
--Aliases
|
||||
|
||||
minetest.register_alias("mesecons_gamecompat:chest", "default:chest")
|
||||
minetest.register_alias("mesecons_gamecompat:chest_locked", "default:chest_locked")
|
||||
minetest.register_alias("mesecons_gamecompat:coalblock", "default:coalblock")
|
||||
minetest.register_alias("mesecons_gamecompat:cobble", "default:cobble")
|
||||
minetest.register_alias("mesecons_gamecompat:glass", "default:glass")
|
||||
minetest.register_alias("mesecons_gamecompat:lava_source", "default:lava_source")
|
||||
minetest.register_alias("mesecons_gamecompat:mese", "default:mese")
|
||||
minetest.register_alias("mesecons_gamecompat:mese_crystal", "default:mese_crystal")
|
||||
minetest.register_alias("mesecons_gamecompat:mese_crystal_fragment", "default:mese_crystal_fragment")
|
||||
minetest.register_alias("mesecons_gamecompat:obsidian_glass", "default:obsidian_glass")
|
||||
minetest.register_alias("mesecons_gamecompat:stone", "default:stone")
|
||||
minetest.register_alias("mesecons_gamecompat:steel_ingot", "default:steel_ingot")
|
||||
minetest.register_alias("mesecons_gamecompat:steelblock", "default:steelblock")
|
||||
minetest.register_alias("mesecons_gamecompat:torch", "default:torch")
|
||||
|
||||
if minetest.get_modpath("dye") then
|
||||
for _, color in ipairs(mesecon.dye_colors) do
|
||||
minetest.register_alias("mesecons_gamecompat:dye_" .. color, "dye:" .. color)
|
||||
end
|
||||
end
|
||||
|
||||
-- Sounds
|
||||
|
||||
mesecon.node_sound.default = default.node_sound_defaults()
|
||||
mesecon.node_sound.glass = default.node_sound_glass_defaults()
|
||||
mesecon.node_sound.leaves = default.node_sound_leaves_defaults()
|
||||
mesecon.node_sound.stone = default.node_sound_stone_defaults()
|
||||
mesecon.node_sound.wood = default.node_sound_wood_defaults()
|
||||
|
||||
if minetest.get_modpath("fire") then
|
||||
mesecon.sound_name.fire = "fire_fire"
|
||||
end
|
||||
|
||||
if minetest.get_modpath("tnt") then
|
||||
mesecon.sound_name.explode = "tnt_explode"
|
||||
end
|
||||
|
||||
-- Textures
|
||||
|
||||
mesecon.texture.steel_block = "default_steel_block.png"
|
||||
|
||||
-- MVPS stoppers
|
||||
|
||||
if minetest.get_modpath("mesecons_mvps") then
|
||||
-- All of the locked and internal nodes in Minetest Game
|
||||
for _, name in ipairs({
|
||||
"default:chest_locked",
|
||||
"default:chest_locked_open",
|
||||
"doors:hidden",
|
||||
"doors:trapdoor_steel",
|
||||
"doors:trapdoor_steel_open",
|
||||
"xpanes:trapdoor_steel_bar",
|
||||
"xpanes:trapdoor_steel_bar_open",
|
||||
}) do
|
||||
mesecon.register_mvps_stopper(name)
|
||||
end
|
||||
core.register_on_mods_loaded(function()
|
||||
if minetest.get_modpath("doors") then
|
||||
for k,_ in pairs(doors.registered_doors) do
|
||||
mesecon.register_mvps_stopper(k)
|
||||
end
|
||||
end
|
||||
if minetest.get_modpath("beds") then
|
||||
for _,v in pairs(core.registered_nodes) do
|
||||
if v.groups and v.groups.bed then
|
||||
mesecon.register_mvps_stopper(v.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
145
mods/mesecons/mesecons_gamecompat/doors.lua
Normal file
145
mods/mesecons/mesecons_gamecompat/doors.lua
Normal file
|
@ -0,0 +1,145 @@
|
|||
-- Modified, from minetest_game/mods/doors/init.lua
|
||||
local function on_rightclick(pos, dir, check_name, replace, replace_dir, params)
|
||||
pos.y = pos.y + dir
|
||||
if minetest.get_node(pos).name ~= check_name then
|
||||
return
|
||||
end
|
||||
local p2 = minetest.get_node(pos).param2
|
||||
p2 = params[p2 + 1]
|
||||
|
||||
minetest.swap_node(pos, {name = replace_dir, param2 = p2})
|
||||
|
||||
pos.y = pos.y - dir
|
||||
minetest.swap_node(pos, {name = replace, param2 = p2})
|
||||
|
||||
if (minetest.get_meta(pos):get_int("right") ~= 0) == (params[1] ~= 3) then
|
||||
minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
else
|
||||
minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
end
|
||||
end
|
||||
|
||||
local function meseconify_door(name)
|
||||
if minetest.registered_items[name .. "_b_1"] then
|
||||
-- old style double-node doors
|
||||
if minetest.registered_items[name .. "_b_1"].mesecons then
|
||||
minetest.log("info", "[mesecons_doors] Not touching door " .. name)
|
||||
return
|
||||
end
|
||||
|
||||
local function toggle_state1 (pos)
|
||||
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
|
||||
end
|
||||
|
||||
local function toggle_state2 (pos)
|
||||
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||
end
|
||||
|
||||
minetest.override_item(name.."_b_1", {
|
||||
mesecons = {effector = {
|
||||
action_on = toggle_state1,
|
||||
action_off = toggle_state1,
|
||||
rules = mesecon.rules.pplate
|
||||
}}
|
||||
})
|
||||
|
||||
minetest.override_item(name.."_b_2", {
|
||||
mesecons = {effector = {
|
||||
action_on = toggle_state2,
|
||||
action_off = toggle_state2,
|
||||
rules = mesecon.rules.pplate
|
||||
}}
|
||||
})
|
||||
elseif minetest.registered_items[name .. "_a"] then
|
||||
-- new style mesh node based doors
|
||||
if minetest.registered_items[name .. "_a"].mesecons then
|
||||
minetest.log("info", "[mesecons_doors] Not touching door " .. name)
|
||||
return
|
||||
end
|
||||
local override = {
|
||||
mesecons = {effector = {
|
||||
action_on = function(pos)
|
||||
local door = doors.get(pos)
|
||||
if door then
|
||||
door:open()
|
||||
end
|
||||
end,
|
||||
action_off = function(pos)
|
||||
local door = doors.get(pos)
|
||||
if door then
|
||||
door:close()
|
||||
end
|
||||
end,
|
||||
rules = mesecon.rules.pplate
|
||||
}}
|
||||
}
|
||||
minetest.override_item(name .. "_a", override)
|
||||
minetest.override_item(name .. "_b", override)
|
||||
if minetest.registered_items[name .. "_c"] then
|
||||
minetest.override_item(name .. "_c", override)
|
||||
minetest.override_item(name .. "_d", override)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Trapdoor
|
||||
local function trapdoor_switch(name)
|
||||
return function(pos, node)
|
||||
local state = minetest.get_meta(pos):get_int("state")
|
||||
if state == 1 then
|
||||
minetest.sound_play("doors_door_close", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
minetest.set_node(pos, {name=name, param2 = node.param2})
|
||||
else
|
||||
minetest.sound_play("doors_door_open", { pos = pos, gain = 0.3, max_hear_distance = 10 }, true)
|
||||
minetest.set_node(pos, {name=name.."_open", param2 = node.param2})
|
||||
end
|
||||
minetest.get_meta(pos):set_int("state", state == 1 and 0 or 1)
|
||||
end
|
||||
end
|
||||
|
||||
local function meseconify_trapdoor(name)
|
||||
local override
|
||||
if doors and doors.get then
|
||||
override = {
|
||||
mesecons = {effector = {
|
||||
action_on = function(pos)
|
||||
local door = doors.get(pos)
|
||||
if door then
|
||||
door:open()
|
||||
end
|
||||
end,
|
||||
action_off = function(pos)
|
||||
local door = doors.get(pos)
|
||||
if door then
|
||||
door:close()
|
||||
end
|
||||
end,
|
||||
}},
|
||||
}
|
||||
else
|
||||
override = {
|
||||
mesecons = {effector = {
|
||||
action_on = trapdoor_switch(name),
|
||||
action_off = trapdoor_switch(name)
|
||||
}},
|
||||
}
|
||||
end
|
||||
|
||||
if minetest.registered_items[name] then
|
||||
minetest.override_item(name, override)
|
||||
minetest.override_item(name.."_open", override)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
for k,_ in pairs(doors.registered_doors) do
|
||||
if k:find("_a$") then
|
||||
meseconify_door(k:sub(1,-3))
|
||||
end
|
||||
end
|
||||
for k,_ in pairs(doors.registered_trapdoors) do
|
||||
if not k:find("_open$") then
|
||||
meseconify_trapdoor(k)
|
||||
end
|
||||
end
|
||||
end)
|
29
mods/mesecons/mesecons_gamecompat/init.lua
Normal file
29
mods/mesecons/mesecons_gamecompat/init.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
mesecon.node_sound = {}
|
||||
|
||||
mesecon.sound_name = {}
|
||||
|
||||
mesecon.texture = {}
|
||||
|
||||
mesecon.dye_colors = {
|
||||
"red", "green", "blue", "grey", "dark_grey", "yellow",
|
||||
"orange", "white", "pink", "magenta", "cyan", "violet",
|
||||
}
|
||||
|
||||
if minetest.get_modpath("default") then
|
||||
minetest.log("info", "Mesecons: detected Minetest Game for game compatibility")
|
||||
dofile(minetest.get_modpath("mesecons_gamecompat").."/compat_mtg.lua")
|
||||
end
|
||||
|
||||
if minetest.get_modpath("mcl_redstone") then
|
||||
minetest.log("info", "Mesecons: detected MineClonia Game for game compatibility")
|
||||
dofile(minetest.get_modpath("mesecons_gamecompat").."/compat_mcla.lua")
|
||||
end
|
||||
|
||||
if minetest.get_modpath("hades_core") then
|
||||
minetest.log("info", "Mesecons: detected Hades Revisited Game for game compatibility")
|
||||
dofile(minetest.get_modpath("mesecons_gamecompat").."/compat_hades.lua")
|
||||
end
|
||||
|
||||
if minetest.get_modpath("doors") then
|
||||
dofile(minetest.get_modpath("mesecons_gamecompat").."/doors.lua")
|
||||
end
|
3
mods/mesecons/mesecons_gamecompat/mod.conf
Normal file
3
mods/mesecons/mesecons_gamecompat/mod.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
name = mesecons_gamecompat
|
||||
depends = mesecons
|
||||
optional_depends = fire, default, dye, mesecons_mvps, tnt, doors, beds, mcl_fire, mcl_core, mcl_dye, mcl_tnt, hades_sounds
|
Loading…
Add table
Add a link
Reference in a new issue