MineClone/MineClonia compatibility (#80)

This commit is contained in:
Github is a non-free platform owned by Microsoft. Reasonable alternatives exist, such as Gitea, Sourcehut. We need a federated, mastodon-like forge based on ForgeFed. See: https://forgefed.org 2023-12-02 21:45:07 +01:00 committed by GitHub
parent 722ff851dd
commit f781039f43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 91 additions and 22 deletions

@ -13,5 +13,7 @@ read_globals = {
globals = {
"digilines",
"tubelib",
"tubelib2"
"tubelib2",
"mcl_sounds",
"mcl_formspec"
}

@ -1,6 +1,13 @@
digilines = {}
digilines.S = minetest.get_translator("digilines")
digilines.mcl = minetest.get_modpath("mcl_core")
-- sounds check
if minetest.get_modpath("default") then digilines.sounds = default end
if digilines.mcl then digilines.sounds = mcl_sounds end
-- Backwards compatibility code.
-- We define a proxy table whose methods can be called with the
-- `foo:bar` notation, and it will redirect the call to the
@ -55,12 +62,24 @@ function digilines.receptor_send(pos, rules, channel, msg)
end
end
local fiber = "mesecons_materials:fiber"
local insulated = "mesecons_insulated:insulated_off"
local gold_ingot = "default:gold_ingot"
if digilines.mcl then
gold_ingot = "mcl_core:gold_ingot"
-- MCL dont support mesecons insulated
if not minetest.get_modpath("mesecons_insulated") then
insulated = "mesecons:redstone"
end
end
minetest.register_craft({
output = 'digilines:wire_std_00000000 2',
recipe = {
{'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'},
{'mesecons_insulated:insulated_off', 'mesecons_insulated:insulated_off', 'default:gold_ingot'},
{'mesecons_materials:fiber', 'mesecons_materials:fiber', 'mesecons_materials:fiber'},
{fiber, fiber, fiber},
{insulated, insulated, gold_ingot},
{fiber, fiber, fiber},
}
})

@ -146,7 +146,15 @@ local tube_insert_object = function(pos, _, original_stack, direction)
return stack
end
local formspec_header = ""
if minetest.get_modpath("mcl_formspec") then
formspec_header = mcl_formspec.get_itemslot_bg(0,1,8,4)..
mcl_formspec.get_itemslot_bg(0,6,8,4)
end
minetest.register_alias("digilines_inventory:chest", "digilines:chest")
minetest.register_node("digilines:chest", {
description = S("Digiline Chest"),
tiles = {
@ -159,15 +167,15 @@ minetest.register_node("digilines:chest", {
},
paramtype2 = "facedir",
legacy_facedir_simple = true,
groups = {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1},
sounds = default.node_sound_wood_defaults(),
groups = {choppy=2, oddly_breakable_by_hand=2, tubedevice=1, tubedevice_receiver=1, axey=1, handy=1},
sounds = digilines.sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", S("Digiline Chest"))
meta:set_string("formspec", "size[8,10]"..
((default and default.gui_bg) or "")..
((default and default.gui_bg_img) or "")..
((default and default.gui_slots) or "")..
formspec_header..
"label[0,0;" .. S("Digiline Chest") .. "]" ..
"list[current_name;main;0,1;8,4;]"..
"field[2,5.5;5,1;channel;" .. S("Channel") .. ";${channel}]"..
@ -405,8 +413,14 @@ if minetest.global_exists("tubelib") then
})
end
local chest = "default:chest"
if minetest.get_modpath("mcl_chests") then
chest = "mcl_chests:chest"
end
minetest.register_craft({
type = "shapeless",
output = "digilines:chest",
recipe = {"default:chest", "digilines:wire_std_00000000"}
recipe = {chest, "digilines:wire_std_00000000"}
})

21
lcd.lua

@ -286,6 +286,8 @@ minetest.register_node("digilines:lcd", {
node_box = lcd_box,
selection_box = lcd_box,
groups = {choppy = 3, dig_immediate = 2},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
after_place_node = function(pos)
local param2 = minetest.get_node(pos).param2
if param2 == 0 or param2 == 1 then
@ -339,14 +341,21 @@ minetest.register_entity(":digilines_lcd:text", {
on_activate = set_texture,
})
local steel_ingot = "default:steel_ingot"
local glass = "default:glass"
local lightstone = "mesecons_lightstone:lightstone_green_off"
if digilines.mcl then
steel_ingot = "mcl_core:iron_ingot"
glass = "mcl_core:glass"
lightstone = "mesecons_lightstone:lightstone_off"
end
minetest.register_craft({
output = "digilines:lcd 2",
recipe = {
{"default:steel_ingot", "digilines:wire_std_00000000", "default:steel_ingot"},
{"mesecons_lightstone:lightstone_green_off",
"mesecons_lightstone:lightstone_green_off",
"mesecons_lightstone:lightstone_green_off"},
{"default:glass","default:glass","default:glass"}
{steel_ingot, "digilines:wire_std_00000000", steel_ingot},
{lightstone, lightstone, lightstone},
{glass, glass, glass}
}
})

@ -39,6 +39,8 @@ minetest.register_node("digilines:lightsensor", {
paramtype = "light",
groups = {dig_immediate=2},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
selection_box = lsensor_selbox,
node_box = lsensor_nodebox,
digilines =
@ -63,10 +65,18 @@ minetest.register_node("digilines:lightsensor", {
end,
})
local steel_ingot = "default:steel_ingot"
local glass = "default:glass"
if digilines.mcl then
steel_ingot = "mcl_core:iron_ingot"
glass = "mcl_core:glass"
end
minetest.register_craft({
output = "digilines:lightsensor",
recipe = {
{"default:glass","default:glass","default:glass"},
{"default:steel_ingot", "digilines:wire_std_00000000", "default:steel_ingot"},
{glass, glass, glass},
{steel_ingot, "digilines:wire_std_00000000", steel_ingot},
}
})

@ -1,6 +1,6 @@
name = digilines
depends = default
optional_depends = tubelib,tubelib2
depends =
optional_depends = mcl_core, mcl_sounds, default, tubelib, tubelib2
description = """
This mod adds digiline wires, an RTC (Real Time Clock), a light sensor as well as an LCD Screen.
Can be used together with the luacontroller from mesecons.

19
rtc.lua

@ -35,6 +35,8 @@ minetest.register_node("digilines:rtc", {
paramtype = "light",
paramtype2 = "facedir",
groups = {dig_immediate=2},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
selection_box = rtc_selbox,
node_box = rtc_nodebox,
digilines =
@ -59,11 +61,24 @@ minetest.register_node("digilines:rtc", {
end,
})
local steel_ingot = "default:steel_ingot"
local mese_crystal = "default:mese_crystal_fragment"
local dye_black = "dye:black"
if digilines.mcl then
steel_ingot = "mcl_core:iron_ingot"
mese_crystal = "mesecons:redstone"
end
if minetest.get_modpath("mcl_dye") then
dye_black = "mcl_dye:black"
end
minetest.register_craft({
output = "digilines:rtc",
recipe = {
{"", "dye:black", ""},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
{"", dye_black, ""},
{steel_ingot, mese_crystal, steel_ingot},
{"", "digilines:wire_std_00000000", ""}
}
})