commit 0a14ab26c1b7528199a4c29dfe5ee21b0909403d Author: jogag Date: Wed Aug 26 17:21:57 2015 +0200 Add mods: digiprinter, digiboard, digilines_weather_sensor, digilines_memory, digilines_crafting, homedecor_plastic diff --git a/digiboard/depends.txt b/digiboard/depends.txt new file mode 100644 index 0000000..2cec86e --- /dev/null +++ b/digiboard/depends.txt @@ -0,0 +1,2 @@ +default +digilines diff --git a/digiboard/init.lua b/digiboard/init.lua new file mode 100644 index 0000000..8137796 --- /dev/null +++ b/digiboard/init.lua @@ -0,0 +1,53 @@ + + +-- Original Digiboard mod by bas080 +-- Cracked by jogag +-- Added features: settable channel, no more minetest.env, settable field caption (via digiline) + +minetest.register_node("digiboard:keyboard", { + description = "Digiboard", + tiles = {"keyboard_top.png", "keyboard_bottom.png", "keyboard_side.png", "keyboard_side.png", "keyboard_side.png", "keyboard_side.png"}, + walkable = true, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-4/8, -4/8, 0, 4/8, -3/8, 4/8}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-4/8, -4/8, 0, 4/8, -3/8, 4/8}, + }, + }, + digiline = { receptor = {}, + effector = { + action = function(pos, node, channel, msg) + local meta = minetest.get_meta(pos) + if channel == meta:get_string("channel") then + meta:set_string("formspec", "field[text;"..msg..";]") + end + end + }, + }, + groups = {choppy = 3, dig_immediate = 2}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;]") + meta:set_string("infotext", "Keyboard") + meta:set_int("lines", 0) + end, + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local channel = meta:get_string("channel") + if fields.channel then + meta:set_string("channel") + meta:set_string("formspec", "field[text;Enter text;]") + elseif fields.text then + digiline:receptor_send(pos, digiline.rules.default, channel, text) + end + end, +}) diff --git a/digiboard/textures/keyboard_bottom.png b/digiboard/textures/keyboard_bottom.png new file mode 100644 index 0000000..47155a5 Binary files /dev/null and b/digiboard/textures/keyboard_bottom.png differ diff --git a/digiboard/textures/keyboard_side.png b/digiboard/textures/keyboard_side.png new file mode 100644 index 0000000..c5183f4 Binary files /dev/null and b/digiboard/textures/keyboard_side.png differ diff --git a/digiboard/textures/keyboard_top.png b/digiboard/textures/keyboard_top.png new file mode 100644 index 0000000..3e20f9c Binary files /dev/null and b/digiboard/textures/keyboard_top.png differ diff --git a/digilines_crafting/init.lua b/digilines_crafting/init.lua new file mode 100644 index 0000000..ff4c371 --- /dev/null +++ b/digilines_crafting/init.lua @@ -0,0 +1,64 @@ + +-- Created by jogag +-- Part of the Digiline Stuff pack +-- Mod: crafting recipes for all devices +-- Also adds recipes for RTC and Lightsensor + +------------------------------ +-- DIGILINE BUILTIN DEVICES -- +------------------------------ + +-- RTC +minetest.register_craft({ + output = "digilines_rtc:rtc 2", + recipe = { + { "default:steel_ingot" }, + { "mesecons_materials:silicon" }, + { "digilines:wire_std_00000000" }, + }, +}) + +-- Light sensor +minetest.register_craft({ + output = "digilines_lightsensor:lightsensor 2", + recipe = { + { "homedecor:plastic", "default:glass" }, + { "", "mesecons_materials:silicon" }, + { "", "digilines:wire_std_00000000" }, + }, +}) + +------------------------- +-- DIGILINE STUFF PACK -- +------------------------- + +-- Memory chip (16 spaces) +minetest.register_craft({ + output = "digilines_memory:memory_1", + recipe = { + { "mesecons_materials:silicon", "mesecons_materials:silicon", "mesecons_materials:silicon" }, + { "group:mesecon_conductor_craftable", "default:mese_crystal_fragment", "group:mesecon_conductor_craftable" }, + { "mesecons_materials:fiber", "digilines:wire_std_00000000", "mesecons_materials:fiber" }, + }, +}) + +-- Weather sensor +minetest.register_craft({ + output = "digilines_weather_sensor:sensor 2", + recipe = { + { "default:stick" }, + { "mesecons_materials:silicon" }, + { "digilines:wire_std_00000000" }, + }, +}) + +-- Digiprinter +minetest.register_craft({ + output = "digiprinter:printer", + recipe = { + { "homedecor:plastic_sheeting", "", "" }, + { "digilines:wire_std_00000000", "default:mese_crystal", "homedecor:plastic_sheeting" }, + { "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }, + }, +}) + diff --git a/digilines_memory/depends.txt b/digilines_memory/depends.txt new file mode 100644 index 0000000..da1d119 --- /dev/null +++ b/digilines_memory/depends.txt @@ -0,0 +1 @@ +digilines diff --git a/digilines_memory/init.lua b/digilines_memory/init.lua new file mode 100644 index 0000000..6e545bb --- /dev/null +++ b/digilines_memory/init.lua @@ -0,0 +1,104 @@ + +-- Created by jogag +-- Part of the Digiline Stuff pack +-- Mod: digiline memory chip +-- A memory chip you can use to store several strings +-- "SET
" to write +-- "GET
" to read +-- "ERASE" to delete all!!! xD + +local GET_CMD = "GET" +local SET_CMD = "SET" +local DEL_CMD = "ERASE" + +local OK_MSG = "OK" + +-- list with the various chip sizes +-- (put two equal chips in crafting grid to upgrade) +local MEMORY_CHIPS = { 16, 32, 64, 128, 256, 512, 1024 } + +-- all taken from digiline RTC mod +local chip_nodebox = +{ + type = "fixed", + fixed = { + { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab + + { -7/16, -7/16, -7/16, 7/16, -5/16, 7/16 }, + } +} + +local chip_selbox = +{ + type = "fixed", + fixed = {{ -8/16, -8/16, -8/16, 8/16, -3/16, 8/16 }} +} + +local get_chip_size = function(pos) + return MEMORY_CHIPS[tonumber(minetest.get_node(pos).name:split("_")[3])] +end + +local on_digiline_receive = function(pos, node, channel, msg) + local meta = minetest.get_meta(pos) + local data = minetest.deserialize(meta:get_string("data")) + -- ^^ xDDDDD + if channel == meta:get_string("channel") then + if msg == DEL_CMD then + meta:set_string("data", "return {}") + digiline:receptor_send(pos, digilines.rules.default, channel, OK_MSG) + return + end + + if msg:split(" ")[2] == nil then return end -- no arguments :/ + + cmd = msg:split(" ")[2] + addr = tonumber(msg:split(" ")[2]) + if addr == nil or addr < 1 or addr > get_chip_size(pos) then return end -- invalid address + + if cmd == GET_CMD then digiline:receptor_send(pos, digiline.rules.default, channel, data[addr]) + elseif cmd == SET_CMD and msg:split(" ")[3] ~= nil then + data[addr] = msg:sub(cmd:len() + tostring(addr):len() + 2, -1) -- its too complicated... + meta:set_string("data", minetest.serialize(data)) + digiline:receptor_send(pos, digilines.rules.default, channel, OK_MSG) + end + end +end + +for i, s in ipairs(MEMORY_CHIPS) do + minetest.register_node("digilines_memory:memory_"..i, { + description = "Digiline Memory Chip ("..s.." addresses)", + drawtype = "nodebox", + tiles = {"digilines_memory.png"}, + + paramtype = "light", + paramtype2 = "facedir", + groups = {dig_immediate=2}, + selection_box = chip_selbox, + node_box = chip_nodebox, + digiline = { + receptor = {}, + effector = { action = on_digiline_receive }, + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + meta:set_string("infotext", "Memory Chip ("..get_chip_size(pos).." addresses)") + meta:set_string("channel", "") + meta:set_string("data", "return {}") -- xD + end, + on_receive_fields = function(pos, formname, fields, sender) + if fields.channel then minetest.get_meta(pos):set_string("channel", fields.channel) end + end, + }) + + if i ~= 1 then + minetest.register_craft({ + type = "shapeless", + output = "digilines_memory:memory_"..i, + recipe = { + "digilines_memory:memory_"..(i - 1), + "digilines_memory:memory_"..(i - 1), + }, + }) + end +end diff --git a/digilines_memory/textures/digilines_memory.png b/digilines_memory/textures/digilines_memory.png new file mode 100644 index 0000000..2aa9c3e Binary files /dev/null and b/digilines_memory/textures/digilines_memory.png differ diff --git a/digilines_weather_sensor/depends.txt b/digilines_weather_sensor/depends.txt new file mode 100644 index 0000000..40769d5 --- /dev/null +++ b/digilines_weather_sensor/depends.txt @@ -0,0 +1,2 @@ +digilines +weather diff --git a/digilines_weather_sensor/init.lua b/digilines_weather_sensor/init.lua new file mode 100644 index 0000000..6aa6971 --- /dev/null +++ b/digilines_weather_sensor/init.lua @@ -0,0 +1,64 @@ + +-- Created by jogag +-- Part of the Digiline Stuff pack +-- Mod: digiline rain sensor +-- Compatible with Weather mod and my own Weather+ mod +-- Send "GET" to obtain the current weather (none, rain, snow, error) +-- If you get "error" is because the weather mod is not installed + +local GET_CMD = "GET" + +local ERR_MSG = "none" + +-- all taken from digiline lightsensor mod +local wsensor_nodebox = +{ + type = "fixed", + fixed = { + { -8/16, -8/16, -8/16, 8/16, -7/16, 8/16 }, -- bottom slab + + { -7/16, -7/16, -7/16, -4/16, -5/16, 7/16 }, -- bonds + { 4/16, -7/16, -7/16, 7/16, -5/16, 7/16 }, + { -7/16, -7/16, -7/16, 7/16, -5/16, -4/16 }, + { -7/16, -7/16, 4/16, 7/16, -5/16, 7/16 }, + + { -1/16, -7/16, -1/16, 1/16, -5/16, 1/16 }, -- pin thing in the middle + } +} + +local wsensor_selbox = +{ + type = "fixed", + fixed = {{ -8/16, -8/16, -8/16, 8/16, -3/16, 8/16 }} +} + +local on_digiline_receive = function (pos, node, channel, msg) + local setchan = minetest.get_meta(pos):get_string("channel") + if channel == setchan and msg == GET_CMD then + local value = weather and tostring(weather) or ERR_MSG + digiline:receptor_send(pos, digiline.rules.default, channel, value) + end +end + +minetest.register_node("digilines_weather_sensor:sensor", { + description = "Digiline Rain Sensor", + drawtype = "nodebox", + tiles = {"digilines_weather_sensor.png"}, + + paramtype = "light", + groups = {dig_immediate=2}, + selection_box = wsensor_selbox, + node_box = wsensor_nodebox, + digiline = { + receptor = {}, + effector = { action = on_digiline_receive }, + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[channel;Channel;${channel}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + if fields.channel then minetest.get_meta(pos):set_string("channel", fields.channel) end + end, +}) + diff --git a/digilines_weather_sensor/textures/digilines_weather_sensor.png b/digilines_weather_sensor/textures/digilines_weather_sensor.png new file mode 100644 index 0000000..0f0f0af Binary files /dev/null and b/digilines_weather_sensor/textures/digilines_weather_sensor.png differ diff --git a/digiprinter/depends.txt b/digiprinter/depends.txt new file mode 100644 index 0000000..d3d64c2 --- /dev/null +++ b/digiprinter/depends.txt @@ -0,0 +1,2 @@ +digilines +memorandum diff --git a/digiprinter/init.lua b/digiprinter/init.lua new file mode 100644 index 0000000..64423ef --- /dev/null +++ b/digiprinter/init.lua @@ -0,0 +1,154 @@ + +-- Created by jogag +-- Part of the Digiline Stuff pack +-- Mod: Digiprinter - a digiline-controlled printer +-- It prints paper via the Writable Paper (memorandum) mod +-- then it sends "OK" or "ERR_PAPER" or "ERR_SPACE" + +local OK_MSG = "OK" +local NO_PAPER_MSG = "ERR_PAPER" +local NO_SPACE_MSG = "ERR_SPACE" + +local PRINT_DELAY = 3 + +-- taken from pipeworks mod +local function facedir_to_dir(facedir) + --a table of possible dirs + return ({{x=0, y=0, z=1}, + {x=1, y=0, z=0}, + {x=0, y=0, z=-1}, + {x=-1, y=0, z=0}, + {x=0, y=-1, z=0}, + {x=0, y=1, z=0}}) + + --indexed into by a table of correlating facedirs + [({[0]=1, 2, 3, 4, + 5, 2, 6, 4, + 6, 2, 5, 4, + 1, 5, 3, 6, + 1, 6, 3, 5, + 1, 4, 3, 2}) + + --indexed into by the facedir in question + [facedir]] +end + +local print_paper = function(pos, node, msg) + local inv = minetest.get_meta(pos):get_inventory() + + local vel = facedir_to_dir(node.param2) + local front = { x = pos.x - vel.x, y = pos.y - vel.y, z = pos.z - vel.z } + if minetest.get_node(front).name ~= "air" then + -- search for the next block + vel = { x = vel.x * 2, y = vel.y * 2, z = vel.z * 2 } + front = { x = pos.x - vel.x, y = pos.y - vel.y, z = pos.z - vel.z } + end + + if inv:is_empty("paper") then digiline:receptor_send(pos, digiline.rules.default, channel, NO_PAPER_MSG) + elseif minetest.get_node(front).name ~= "air" then digiline:receptor_send(pos, digiline.rules.default, channel, NO_SPACE_MSG) + else + local paper = inv:get_stack("paper", 1) + paper:take_item() + inv:set_stack("paper", 1, paper) + + minetest.add_node(front, { + name = (msg == "" and "memorandum:letter_empty" or "memorandum:letter_written"), + param2 = node.param2 + }) + + local meta = minetest.get_meta(front) + meta:set_string("text", msg) + meta:set_string("signed", "Digiprinter") + meta:set_string("infotext", 'On this piece of paper is written: "'..msg..'" Printed with Digiprinter') -- xD + + digiline:receptor_send(pos, digiline.rules.default, channel, OK_MSG) + end + minetest.get_meta(pos):set_string("infotext", "Digiline Printer Idle") +end + +local on_digiline_receive = function(pos, node, channel, msg) + local meta = minetest.get_meta(pos) + if channel == meta:get_string("channel") and not meta:get_string("infotext"):find("Busy") then + meta:set_string("infotext", "Digiline Printer Busy") + minetest.after(PRINT_DELAY, print_paper, pos, node, msg) + end +end + +-- taken from computer mod xD +minetest.register_node("digiprinter:printer", { + description = "Digiline Printer", + inventory_image = "computer_printer_inv.png", + tiles = {"digiprinter_t.png","digiprinter_bt.png","digiprinter_l.png", + "digiprinter_r.png","digiprinter_b.png","digiprinter_f.png"}, + paramtype = "light", + paramtype2 = "facedir", + walkable = true, + groups = {snappy=3}, + sound = default.node_sound_wood_defaults(), + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.4375, -0.3125, -0.125, 0.4375, -0.0625, 0.375}, + {-0.4375, -0.5, -0.125, 0.4375, -0.4375, 0.375}, + {-0.4375, -0.5, -0.125, -0.25, -0.0625, 0.375}, + {0.25, -0.5, -0.125, 0.4375, -0.0625, 0.375}, + {-0.4375, -0.5, -0.0625, 0.4375, -0.0625, 0.375}, + {-0.375, -0.4375, 0.25, 0.375, -0.0625, 0.4375}, + {-0.25, -0.25, 0.4375, 0.25, 0.0625, 0.5}, + {-0.25, -0.481132, -0.3125, 0.25, -0.4375, 0} + }, + }, + digiline = { + receptor = {}, + effector = { + action = on_digiline_receive + }, + }, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("channel", "") + meta:set_string("infotext", "Digiline Printer Idle") + 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 "").. + "label[0,0;Digiline Printer]".. + "label[3.5,2;Paper]".. + "list[current_name;paper;3.5,2.5;1,1;]".. + "field[2,3.5;5,5;channel;Channel;${channel}]".. + ((default and default.get_hotbar_bg) and default.get_hotbar_bg(0,6) or "").. + "list[current_player;main;0,6;8,4;]") + local inv = meta:get_inventory() + inv:set_size("paper", 1) + end, + on_receive_fields = function(pos, formname, fields, sender) + if fields.channel then minetest.get_meta(pos):set_string("channel", fields.channel) end + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then return 0 end + return (stack:get_name() == "default:paper" and stack:get_count() or 0) + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + return (minetest.get_meta(pos):get_string("infotext"):find("Busy") and stack:get_count() or 0) + end, + can_dig = function(pos, player) + return minetest.get_meta(pos):get_inventory():is_empty("paper") + end, +}) + +-- printer crafting: +-- +-------+ +-- | ? P ? | +-- | ? M ? | +-- | ? D ? | +-- +-------+ +minetest.register_craft({ + output = "digiprinter:printer", + recipe = { + { "homedecor", "default:paper", "" }, + { "", "default:mese_crystal", "" }, + { "", "digilines:wire_std_000000", "" }, + }, +}) + diff --git a/digiprinter/textures/digiprinter_b.png b/digiprinter/textures/digiprinter_b.png new file mode 100644 index 0000000..a3bc6b1 Binary files /dev/null and b/digiprinter/textures/digiprinter_b.png differ diff --git a/digiprinter/textures/digiprinter_bt.png b/digiprinter/textures/digiprinter_bt.png new file mode 100644 index 0000000..6e03ece Binary files /dev/null and b/digiprinter/textures/digiprinter_bt.png differ diff --git a/digiprinter/textures/digiprinter_f.png b/digiprinter/textures/digiprinter_f.png new file mode 100644 index 0000000..f8abf3e Binary files /dev/null and b/digiprinter/textures/digiprinter_f.png differ diff --git a/digiprinter/textures/digiprinter_inv.png b/digiprinter/textures/digiprinter_inv.png new file mode 100644 index 0000000..064d996 Binary files /dev/null and b/digiprinter/textures/digiprinter_inv.png differ diff --git a/digiprinter/textures/digiprinter_l.png b/digiprinter/textures/digiprinter_l.png new file mode 100644 index 0000000..94be11e Binary files /dev/null and b/digiprinter/textures/digiprinter_l.png differ diff --git a/digiprinter/textures/digiprinter_r.png b/digiprinter/textures/digiprinter_r.png new file mode 100644 index 0000000..bd25496 Binary files /dev/null and b/digiprinter/textures/digiprinter_r.png differ diff --git a/digiprinter/textures/digiprinter_t.png b/digiprinter/textures/digiprinter_t.png new file mode 100644 index 0000000..5fe4174 Binary files /dev/null and b/digiprinter/textures/digiprinter_t.png differ diff --git a/homedecor_plastic/init.lua b/homedecor_plastic/init.lua new file mode 100644 index 0000000..8071072 --- /dev/null +++ b/homedecor_plastic/init.lua @@ -0,0 +1,79 @@ + +-- Created by jogag +-- Part of the Digiline Stuff pack +-- Mod: Plastic from homedecor, if homedecor is not installed :) +-- + Also checks for pipeworks! + +-- Texture license: from VanessaE, WTFPL + +if not minetest.get_modpath("homedecor") and not minetest.get_modpath("pipeworks") then + + minetest.register_craftitem(":homedecor:oil_extract", { + description = "Oil extract", + inventory_image = "homedecor_oil_extract.png", + }) + + minetest.register_craftitem(":homedecor:paraffin", { + description = "Unprocessed paraffin", + inventory_image = "homedecor_paraffin.png", + }) + + minetest.register_alias("homedecor:plastic_base", "homedecor:paraffin") + + minetest.register_craftitem(":homedecor:plastic_sheeting", { + description = "Plastic sheet", + inventory_image = "homedecor_plastic_sheeting.png", + }) + + minetest.register_craft({ + type = "shapeless", + output = "homedecor:oil_extract 6", + recipe = { "default:junglegrass", + "default:junglegrass", + "default:junglegrass" + } + }) + + minetest.register_craft({ + type = "shapeless", + output = "homedecor:oil_extract 3", + recipe = { "default:dry_shrub", + "default:dry_shrub", + "default:dry_shrub" + }, + }) + + minetest.register_craft({ + type = "shapeless", + output = "homedecor:oil_extract 4", + recipe = { "default:leaves", + "default:leaves", + "default:leaves", + "default:leaves", + "default:leaves", + "default:leaves" + } + }) + + minetest.register_craft({ + type = "cooking", + output = "homedecor:paraffin", + recipe = "homedecor:oil_extract", + }) + + minetest.register_craft({ + type = "fuel", + recipe = "homedecor:paraffin", + burntime = 30, + }) + + minetest.register_craft({ + type = "fuel", + recipe = "homedecor:plastic_sheeting", + burntime = 30, + }) + + minetest.register_alias("pipeworks:oil_extract", "homedecor:oil_extract") + minetest.register_alias("pipeworks:paraffin", "homedecor:paraffin") + minetest.register_alias("pipeworks:plastic_sheeting", "homedecor:plastic_sheeting") +end diff --git a/homedecor_plastic/textures/homedecor_oil_extract.png b/homedecor_plastic/textures/homedecor_oil_extract.png new file mode 100644 index 0000000..e34623d Binary files /dev/null and b/homedecor_plastic/textures/homedecor_oil_extract.png differ diff --git a/homedecor_plastic/textures/homedecor_paraffin.png b/homedecor_plastic/textures/homedecor_paraffin.png new file mode 100644 index 0000000..77d2bbd Binary files /dev/null and b/homedecor_plastic/textures/homedecor_paraffin.png differ diff --git a/homedecor_plastic/textures/homedecor_plastic_sheeting.png b/homedecor_plastic/textures/homedecor_plastic_sheeting.png new file mode 100644 index 0000000..034dcc2 Binary files /dev/null and b/homedecor_plastic/textures/homedecor_plastic_sheeting.png differ