From 7ecb29e87f1f272f92d0fec871dd525a80a9537c Mon Sep 17 00:00:00 2001
From: Auke Kok <sofar+github@foo-projects.org>
Date: Fri, 27 May 2016 16:08:53 -0700
Subject: Convert digilines to a mod (not modpack). (#32)

Digilines is probably used by most people in its entirety.

I've retained the ability to disable inventory, rtc, lightsensor and
LCD by the minetest settings "diglines_enable_rtc" etc.. If set to
"false", these components will not be loaded. It is assumed by default
that these are enabled.

In the conversion the digilines_lcd:lcd node was renamed to
digilines:lcd (same for all the other nodes). To retain backwards
compatibility I've provided aliases for each of these nodes.
---
 init.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 init.lua

(limited to 'init.lua')

diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..2f48a73
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,44 @@
+digiline = {}
+
+local modpath = minetest.get_modpath("digilines")
+dofile(modpath .. "/presetrules.lua")
+dofile(modpath .. "/util.lua")
+dofile(modpath .. "/internal.lua")
+dofile(modpath .. "/wires_common.lua")
+dofile(modpath .. "/wire_std.lua")
+
+function digiline:receptor_send(pos, rules, channel, msg)
+	local checked = {}
+	checked[tostring(pos.x).."_"..tostring(pos.y).."_"..tostring(pos.z)] = true -- exclude itself
+	for _,rule in ipairs(rules) do
+		if digiline:rules_link(pos, digiline:addPosRule(pos, rule)) then
+			digiline:transmit(digiline:addPosRule(pos, rule), channel, msg, checked)
+		end
+	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'},
+	}
+})
+
+-- former submods
+if minetest.is_yes(minetest.setting_get("digilines_enable_inventory") or true) then
+	dofile(modpath .. "/inventory.lua")
+end
+
+if minetest.is_yes(minetest.setting_get("digilines_enable_lcd") or true) then
+	dofile(modpath .. "/lcd.lua")
+end
+
+if minetest.is_yes(minetest.setting_get("digilines_enable_lightsensor") or true) then
+	dofile(modpath .. "/lightsensor.lua")
+end
+
+if minetest.is_yes(minetest.setting_get("digilines_enable_rtc") or true) then
+	dofile(modpath .. "/rtc.lua")
+end
-- 
cgit v1.2.3