diff options
author | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-12-01 09:06:00 -0500 |
---|---|---|
committer | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-12-01 09:06:00 -0500 |
commit | 856b86858ebfa4af2c352b022188f82dcff7ed92 (patch) | |
tree | 867b0323f38e6b582b3fa3e4e1e896607493d5b1 | |
parent | 2d8ff9f889450fb5c36016276997544aae98a350 (diff) | |
download | dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar.gz dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar.bz2 dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.tar.xz dreambuilder_modpack-856b86858ebfa4af2c352b022188f82dcff7ed92.zip |
update basic_materials, biome_lib, technic, digilines, digistuff,
gloopblocks, homedecor, moreblocks, pipeworks, prefab_redo
-rw-r--r-- | basic_materials/electrical-electronic.lua | 3 | ||||
-rw-r--r-- | basic_materials/metals.lua | 3 | ||||
-rw-r--r-- | biome_lib/init.lua | 8 | ||||
-rw-r--r-- | concrete/depends.txt | 2 | ||||
-rw-r--r-- | concrete/init.lua | 14 | ||||
-rw-r--r-- | digilines/lcd.lua | 94 | ||||
-rw-r--r-- | digistuff/button.lua | 160 | ||||
-rw-r--r-- | digistuff/camera.lua | 98 | ||||
-rw-r--r-- | digistuff/conductors.lua | 62 | ||||
-rw-r--r-- | digistuff/depends.txt | 1 | ||||
-rw-r--r-- | digistuff/detector.lua | 63 | ||||
-rw-r--r-- | digistuff/init.lua | 1123 | ||||
-rw-r--r-- | digistuff/light.lua | 71 | ||||
-rw-r--r-- | digistuff/nic.lua | 69 | ||||
-rw-r--r-- | digistuff/noteblock.lua | 64 | ||||
-rw-r--r-- | digistuff/panel.lua | 151 | ||||
-rw-r--r-- | digistuff/piezo.lua | 80 | ||||
-rw-r--r-- | digistuff/piston.lua | 222 | ||||
-rw-r--r-- | digistuff/sounds/digistuff_piston_extend.ogg | bin | 0 -> 6301 bytes | |||
-rw-r--r-- | digistuff/sounds/digistuff_piston_retract.ogg | bin | 0 -> 6214 bytes | |||
-rw-r--r-- | digistuff/textures/digistuff_piston_sides.png | bin | 0 -> 5179 bytes | |||
-rw-r--r-- | digistuff/touchscreen.lua | 279 | ||||
-rw-r--r-- | extranodes/init.lua | 57 | ||||
-rw-r--r-- | gloopblocks/init.lua | 8 | ||||
-rw-r--r-- | homedecor/crafts.lua | 14 | ||||
-rw-r--r-- | moreblocks/CHANGELOG.md | 13 | ||||
-rw-r--r-- | moreblocks/LICENSE.md | 2 | ||||
-rw-r--r-- | moreblocks/README.md | 2 | ||||
-rw-r--r-- | moreblocks/aliases.lua | 2 | ||||
-rw-r--r-- | moreblocks/circular_saw.lua | 2 | ||||
-rw-r--r-- | moreblocks/config.lua | 2 | ||||
-rw-r--r-- | moreblocks/crafting.lua | 2 | ||||
-rw-r--r-- | moreblocks/depends.txt | 1 | ||||
-rw-r--r-- | moreblocks/init.lua | 2 | ||||
-rw-r--r-- | moreblocks/nodes.lua | 2 | ||||
-rw-r--r-- | moreblocks/ownership.lua | 2 | ||||
-rw-r--r-- | moreblocks/redefinitions.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/aliases.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/conversion.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/init.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/microblocks.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/panels.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/recipes.lua | 4 | ||||
-rw-r--r-- | moreblocks/stairsplus/registrations.lua | 32 | ||||
-rw-r--r-- | moreblocks/stairsplus/slabs.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/slopes.lua | 2 | ||||
-rw-r--r-- | moreblocks/stairsplus/stairs.lua | 2 | ||||
-rw-r--r-- | pipeworks/autoplace_tubes.lua | 2 | ||||
-rw-r--r-- | prefab_redo/depends.txt | 1 | ||||
-rw-r--r-- | prefab_redo/init.lua | 22 | ||||
-rw-r--r-- | technic/crafts.lua | 6 | ||||
-rw-r--r-- | technic/locale/de.txt | 36 | ||||
-rw-r--r-- | technic/locale/es.txt | 35 | ||||
-rw-r--r-- | technic/locale/it.txt | 36 | ||||
-rw-r--r-- | technic/locale/template.txt | 35 | ||||
-rw-r--r-- | technic/machines/LV/cnc_nodes.lua | 91 | ||||
-rw-r--r-- | technic/machines/LV/init.lua | 5 | ||||
-rw-r--r-- | technic/machines/register/cables.lua | 22 | ||||
-rw-r--r-- | technic_cnc/cnc.lua (renamed from technic/machines/LV/cnc.lua) | 158 | ||||
-rw-r--r-- | technic_cnc/cnc_api.lua (renamed from technic/machines/LV/cnc_api.lua) | 110 | ||||
-rw-r--r-- | technic_cnc/cnc_materials.lua | 131 | ||||
-rw-r--r-- | technic_cnc/depends.txt | 3 | ||||
-rw-r--r-- | technic_cnc/init.lua | 18 | ||||
-rw-r--r-- | technic_cnc/locale/de.txt | 36 | ||||
-rw-r--r-- | technic_cnc/locale/es.txt | 35 | ||||
-rw-r--r-- | technic_cnc/locale/it.txt | 36 | ||||
-rw-r--r-- | technic_cnc/locale/template.txt | 36 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_cylinder.obj (renamed from technic/models/technic_cylinder.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_cylinder_horizontal.obj (renamed from technic/models/technic_cylinder_horizontal.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_innercorner.obj (renamed from technic/models/technic_innercorner.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_innercorner_upsdown.obj (renamed from technic/models/technic_innercorner_upsdown.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_oblate_spheroid.obj (renamed from technic/models/technic_oblate_spheroid.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_one_curved_edge.obj (renamed from technic/models/technic_one_curved_edge.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_outercorner.obj (renamed from technic/models/technic_outercorner.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_outercorner_upsdown.obj (renamed from technic/models/technic_outercorner_upsdown.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_pyramid.obj (renamed from technic/models/technic_pyramid.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_pyramid_spike.obj (renamed from technic/models/technic_pyramid_spike.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_slope.obj (renamed from technic/models/technic_slope.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_slope_horizontal.obj (renamed from technic/models/technic_slope_horizontal.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_slope_upsdown.obj (renamed from technic/models/technic_slope_upsdown.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_sphere.obj (renamed from technic/models/technic_sphere.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/models/technic_cnc_two_curved_edge.obj (renamed from technic/models/technic_two_curved_edge.obj) | 0 | ||||
-rw-r--r-- | technic_cnc/textures/technic_cnc_bottom.png (renamed from technic/textures/technic_cnc_bottom.png) | bin | 2006 -> 2006 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_cylinder.png (renamed from technic/textures/technic_cnc_cylinder.png) | bin | 6047 -> 6047 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_cylinder_horizontal.png (renamed from technic/textures/technic_cnc_cylinder_horizontal.png) | bin | 7130 -> 7130 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_element_cross.png (renamed from technic/textures/technic_cnc_element_cross.png) | bin | 4592 -> 4592 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_element_edge.png (renamed from technic/textures/technic_cnc_element_edge.png) | bin | 3898 -> 3898 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_element_end.png (renamed from technic/textures/technic_cnc_element_end.png) | bin | 3563 -> 3563 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_element_straight.png (renamed from technic/textures/technic_cnc_element_straight.png) | bin | 4027 -> 4027 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_element_t.png (renamed from technic/textures/technic_cnc_element_t.png) | bin | 4369 -> 4369 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_front.png (renamed from technic/textures/technic_cnc_front.png) | bin | 2000 -> 2000 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_front_active.png (renamed from technic/textures/technic_cnc_front_active.png) | bin | 2216 -> 2216 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_full.png (renamed from technic/textures/technic_cnc_full.png) | bin | 997 -> 997 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_half.png (renamed from technic/textures/technic_cnc_half.png) | bin | 1564 -> 1564 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_milling_background.png (renamed from technic/textures/technic_cnc_milling_background.png) | bin | 78748 -> 78748 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_oblate_spheroid.png (renamed from technic/textures/technic_cnc_oblate_spheroid.png) | bin | 8915 -> 8915 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_onecurvededge.png (renamed from technic/textures/technic_cnc_onecurvededge.png) | bin | 8170 -> 8170 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_pyramid.png (renamed from technic/textures/technic_cnc_pyramid.png) | bin | 4790 -> 4790 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_side.png (renamed from technic/textures/technic_cnc_side.png) | bin | 1922 -> 1922 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_slope.png (renamed from technic/textures/technic_cnc_slope.png) | bin | 6081 -> 6081 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_slope_edge.png (renamed from technic/textures/technic_cnc_slope_edge.png) | bin | 5900 -> 5900 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_slope_edge_upsdwn.png (renamed from technic/textures/technic_cnc_slope_edge_upsdwn.png) | bin | 4831 -> 4831 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_slope_inner_edge.png (renamed from technic/textures/technic_cnc_slope_inner_edge.png) | bin | 7412 -> 7412 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_slope_inner_edge_upsdwn.png (renamed from technic/textures/technic_cnc_slope_inner_edge_upsdwn.png) | bin | 7404 -> 7404 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_slope_lying.png (renamed from technic/textures/technic_cnc_slope_lying.png) | bin | 6815 -> 6815 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_slope_upsdwn.png (renamed from technic/textures/technic_cnc_slope_upsdwn.png) | bin | 5814 -> 5814 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_sphere.png (renamed from technic/textures/technic_cnc_sphere.png) | bin | 5777 -> 5777 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_spike.png (renamed from technic/textures/technic_cnc_spike.png) | bin | 6392 -> 6392 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_stick.png (renamed from technic/textures/technic_cnc_stick.png) | bin | 2305 -> 2305 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_top.png (renamed from technic/textures/technic_cnc_top.png) | bin | 2137 -> 2137 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_top_active.png (renamed from technic/textures/technic_cnc_top_active.png) | bin | 2214 -> 2214 bytes | |||
-rw-r--r-- | technic_cnc/textures/technic_cnc_twocurvededge.png (renamed from technic/textures/technic_cnc_twocurvededge.png) | bin | 7119 -> 7119 bytes |
112 files changed, 2008 insertions, 1578 deletions
diff --git a/basic_materials/electrical-electronic.lua b/basic_materials/electrical-electronic.lua index 96eb142..065b921 100644 --- a/basic_materials/electrical-electronic.lua +++ b/basic_materials/electrical-electronic.lua @@ -72,7 +72,8 @@ minetest.register_craft({ minetest.register_alias("homedecor:ic", "basic_materials:ic") minetest.register_alias("homedecor:motor", "basic_materials:motor") +minetest.register_alias("technic:motor", "basic_materials:motor") minetest.register_alias("homedecor:heating_element", "basic_materials:heating_element") -minetest.register_alias("homedecor:power_crystal", "basic_materials:energy_crystal_simple") +minetest.register_alias("homedecor:power_crystal", "basic_materials:energy_crystal_simple") minetest.register_alias_force("mesecons_materials:silicon", "basic_materials:silicon") diff --git a/basic_materials/metals.lua b/basic_materials/metals.lua index 7a02d21..e4af694 100644 --- a/basic_materials/metals.lua +++ b/basic_materials/metals.lua @@ -262,7 +262,7 @@ minetest.register_craft( { minetest.register_alias("homedecor:copper_wire", "basic_materials:copper_wire") minetest.register_alias("technic:fine_copper_wire", "basic_materials:copper_wire") minetest.register_alias("technic:fine_silver_wire", "basic_materials:silver_wire") -minetest.register_alias("technic:fine_gold_wire", "basic_materialsgold_wire") +minetest.register_alias("technic:fine_gold_wire", "basic_materials:gold_wire") minetest.register_alias("homedecor:steel_wire", "basic_materials:steel_wire") @@ -282,3 +282,4 @@ minetest.register_alias("chains:chain_brass", "basic_materials:chai minetest.register_alias("pipeworks:gear", "basic_materials:gear_steel") minetest.register_alias("technic:rebar", "basic_materials:steel_bar") + diff --git a/biome_lib/init.lua b/biome_lib/init.lua index f8b05d2..818011f 100644 --- a/biome_lib/init.lua +++ b/biome_lib/init.lua @@ -34,8 +34,12 @@ biome_lib.queue_run_ratio = tonumber(minetest.settings:get("biome_lib_queue_run_ -- Boilerplate to support localized strings if intllib mod is installed. local S -if minetest.get_modpath("intllib") then - S = intllib.Getter() +if minetest.global_exists("intllib") then + if intllib.make_gettext_pair then + S = intllib.make_gettext_pair() + else + S = intllib.Getter() + end else S = function(s) return s end end diff --git a/concrete/depends.txt b/concrete/depends.txt index 269e83a..5ca909c 100644 --- a/concrete/depends.txt +++ b/concrete/depends.txt @@ -1,4 +1,4 @@ default basic_materials intllib? - +moreblocks? diff --git a/concrete/init.lua b/concrete/init.lua index 1da6a51..d309613 100644 --- a/concrete/init.lua +++ b/concrete/init.lua @@ -61,6 +61,20 @@ minetest.register_node(":technic:blast_resistant_concrete", { end, }) +if minetest.get_modpath("moreblocks") then + stairsplus:register_all("technic","blast_resistant_concrete","technic:blast_resistant_concrete",{ + description = "Blast-resistant Concrete", + tiles = {"technic_blast_resistant_concrete_block.png",}, + groups = {cracky=1, level=3, concrete=1}, + sounds = default.node_sound_stone_defaults(), + on_blast = function(pos, intensity) + if intensity > 1 then + minetest.remove_node(pos) + minetest.add_item(pos, "technic:blast_resistant_concrete") + end + end, + }) +end local box_platform = {-0.5, 0.3, -0.5, 0.5, 0.5, 0.5} local box_post = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15} diff --git a/digilines/lcd.lua b/digilines/lcd.lua index ce17dac..19aa4a4 100644 --- a/digilines/lcd.lua +++ b/digilines/lcd.lua @@ -128,16 +128,49 @@ local clearscreen = function(pos) end end +local set_texture = function(ent) + local meta = minetest.get_meta(ent.object:get_pos()) + local text = meta:get_string("text") + ent.object:set_properties({ + textures = { + generate_texture(create_lines(text)) + } + }) +end + +local get_entity = function(pos) + local lcd_entity + local objects = minetest.get_objects_inside_radius(pos, 0.5) + for _, o in ipairs(objects) do + local o_entity = o:get_luaentity() + if o_entity and o_entity.name == "digilines_lcd:text" then + if not lcd_entity then + lcd_entity = o_entity + else + -- Remove extras, if any + o:remove() + end + end + end + return lcd_entity +end + +local spawn_entity = function(pos) + if not get_entity(pos) then + local lcd_info = lcds[minetest.get_node(pos).param2] + if not lcd_info then + return + end + local text = minetest.add_entity(vector.add(pos, lcd_info.delta), "digilines_lcd:text") + text:set_yaw(lcd_info.yaw or 0) + end +end + local prepare_writing = function(pos) - local lcd_info = lcds[minetest.get_node(pos).param2] - if lcd_info == nil then return end - local text = minetest.add_entity( - {x = pos.x + lcd_info.delta.x, - y = pos.y + lcd_info.delta.y, - z = pos.z + lcd_info.delta.z}, "digilines_lcd:text") - text:setyaw(lcd_info.yaw or 0) - --* text:setpitch(lcd_info.yaw or 0) - return text + local entity = get_entity(pos) + if entity then + set_texture(entity) + end end local on_digiline_receive = function(pos, _, channel, msg) @@ -147,7 +180,7 @@ local on_digiline_receive = function(pos, _, channel, msg) meta:set_string("text", msg) meta:set_string("infotext", msg) - clearscreen(pos) + if msg ~= "" then prepare_writing(pos) end @@ -165,30 +198,28 @@ minetest.register_node("digilines:lcd", { inventory_image = "lcd_lcd.png", wield_image = "lcd_lcd.png", tiles = {"lcd_anyside.png"}, - paramtype = "light", sunlight_propagates = true, + light_source = 6, paramtype2 = "wallmounted", node_box = lcd_box, selection_box = lcd_box, groups = {choppy = 3, dig_immediate = 2}, - - after_place_node = function (pos) + after_place_node = function(pos) local param2 = minetest.get_node(pos).param2 if param2 == 0 or param2 == 1 then minetest.add_node(pos, {name = "digilines:lcd", param2 = 3}) end - prepare_writing (pos) - end, - - on_construct = function(pos) - reset_meta(pos) + spawn_entity(pos) + prepare_writing(pos) end, - - on_destruct = function(pos) - clearscreen(pos) + on_construct = reset_meta, + on_destruct = clearscreen, + on_punch = function(pos, node, puncher, pointed_thing) + if minetest.is_player(puncher) then + spawn_entity(pos) + end end, - on_receive_fields = function(pos, _, fields, sender) local name = sender:get_player_name() if minetest.is_protected(pos, name) and not minetest.check_player_privs(name, {protection_bypass=true}) then @@ -199,28 +230,27 @@ minetest.register_node("digilines:lcd", { minetest.get_meta(pos):set_string("channel", fields.channel) end end, - - digiline = - { + digiline = { receptor = {}, effector = { action = on_digiline_receive }, }, +}) - light_source = 6, +minetest.register_lbm({ + label = "Replace Missing Text Entities", + name = "digilines:replace_text", + nodenames = {"digilines:lcd"}, + run_at_every_load = true, + action = spawn_entity, }) minetest.register_entity(":digilines_lcd:text", { collisionbox = { 0, 0, 0, 0, 0, 0 }, visual = "upright_sprite", textures = {}, - - on_activate = function(self) - local meta = minetest.get_meta(self.object:getpos()) - local text = meta:get_string("text") - self.object:set_properties({textures={generate_texture(create_lines(text))}}) - end + on_activate = set_texture, }) minetest.register_craft({ diff --git a/digistuff/button.lua b/digistuff/button.lua new file mode 100644 index 0000000..76022f6 --- /dev/null +++ b/digistuff/button.lua @@ -0,0 +1,160 @@ +digistuff.button_turnoff = function (pos) + local node = minetest.get_node(pos) + if node.name=="digistuff:button_on" then --has not been dug + minetest.swap_node(pos, {name = "digistuff:button_off", param2=node.param2}) + if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_pop", {pos=pos}) end + end +end + +minetest.register_node("digistuff:button", { + drawtype = "nodebox", + tiles = { + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_off.png" + }, + paramtype = "light", + paramtype2 = "facedir", + legacy_wallmounted = true, + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } + }, + node_box = { + type = "fixed", + fixed = { + { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button + { -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself + } + }, + digiline = + { + receptor = {} + }, + groups = {dig_immediate=2}, + description = "Digilines Button", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;msg;Message;${msg}]button_exit[2.25,3;3,1;submit;Save]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + if fields.channel and fields.msg and fields.channel ~= "" and fields.msg ~= "" then + meta:set_string("channel",fields.channel) + meta:set_string("msg",fields.msg) + meta:set_string("formspec","") + minetest.swap_node(pos, {name = "digistuff:button_off", param2=minetest.get_node(pos).param2}) + else + minetest.chat_send_player(sender:get_player_name(),"Channel and message must both be set!") + end + end, + sounds = default and default.node_sound_stone_defaults(), +}) + +minetest.register_node("digistuff:button_off", { + drawtype = "nodebox", + tiles = { + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_off.png" + }, + paramtype = "light", + paramtype2 = "facedir", + legacy_wallmounted = true, + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } + }, + node_box = { + type = "fixed", + fixed = { + { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button + { -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself + } + }, + digiline = + { + receptor = {} + }, + groups = {dig_immediate=2, not_in_creative_inventory=1}, + drop = "digistuff:button", + description = "Digilines Button (off state - you hacker you!)", + on_rightclick = function (pos, node, clicker) + local meta = minetest.get_meta(pos) + digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg")) + minetest.swap_node(pos, {name = "digistuff:button_on", param2=node.param2}) + if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end + minetest.after(0.5, digistuff.button_turnoff, pos) + end, + sounds = default and default.node_sound_stone_defaults(), +}) + +minetest.register_node("digistuff:button_on", { + drawtype = "nodebox", + tiles = { + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_sides.png", + "digistuff_digibutton_on.png" + }, + paramtype = "light", + paramtype2 = "facedir", + legacy_wallmounted = true, + walkable = false, + light_source = 7, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } + }, + node_box = { + type = "fixed", + fixed = { + { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, + { -4/16, -2/16, 11/32, 4/16, 2/16, 6/16 } + } + }, + digiline = + { + receptor = {} + }, + groups = {dig_immediate=2, not_in_creative_inventory=1}, + drop = 'digistuff:button', + on_rightclick = function (pos, node, clicker) + local meta = minetest.get_meta(pos) + digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg")) + if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end + end, + description = "Digilines Button (on state - you hacker you!)", + sounds = default and default.node_sound_stone_defaults(), +}) + +minetest.register_craft({ + output = "digistuff:digimese", + recipe = { + {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"}, + {"digilines:wire_std_00000000","default:mese","digilines:wire_std_00000000"}, + {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"} + } +}) + +minetest.register_craft({ + output = "digistuff:button", + recipe = { + {"mesecons_button:button_off"}, + {"mesecons_luacontroller:luacontroller0000"}, + {"digilines:wire_std_00000000"} + } +}) diff --git a/digistuff/camera.lua b/digistuff/camera.lua new file mode 100644 index 0000000..3a2a129 --- /dev/null +++ b/digistuff/camera.lua @@ -0,0 +1,98 @@ +minetest.register_node("digistuff:camera", { + tiles = { + "digistuff_camera_top.png", + "digistuff_camera_bottom.png", + "digistuff_camera_right.png", + "digistuff_camera_left.png", + "digistuff_camera_back.png", + "digistuff_camera_front.png", + }, + digiline = + { + receptor = {} + }, + groups = {cracky=2}, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.1,-0.5,-0.28,0.1,-0.3,0.3}, --Camera Body + {-0.045,-0.42,-0.34,0.045,-0.36,-0.28}, -- Lens + {-0.05,-0.9,-0.05,0.05,-0.5,0.05}, --Pole + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.1,-0.5,-0.34,0.1,-0.3,0.3}, --Camera Body + } + }, + description = "Digilines Camera", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","size[8,6;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;radius;Radius (max 10);${radius}]field[1,3;6,2;distance;Distance (max 20);${distance}]button_exit[2.25,4;3,1;submit;Save]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + if fields.distance and tonumber(fields.distance) then meta:set_int("distance",math.max(math.min(20,fields.distance),0)) end + if fields.radius and tonumber(fields.radius) then meta:set_int("radius",math.max(math.min(10,fields.radius),1)) end + end, + sounds = default and default.node_sound_stone_defaults() +}) + +minetest.register_abm({ + nodenames = {"digistuff:camera"}, + interval = 1.0, + chance = 1, + action = function(pos,node) + local meta = minetest.get_meta(pos) + local channel = meta:get_string("channel") + local radius = meta:get_int("radius") + local distance = meta:get_int("distance") + local dir = vector.multiply(minetest.facedir_to_dir(node.param2),-1) + local spot = vector.add(pos,vector.multiply(dir,distance)) + local i = 0 + while i <= 10 and minetest.get_node(spot).name == "air" do + --Downward search for ground level + spot = vector.add(spot,vector.new(0,-1,0)) + i = i + 1 + end + if minetest.get_node(spot).name == "air" or minetest.get_node(spot).name == "ignore" then + --Ground not in range + return + end + + local found_any = false + local players_found = {} + local objs = minetest.get_objects_inside_radius(spot,radius) + if objs then + local _,obj + for _,obj in ipairs(objs) do + if obj:is_player() then + table.insert(players_found,obj:get_player_name()) + found_any = true + end + end + if found_any then + digiline:receptor_send({x=pos.x,y=pos.y-1,z=pos.z}, digiline.rules.default, channel, players_found) + end + end + end +}) + +minetest.register_craft({ + output = "digistuff:camera", + recipe = { + {"homedecor:plastic_sheeting","homedecor:plastic_sheeting","homedecor:plastic_sheeting"}, + {"default:glass","homedecor:ic","mesecons_luacontroller:luacontroller0000"}, + {"homedecor:plastic_sheeting","homedecor:plastic_sheeting","homedecor:plastic_sheeting"}, + } +}) diff --git a/digistuff/conductors.lua b/digistuff/conductors.lua new file mode 100644 index 0000000..77229e2 --- /dev/null +++ b/digistuff/conductors.lua @@ -0,0 +1,62 @@ +minetest.register_node("digistuff:digimese", { + description = "Digimese", + tiles = {"digistuff_digimese.png"}, + paramtype = "light", + light_source = 3, + groups = {cracky = 3, level = 2}, + is_ground_content = false, + sounds = default and default.node_sound_stone_defaults(), + digiline = { wire = { rules = { + {x = 1, y = 0, z = 0}, + {x =-1, y = 0, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y =-1, z = 0}, + {x = 0, y = 0, z = 1}, + {x = 0, y = 0, z =-1}}}} +}) + +minetest.register_node("digistuff:junctionbox", { + description = "Digilines Junction Box", + tiles = {"digistuff_junctionbox.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky = 3}, + is_ground_content = false, + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.1,-0.15,0.35,0.1,0.15,0.5}, + } + }, + sounds = default and default.node_sound_stone_defaults(), + digiline = { + receptor = {}, + wire = { + rules = { + {x = 1,y = 0,z = 0}, + {x = -1,y = 0,z = 0}, + {x = 0,y = 0,z = 1}, + {x = 0,y = 0,z = -1}, + {x = 0,y = 1,z = 0}, + {x = 0,y = -1,z = 0}, + {x = 0,y = -2,z = 0}, + {x = 0,y = 2,z = 0}, + {x = -2,y = 0,z = 0}, + {x = 2,y = 0,z = 0}, + {x = 0,y = 0,z = -2}, + {x = 0,y = 0,z = 2}, + } + }, + }, +}) + +minetest.register_craft({ + output = "digistuff:junctionbox", + recipe = { + {"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",}, + {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000",}, + {"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",}, + } +}) diff --git a/digistuff/depends.txt b/digistuff/depends.txt index a581a9b..cfb8465 100644 --- a/digistuff/depends.txt +++ b/digistuff/depends.txt @@ -1,3 +1,4 @@ default? digilines mesecons? +mesecons_mvps? diff --git a/digistuff/detector.lua b/digistuff/detector.lua new file mode 100644 index 0000000..f6542da --- /dev/null +++ b/digistuff/detector.lua @@ -0,0 +1,63 @@ +minetest.register_node("digistuff:detector", { + tiles = { + "digistuff_digidetector.png" + }, + digiline = + { + receptor = {} + }, + groups = {cracky=2}, + description = "Digilines Player Detector", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;radius;Radius;${radius}]button_exit[2.25,3;3,1;submit;Save]") + end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + if fields.msg then meta:set_string("msg",fields.msg) end + if fields.radius then meta:set_string("radius",fields.radius) end + end, + sounds = default and default.node_sound_stone_defaults() +}) + +minetest.register_abm({ + nodenames = {"digistuff:detector"}, + interval = 1.0, + chance = 1, + action = function(pos) + local meta = minetest.get_meta(pos) + local channel = meta:get_string("channel") + local radius = meta:get_string("radius") + local found_any = false + local players_found = {} + if not radius or not tonumber(radius) or tonumber(radius) < 1 or tonumber(radius) > 10 then radius = 6 end + local objs = minetest.get_objects_inside_radius(pos, radius) + if objs then + local _,obj + for _,obj in ipairs(objs) do + if obj:is_player() then + table.insert(players_found,obj:get_player_name()) + found_any = true + end + end + if found_any then + digiline:receptor_send(pos, digiline.rules.default, channel, players_found) + end + end + end +}) + +minetest.register_craft({ + output = "digistuff:detector", + recipe = { + {"mesecons_detector:object_detector_off"}, + {"mesecons_luacontroller:luacontroller0000"}, + {"digilines:wire_std_00000000"} + } +}) diff --git a/digistuff/init.lua b/digistuff/init.lua index 33b5936..1deefe1 100644 --- a/digistuff/init.lua +++ b/digistuff/init.lua @@ -1,1110 +1,25 @@ digistuff = {} -digistuff.sounds_playing = {} -digistuff.update_panel_formspec = function (pos,dispstr) - local meta = minetest.get_meta(pos) - local locked = meta:get_int("locked") == 1 - local fs = "size[10,8]".. - "background[0,0;0,0;digistuff_panel_bg.png;true]".. - "label[0,0;%s]".. - (locked and "image_button[9,3;1,1;digistuff_panel_locked.png;unlock;]" or "image_button[9,3;1,1;digistuff_panel_unlocked.png;lock;]").. - "image_button[2,4.5;1,1;digistuff_adwaita_go-up.png;up;]".. - "image_button[1,5;1,1;digistuff_adwaita_go-previous.png;left;]".. - "image_button[3,5;1,1;digistuff_adwaita_go-next.png;right;]".. - "image_button[2,5.5;1,1;digistuff_adwaita_go-down.png;down;]".. - "image_button[1,6.5;1,1;digistuff_adwaita_edit-undo.png;back;]".. - "image_button[3,6.5;1,1;digistuff_adwaita_emblem-default.png;enter;]".. - "field[6,5.75;2,1;channel;Channel;${channel}]".. - "button[8,5.5;1,1;savechan;Set]" - fs = fs:format(minetest.formspec_escape(dispstr)):gsub("|","\n") - meta:set_string("formspec",fs) - meta:set_string("text",dispstr) +local components = { + "touchscreen", + "light", + "noteblock", + "camera", + "button", + "panel", + "piezo", + "detector", + "conductors", + "piston", +} +for _,name in ipairs(components) do + dofile(string.format("%s%s%s.lua",minetest.get_modpath(minetest.get_current_modname()),DIR_DELIM,name)) end -digistuff.update_ts_formspec = function (pos) - local meta = minetest.get_meta(pos) - local fs = "size[10,8]".. - "background[0,0;0,0;digistuff_ts_bg.png;true]" - if meta:get_int("init") == 0 then - fs = fs.."field[3.75,3;3,1;channel;Channel;]".. - "button_exit[4,3.75;2,1;save;Save]" - else - local data = minetest.deserialize(meta:get_string("data")) or {} - for _,field in pairs(data) do - if field.type == "image" then - fs = fs..string.format("image[%s,%s;%s,%s;%s]",field.X,field.Y,field.W,field.H,field.texture_name) - elseif field.type == "field" then - fs = fs..string.format("field[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label,field.default) - elseif field.type == "pwdfield" then - fs = fs..string.format("pwdfield[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) - elseif field.type == "textarea" then - fs = fs..string.format("textarea[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label,field.default) - elseif field.type == "label" then - fs = fs..string.format("label[%s,%s;%s]",field.X,field.Y,field.label) - elseif field.type == "vertlabel" then - fs = fs..string.format("vertlabel[%s,%s;%s]",field.X,field.Y,field.label) - elseif field.type == "button" then - fs = fs..string.format("button[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) - elseif field.type == "button_exit" then - fs = fs..string.format("button_exit[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) - elseif field.type == "image_button" then - fs = fs..string.format("image_button[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.image,field.name,field.label) - elseif field.type == "image_button_exit" then - fs = fs..string.format("image_button_exit[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.image,field.name,field.label) - elseif field.type == "dropdown" then - local choices = "" - for _,i in ipairs(field.choices) do - if type(i) == "string" then - choices = choices..minetest.formspec_escape(i).."," - end - end - choices = string.sub(choices,1,-2) - fs = fs..string.format("dropdown[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,choices,field.selected_id) - end - end - end - meta:set_string("formspec",fs) -end - -digistuff.ts_on_receive_fields = function (pos, formname, fields, sender) - local meta = minetest.get_meta(pos) - local setchan = meta:get_string("channel") - local playername = sender:get_player_name() - local locked = meta:get_int("locked") == 1 - local can_bypass = minetest.check_player_privs(playername,{protection_bypass=true}) - local is_protected = minetest.is_protected(pos,playername) - if (locked and is_protected) and not can_bypass then - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to use this screen.") - return - end - local init = meta:get_int("init") == 1 - if not init then - if fields.save then - meta:set_string("channel",fields.channel) - meta:set_int("init",1) - digistuff.update_ts_formspec(pos) - end - else - fields.clicker = sender:get_player_name() - digiline:receptor_send(pos, digiline.rules.default, setchan, fields) - end -end - -digistuff.process_command = function (meta, data, msg) - if msg.command == "clear" then - data = {} - elseif msg.command == "addimage" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - if not msg.texture_name or type(msg.texture_name) ~= "string" then - return - end - local field = {type="image",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,texture_name=minetest.formspec_escape(msg.texture_name)} - table.insert(data,field) - elseif msg.command == "addfield" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - for _,i in pairs({"name","label","default"}) do - if not msg[i] or type(msg[i]) ~= "string" then - return - end - end - local field = {type="field",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label),default=minetest.formspec_escape(msg.default)} - table.insert(data,field) - elseif msg.command == "addpwdfield" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - for _,i in pairs({"name","label"}) do - if not msg[i] or type(msg[i]) ~= "string" then - return - end - end - local field = {type="pwdfield",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} - table.insert(data,field) - elseif msg.command == "addtextarea" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - for _,i in pairs({"name","label","default"}) do - if not msg[i] or type(msg[i]) ~= "string" then - return - end - end - local field = {type="textarea",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label),default=minetest.formspec_escape(msg.default)} - table.insert(data,field) - elseif msg.command == "addlabel" then - for _,i in pairs({"X","Y"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - if not msg.label or type(msg.label) ~= "string" then - return - end - local field = {type="label",X=msg.X,Y=msg.Y,label=minetest.formspec_escape(msg.label)} - table.insert(data,field) - elseif msg.command == "addvertlabel" then - for _,i in pairs({"X","Y"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - if not msg.label or type(msg.label) ~= "string" then - return - end - local field = {type="vertlabel",X=msg.X,Y=msg.Y,label=minetest.formspec_escape(msg.label)} - table.insert(data,field) - elseif msg.command == "addbutton" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - for _,i in pairs({"name","label"}) do - if not msg[i] or type(msg[i]) ~= "string" then - return - end - end - local field = {type="button",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} - table.insert(data,field) - elseif msg.command == "addbutton_exit" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - for _,i in pairs({"name","label"}) do - if not msg[i] or type(msg[i]) ~= "string" then - return - end - end - local field = {type="button_exit",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} - table.insert(data,field) - elseif msg.command == "addimage_button" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - for _,i in pairs({"image","name","label"}) do - if not msg[i] or type(msg[i]) ~= "string" then - return - end - end - local field = {type="image_button",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,image=minetest.formspec_escape(msg.image),name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} - table.insert(data,field) - elseif msg.command == "addimage_button_exit" then - for _,i in pairs({"X","Y","W","H"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - for _,i in pairs({"image","name","label"}) do - if not msg[i] or type(msg[i]) ~= "string" then - return - end - end - local field = {type="image_button_exit",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,image=minetest.formspec_escape(msg.image),name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} - table.insert(data,field) - elseif msg.command == "adddropdown" then - for _,i in pairs({"X","Y","W","H","selected_id"}) do - if not msg[i] or type(msg[i]) ~= "number" then - return - end - end - if not msg.name or type(msg.name) ~= "string" then - return - end - if not msg.choices or type(msg.choices) ~= "table" or #msg.choices < 1 then - return - end - local field = {type="dropdown",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=msg.name,selected_id=msg.selected_id,choices=msg.choices} - table.insert(data,field) - elseif msg.command == "lock" then - meta:set_int("locked",1) - elseif msg.command == "unlock" then - meta:set_int("locked",0) - end - return data -end - -digistuff.ts_on_digiline_receive = function (pos, node, channel, msg) - local meta = minetest.get_meta(pos) - local setchan = meta:get_string("channel") - if channel ~= setchan then return end - if type(msg) ~= "table" then return end - local data = minetest.deserialize(meta:get_string("data")) or {} - if msg.command then - data = digistuff.process_command(meta,data,msg) - else - for _,i in ipairs(msg) do - if i.command then - data = digistuff.process_command(meta,data,i) or data - end - end - end - meta:set_string("data",minetest.serialize(data)) - digistuff.update_ts_formspec(pos) -end - -digistuff.panel_on_digiline_receive = function (pos, node, channel, msg) - local meta = minetest.get_meta(pos) - local setchan = meta:get_string("channel") - if channel ~= setchan then return end - if type(msg) ~= "string" then return end - digistuff.update_panel_formspec(pos,msg) -end - -digistuff.panel_on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.get_meta(pos) - local setchan = meta:get_string("channel") - local playername = sender:get_player_name() - local locked = meta:get_int("locked") == 1 - local can_bypass = minetest.check_player_privs(playername,{protection_bypass=true}) - local is_protected = minetest.is_protected(pos,playername) - if fields.savechan then - if can_bypass or not is_protected then - meta:set_string("channel",fields.channel) - local helpmsg = "Channel has been set. Waiting for data..." - digistuff.update_panel_formspec(pos,helpmsg) - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to change the channel of this panel.") - end - elseif fields.up then - if can_bypass or not is_protected or not locked then - digiline:receptor_send(pos, digiline.rules.default, setchan, "up") - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to use this panel.") - end - elseif fields.down then - if can_bypass or not is_protected or not locked then - digiline:receptor_send(pos, digiline.rules.default, setchan, "down") - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to use this panel.") - end - elseif fields.left then - if can_bypass or not is_protected or not locked then - digiline:receptor_send(pos, digiline.rules.default, setchan, "left") - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to use this panel.") - end - elseif fields.right then - if can_bypass or not is_protected or not locked then - digiline:receptor_send(pos, digiline.rules.default, setchan, "right") - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to use this panel.") - end - elseif fields.back then - if can_bypass or not is_protected or not locked then - digiline:receptor_send(pos, digiline.rules.default, setchan, "back") - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to use this panel.") - end - elseif fields.enter then - if can_bypass or not is_protected or not locked then - digiline:receptor_send(pos, digiline.rules.default, setchan, "enter") - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to use this panel.") - end - elseif fields.lock then - if can_bypass or not is_protected then - meta:set_int("locked",1) - minetest.chat_send_player(playername,"This panel has been locked. Access will now be controlled according to area protection.") - digistuff.update_panel_formspec(pos,meta:get_string("text")) - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to lock this panel.") - end - elseif fields.unlock then - if can_bypass or not is_protected then - meta:set_int("locked",0) - minetest.chat_send_player(playername,"This panel has been unlocked. It can now be used (but not locked or have the channel changed) by anyone.") - digistuff.update_panel_formspec(pos,meta:get_string("text")) - else - minetest.record_protection_violation(pos,playername) - minetest.chat_send_player(playername,"You are not authorized to unlock this panel.") - end - end -end - -digistuff.button_turnoff = function (pos) - local node = minetest.get_node(pos) - if node.name=="digistuff:button_on" then --has not been dug - minetest.swap_node(pos, {name = "digistuff:button_off", param2=node.param2}) - if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_pop", {pos=pos}) end - end -end - -minetest.register_node("digistuff:digimese", { - description = "Digimese", - tiles = {"digistuff_digimese.png"}, - paramtype = "light", - light_source = 3, - groups = {cracky = 3, level = 2}, - is_ground_content = false, - sounds = default and default.node_sound_stone_defaults(), - digiline = { wire = { rules = { - {x = 1, y = 0, z = 0}, - {x =-1, y = 0, z = 0}, - {x = 0, y = 1, z = 0}, - {x = 0, y =-1, z = 0}, - {x = 0, y = 0, z = 1}, - {x = 0, y = 0, z =-1}}}} -}) - -minetest.register_node("digistuff:button", { - drawtype = "nodebox", - tiles = { - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_off.png" - }, - paramtype = "light", - paramtype2 = "facedir", - legacy_wallmounted = true, - walkable = false, - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } - }, - node_box = { - type = "fixed", - fixed = { - { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button - { -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself - } - }, - digiline = - { - receptor = {} - }, - groups = {dig_immediate=2}, - description = "Digilines Button", - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;msg;Message;${msg}]button_exit[2.25,3;3,1;submit;Save]") - end, - on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.get_meta(pos) - if fields.channel and fields.msg and fields.channel ~= "" and fields.msg ~= "" then - meta:set_string("channel",fields.channel) - meta:set_string("msg",fields.msg) - meta:set_string("formspec","") - minetest.swap_node(pos, {name = "digibutton:button_off", param2=minetest.get_node(pos).param2}) - else - minetest.chat_send_player(sender:get_player_name(),"Channel and message must both be set!") - end - end, - sounds = default and default.node_sound_stone_defaults(), -}) - -minetest.register_node("digistuff:button_off", { - drawtype = "nodebox", - tiles = { - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_off.png" - }, - paramtype = "light", - paramtype2 = "facedir", - legacy_wallmounted = true, - walkable = false, - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } - }, - node_box = { - type = "fixed", - fixed = { - { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, -- the thin plate behind the button - { -4/16, -2/16, 4/16, 4/16, 2/16, 6/16 } -- the button itself - } - }, - digiline = - { - receptor = {} - }, - groups = {dig_immediate=2, not_in_creative_inventory=1}, - drop = "digistuff:button", - description = "Digilines Button (off state - you hacker you!)", - on_rightclick = function (pos, node, clicker) - local meta = minetest.get_meta(pos) - digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg")) - minetest.swap_node(pos, {name = "digistuff:button_on", param2=node.param2}) - if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end - minetest.after(0.5, digistuff.button_turnoff, pos) - end, - sounds = default and default.node_sound_stone_defaults(), -}) - -minetest.register_node("digistuff:button_on", { - drawtype = "nodebox", - tiles = { - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_sides.png", - "digistuff_digibutton_on.png" - }, - paramtype = "light", - paramtype2 = "facedir", - legacy_wallmounted = true, - walkable = false, - light_source = 7, - sunlight_propagates = true, - selection_box = { - type = "fixed", - fixed = { -6/16, -6/16, 5/16, 6/16, 6/16, 8/16 } - }, - node_box = { - type = "fixed", - fixed = { - { -6/16, -6/16, 6/16, 6/16, 6/16, 8/16 }, - { -4/16, -2/16, 11/32, 4/16, 2/16, 6/16 } - } - }, - digiline = - { - receptor = {} - }, - groups = {dig_immediate=2, not_in_creative_inventory=1}, - drop = 'digistuff:button', - on_rightclick = function (pos, node, clicker) - local meta = minetest.get_meta(pos) - digiline:receptor_send(pos, digiline.rules.default, meta:get_string("channel"), meta:get_string("msg")) - if minetest.get_modpath("mesecons") then minetest.sound_play("mesecons_button_push", {pos=pos}) end - end, - description = "Digilines Button (on state - you hacker you!)", - sounds = default and default.node_sound_stone_defaults(), -}) - -minetest.register_craft({ - output = "digistuff:digimese", - recipe = { - {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"}, - {"digilines:wire_std_00000000","default:mese","digilines:wire_std_00000000"}, - {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000"} - } -}) - -minetest.register_craft({ - output = "digistuff:button", - recipe = { - {"mesecons_button:button_off"}, - {"mesecons_luacontroller:luacontroller0000"}, - {"digilines:wire_std_00000000"} - } -}) - -minetest.register_alias("digibutton:button","digistuff:button") -minetest.register_alias("digibutton:button_off","digistuff:button_off") -minetest.register_alias("digibutton:button_on","digistuff:button_on") -minetest.register_alias("digibutton:digimese","digistuff:digimese") - -minetest.register_node("digistuff:detector", { - tiles = { - "digistuff_digidetector.png" - }, - digiline = - { - receptor = {} - }, - groups = {cracky=2}, - description = "Digilines Player Detector", - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec","size[8,4;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;radius;Radius;${radius}]button_exit[2.25,3;3,1;submit;Save]") - end, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then - minetest.record_protection_violation(pos,name) - return - end - local meta = minetest.get_meta(pos) - if fields.channel then meta:set_string("channel",fields.channel) end - if fields.msg then meta:set_string("msg",fields.msg) end - if fields.radius then meta:set_string("radius",fields.radius) end - end, - sounds = default and default.node_sound_stone_defaults() -}) - -minetest.register_abm({ - nodenames = {"digistuff:detector"}, - interval = 1.0, - chance = 1, - action = function(pos) - local meta = minetest.get_meta(pos) - local channel = meta:get_string("channel") - local radius = meta:get_string("radius") - local found_any = false - local players_found = {} - if not radius or not tonumber(radius) or tonumber(radius) < 1 or tonumber(radius) > 10 then radius = 6 end - local objs = minetest.get_objects_inside_radius(pos, radius) - if objs then - local _,obj - for _,obj in ipairs(objs) do - if obj:is_player() then - table.insert(players_found,obj:get_player_name()) - found_any = true - end - end - if found_any then - digiline:receptor_send(pos, digiline.rules.default, channel, players_found) - end - end - end -}) - -minetest.register_node("digistuff:panel", { - description = "Digilines Control Panel", - groups = {cracky=3}, - on_construct = function(pos) - local helpmsg = "Please set a channel." - digistuff.update_panel_formspec(pos,helpmsg) - minetest.get_meta(pos):set_int("locked",0) - end, - drawtype = "nodebox", - tiles = { - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_panel_front.png" - }, - paramtype = "light", - paramtype2 = "facedir", - node_box = { - type = "fixed", - fixed = { - { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } - } - }, - on_receive_fields = digistuff.panel_on_receive_fields, - digiline = - { - receptor = {}, - effector = { - action = digistuff.panel_on_digiline_receive - }, - }, -}) - -minetest.register_craft({ - output = "digistuff:detector", - recipe = { - {"mesecons_detector:object_detector_off"}, - {"mesecons_luacontroller:luacontroller0000"}, - {"digilines:wire_std_00000000"} - } -}) - -minetest.register_craft({ - output = "digistuff:panel", - recipe = { - {"","digistuff:button",""}, - {"digistuff:button","digilines:lcd","digistuff:button"}, - {"","digistuff:button",""} - } -}) - -minetest.register_craft({ - output = "digistuff:touchscreen", - recipe = { - {"mesecons_luacontroller:luacontroller0000","default:glass","default:glass"}, - {"default:glass","digilines:lcd","default:glass"}, - {"default:glass","default:glass","default:glass"} - } -}) - -minetest.register_node("digistuff:touchscreen", { - description = "Digilines Touchscreen", - groups = {cracky=3}, - on_construct = function(pos) - digistuff.update_ts_formspec(pos,true) - end, - drawtype = "nodebox", - tiles = { - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_panel_back.png", - "digistuff_ts_front.png" - }, - paramtype = "light", - paramtype2 = "facedir", - node_box = { - type = "fixed", - fixed = { - { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } - } - }, - on_receive_fields = digistuff.ts_on_receive_fields, - digiline = - { - receptor = {}, - effector = { - action = digistuff.ts_on_digiline_receive - }, - }, -}) - -minetest.register_node("digistuff:piezo", { - description = "Digilines Piezoelectric Beeper", - groups = {cracky=3}, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec","field[channel;Channel;${channel}") - end, - on_destruct = function(pos) - local pos_hash = minetest.hash_node_position(pos) - if digistuff.sounds_playing[pos_hash] then - minetest.sound_stop(digistuff.sounds_playing[pos_hash]) - digistuff.sounds_playing[pos_hash] = nil - end - end, - tiles = { - "digistuff_piezo_top.png", - "digistuff_piezo_sides.png", - "digistuff_piezo_sides.png", - "digistuff_piezo_sides.png", - "digistuff_piezo_sides.png", - "digistuff_piezo_sides.png" - }, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then - minetest.record_protection_violation(pos,name) - return - end - local meta = minetest.get_meta(pos) - if fields.channel then meta:set_string("channel",fields.channel) end - end, - digiline = - { - receptor = {}, - effector = { - action = function(pos,node,channel,msg) - local meta = minetest.get_meta(pos) - local setchan = meta:get_string("channel") - if channel ~= setchan then return end - if msg == "shortbeep" then - local pos_hash = minetest.hash_node_position(pos) - if digistuff.sounds_playing[pos_hash] then - minetest.sound_stop(digistuff.sounds_playing[pos_hash]) - digistuff.sounds_playing[pos_hash] = nil - end - minetest.sound_play({name = "digistuff_piezo_short_single",gain = 0.2},{pos = pos,max_hear_distance = 16}) - elseif msg == "longbeep" then - local pos_hash = minetest.hash_node_position(pos) - if digistuff.sounds_playing[pos_hash] then - minetest.sound_stop(digistuff.sounds_playing[pos_hash]) - digistuff.sounds_playing[pos_hash] = nil - end - minetest.sound_play({name = "digistuff_piezo_long_single",gain = 0.2},{pos = pos,max_hear_distance = 16}) - elseif msg == "fastrepeat" then - local pos_hash = minetest.hash_node_position(pos) - if digistuff.sounds_playing[pos_hash] then - minetest.sound_stop(digistuff.sounds_playing[pos_hash]) - digistuff.sounds_playing[pos_hash] = nil - end - digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_fast_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true}) - elseif msg == "slowrepeat" then - local pos_hash = minetest.hash_node_position(pos) - if digistuff.sounds_playing[pos_hash] then - minetest.sound_stop(digistuff.sounds_playing[pos_hash]) - digistuff.sounds_playing[pos_hash] = nil - end - digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_slow_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true}) - elseif msg == "stop" then - local pos_hash = minetest.hash_node_position(pos) - if digistuff.sounds_playing[pos_hash] then - minetest.sound_stop(digistuff.sounds_playing[pos_hash]) - digistuff.sounds_playing[pos_hash] = nil - end - end - end - }, - }, -}) - local http = minetest.request_http_api() - -if http then - minetest.register_node("digistuff:nic", { - description = "Digilines NIC", - groups = {cracky=3}, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec","field[channel;Channel;${channel}") - end, - tiles = { - "digistuff_nic_top.png", - "jeija_microcontroller_bottom.png", - "jeija_microcontroller_sides.png", - "jeija_microcontroller_sides.png", - "jeija_microcontroller_sides.png", - "jeija_microcontroller_sides.png" - }, - drawtype = "nodebox", - selection_box = { - --From luacontroller - type = "fixed", - fixed = { -8/16, -8/16, -8/16, 8/16, -5/16, 8/16 }, - }, - node_box = { - --From Luacontroller - type = "fixed", - fixed = { - {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16}, -- Bottom slab - {-5/16, -7/16, -5/16, 5/16, -6/16, 5/16}, -- Circuit board - {-3/16, -6/16, -3/16, 3/16, -5/16, 3/16}, -- IC - } - }, - paramtype = "light", - sunlight_propagates = true, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then - minetest.record_protection_violation(pos,name) - return - end - local meta = minetest.get_meta(pos) - if fields.channel then meta:set_string("channel",fields.channel) end - end, - digiline = - { - receptor = {}, - effector = { - action = function(pos,node,channel,msg) - local meta = minetest.get_meta(pos) - if meta:get_string("channel") ~= channel then return end - if type(msg) ~= "string" then return end - http.fetch({ - url = msg, - timeout = 5, - user_agent = "Minetest Digilines Modem", - }, - function(res) - digiline:receptor_send(pos, digiline.rules.default, channel, res) - end) - end - }, - }, - }) - minetest.register_craft({ - output = "digistuff:nic", - recipe = { - {"","","mesecons:wire_00000000_off"}, - {"digilines:wire_std_00000000","mesecons_luacontroller:luacontroller0000","mesecons:wire_00000000_off"} - } - }) -end - -minetest.register_node("digistuff:camera", { - tiles = { - "digistuff_camera_top.png", - "digistuff_camera_bottom.png", - "digistuff_camera_right.png", - "digistuff_camera_left.png", - "digistuff_camera_back.png", - "digistuff_camera_front.png", - }, - digiline = - { - receptor = {} - }, - groups = {cracky=2}, - paramtype = "light", - paramtype2 = "facedir", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-0.1,-0.5,-0.28,0.1,-0.3,0.3}, --Camera Body - {-0.045,-0.42,-0.34,0.045,-0.36,-0.28}, -- Lens - {-0.05,-0.9,-0.05,0.05,-0.5,0.05}, --Pole - } - }, - selection_box = { - type = "fixed", - fixed = { - {-0.1,-0.5,-0.34,0.1,-0.3,0.3}, --Camera Body - } - }, - description = "Digilines Camera", - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec","size[8,6;]field[1,1;6,2;channel;Channel;${channel}]field[1,2;6,2;radius;Radius (max 10);${radius}]field[1,3;6,2;distance;Distance (max 20);${distance}]button_exit[2.25,4;3,1;submit;Save]") - end, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then - minetest.record_protection_violation(pos,name) - return - end - local meta = minetest.get_meta(pos) - if fields.channel then meta:set_string("channel",fields.channel) end - if fields.distance and tonumber(fields.distance) then meta:set_int("distance",math.max(math.min(20,fields.distance),0)) end - if fields.radius and tonumber(fields.radius) then meta:set_int("radius",math.max(math.min(10,fields.radius),1)) end - end, - sounds = default and default.node_sound_stone_defaults() -}) - -minetest.register_abm({ - nodenames = {"digistuff:camera"}, - interval = 1.0, - chance = 1, - action = function(pos,node) - local meta = minetest.get_meta(pos) - local channel = meta:get_string("channel") - local radius = meta:get_int("radius") - local distance = meta:get_int("distance") - local dir = vector.multiply(minetest.facedir_to_dir(node.param2),-1) - local spot = vector.add(pos,vector.multiply(dir,distance)) - local i = 0 - while i <= 10 and minetest.get_node(spot).name == "air" do - --Downward search for ground level - spot = vector.add(spot,vector.new(0,-1,0)) - i = i + 1 - end - if minetest.get_node(spot).name == "air" or minetest.get_node(spot).name == "ignore" then - --Ground not in range - return - end - - local found_any = false - local players_found = {} - local objs = minetest.get_objects_inside_radius(spot,radius) - if objs then - local _,obj - for _,obj in ipairs(objs) do - if obj:is_player() then - table.insert(players_found,obj:get_player_name()) - found_any = true - end - end - if found_any then - digiline:receptor_send({x=pos.x,y=pos.y-1,z=pos.z}, digiline.rules.default, channel, players_found) - end - end - end -}) - -minetest.register_craft({ - output = "digistuff:camera", - recipe = { - {"homedecor:plastic_sheeting","homedecor:plastic_sheeting","homedecor:plastic_sheeting"}, - {"default:glass","homedecor:ic","mesecons_luacontroller:luacontroller0000"}, - {"homedecor:plastic_sheeting","homedecor:plastic_sheeting","homedecor:plastic_sheeting"}, - } -}) - -if minetest.get_modpath("mesecons_noteblock") then - local validnbsounds = dofile(minetest.get_modpath("digistuff")..DIR_DELIM.."nbsounds.lua") - minetest.register_node("digistuff:noteblock", { - description = "Digilines Noteblock", - groups = {cracky=3}, - on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec","field[channel;Channel;${channel}") - end, - on_destruct = function(pos) - local pos_hash = minetest.hash_node_position(pos) - if digistuff.sounds_playing[pos_hash] then - minetest.sound_stop(digistuff.sounds_playing[pos_hash]) - digistuff.sounds_playing[pos_hash] = nil - end - end, - tiles = { - "mesecons_noteblock.png" - }, - on_receive_fields = function(pos, formname, fields, sender) - local name = sender:get_player_name() - if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then - minetest.record_protection_violation(pos,name) - return - end - local meta = minetest.get_meta(pos) - if fields.channel then meta:set_string("channel",fields.channel) end - end, - digiline = - { - receptor = {}, - effector = { - action = function(pos,node,channel,msg) - if msg == "get_sounds" then - local soundnames = {} - for i in pairs(validnbsounds) do - table.insert(soundnames,i) - end - digiline:receptor_send(pos, digiline.rules.default, channel, soundnames) - end - local meta = minetest.get_meta(pos) - local setchan = meta:get_string("channel") - if channel ~= setchan then return end - if type(msg) == "string" then - local sound = validnbsounds[msg] - if sound then minetest.sound_play(sound,{pos=pos}) end - elseif type(msg) == "table" then - if type(msg.sound) ~= "string" then return end - local sound = validnbsounds[msg.sound] - local volume = 1 - if type(msg.volume) == "number" then - volume = math.max(0,math.min(1,msg.volume)) - end - if sound then minetest.sound_play({name=sound,gain=volume},{pos=pos}) end - end - end - }, - }, - }) +if not http then + minetest.log("error","digistuff is not allowed to use the HTTP API - digilines NIC will not be available!") + minetest.log("error","If this functionality is desired, please add digistuff to your secure.http_mods setting") +else + loadfile(string.format("%s%s%s.lua",minetest.get_modpath(minetest.get_current_modname()),DIR_DELIM,"nic"))(http) end - -for i=0,14,1 do - local mult = 255 - ((14-i)*12) - minetest.register_node("digistuff:light_"..i, { - drop = "digistuff:light_0", - description = "Digilines Dimmable Light"..(i > 0 and " (on state - you hacker you!)" or ""), - tiles = {"digistuff_light.png"}, - paramtype = "light", - paramtype2 = "facedir", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-0.25,0.4,-0.25,0.25,0.5,0.25}, - } - }, - groups = i > 0 and {cracky = 1, not_in_creative_inventory = 1} or {cracky = 1}, - is_ground_content = false, - light_source = i, - color = {r = mult,g = mult,b = mult}, - sounds = default and default.node_sound_glass_defaults(), - 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) - local name = sender:get_player_name() - if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then - minetest.record_protection_violation(pos,name) - return - end - local meta = minetest.get_meta(pos) - if fields.channel then meta:set_string("channel",fields.channel) end - end, - digiline = { - receptor = {}, - wire = { - rules = { - {x = 1,y = 0,z = 0}, - {x = -1,y = 0,z = 0}, - {x = 0,y = 0,z = 1}, - {x = 0,y = 0,z = -1}, - {x = 0,y = 1,z = 0}, - {x = 0,y = -1,z = 0}, - {x = 2,y = 0,z = 0}, - {x = -2,y = 0,z = 0}, - {x = 0,y = 0,z = 2}, - {x = 0,y = 0,z = -2}, - {x = 0,y = 2,z = 0}, - {x = 0,y = -2,z = 0}, - } - }, - effector = { - action = function(pos,node,channel,msg) - local meta = minetest.get_meta(pos) - if meta:get_string("channel") ~= channel then return end - local value = tonumber(msg) - if (not value) or value > 14 or value < 0 then return end - node.name = "digistuff:light_"..math.floor(value) - minetest.swap_node(pos,node) - end - }, - }, - }) -end - -minetest.register_node("digistuff:junctionbox", { - description = "Digilines Junction Box", - tiles = {"digistuff_junctionbox.png"}, - paramtype = "light", - paramtype2 = "facedir", - groups = {cracky = 3}, - is_ground_content = false, - paramtype = "light", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-0.1,-0.15,0.35,0.1,0.15,0.5}, - } - }, - sounds = default and default.node_sound_stone_defaults(), - digiline = { - receptor = {}, - wire = { - rules = { - {x = 1,y = 0,z = 0}, - {x = -1,y = 0,z = 0}, - {x = 0,y = 0,z = 1}, - {x = 0,y = 0,z = -1}, - {x = 0,y = 1,z = 0}, - {x = 0,y = -1,z = 0}, - {x = 0,y = -2,z = 0}, - {x = 0,y = 2,z = 0}, - {x = -2,y = 0,z = 0}, - {x = 2,y = 0,z = 0}, - {x = 0,y = 0,z = -2}, - {x = 0,y = 0,z = 2}, - } - }, - }, -}) - -minetest.register_craft({ - output = "digistuff:light_0", - recipe = { - {"digilines:wire_std_00000000","mesecons_lamp:lamp_off",}, - } -}) - -minetest.register_craft({ - output = "digistuff:junctionbox", - recipe = { - {"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",}, - {"digilines:wire_std_00000000","digilines:wire_std_00000000","digilines:wire_std_00000000",}, - {"homedecor:plastic_sheeting","digilines:wire_std_00000000","homedecor:plastic_sheeting",}, - } -}) diff --git a/digistuff/light.lua b/digistuff/light.lua new file mode 100644 index 0000000..aeca08d --- /dev/null +++ b/digistuff/light.lua @@ -0,0 +1,71 @@ +for i=0,14,1 do + local mult = 255 - ((14-i)*12) + minetest.register_node("digistuff:light_"..i, { + drop = "digistuff:light_0", + description = "Digilines Dimmable Light"..(i > 0 and " (on state - you hacker you!)" or ""), + tiles = {"digistuff_light.png"}, + paramtype = "light", + paramtype2 = "facedir", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.25,0.4,-0.25,0.25,0.5,0.25}, + } + }, + groups = i > 0 and {cracky = 1, not_in_creative_inventory = 1} or {cracky = 1}, + is_ground_content = false, + light_source = i, + color = {r = mult,g = mult,b = mult}, + sounds = default and default.node_sound_glass_defaults(), + 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) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + digiline = { + receptor = {}, + wire = { + rules = { + {x = 1,y = 0,z = 0}, + {x = -1,y = 0,z = 0}, + {x = 0,y = 0,z = 1}, + {x = 0,y = 0,z = -1}, + {x = 0,y = 1,z = 0}, + {x = 0,y = -1,z = 0}, + {x = 2,y = 0,z = 0}, + {x = -2,y = 0,z = 0}, + {x = 0,y = 0,z = 2}, + {x = 0,y = 0,z = -2}, + {x = 0,y = 2,z = 0}, + {x = 0,y = -2,z = 0}, + } + }, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + if meta:get_string("channel") ~= channel then return end + local value = tonumber(msg) + if (not value) or value > 14 or value < 0 then return end + node.name = "digistuff:light_"..math.floor(value) + minetest.swap_node(pos,node) + end + }, + }, + }) +end + +minetest.register_craft({ + output = "digistuff:light_0", + recipe = { + {"digilines:wire_std_00000000","mesecons_lamp:lamp_off",}, + } +}) diff --git a/digistuff/nic.lua b/digistuff/nic.lua new file mode 100644 index 0000000..8760bdf --- /dev/null +++ b/digistuff/nic.lua @@ -0,0 +1,69 @@ +local http = ... +minetest.register_node("digistuff:nic", { + description = "Digilines NIC", + groups = {cracky=3}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","field[channel;Channel;${channel}") + end, + tiles = { + "digistuff_nic_top.png", + "jeija_microcontroller_bottom.png", + "jeija_microcontroller_sides.png", + "jeija_microcontroller_sides.png", + "jeija_microcontroller_sides.png", + "jeija_microcontroller_sides.png" + }, + drawtype = "nodebox", + selection_box = { + --From luacontroller + type = "fixed", + fixed = { -8/16, -8/16, -8/16, 8/16, -5/16, 8/16 }, + }, + node_box = { + --From Luacontroller + type = "fixed", + fixed = { + {-8/16, -8/16, -8/16, 8/16, -7/16, 8/16}, -- Bottom slab + {-5/16, -7/16, -5/16, 5/16, -6/16, 5/16}, -- Circuit board + {-3/16, -6/16, -3/16, 3/16, -5/16, 3/16}, -- IC + } + }, + paramtype = "light", + sunlight_propagates = true, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + digiline = + { + receptor = {}, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + if meta:get_string("channel") ~= channel then return end + if type(msg) ~= "string" then return end + http.fetch({ + url = msg, + timeout = 5, + user_agent = "Minetest Digilines Modem", + }, + function(res) + digiline:receptor_send(pos, digiline.rules.default, channel, res) + end) + end + }, + }, +}) +minetest.register_craft({ + output = "digistuff:nic", + recipe = { + {"","","mesecons:wire_00000000_off"}, + {"digilines:wire_std_00000000","mesecons_luacontroller:luacontroller0000","mesecons:wire_00000000_off"} + } +}) diff --git a/digistuff/noteblock.lua b/digistuff/noteblock.lua new file mode 100644 index 0000000..f2e9c89 --- /dev/null +++ b/digistuff/noteblock.lua @@ -0,0 +1,64 @@ +if not minetest.get_modpath("mesecons_noteblock") then + minetest.log("error","mesecons_noteblock is not installed - digilines noteblock will not be available!") + return +end + +local validnbsounds = dofile(minetest.get_modpath(minetest.get_current_modname())..DIR_DELIM.."nbsounds.lua") +minetest.register_node("digistuff:noteblock", { + description = "Digilines Noteblock", + groups = {cracky=3}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","field[channel;Channel;${channel}") + end, + on_destruct = function(pos) + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + end, + tiles = { + "mesecons_noteblock.png" + }, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + digiline = + { + receptor = {}, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if msg == "get_sounds" then + local soundnames = {} + for i in pairs(validnbsounds) do + table.insert(soundnames,i) + end + digiline:receptor_send(pos, digiline.rules.default, channel, soundnames) + return + end + if type(msg) == "string" then + local sound = validnbsounds[msg] + if sound then minetest.sound_play(sound,{pos=pos}) end + elseif type(msg) == "table" then + if type(msg.sound) ~= "string" then return end + local sound = validnbsounds[msg.sound] + local volume = 1 + if type(msg.volume) == "number" then + volume = math.max(0,math.min(1,msg.volume)) + end + if sound then minetest.sound_play({name=sound,gain=volume},{pos=pos}) end + end + end + }, + }, +}) diff --git a/digistuff/panel.lua b/digistuff/panel.lua new file mode 100644 index 0000000..d543af1 --- /dev/null +++ b/digistuff/panel.lua @@ -0,0 +1,151 @@ +digistuff.update_panel_formspec = function (pos,dispstr) + local meta = minetest.get_meta(pos) + local locked = meta:get_int("locked") == 1 + local fs = "size[10,8]".. + "background[0,0;0,0;digistuff_panel_bg.png;true]".. + "label[0,0;%s]".. + (locked and "image_button[9,3;1,1;digistuff_panel_locked.png;unlock;]" or "image_button[9,3;1,1;digistuff_panel_unlocked.png;lock;]").. + "image_button[2,4.5;1,1;digistuff_adwaita_go-up.png;up;]".. + "image_button[1,5;1,1;digistuff_adwaita_go-previous.png;left;]".. + "image_button[3,5;1,1;digistuff_adwaita_go-next.png;right;]".. + "image_button[2,5.5;1,1;digistuff_adwaita_go-down.png;down;]".. + "image_button[1,6.5;1,1;digistuff_adwaita_edit-undo.png;back;]".. + "image_button[3,6.5;1,1;digistuff_adwaita_emblem-default.png;enter;]".. + "field[6,5.75;2,1;channel;Channel;${channel}]".. + "button[8,5.5;1,1;savechan;Set]" + fs = fs:format(minetest.formspec_escape(dispstr)):gsub("|","\n") + meta:set_string("formspec",fs) + meta:set_string("text",dispstr) +end + +digistuff.panel_on_digiline_receive = function (pos, node, channel, msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if type(msg) ~= "string" then return end + digistuff.update_panel_formspec(pos,msg) +end + +digistuff.panel_on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + local playername = sender:get_player_name() + local locked = meta:get_int("locked") == 1 + local can_bypass = minetest.check_player_privs(playername,{protection_bypass=true}) + local is_protected = minetest.is_protected(pos,playername) + if fields.savechan then + if can_bypass or not is_protected then + meta:set_string("channel",fields.channel) + local helpmsg = "Channel has been set. Waiting for data..." + digistuff.update_panel_formspec(pos,helpmsg) + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to change the channel of this panel.") + end + elseif fields.up then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "up") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.down then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "down") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.left then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "left") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.right then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "right") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.back then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "back") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.enter then + if can_bypass or not is_protected or not locked then + digiline:receptor_send(pos, digiline.rules.default, setchan, "enter") + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this panel.") + end + elseif fields.lock then + if can_bypass or not is_protected then + meta:set_int("locked",1) + minetest.chat_send_player(playername,"This panel has been locked. Access will now be controlled according to area protection.") + digistuff.update_panel_formspec(pos,meta:get_string("text")) + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to lock this panel.") + end + elseif fields.unlock then + if can_bypass or not is_protected then + meta:set_int("locked",0) + minetest.chat_send_player(playername,"This panel has been unlocked. It can now be used (but not locked or have the channel changed) by anyone.") + digistuff.update_panel_formspec(pos,meta:get_string("text")) + else + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to unlock this panel.") + end + end +end + + +minetest.register_node("digistuff:panel", { + description = "Digilines Control Panel", + groups = {cracky=3}, + on_construct = function(pos) + local helpmsg = "Please set a channel." + digistuff.update_panel_formspec(pos,helpmsg) + minetest.get_meta(pos):set_int("locked",0) + end, + drawtype = "nodebox", + tiles = { + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_front.png" + }, + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } + } + }, + on_receive_fields = digistuff.panel_on_receive_fields, + digiline = + { + receptor = {}, + effector = { + action = digistuff.panel_on_digiline_receive + }, + }, +}) + +minetest.register_craft({ + output = "digistuff:panel", + recipe = { + {"","digistuff:button",""}, + {"digistuff:button","digilines:lcd","digistuff:button"}, + {"","digistuff:button",""} + } +}) diff --git a/digistuff/piezo.lua b/digistuff/piezo.lua new file mode 100644 index 0000000..f96e4a1 --- /dev/null +++ b/digistuff/piezo.lua @@ -0,0 +1,80 @@ +digistuff.sounds_playing = {} + +minetest.register_node("digistuff:piezo", { + description = "Digilines Piezoelectric Beeper", + groups = {cracky=3}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","field[channel;Channel;${channel}") + end, + on_destruct = function(pos) + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + end, + tiles = { + "digistuff_piezo_top.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png", + "digistuff_piezo_sides.png" + }, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + digiline = + { + receptor = {}, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if msg == "shortbeep" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + minetest.sound_play({name = "digistuff_piezo_short_single",gain = 0.2},{pos = pos,max_hear_distance = 16}) + elseif msg == "longbeep" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + minetest.sound_play({name = "digistuff_piezo_long_single",gain = 0.2},{pos = pos,max_hear_distance = 16}) + elseif msg == "fastrepeat" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_fast_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true}) + elseif msg == "slowrepeat" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + digistuff.sounds_playing[pos_hash] = minetest.sound_play({name = "digistuff_piezo_slow_repeat",gain = 0.2},{pos = pos,max_hear_distance = 16,loop = true}) + elseif msg == "stop" then + local pos_hash = minetest.hash_node_position(pos) + if digistuff.sounds_playing[pos_hash] then + minetest.sound_stop(digistuff.sounds_playing[pos_hash]) + digistuff.sounds_playing[pos_hash] = nil + end + end + end + }, + }, +}) diff --git a/digistuff/piston.lua b/digistuff/piston.lua new file mode 100644 index 0000000..b4ed655 --- /dev/null +++ b/digistuff/piston.lua @@ -0,0 +1,222 @@ +if not minetest.get_modpath("mesecons_mvps") then + minetest.log("error","mesecons_mvps is not installed - digilines piston will not be available!") + return +end + +local function extend(pos,node,max) + local meta = minetest.get_meta(pos):to_table() + local facedir = minetest.facedir_to_dir(node.param2) + local actiondir = vector.multiply(facedir,-1) + local ppos = vector.add(pos,actiondir) + local success,stack,oldstack = mesecon.mvps_push(ppos,actiondir,max) + if not success then return end + minetest.sound_play("digistuff_piston_extend",{pos = pos,max_hear_distance = 20,gain = 0.6}) + minetest.swap_node(pos,{name = "digistuff:piston_ext",param2 = node.param2}) + minetest.swap_node(ppos,{name = "digistuff:piston_pusher",param2 = node.param2}) + mesecon.mvps_process_stack(stack) + mesecon.mvps_move_objects(ppos,actiondir,oldstack) + minetest.get_meta(pos):from_table(meta) +end + +local function retract(pos,node,max,allsticky) + local facedir = minetest.facedir_to_dir(node.param2) + local actiondir = vector.multiply(facedir,-1) + local ppos = vector.add(pos,actiondir) + minetest.swap_node(pos,{name = "digistuff:piston",param2 = node.param2}) + if minetest.get_node(ppos).name == "digistuff:piston_pusher" then + minetest.remove_node(ppos) + end + minetest.sound_play("digistuff_piston_retract",{pos = pos,max_hear_distance = 20,gain = 0.6}) + minetest.check_for_falling(ppos) + if type(max) ~= "number" or max <= 0 then return end + local pullpos = vector.add(pos,vector.multiply(actiondir,2)) + local success,stack,oldstack + if allsticky then + success,stack,oldstack = mesecon.mvps_pull_all(pullpos,facedir,max) + else + success,stack,oldstack = mesecon.mvps_pull_single(pullpos,facedir,max) + end + if success then + mesecon.mvps_move_objects(pullpos,actiondir,oldstack,-1) + end +end + +minetest.register_node("digistuff:piston", { + description = "Digilines Piston", + groups = {cracky=3}, + paramtype2 = "facedir", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec","field[channel;Channel;${channel}") + end, + tiles = { + "digistuff_piston_sides.png^[transformR180", + "digistuff_piston_sides.png", + "digistuff_piston_sides.png^[transformR90", + "digistuff_piston_sides.png^[transformR270", + "digistuff_camera_pole.png", + "digistuff_camera_pole.png", + }, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + digiline = { + wire = { + rules = { + {x = 1, y = 0, z = 0}, + {x =-1, y = 0, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y =-1, z = 0}, + {x = 0, y = 0, z = 1}, + {x = 0, y = 0, z =-1}, + }, + }, + receptor = {}, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if msg == "extend" then + extend(pos,node,16) + elseif type(msg) == "table" and msg.action == "extend" then + local max = 16 + if type(msg.max) == "number" then + max = math.max(0,math.min(16,math.floor(msg.max))) + end + extend(pos,node,max) + end + end + }, + }, +}) + +minetest.register_node("digistuff:piston_ext", { + description = "Digilines Piston (extended state - you hacker you!)", + groups = {cracky = 3,not_in_creative_inventory = 1}, + paramtype2 = "facedir", + tiles = { + "digistuff_piston_sides.png^[transformR180", + "digistuff_piston_sides.png", + "digistuff_piston_sides.png^[transformR90", + "digistuff_piston_sides.png^[transformR270", + "digistuff_camera_pole.png", + "digistuff_camera_pole.png", + }, + drop = "digistuff:piston", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-0.3,0.5,0.5,0.5}, + {-0.2,-0.2,-0.5,0.2,0.2,-0.3}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-1.5,0.5,0.5,0.5}, + } + }, + on_rotate = function() return false end, + on_receive_fields = function(pos, formname, fields, sender) + local name = sender:get_player_name() + if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then + minetest.record_protection_violation(pos,name) + return + end + local meta = minetest.get_meta(pos) + if fields.channel then meta:set_string("channel",fields.channel) end + end, + after_dig_node = function(pos,node) + local pdir = vector.multiply(minetest.facedir_to_dir(node.param2),-1) + local ppos = vector.add(pos,pdir) + if minetest.get_node(ppos).name == "digistuff:piston_pusher" then + minetest.remove_node(ppos) + end + end, + digiline = { + wire = { + rules = { + {x = 1, y = 0, z = 0}, + {x =-1, y = 0, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y =-1, z = 0}, + {x = 0, y = 0, z = 1}, + {x = 0, y = 0, z =-1}, + }, + }, + receptor = {}, + effector = { + action = function(pos,node,channel,msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if msg == "retract" then + retract(pos,node) + elseif msg == "retract_sticky" then + retract(pos,node,16) + elseif type(msg) == "table" and msg.action == "retract" then + local max = 16 + if type(msg.max) == "number" then + max = math.max(0,math.min(16,math.floor(msg.max))) + elseif msg.max == nil then + max = 0 + end + retract(pos,node,max,msg.allsticky) + end + end + }, + }, +}) + +minetest.register_node("digistuff:piston_pusher", { + description = "Digilines Piston Pusher (you hacker you!)", + groups = {not_in_creative_inventory=1}, + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + tiles = { + "digistuff_piston_sides.png^[transformR180", + "digistuff_piston_sides.png", + "digistuff_piston_sides.png^[transformR90", + "digistuff_piston_sides.png^[transformR270", + "digistuff_camera_pole.png", + "digistuff_camera_pole.png", + }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5,-0.5,-0.5,0.5,0.5,-0.3}, + {-0.2,-0.2,-0.3,0.2,0.2,0.5}, + } + }, + selection_box = { + type = "fixed", + fixed = { + {0,0,0,0,0,0}, + } + }, + digiline = { + wire = { + rules = { + {x = 1, y = 0, z = 0}, + {x =-1, y = 0, z = 0}, + {x = 0, y = 1, z = 0}, + {x = 0, y =-1, z = 0}, + {x = 0, y = 0, z = 1}, + {x = 0, y = 0, z =-1}, + }, + }, + }, +}) + +mesecon.register_mvps_stopper("digistuff:piston_ext") +mesecon.register_mvps_stopper("digistuff:piston_pusher") diff --git a/digistuff/sounds/digistuff_piston_extend.ogg b/digistuff/sounds/digistuff_piston_extend.ogg Binary files differnew file mode 100644 index 0000000..2a855df --- /dev/null +++ b/digistuff/sounds/digistuff_piston_extend.ogg diff --git a/digistuff/sounds/digistuff_piston_retract.ogg b/digistuff/sounds/digistuff_piston_retract.ogg Binary files differnew file mode 100644 index 0000000..57f9342 --- /dev/null +++ b/digistuff/sounds/digistuff_piston_retract.ogg diff --git a/digistuff/textures/digistuff_piston_sides.png b/digistuff/textures/digistuff_piston_sides.png Binary files differnew file mode 100644 index 0000000..5475f50 --- /dev/null +++ b/digistuff/textures/digistuff_piston_sides.png diff --git a/digistuff/touchscreen.lua b/digistuff/touchscreen.lua new file mode 100644 index 0000000..5b3c5b7 --- /dev/null +++ b/digistuff/touchscreen.lua @@ -0,0 +1,279 @@ +digistuff.update_ts_formspec = function (pos) + local meta = minetest.get_meta(pos) + local fs = "size[10,8]".. + "background[0,0;0,0;digistuff_ts_bg.png;true]" + if meta:get_int("init") == 0 then + fs = fs.."field[3.75,3;3,1;channel;Channel;]".. + "button_exit[4,3.75;2,1;save;Save]" + else + local data = minetest.deserialize(meta:get_string("data")) or {} + for _,field in pairs(data) do + if field.type == "image" then + fs = fs..string.format("image[%s,%s;%s,%s;%s]",field.X,field.Y,field.W,field.H,field.texture_name) + elseif field.type == "field" then + fs = fs..string.format("field[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label,field.default) + elseif field.type == "pwdfield" then + fs = fs..string.format("pwdfield[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) + elseif field.type == "textarea" then + fs = fs..string.format("textarea[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label,field.default) + elseif field.type == "label" then + fs = fs..string.format("label[%s,%s;%s]",field.X,field.Y,field.label) + elseif field.type == "vertlabel" then + fs = fs..string.format("vertlabel[%s,%s;%s]",field.X,field.Y,field.label) + elseif field.type == "button" then + fs = fs..string.format("button[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) + elseif field.type == "button_exit" then + fs = fs..string.format("button_exit[%s,%s;%s,%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,field.label) + elseif field.type == "image_button" then + fs = fs..string.format("image_button[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.image,field.name,field.label) + elseif field.type == "image_button_exit" then + fs = fs..string.format("image_button_exit[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.image,field.name,field.label) + elseif field.type == "dropdown" then + local choices = "" + for _,i in ipairs(field.choices) do + if type(i) == "string" then + choices = choices..minetest.formspec_escape(i).."," + end + end + choices = string.sub(choices,1,-2) + fs = fs..string.format("dropdown[%s,%s;%s,%s;%s;%s;%s]",field.X,field.Y,field.W,field.H,field.name,choices,field.selected_id) + end + end + end + meta:set_string("formspec",fs) +end + +digistuff.ts_on_receive_fields = function (pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + local playername = sender:get_player_name() + local locked = meta:get_int("locked") == 1 + local can_bypass = minetest.check_player_privs(playername,{protection_bypass=true}) + local is_protected = minetest.is_protected(pos,playername) + if (locked and is_protected) and not can_bypass then + minetest.record_protection_violation(pos,playername) + minetest.chat_send_player(playername,"You are not authorized to use this screen.") + return + end + local init = meta:get_int("init") == 1 + if not init then + if fields.save then + meta:set_string("channel",fields.channel) + meta:set_int("init",1) + digistuff.update_ts_formspec(pos) + end + else + fields.clicker = sender:get_player_name() + digiline:receptor_send(pos, digiline.rules.default, setchan, fields) + end +end + +digistuff.process_command = function (meta, data, msg) + if msg.command == "clear" then + data = {} + elseif msg.command == "addimage" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.texture_name or type(msg.texture_name) ~= "string" then + return + end + local field = {type="image",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,texture_name=minetest.formspec_escape(msg.texture_name)} + table.insert(data,field) + elseif msg.command == "addfield" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label","default"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="field",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label),default=minetest.formspec_escape(msg.default)} + table.insert(data,field) + elseif msg.command == "addpwdfield" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="pwdfield",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addtextarea" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label","default"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="textarea",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label),default=minetest.formspec_escape(msg.default)} + table.insert(data,field) + elseif msg.command == "addlabel" then + for _,i in pairs({"X","Y"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.label or type(msg.label) ~= "string" then + return + end + local field = {type="label",X=msg.X,Y=msg.Y,label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addvertlabel" then + for _,i in pairs({"X","Y"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.label or type(msg.label) ~= "string" then + return + end + local field = {type="vertlabel",X=msg.X,Y=msg.Y,label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addbutton" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="button",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addbutton_exit" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="button_exit",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addimage_button" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"image","name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="image_button",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,image=minetest.formspec_escape(msg.image),name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "addimage_button_exit" then + for _,i in pairs({"X","Y","W","H"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + for _,i in pairs({"image","name","label"}) do + if not msg[i] or type(msg[i]) ~= "string" then + return + end + end + local field = {type="image_button_exit",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,image=minetest.formspec_escape(msg.image),name=minetest.formspec_escape(msg.name),label=minetest.formspec_escape(msg.label)} + table.insert(data,field) + elseif msg.command == "adddropdown" then + for _,i in pairs({"X","Y","W","H","selected_id"}) do + if not msg[i] or type(msg[i]) ~= "number" then + return + end + end + if not msg.name or type(msg.name) ~= "string" then + return + end + if not msg.choices or type(msg.choices) ~= "table" or #msg.choices < 1 then + return + end + local field = {type="dropdown",X=msg.X,Y=msg.Y,W=msg.W,H=msg.H,name=msg.name,selected_id=msg.selected_id,choices=msg.choices} + table.insert(data,field) + elseif msg.command == "lock" then + meta:set_int("locked",1) + elseif msg.command == "unlock" then + meta:set_int("locked",0) + end + return data +end + +digistuff.ts_on_digiline_receive = function (pos, node, channel, msg) + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") + if channel ~= setchan then return end + if type(msg) ~= "table" then return end + local data = minetest.deserialize(meta:get_string("data")) or {} + if msg.command then + data = digistuff.process_command(meta,data,msg) + else + for _,i in ipairs(msg) do + if i.command then + data = digistuff.process_command(meta,data,i) or data + end + end + end + meta:set_string("data",minetest.serialize(data)) + digistuff.update_ts_formspec(pos) +end + +minetest.register_node("digistuff:touchscreen", { + description = "Digilines Touchscreen", + groups = {cracky=3}, + on_construct = function(pos) + digistuff.update_ts_formspec(pos,true) + end, + drawtype = "nodebox", + tiles = { + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_panel_back.png", + "digistuff_ts_front.png" + }, + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + { -0.5, -0.5, 0.4, 0.5, 0.5, 0.5 } + } + }, + on_receive_fields = digistuff.ts_on_receive_fields, + digiline = + { + receptor = {}, + effector = { + action = digistuff.ts_on_digiline_receive + }, + }, +}) + +minetest.register_craft({ + output = "digistuff:touchscreen", + recipe = { + {"mesecons_luacontroller:luacontroller0000","default:glass","default:glass"}, + {"default:glass","digilines:lcd","default:glass"}, + {"default:glass","default:glass","default:glass"} + } +}) diff --git a/extranodes/init.lua b/extranodes/init.lua index 5d8b260..edc7e87 100644 --- a/extranodes/init.lua +++ b/extranodes/init.lua @@ -57,12 +57,6 @@ if minetest.get_modpath("moreblocks") then tiles={"technic_stainless_steel_block.png"}, }) - stairsplus:register_all("technic", "brass_block", "basic_materials:brass_block", { - description=S("Brass Block"), - groups={cracky=1, not_in_creative_inventory=1}, - tiles={"basic_materials_brass_block.png"}, - }) - function register_technic_stairs_alias(modname, origname, newmod, newname) minetest.register_alias(modname .. ":slab_" .. origname, newmod..":slab_" .. newname) minetest.register_alias(modname .. ":slab_" .. origname .. "_inverted", newmod..":slab_" .. newname .. "_inverted") @@ -199,7 +193,6 @@ end minetest.register_node(":technic:insulator_clip", iclip_def) minetest.register_node(":technic:insulator_clip_fencepost", iclipfence_def) -minetest.register_node(":technic:steel_strut_with_insulator_clip", sclip_def) minetest.register_craft({ output = "technic:insulator_clip", @@ -221,33 +214,35 @@ minetest.register_craft({ local steelmod = minetest.get_modpath("steel") -if steelmod then - minetest.register_craft({ - output = "technic:steel_strut_with_insulator_clip", - recipe = { - {"technic:insulator_clip_fencepost"}, - {"steel:strut_mount"} - } - }) +if streetsmod or steelmod then + minetest.register_node(":technic:steel_strut_with_insulator_clip", sclip_def) - minetest.register_craft({ - output = "technic:steel_strut_with_insulator_clip", - recipe = { - {"technic:insulator_clip_fencepost", "" }, - {"steel:strut", "default:steel_ingot" }, - } - }) + if steelmod then + minetest.register_craft({ + output = "technic:steel_strut_with_insulator_clip", + recipe = { + {"technic:insulator_clip_fencepost"}, + {"steel:strut_mount"} + } + }) -end + minetest.register_craft({ + output = "technic:steel_strut_with_insulator_clip", + recipe = { + {"technic:insulator_clip_fencepost", "" }, + {"steel:strut", "default:steel_ingot" }, + } + }) -if streetsmod then - minetest.register_craft({ - output = "technic:steel_strut_with_insulator_clip", - recipe = { - {"technic:insulator_clip_fencepost", "" }, - {"streets:steel_support", "default:steel_ingot" }, - } - }) + elseif streetsmod then + minetest.register_craft({ + output = "technic:steel_strut_with_insulator_clip", + recipe = { + {"technic:insulator_clip_fencepost", "" }, + {"streets:steel_support", "default:steel_ingot" }, + } + }) + end end if minetest.get_modpath("unifieddyes") then diff --git a/gloopblocks/init.lua b/gloopblocks/init.lua index 27af14a..52eeaa2 100644 --- a/gloopblocks/init.lua +++ b/gloopblocks/init.lua @@ -441,14 +441,6 @@ if minetest.get_modpath("moreblocks") then sunlight_propagates = true,
})
- stairsplus:register_all("gloopblocks", "cement", "basic_materials:cement_block", {
- description = S("Cement"),
- tiles = {"basic_materials_cement_block.png"},
- groups = {cracky=2, not_in_creative_inventory=1},
- sounds = default.node_sound_stone_defaults(),
- sunlight_propagates = true,
- })
-
stairsplus:register_all("gloopblocks", "pavement", "gloopblocks:pavement", {
description = S("Pavement"),
tiles = {"gloopblocks_pavement.png"},
diff --git a/homedecor/crafts.lua b/homedecor/crafts.lua index 68463a9..aaef1dd 100644 --- a/homedecor/crafts.lua +++ b/homedecor/crafts.lua @@ -1541,7 +1541,7 @@ minetest.register_craft( { recipe = { { "default:steel_ingot", "default:steel_ingot", "basic_materials:ic" }, { "default:steel_ingot", "bucket:bucket_water", "default:steel_ingot" }, - { "default:steel_ingot", "technic:motor", "default:steel_ingot" } + { "default:steel_ingot", "basic_materials:motor", "default:steel_ingot" } }, }) @@ -1558,7 +1558,7 @@ minetest.register_craft( { output = "homedecor:dryer", recipe = { { "default:steel_ingot", "default:steel_ingot", "basic_materials:ic" }, - { "default:steel_ingot", "bucket:bucket_empty", "technic:motor" }, + { "default:steel_ingot", "bucket:bucket_empty", "basic_materials:motor" }, { "default:steel_ingot", "basic_materials:heating_element", "default:steel_ingot" } }, }) @@ -1587,7 +1587,7 @@ minetest.register_craft( { output = "homedecor:dishwasher", recipe = { { "basic_materials:ic", "homedecor:fence_chainlink", "default:steel_ingot", }, - { "default:steel_ingot", "homedecor:shower_head", "technic:motor" }, + { "default:steel_ingot", "homedecor:shower_head", "basic_materials:motor" }, { "default:steel_ingot", "basic_materials:heating_element", "bucket:bucket_water" } }, }) @@ -1888,8 +1888,8 @@ minetest.register_craft({ output = "homedecor:air_conditioner", recipe = { { "default:steel_ingot", "building_blocks:grate", "default:steel_ingot" }, - { "default:steel_ingot", "technic:motor", "default:steel_ingot" }, - { "default:steel_ingot", "technic:motor", "default:steel_ingot" }, + { "default:steel_ingot", "basic_materials:motor", "default:steel_ingot" }, + { "default:steel_ingot", "basic_materials:motor", "default:steel_ingot" }, }, }) @@ -1905,7 +1905,7 @@ minetest.register_craft({ minetest.register_craft({ output = "homedecor:ceiling_fan", recipe = { - { "technic:motor" }, + { "basic_materials:motor" }, { "homedecor:fan_blades" }, { "homedecor:glowlight_small_cube" } } @@ -1989,7 +1989,7 @@ minetest.register_craft({ output = "homedecor:dvd_player 2", recipe = { { "", "basic_materials:plastic_sheet", "" }, - { "default:obsidian_glass", "technic:motor", "technic:motor" }, + { "default:obsidian_glass", "basic_materials:motor", "basic_materials:motor" }, { "default:mese_crystal_fragment", "basic_materials:ic", "basic_materials:energy_crystal_simple" }, }, }) diff --git a/moreblocks/CHANGELOG.md b/moreblocks/CHANGELOG.md index 2b9c5f2..53c4458 100644 --- a/moreblocks/CHANGELOG.md +++ b/moreblocks/CHANGELOG.md @@ -7,14 +7,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.2.0] - 2018-11-24 + ### Added +- Stairs+ nodes for `basic_materials`'s concrete, cement and brass blocks. - Listring add for circular saw. -- Stairs+: New API function: - `stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)` +- **Stairs+:** New API function + `stairsplus:register_custom_subset(subset, modname, subname, recipeitem, fields)`. ### Fixed +- The papyrus crafting recipe override is now properly applied over the + `default` mod's recipe. +- Centered wooden tiles are now craftable. - Wool Stairs+ nodes can no longer be used in crafting. - The circular saw can no longer replace items from the player's inventory when it is full. @@ -52,5 +58,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Initial versioned release. -[Unreleased]: https://github.com/minetest-mods/moreblocks/compare/v1.1.0...HEAD +[Unreleased]: https://github.com/minetest-mods/moreblocks/compare/v1.2.0...HEAD +[1.2.0]: https://github.com/minetest-mods/moreblocks/compare/v1.1.0...v1.2.0 [1.1.0]: https://github.com/minetest-mods/moreblocks/compare/v1.0.0...v1.1.0 diff --git a/moreblocks/LICENSE.md b/moreblocks/LICENSE.md index a3511ad..f68debf 100644 --- a/moreblocks/LICENSE.md +++ b/moreblocks/LICENSE.md @@ -1,6 +1,6 @@ # zlib license -Copyright (c) 2011-2017 Hugo Locurcio and contributors +Copyright (c) 2011-2018 Hugo Locurcio and contributors **This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.** diff --git a/moreblocks/README.md b/moreblocks/README.md index 6c37b74..33b9d6b 100644 --- a/moreblocks/README.md +++ b/moreblocks/README.md @@ -65,7 +65,7 @@ versions than 0.4.16 will generally not be fixed. ## License -Copyright © 2011-2017 Hugo Locurcio and contributors +Copyright © 2011-2018 Hugo Locurcio and contributors - More Blocks code is licensed under the zlib license, see [`LICENSE.md`](LICENSE.md) for details. diff --git a/moreblocks/aliases.lua b/moreblocks/aliases.lua index f1dbe84..59f5d5c 100644 --- a/moreblocks/aliases.lua +++ b/moreblocks/aliases.lua @@ -1,7 +1,7 @@ --[[ More Blocks: alias definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/circular_saw.lua b/moreblocks/circular_saw.lua index fe241e5..94e680e 100644 --- a/moreblocks/circular_saw.lua +++ b/moreblocks/circular_saw.lua @@ -1,7 +1,7 @@ --[[ More Blocks: circular saw -Copyright (c) 2011-2017 Hugo Locurcio, Sokomine and contributors. +Copyright (c) 2011-2018 Hugo Locurcio, Sokomine and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/config.lua b/moreblocks/config.lua index 8d49c3b..84dcaf2 100644 --- a/moreblocks/config.lua +++ b/moreblocks/config.lua @@ -1,7 +1,7 @@ --[[ More Blocks: configuration handling -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/crafting.lua b/moreblocks/crafting.lua index 5b14602..5fdd82f 100644 --- a/moreblocks/crafting.lua +++ b/moreblocks/crafting.lua @@ -1,7 +1,7 @@ --[[ More Blocks: crafting recipes -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/depends.txt b/moreblocks/depends.txt index e8ecf06..d27d8a5 100644 --- a/moreblocks/depends.txt +++ b/moreblocks/depends.txt @@ -3,3 +3,4 @@ intllib? stairs? farming? wool? +basic_materials? diff --git a/moreblocks/init.lua b/moreblocks/init.lua index c12f5e0..168768a 100644 --- a/moreblocks/init.lua +++ b/moreblocks/init.lua @@ -3,7 +3,7 @@ ** More Blocks ** By Calinou, with the help of ShadowNinja and VanessaE. -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. ===================================================================== --]] diff --git a/moreblocks/nodes.lua b/moreblocks/nodes.lua index efa1f94..f898068 100644 --- a/moreblocks/nodes.lua +++ b/moreblocks/nodes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: node definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/ownership.lua b/moreblocks/ownership.lua index c569ae7..eb1ae0e 100644 --- a/moreblocks/ownership.lua +++ b/moreblocks/ownership.lua @@ -1,7 +1,7 @@ --[[ More Blocks: ownership handling -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/redefinitions.lua b/moreblocks/redefinitions.lua index 437c2d3..fd24c80 100644 --- a/moreblocks/redefinitions.lua +++ b/moreblocks/redefinitions.lua @@ -1,7 +1,7 @@ --[[ More Blocks: redefinitions of default stuff -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/aliases.lua b/moreblocks/stairsplus/aliases.lua index a4d95f0..224dce7 100644 --- a/moreblocks/stairsplus/aliases.lua +++ b/moreblocks/stairsplus/aliases.lua @@ -1,7 +1,7 @@ --[[ More Blocks: alias definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/conversion.lua b/moreblocks/stairsplus/conversion.lua index 887f3e3..bc8e77e 100644 --- a/moreblocks/stairsplus/conversion.lua +++ b/moreblocks/stairsplus/conversion.lua @@ -1,7 +1,7 @@ --[[ More Blocks: conversion -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/init.lua b/moreblocks/stairsplus/init.lua index 4f3a17e..624b7c8 100644 --- a/moreblocks/stairsplus/init.lua +++ b/moreblocks/stairsplus/init.lua @@ -1,7 +1,7 @@ --[[ More Blocks: Stairs+ -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/microblocks.lua b/moreblocks/stairsplus/microblocks.lua index 22c20a3..dc8ddfd 100644 --- a/moreblocks/stairsplus/microblocks.lua +++ b/moreblocks/stairsplus/microblocks.lua @@ -1,7 +1,7 @@ --[[ More Blocks: microblock definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/panels.lua b/moreblocks/stairsplus/panels.lua index ac641d8..5e2bf7b 100644 --- a/moreblocks/stairsplus/panels.lua +++ b/moreblocks/stairsplus/panels.lua @@ -1,7 +1,7 @@ --[[ More Blocks: panel definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/recipes.lua b/moreblocks/stairsplus/recipes.lua index 56fcf68..ec908bd 100644 --- a/moreblocks/stairsplus/recipes.lua +++ b/moreblocks/stairsplus/recipes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: Stairs+ -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -440,4 +440,4 @@ stairsplus.register_recipes = function(category, alternate, modname, subname, re }) end end -end
\ No newline at end of file +end diff --git a/moreblocks/stairsplus/registrations.lua b/moreblocks/stairsplus/registrations.lua index dc89234..6262a6d 100644 --- a/moreblocks/stairsplus/registrations.lua +++ b/moreblocks/stairsplus/registrations.lua @@ -1,7 +1,7 @@ --[[ More Blocks: registrations -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] @@ -112,6 +112,36 @@ if minetest.get_modpath("wool") then end end +-- basic_materials, keeping the original other-mod-oriented names +-- for backwards compatibility + +if minetest.get_modpath("basic_materials") then + stairsplus:register_all("technic","concrete","basic_materials:concrete_block",{ + description = "Concrete", + tiles = {"basic_materials_concrete_block.png",}, + groups = {cracky=1, level=2, concrete=1}, + sounds = default.node_sound_stone_defaults(), + }) + + minetest.register_alias("prefab:concrete_stair","technic:stair_concrete") + minetest.register_alias("prefab:concrete_slab","technic:slab_concrete") + + stairsplus:register_all("gloopblocks", "cement", "basic_materials:cement_block", { + description = "Cement", + tiles = {"basic_materials_cement_block.png"}, + groups = {cracky=2, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("technic", "brass_block", "basic_materials:brass_block", { + description="Brass Block", + groups={cracky=1, not_in_creative_inventory=1}, + tiles={"basic_materials_brass_block.png"}, + }) + +end + -- Alias cuts of split_stone_tile_alt which was renamed checker_stone_tile. stairsplus:register_alias_all("moreblocks", "split_stone_tile_alt", "moreblocks", "checker_stone_tile") diff --git a/moreblocks/stairsplus/slabs.lua b/moreblocks/stairsplus/slabs.lua index 3fa119e..11618a2 100644 --- a/moreblocks/stairsplus/slabs.lua +++ b/moreblocks/stairsplus/slabs.lua @@ -1,7 +1,7 @@ --[[ More Blocks: slab definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/slopes.lua b/moreblocks/stairsplus/slopes.lua index 7b82733..63635eb 100644 --- a/moreblocks/stairsplus/slopes.lua +++ b/moreblocks/stairsplus/slopes.lua @@ -1,7 +1,7 @@ --[[ More Blocks: slope definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/moreblocks/stairsplus/stairs.lua b/moreblocks/stairsplus/stairs.lua index 5c38864..0ccf081 100644 --- a/moreblocks/stairsplus/stairs.lua +++ b/moreblocks/stairsplus/stairs.lua @@ -1,7 +1,7 @@ --[[ More Blocks: stair definitions -Copyright (c) 2011-2017 Hugo Locurcio and contributors. +Copyright (c) 2011-2018 Hugo Locurcio and contributors. Licensed under the zlib license. See LICENSE.md for more information. --]] diff --git a/pipeworks/autoplace_tubes.lua b/pipeworks/autoplace_tubes.lua index a3a6aee..40a041f 100644 --- a/pipeworks/autoplace_tubes.lua +++ b/pipeworks/autoplace_tubes.lua @@ -122,7 +122,7 @@ end -- when they are updated. function pipeworks.on_rotate(pos, node, user, mode, new_param2) node.param2 = new_param2 - minetest.set_node(pos, node) + minetest.swap_node(pos, node) pipeworks.scan_for_tube_objects(pos) return true end diff --git a/prefab_redo/depends.txt b/prefab_redo/depends.txt index b8def00..7af3d83 100644 --- a/prefab_redo/depends.txt +++ b/prefab_redo/depends.txt @@ -1,4 +1,3 @@ default doors basic_materials -moreblocks diff --git a/prefab_redo/init.lua b/prefab_redo/init.lua index 02d8652..7b28b84 100644 --- a/prefab_redo/init.lua +++ b/prefab_redo/init.lua @@ -5,8 +5,6 @@ minetest.register_alias("prefab:concrete","technic:concrete") minetest.register_alias("prefab:concrete_wall","prefab_redo:concrete_wall") minetest.register_alias("prefab:concrete_with_grass","prefab_redo:concrete_with_grass") -minetest.register_alias("prefab:concrete_stair","technic:stair_concrete") -minetest.register_alias("prefab:concrete_slab","technic:slab_concrete") minetest.register_alias("prefab:concrete_ladder","prefab_redo:concrete_ladder") minetest.register_alias("prefab:concrete_door_a","doors:door_concrete_a") minetest.register_alias("prefab:concrete_door_b","doors:door_concrete_b") @@ -17,26 +15,6 @@ minetest.register_alias("prefab:concrete_railing_corner","prefab_redo:concrete_r minetest.register_alias("prefab:concrete_catwalk","prefab_redo:concrete_catwalk") minetest.register_alias("prefab:concrete_bench","prefab_redo:concrete_bench") -stairsplus:register_all("technic","concrete","basic_materials:concrete_block",{ - description = "Concrete", - tiles = {"basic_materials_concrete_block.png",}, - groups = {cracky=1, level=2, concrete=1}, - sounds = default.node_sound_stone_defaults(), -}) - -stairsplus:register_all("technic","blast_resistant_concrete","technic:blast_resistant_concrete",{ - description = "Blast-resistant Concrete", - tiles = {"technic_blast_resistant_concrete_block.png",}, - groups = {cracky=1, level=3, concrete=1}, - sounds = default.node_sound_stone_defaults(), - on_blast = function(pos, intensity) - if intensity > 1 then - minetest.remove_node(pos) - minetest.add_item(pos, "technic:blast_resistant_concrete") - end - end, -}) - minetest.register_node("prefab_redo:concrete_with_grass", { description = "Concrete with Grass", sounds = default.node_sound_glass_defaults(), diff --git a/technic/crafts.lua b/technic/crafts.lua index 90bd2dd..3b17e6d 100644 --- a/technic/crafts.lua +++ b/technic/crafts.lua @@ -44,6 +44,12 @@ minetest.clear_craft({ output = "basic_materials:brass_ingot", }) +minetest.register_craft( { + type = "shapeless", + output = "basic_materials:brass_ingot 9", + recipe = { "basic_materials:brass_block" }, +}) + -- tubes crafting recipes minetest.register_craft({ diff --git a/technic/locale/de.txt b/technic/locale/de.txt index 855ec5a..69bcb3d 100644 --- a/technic/locale/de.txt +++ b/technic/locale/de.txt @@ -67,7 +67,6 @@ Disabled = %s Alloy Furnace = %s Legierungsofen %s Battery Box = %s Batteriebox %s Cable = %s Kabel -%s CNC Machine = %s CNC-Maschine %s Compressor = %s Kompressor %s Extractor = %s Extraktor %s Forcefield Emitter = %s Kraftfeld-Emitter @@ -121,41 +120,6 @@ Digging finished = Digging %d m above machine = Digging %d m below machine = -## CNC -Cylinder = Zylinder -Element Cross = Halbes Kreuzelement -Element Cross Double = Kreuzelement -Element Edge = Halbes Eckelement -Element Edge Double = Eckelement -Element End = Halbes Endelement -Element End Double = Endelement -Element Straight = Halbes aufrechtes Element -Element Straight Double = Aufrechtes Element -Element T = Halbes T-Element -Element T Double = T-Element -Horizontal Cylinder = Liegender Zylinder -One Curved Edge Block = Block mit einer abgerundeten Kante -Pyramid = Pyramide -Slope = Schraege -Slope Edge = Schraege mit Ecke -Slope Inner Edge = Schraege mit Innenecke -Slope Lying = Liegende Schraege -Slope Upside Down = Umgedrehte Schraege -Slope Upside Down Edge = Umgedrehte Schraege mit Ecke -Slope Upside Down Inner Edge = Umgedrehte Schraege mit Innenecke -Sphere = Kugel -Spike = Spitze -Stick = Stange -Two Curved Edge Block = Block mit zwei abgerundeten Kanten -Brick = Ziegel: -Cobble = Pflasterstein: -Dirt = Erde: -Leaves = Laub: -Sandstone = Sandstein: -Stone = Stein: -Tree = Baumstamm: -Wooden = Holz: - ## Grinder Recipes # $1: Name %s Dust = %sstaub diff --git a/technic/locale/es.txt b/technic/locale/es.txt index 7945d65..2c1cdca 100644 --- a/technic/locale/es.txt +++ b/technic/locale/es.txt @@ -63,7 +63,6 @@ Disabled = %s Alloy Furnace = Horno de Aleacion %s %s Battery Box = Caja de Bateria %s %s Cable = Cable %s -%s CNC Machine = Maquina CNC %s %s Compressor = Compresor %s %s Extractor = Extractor %s %s Forcefield Emitter = Emisor de Campo de Fuerza %s @@ -115,40 +114,6 @@ Digging finished = Digging %d m above machine = Digging %d m below machine = -## CNC Machine -Element Edge = Elemento Borde -Tree = Arbol -Element Cross Double = Elemento Cruz Doble -Spike = Pica -Element Edge Double = Elemento Borde Doble -Two Curved Edge Block = Dos Bloques de Borde Curvados -Pyramid = Piramide -Slope Upside Down Inner Edge = Borde Interno de Rampa Al Reves -Slope Upside Down Edge = Borde de Rampa Al Reves -Element Straight Double = Elemento Doble Recto -Sphere = Esfera -Element End Double = Doble Fin de Elemento -Element Straight = Recta de Elemento -Horizontal Cylinder = Cilindro Horizontal -Slope Inner Edge = Borde Interno de Rampa -One Curved Edge Block = Un Bloque de Borde Curvado -Element Cross = Cruce de Elementos -Stick = Varita -Element End = Fin de Elemento -Slope Lying = Rampa en Reposo -Slope Upside Down = Rampa Al Reves -Slope Edge = Borde de Rampa -Slope = Rampa -Element T = Elemento T -Cylinder = Cilindro -Cobble = Adoquines -Stone = Piedra -Brick = Ladrillo -Dirt = Tierra -Sandstone = Arenisca -Wooden = Madera -Leaves = Hojas - ## Grinder Recipes # $1: Name %s Dust = Polvo de %s diff --git a/technic/locale/it.txt b/technic/locale/it.txt index a092a53..18b0e4f 100644 --- a/technic/locale/it.txt +++ b/technic/locale/it.txt @@ -64,7 +64,6 @@ Disabled = Disabilitato %s Alloy Furnace = %s Fornace per leghe %s Battery Box = %s Box batterie %s Cable = Cavo %s -%s CNC Machine = Tornio CNC %s %s Compressor = Compressore %s %s Extractor = Estrattore %s %s Forcefield Emitter = Emettitore di campo di forza %s @@ -118,41 +117,6 @@ Digging finished = Scavo finito Digging %d m above machine = Scavo di %d m sopra la macchina Digging %d m below machine = Scavo di %d m sotto la macchina -## CNC -Cylinder = Cilindro -Element Cross = Elemento a croce -Element Cross Double = Elemento a croce doppio -Element Edge = Elemento bordo -Element Edge Double = Elemento bordo doppio -Element End = Elemento finale -Element End Double = Elemento finale doppio -Element Straight = Elemento dritto -Element Straight Double = Elemento dritto doppio -Element T = Elemento a T -Element T Double = Elemento a T doppio -Horizontal Cylinder = Cilindro orizzontale -One Curved Edge Block = Blocco con bordo curvo -Pyramid = Piramide -Slope = Inclinato -Slope Edge = Bordo inclinato -Slope Inner Edge = Bordo interno inclinato -Slope Lying = Pendenza bugiarda -Slope Upside Down = Pendenza capovolta -Slope Upside Down Edge = Bordo inclinato capovolto -Slope Upside Down Inner Edge = Bordo interno inclinato capovolto -Sphere = Sfera -Spike = Spuntone -Stick = Bastone -Two Curved Edge Block = Blocco con bordo a doppia curva -Brick = Mattone -Cobble = Ciottolato -Dirt = Terra -Leaves = Foglie -Sandstone = Arenaria -Stone = Pietra -Tree = Albero -Wooden = Legno - ## Grinder Recipes # $1: Name %s Dust = Polvere di %s diff --git a/technic/locale/template.txt b/technic/locale/template.txt index 0464241..f94ccda 100644 --- a/technic/locale/template.txt +++ b/technic/locale/template.txt @@ -71,7 +71,6 @@ Disabled = %s Alloy Furnace = %s Battery Box = %s Cable = -%s CNC Machine = %s Centrifuge = %s Compressor = %s Extractor = @@ -127,40 +126,6 @@ Digging %d m above machine = Digging %d m below machine = @1 (@2 @3 -> @4 @5) = -## CNC -Cylinder = -Element Cross = -Element Cross Double = -Element Edge = -Element Edge Double = -Element End = -Element End Double = -Element Straight = -Element Straight Double = -Element T = -Element T Double = -Horizontal Cylinder = -One Curved Edge Block = -Pyramid = -Slope = -Slope Edge = -Slope Inner Edge = -Slope Lying = -Slope Upside Down = -Slope Upside Down Edge = -Slope Upside Down Inner Edge = -Sphere = -Spike = -Stick = -Two Curved Edge Block = -Brick = -Cobble = -Dirt = -Leaves = -Sandstone = -Stone = -Tree = -Wooden = ## Grinder Recipes # $1: Name diff --git a/technic/machines/LV/cnc_nodes.lua b/technic/machines/LV/cnc_nodes.lua deleted file mode 100644 index 05be9af..0000000 --- a/technic/machines/LV/cnc_nodes.lua +++ /dev/null @@ -1,91 +0,0 @@ --- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS: ------------------------------------------------------------ - -local S = technic.getter - --- DIRT -------- -technic.cnc.register_all("default:dirt", - {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, - {"default_grass.png", "default_dirt.png", "default_grass.png"}, - S("Dirt")) --- WOOD -------- -technic.cnc.register_all("default:wood", - {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, - {"default_wood.png"}, - S("Wooden")) --- STONE --------- -technic.cnc.register_all("default:stone", - {cracky=3, not_in_creative_inventory=1}, - {"default_stone.png"}, - S("Stone")) --- COBBLE ---------- -technic.cnc.register_all("default:cobble", - {cracky=3, not_in_creative_inventory=1}, - {"default_cobble.png"}, - S("Cobble")) --- BRICK --------- -technic.cnc.register_all("default:brick", - {cracky=3, not_in_creative_inventory=1}, - {"default_brick.png"}, - S("Brick")) - --- SANDSTONE ------------- -technic.cnc.register_all("default:sandstone", - {crumbly=2, cracky=3, not_in_creative_inventory=1}, - {"default_sandstone.png"}, - S("Sandstone")) - --- LEAVES ---------- -technic.cnc.register_all("default:leaves", - {snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, - {"default_leaves.png"}, - S("Leaves")) --- TREE -------- -technic.cnc.register_all("default:tree", - {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1}, - {"default_tree.png"}, - S("Tree")) - --- WROUGHT IRON ---------------- -technic.cnc.register_all("default:steelblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_wrought_iron_block.png"}, - S("Wrought Iron")) - --- Bronze --------- -technic.cnc.register_all("default:bronzeblock", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"default_bronze_block.png"}, - S("Bronze")) - --- Stainless Steel --------- -technic.cnc.register_all("technic:stainless_steel_block", - {cracky=1, level=2, not_in_creative_inventory=1}, - {"technic_stainless_steel_block.png"}, - S("Stainless Steel")) - --- Marble ------------- -technic.cnc.register_all("technic:marble", - {cracky=3, not_in_creative_inventory=1}, - {"technic_marble.png"}, - S("Marble")) - --- Granite ------------- -technic.cnc.register_all("technic:granite", - {cracky=1, not_in_creative_inventory=1}, - {"technic_granite.png"}, - S("Granite")) - diff --git a/technic/machines/LV/init.lua b/technic/machines/LV/init.lua index 30523c9..fde684d 100644 --- a/technic/machines/LV/init.lua +++ b/technic/machines/LV/init.lua @@ -22,8 +22,3 @@ dofile(path.."/extractor.lua") dofile(path.."/compressor.lua") dofile(path.."/music_player.lua") - -dofile(path.."/cnc.lua") -dofile(path.."/cnc_api.lua") -dofile(path.."/cnc_nodes.lua") - diff --git a/technic/machines/register/cables.lua b/technic/machines/register/cables.lua index 1e8cee9..924128e 100644 --- a/technic/machines/register/cables.lua +++ b/technic/machines/register/cables.lua @@ -117,6 +117,19 @@ local function clear_networks(pos) end end +local function item_place_override_node(itemstack, placer, pointed, node) + -- Call the default on_place function with a fake itemstack + local temp_itemstack = ItemStack(itemstack) + temp_itemstack:set_name(node.name) + local original_count = temp_itemstack:get_count() + temp_itemstack = + minetest.item_place(temp_itemstack, placer, pointed, node.param2) or + temp_itemstack + -- Remove the same number of items from the real itemstack + itemstack:take_item(original_count - temp_itemstack:get_count()) + return itemstack +end + function technic.register_cable(tier, size) local ltier = string.lower(tier) cable_tier["technic:"..ltier.."_cable"] = tier @@ -228,11 +241,10 @@ function technic.register_cable(tier, size) num = xyz[((fine_pointed[bigger] < 0 and "-") or "") .. bigger] end end - minetest.set_node(pointed_thing.above, {name = "technic:"..ltier.."_cable_plate_"..num}) - if not (creative and creative.is_enabled_for(placer)) then - itemstack:take_item() - end - return itemstack + return item_place_override_node( + itemstack, placer, pointed_thing, + {name = "technic:"..ltier.."_cable_plate_"..num} + ) end else def.groups.not_in_creative_inventory = 1 diff --git a/technic/machines/LV/cnc.lua b/technic_cnc/cnc.lua index b8eb729..0e23f5a 100644 --- a/technic/machines/LV/cnc.lua +++ b/technic_cnc/cnc.lua @@ -7,18 +7,70 @@ -- I could imagine some form of API allowing modders to come with their own node -- box definitions and easily stuff it in the this machine for production. -local S = technic.getter +local S = technic_cnc.getter +local allow_metadata_inventory_put +local allow_metadata_inventory_take +local allow_metadata_inventory_move +local can_dig +local desc_tr = S("CNC Machine") -minetest.register_craft({ - output = 'technic:cnc', - recipe = { - {'default:glass', 'technic:diamond_drill_head', 'default:glass'}, - {'technic:control_logic_unit', 'technic:machine_casing', 'basic_materials:motor'}, - {'technic:carbon_steel_ingot', 'technic:lv_cable', 'technic:carbon_steel_ingot'}, - }, -}) +if technic_cnc.use_technic then + minetest.register_craft({ + output = 'technic:cnc', + recipe = { + {'default:glass', 'technic:diamond_drill_head', 'default:glass'}, + {'technic:control_logic_unit', 'technic:machine_casing', 'basic_materials:motor'}, + {'technic:carbon_steel_ingot', 'technic:lv_cable', 'technic:carbon_steel_ingot'}, + }, + }) + + allow_metadata_inventory_put = technic.machine_inventory_put + allow_metadata_inventory_take = technic.machine_inventory_take + allow_metadata_inventory_move = technic.machine_inventory_move + can_dig = technic.machine_can_dig + desc_tr = S("%s CNC Machine"):format("LV") +else + minetest.register_craft({ + output = 'technic:cnc', + recipe = { + {'default:glass', 'default:diamond', 'default:glass'}, + {'basic_materials:ic', 'default:steelblock', 'basic_materials:motor'}, + {'default:steel_ingot', 'default:mese', 'default:steel_ingot'}, + }, + }) + + 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_count() + end + + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() + end + allow_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() + end + + can_dig = function(pos, player) + if player and minetest.is_protected(pos, player:get_player_name()) then return false end + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("dst") + and inv:is_empty("src") + and default.can_interact_with_node(player, pos) + end +end local shape = {} local onesize_products = { @@ -40,7 +92,7 @@ local onesize_products = { twocurvededge = 1, } local twosize_products = { - element_straight = 4, + element_straight = 2, element_end = 2, element_cross = 1, element_t = 1, @@ -90,30 +142,32 @@ local cnc_formspec = "listring[current_name;src]".. "listring[current_player;main]" -local size = 1; - -- The form handler is declared here because we need it in both the inactive and active modes -- in order to be able to change programs wile it is running. local function form_handler(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + -- REGISTER MILLING PROGRAMS AND OUTPUTS: ------------------------------------------ -- Program for half/full size if fields["full"] then - size = 1 + meta:set_int("size", 1) return end if fields["half"] then - size = 2 + meta:set_int("size", 2) return end -- Resolve the node name and the number of items to make - local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local inputstack = inv:get_stack("src", 1) local inputname = inputstack:get_name() local multiplier = 0 + local size = meta:get_int("size") + if size < 1 then size = 1 end + for k, _ in pairs(fields) do -- Set a multipier for the half/full size capable blocks if twosize_products[k] ~= nil then @@ -139,7 +193,19 @@ local function form_handler(pos, formname, fields, sender) break end end - return + + if not technic_cnc.use_technic then + local result = meta:get_string("cnc_product") + + if not inv:is_empty("src") + and minetest.registered_nodes[result] + and inv:room_for_item("dst", result) then + local srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + inv:add_item("dst", result.." "..meta:get_int("cnc_multiplier")) + end + end end -- Action code performing the transformation @@ -147,7 +213,7 @@ local run = function(pos, node) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local eu_input = meta:get_int("LV_EU_input") - local machine_name = S("%s CNC Machine"):format("LV") + local machine_name = desc_tr local machine_node = "technic:cnc" local demand = 450 @@ -181,8 +247,8 @@ local run = function(pos, node) end -- The actual block inactive state -minetest.register_node("technic:cnc", { - description = S("%s CNC Machine"):format("LV"), +minetest.register_node(":technic:cnc", { + description = desc_tr, tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"}, groups = {cracky=2, technic_machine=1, technic_lv=1}, @@ -191,40 +257,44 @@ minetest.register_node("technic:cnc", { legacy_facedir_simple = true, on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("infotext", S("%s CNC Machine"):format("LV")) + meta:set_string("infotext", desc_tr) meta:set_float("technic_power_machine", 1) meta:set_string("formspec", cnc_formspec) local inv = meta:get_inventory() inv:set_size("src", 1) inv:set_size("dst", 4) end, - can_dig = technic.machine_can_dig, - allow_metadata_inventory_put = technic.machine_inventory_put, - allow_metadata_inventory_take = technic.machine_inventory_take, - allow_metadata_inventory_move = technic.machine_inventory_move, + can_dig = can_dig, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + allow_metadata_inventory_move = allow_metadata_inventory_move, on_receive_fields = form_handler, - technic_run = run, + technic_run = technic_cnc.use_technic and run, }) -- Active state block -minetest.register_node("technic:cnc_active", { - description = S("%s CNC Machine"):format("LV"), - tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", - "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"}, - groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, - connect_sides = {"bottom", "back", "left", "right"}, - paramtype2 = "facedir", - drop = "technic:cnc", - legacy_facedir_simple = true, - can_dig = technic.machine_can_dig, - allow_metadata_inventory_put = technic.machine_inventory_put, - allow_metadata_inventory_take = technic.machine_inventory_take, - allow_metadata_inventory_move = technic.machine_inventory_move, - on_receive_fields = form_handler, - technic_run = run, - technic_disabled_machine_name = "technic:cnc", -}) +if technic_cnc.use_technic then -technic.register_machine("LV", "technic:cnc", technic.receiver) -technic.register_machine("LV", "technic:cnc_active", technic.receiver) + minetest.register_node(":technic:cnc_active", { + description = desc_tr, + tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png", + "technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"}, + groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1}, + connect_sides = {"bottom", "back", "left", "right"}, + paramtype2 = "facedir", + drop = "technic:cnc", + legacy_facedir_simple = true, + can_dig = can_dig, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + allow_metadata_inventory_move = allow_metadata_inventory_move, + on_receive_fields = form_handler, + technic_run = run, + technic_disabled_machine_name = "technic:cnc", + }) + technic.register_machine("LV", "technic:cnc", technic.receiver) + technic.register_machine("LV", "technic:cnc_active", technic.receiver) +else + minetest.register_alias("technic:cnc_active", "technic:cnc") +end diff --git a/technic/machines/LV/cnc_api.lua b/technic_cnc/cnc_api.lua index f5aae5c..c33ef49 100644 --- a/technic/machines/LV/cnc_api.lua +++ b/technic_cnc/cnc_api.lua @@ -1,16 +1,14 @@ -- API for the technic CNC machine -- Again code is adapted from the NonCubic Blocks MOD v1.4 by yves_de_beck -local S = technic.getter - -technic.cnc = {} +local S = technic_cnc.getter -- REGISTER NONCUBIC FORMS, CREATE MODELS AND RECIPES: ------------------------------------------------------ -- Define slope boxes for the various nodes ------------------------------------------- -technic.cnc.programs = { +technic_cnc.programs = { { suffix = "technic_cnc_stick", model = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}, desc = S("Stick") @@ -83,7 +81,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_oblate_spheroid", - model = "technic_oblate_spheroid.obj", + model = "technic_cnc_oblate_spheroid.obj", desc = S("Oblate spheroid"), cbox = { type = "fixed", @@ -96,32 +94,32 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_sphere", - model = "technic_sphere.obj", + model = "technic_cnc_sphere.obj", desc = S("Sphere") }, { suffix = "technic_cnc_cylinder_horizontal", - model = "technic_cylinder_horizontal.obj", + model = "technic_cnc_cylinder_horizontal.obj", desc = S("Horizontal Cylinder") }, { suffix = "technic_cnc_cylinder", - model = "technic_cylinder.obj", + model = "technic_cnc_cylinder.obj", desc = S("Cylinder") }, { suffix = "technic_cnc_twocurvededge", - model = "technic_two_curved_edge.obj", + model = "technic_cnc_two_curved_edge.obj", desc = S("Two Curved Edge/Corner Block") }, { suffix = "technic_cnc_onecurvededge", - model = "technic_one_curved_edge.obj", + model = "technic_cnc_one_curved_edge.obj", desc = S("One Curved Edge Block") }, { suffix = "technic_cnc_spike", - model = "technic_pyramid_spike.obj", + model = "technic_cnc_pyramid_spike.obj", desc = S("Spike"), cbox = { type = "fixed", @@ -135,7 +133,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_pyramid", - model = "technic_pyramid.obj", + model = "technic_cnc_pyramid.obj", desc = S("Pyramid"), cbox = { type = "fixed", @@ -149,7 +147,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_slope_inner_edge_upsdown", - model = "technic_innercorner_upsdown.obj", + model = "technic_cnc_innercorner_upsdown.obj", desc = S("Slope Upside Down Inner Edge/Corner"), sbox = { type = "fixed", @@ -170,7 +168,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_slope_edge_upsdown", - model = "technic_outercorner_upsdown.obj", + model = "technic_cnc_outercorner_upsdown.obj", desc = S("Slope Upside Down Outer Edge/Corner"), cbox = { type = "fixed", @@ -184,7 +182,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_slope_inner_edge", - model = "technic_innercorner.obj", + model = "technic_cnc_innercorner.obj", desc = S("Slope Inner Edge/Corner"), sbox = { type = "fixed", @@ -205,7 +203,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_slope_edge", - model = "technic_outercorner.obj", + model = "technic_cnc_outercorner.obj", desc = S("Slope Outer Edge/Corner"), cbox = { type = "fixed", @@ -219,7 +217,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_slope_upsdown", - model = "technic_slope_upsdown.obj", + model = "technic_cnc_slope_upsdown.obj", desc = S("Slope Upside Down"), cbox = { type = "fixed", @@ -233,7 +231,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_slope_lying", - model = "technic_slope_horizontal.obj", + model = "technic_cnc_slope_horizontal.obj", desc = S("Slope Lying"), cbox = { type = "fixed", @@ -247,7 +245,7 @@ technic.cnc.programs = { }, { suffix = "technic_cnc_slope", - model = "technic_slope.obj", + model = "technic_cnc_slope.obj", desc = S("Slope"), cbox = { type = "fixed", @@ -263,7 +261,7 @@ technic.cnc.programs = { } -- Allow disabling certain programs for some node. Default is allowing all types for all nodes -technic.cnc.programs_disable = { +technic_cnc.programs_disable = { -- ["default:brick"] = {"technic_cnc_stick"}, -- Example: Disallow the stick for brick -- ... ["default:dirt"] = {"technic_cnc_oblate_spheroid", "technic_cnc_slope_upsdown", "technic_cnc_edge", @@ -273,7 +271,7 @@ technic.cnc.programs_disable = { } -- Generic function for registering all the different node types -function technic.cnc.register_program(recipeitem, suffix, model, groups, images, description, cbox, sbox) +function technic_cnc.register_program(recipeitem, suffix, model, groups, images, description, cbox, sbox) local dtype local nodeboxdef @@ -308,12 +306,12 @@ function technic.cnc.register_program(recipeitem, suffix, model, groups, images, end -- function to iterate over all the programs the CNC machine knows -function technic.cnc.register_all(recipeitem, groups, images, description) - for _, data in ipairs(technic.cnc.programs) do +function technic_cnc.register_all(recipeitem, groups, images, description) + for _, data in ipairs(technic_cnc.programs) do -- Disable node creation for disabled node types for some material local do_register = true - if technic.cnc.programs_disable[recipeitem] ~= nil then - for __, disable in ipairs(technic.cnc.programs_disable[recipeitem]) do + if technic_cnc.programs_disable[recipeitem] ~= nil then + for __, disable in ipairs(technic_cnc.programs_disable[recipeitem]) do if disable == data.suffix then do_register = false end @@ -321,49 +319,49 @@ function technic.cnc.register_all(recipeitem, groups, images, description) end -- Create the node if it passes the test if do_register then - technic.cnc.register_program(recipeitem, data.suffix, data.model, + technic_cnc.register_program(recipeitem, data.suffix, data.model, groups, images, description.." "..data.desc, data.cbox, data.sbox) end end end --- REGISTER NEW TECHNIC_CNC_API's PART 2: technic.cnc..register_element_end(subname, recipeitem, groups, images, desc_element_xyz) +-- REGISTER NEW TECHNIC_CNC_API's PART 2: technic_cnc..register_element_end(subname, recipeitem, groups, images, desc_element_xyz) ----------------------------------------------------------------------------------------------------------------------- -function technic.cnc.register_slope_edge_etc(recipeitem, groups, images, desc_slope, desc_slope_lying, desc_slope_upsdown, desc_slope_edge, desc_slope_inner_edge, desc_slope_upsdwn_edge, desc_slope_upsdwn_inner_edge, desc_pyramid, desc_spike, desc_onecurvededge, desc_twocurvededge, desc_cylinder, desc_cylinder_horizontal, desc_spheroid, desc_element_straight, desc_element_edge, desc_element_t, desc_element_cross, desc_element_end) - - technic.cnc.register_slope(recipeitem, groups, images, desc_slope) - technic.cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying) - technic.cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown) - technic.cnc.register_slope_edge(recipeitem, groups, images, desc_slope_edge) - technic.cnc.register_slope_inner_edge(recipeitem, groups, images, desc_slope_inner_edge) - technic.cnc.register_slope_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_edge) - technic.cnc.register_slope_inner_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_inner_edge) - technic.cnc.register_pyramid(recipeitem, groups, images, desc_pyramid) - technic.cnc.register_spike(recipeitem, groups, images, desc_spike) - technic.cnc.register_onecurvededge(recipeitem, groups, images, desc_onecurvededge) - technic.cnc.register_twocurvededge(recipeitem, groups, images, desc_twocurvededge) - technic.cnc.register_cylinder(recipeitem, groups, images, desc_cylinder) - technic.cnc.register_cylinder_horizontal(recipeitem, groups, images, desc_cylinder_horizontal) - technic.cnc.register_spheroid(recipeitem, groups, images, desc_spheroid) - technic.cnc.register_element_straight(recipeitem, groups, images, desc_element_straight) - technic.cnc.register_element_edge(recipeitem, groups, images, desc_element_edge) - technic.cnc.register_element_t(recipeitem, groups, images, desc_element_t) - technic.cnc.register_element_cross(recipeitem, groups, images, desc_element_cross) - technic.cnc.register_element_end(recipeitem, groups, images, desc_element_end) +function technic_cnc.register_slope_edge_etc(recipeitem, groups, images, desc_slope, desc_slope_lying, desc_slope_upsdown, desc_slope_edge, desc_slope_inner_edge, desc_slope_upsdwn_edge, desc_slope_upsdwn_inner_edge, desc_pyramid, desc_spike, desc_onecurvededge, desc_twocurvededge, desc_cylinder, desc_cylinder_horizontal, desc_spheroid, desc_element_straight, desc_element_edge, desc_element_t, desc_element_cross, desc_element_end) + + technic_cnc.register_slope(recipeitem, groups, images, desc_slope) + technic_cnc.register_slope_lying(recipeitem, groups, images, desc_slope_lying) + technic_cnc.register_slope_upsdown(recipeitem, groups, images, desc_slope_upsdown) + technic_cnc.register_slope_edge(recipeitem, groups, images, desc_slope_edge) + technic_cnc.register_slope_inner_edge(recipeitem, groups, images, desc_slope_inner_edge) + technic_cnc.register_slope_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_edge) + technic_cnc.register_slope_inner_edge_upsdown(recipeitem, groups, images, desc_slope_upsdwn_inner_edge) + technic_cnc.register_pyramid(recipeitem, groups, images, desc_pyramid) + technic_cnc.register_spike(recipeitem, groups, images, desc_spike) + technic_cnc.register_onecurvededge(recipeitem, groups, images, desc_onecurvededge) + technic_cnc.register_twocurvededge(recipeitem, groups, images, desc_twocurvededge) + technic_cnc.register_cylinder(recipeitem, groups, images, desc_cylinder) + technic_cnc.register_cylinder_horizontal(recipeitem, groups, images, desc_cylinder_horizontal) + technic_cnc.register_spheroid(recipeitem, groups, images, desc_spheroid) + technic_cnc.register_element_straight(recipeitem, groups, images, desc_element_straight) + technic_cnc.register_element_edge(recipeitem, groups, images, desc_element_edge) + technic_cnc.register_element_t(recipeitem, groups, images, desc_element_t) + technic_cnc.register_element_cross(recipeitem, groups, images, desc_element_cross) + technic_cnc.register_element_end(recipeitem, groups, images, desc_element_end) end -- REGISTER STICKS: noncubic.register_xyz(recipeitem, groups, images, desc_element_xyz) ------------------------------------------------------------------------------------------------------------ -function technic.cnc.register_stick_etc(recipeitem, groups, images, desc_stick) - technic.cnc.register_stick(recipeitem, groups, images, desc_stick) +function technic_cnc.register_stick_etc(recipeitem, groups, images, desc_stick) + technic_cnc.register_stick(recipeitem, groups, images, desc_stick) end -function technic.cnc.register_elements(recipeitem, groups, images, desc_element_straight_double, desc_element_edge_double, desc_element_t_double, desc_element_cross_double, desc_element_end_double) - technic.cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double) - technic.cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double) - technic.cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double) - technic.cnc.register_element_cross_double(recipeitem, groups, images, desc_element_cross_double) - technic.cnc.register_element_end_double(recipeitem, groups, images, desc_element_end_double) +function technic_cnc.register_elements(recipeitem, groups, images, desc_element_straight_double, desc_element_edge_double, desc_element_t_double, desc_element_cross_double, desc_element_end_double) + technic_cnc.register_element_straight_double(recipeitem, groups, images, desc_element_straight_double) + technic_cnc.register_element_edge_double(recipeitem, groups, images, desc_element_edge_double) + technic_cnc.register_element_t_double(recipeitem, groups, images, desc_element_t_double) + technic_cnc.register_element_cross_double(recipeitem, groups, images, desc_element_cross_double) + technic_cnc.register_element_end_double(recipeitem, groups, images, desc_element_end_double) end diff --git a/technic_cnc/cnc_materials.lua b/technic_cnc/cnc_materials.lua new file mode 100644 index 0000000..e63c792 --- /dev/null +++ b/technic_cnc/cnc_materials.lua @@ -0,0 +1,131 @@ +-- REGISTER MATERIALS AND PROPERTIES FOR NONCUBIC ELEMENTS: +----------------------------------------------------------- + +local S = technic_cnc.getter + +-- DIRT +------- +technic_cnc.register_all("default:dirt", + {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, + {"default_dirt.png"}, + S("Dirt")) +-- (DIRT WITH) GRASS +-------------------- +technic_cnc.register_all("default:dirt_with_grass", + {snappy=2,choppy=2,oddly_breakable_by_hand=3,not_in_creative_inventory=1}, + {"default_grass.png"}, + S("Grassy dirt")) +-- WOOD +------- +technic_cnc.register_all("default:wood", + {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1}, + {"default_wood.png"}, + S("Wooden")) +-- STONE +-------- +technic_cnc.register_all("default:stone", + {cracky=3, not_in_creative_inventory=1}, + {"default_stone.png"}, + S("Stone")) +-- COBBLE +--------- +technic_cnc.register_all("default:cobble", + {cracky=3, not_in_creative_inventory=1}, + {"default_cobble.png"}, + S("Cobble")) +-- BRICK +-------- +technic_cnc.register_all("default:brick", + {cracky=3, not_in_creative_inventory=1}, + {"default_brick.png"}, + S("Brick")) + +-- SANDSTONE +------------ +technic_cnc.register_all("default:sandstone", + {crumbly=2, cracky=3, not_in_creative_inventory=1}, + {"default_sandstone.png"}, + S("Sandstone")) + +-- LEAVES +--------- +technic_cnc.register_all("default:leaves", + {snappy=2, choppy=2, oddly_breakable_by_hand=3, not_in_creative_inventory=1}, + {"default_leaves.png"}, + S("Leaves")) +-- TREE +------- +technic_cnc.register_all("default:tree", + {snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, wood=1, not_in_creative_inventory=1}, + {"default_tree.png"}, + S("Tree")) + +-- Bronze +-------- +technic_cnc.register_all("default:bronzeblock", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"default_bronze_block.png"}, + S("Bronze")) + + +local steeltex = "default_steel_block.png" +local steelname = "Steel" + +if technic_cnc.technic_modpath then + steeltex = "technic_wrought_iron_block.png" + steelname = "Wrought Iron" + + -- Stainless Steel + -------- + technic_cnc.register_all("technic:stainless_steel_block", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"technic_stainless_steel_block.png"}, + S("Stainless Steel")) + + -- Marble + ------------ + technic_cnc.register_all("technic:marble", + {cracky=3, not_in_creative_inventory=1}, + {"technic_marble.png"}, + S("Marble")) + + -- Granite + ------------ + technic_cnc.register_all("technic:granite", + {cracky=1, not_in_creative_inventory=1}, + {"technic_granite.png"}, + S("Granite")) + + -- Blast-resistant concrete + --------------------------- + + technic_cnc.register_all("technic:blast_resistant_concrete", + {cracky=2, level=2, not_in_creative_inventory=1}, + {"technic_blast_resistant_concrete_block.png"}, + S("Blast-resistant concrete")) +end + +-- STEEL +--------------- +technic_cnc.register_all("default:steelblock", + {cracky=1, level=2, not_in_creative_inventory=1}, + {steeltex}, + S(steelname)) + +-- CONCRETE AND CEMENT +---------------------- + +technic_cnc.register_all("basic_materials:concrete_block", + {cracky=2, level=2, not_in_creative_inventory=1}, + {"basic_materials_concrete_block.png"}, + S("Concrete")) + +technic_cnc.register_all("basic_materials:cement_block", + {cracky=2, level=2, not_in_creative_inventory=1}, + {"basic_materials_cement_block.png"}, + S("Cement")) + +technic_cnc.register_all("basic_materials:brass_block", + {cracky=1, level=2, not_in_creative_inventory=1}, + {"basic_materials_brass_block.png"}, + S("Brass block")) diff --git a/technic_cnc/depends.txt b/technic_cnc/depends.txt new file mode 100644 index 0000000..bdaa161 --- /dev/null +++ b/technic_cnc/depends.txt @@ -0,0 +1,3 @@ +default +basic_materials +technic? diff --git a/technic_cnc/init.lua b/technic_cnc/init.lua new file mode 100644 index 0000000..3c4da3e --- /dev/null +++ b/technic_cnc/init.lua @@ -0,0 +1,18 @@ +local modpath = minetest.get_modpath("technic_cnc") + +technic_cnc = {} + +technic_cnc.technic_modpath = minetest.get_modpath("technic") + +technic_cnc.use_technic = technic_cnc.technic_modpath + and minetest.settings:get_bool("technic_cnc_use_technic") ~= false + +if rawget(_G, "intllib") then + technic_cnc.getter = intllib.Getter() +else + technic_cnc.getter = function(s,a,...)if a==nil then return s end a={a,...}return s:gsub("(@?)@(%(?)(%d+)(%)?)",function(e,o,n,c)if e==""then return a[tonumber(n)]..(o==""and c or"")else return"@"..o..n..c end end) end +end + +dofile(modpath.."/cnc.lua") +dofile(modpath.."/cnc_api.lua") +dofile(modpath.."/cnc_materials.lua") diff --git a/technic_cnc/locale/de.txt b/technic_cnc/locale/de.txt new file mode 100644 index 0000000..8b4e5ff --- /dev/null +++ b/technic_cnc/locale/de.txt @@ -0,0 +1,36 @@ +## CNC +CNC Machine = CNC-Maschine +%s CNC Machine = %s CNC-Maschine +Cylinder = Zylinder +Element Cross = Halbes Kreuzelement +Element Cross Double = Kreuzelement +Element Edge = Halbes Eckelement +Element Edge Double = Eckelement +Element End = Halbes Endelement +Element End Double = Endelement +Element Straight = Halbes aufrechtes Element +Element Straight Double = Aufrechtes Element +Element T = Halbes T-Element +Element T Double = T-Element +Horizontal Cylinder = Liegender Zylinder +One Curved Edge Block = Block mit einer abgerundeten Kante +Pyramid = Pyramide +Slope = Schraege +Slope Edge = Schraege mit Ecke +Slope Inner Edge = Schraege mit Innenecke +Slope Lying = Liegende Schraege +Slope Upside Down = Umgedrehte Schraege +Slope Upside Down Edge = Umgedrehte Schraege mit Ecke +Slope Upside Down Inner Edge = Umgedrehte Schraege mit Innenecke +Sphere = Kugel +Spike = Spitze +Stick = Stange +Two Curved Edge Block = Block mit zwei abgerundeten Kanten +Brick = Ziegel: +Cobble = Pflasterstein: +Dirt = Erde: +Leaves = Laub: +Sandstone = Sandstein: +Stone = Stein: +Tree = Baumstamm: +Wooden = Holz: diff --git a/technic_cnc/locale/es.txt b/technic_cnc/locale/es.txt new file mode 100644 index 0000000..f18fdfa --- /dev/null +++ b/technic_cnc/locale/es.txt @@ -0,0 +1,35 @@ +## CNC +CNC Machine = Maquina CNC +%s CNC Machine = Maquina CNC %s +Element Edge = Elemento Borde +Tree = Arbol +Element Cross Double = Elemento Cruz Doble +Spike = Pica +Element Edge Double = Elemento Borde Doble +Two Curved Edge Block = Dos Bloques de Borde Curvados +Pyramid = Piramide +Slope Upside Down Inner Edge = Borde Interno de Rampa Al Reves +Slope Upside Down Edge = Borde de Rampa Al Reves +Element Straight Double = Elemento Doble Recto +Sphere = Esfera +Element End Double = Doble Fin de Elemento +Element Straight = Recta de Elemento +Horizontal Cylinder = Cilindro Horizontal +Slope Inner Edge = Borde Interno de Rampa +One Curved Edge Block = Un Bloque de Borde Curvado +Element Cross = Cruce de Elementos +Stick = Varita +Element End = Fin de Elemento +Slope Lying = Rampa en Reposo +Slope Upside Down = Rampa Al Reves +Slope Edge = Borde de Rampa +Slope = Rampa +Element T = Elemento T +Cylinder = Cilindro +Cobble = Adoquines +Stone = Piedra +Brick = Ladrillo +Dirt = Tierra +Sandstone = Arenisca +Wooden = Madera +Leaves = Hojas diff --git a/technic_cnc/locale/it.txt b/technic_cnc/locale/it.txt new file mode 100644 index 0000000..e50fd74 --- /dev/null +++ b/technic_cnc/locale/it.txt @@ -0,0 +1,36 @@ +## CNC +CNC Machine = Tornio CNC +%s CNC Machine = Tornio CNC %s +Cylinder = Cilindro +Element Cross = Elemento a croce +Element Cross Double = Elemento a croce doppio +Element Edge = Elemento bordo +Element Edge Double = Elemento bordo doppio +Element End = Elemento finale +Element End Double = Elemento finale doppio +Element Straight = Elemento dritto +Element Straight Double = Elemento dritto doppio +Element T = Elemento a T +Element T Double = Elemento a T doppio +Horizontal Cylinder = Cilindro orizzontale +One Curved Edge Block = Blocco con bordo curvo +Pyramid = Piramide +Slope = Inclinato +Slope Edge = Bordo inclinato +Slope Inner Edge = Bordo interno inclinato +Slope Lying = Pendenza bugiarda +Slope Upside Down = Pendenza capovolta +Slope Upside Down Edge = Bordo inclinato capovolto +Slope Upside Down Inner Edge = Bordo interno inclinato capovolto +Sphere = Sfera +Spike = Spuntone +Stick = Bastone +Two Curved Edge Block = Blocco con bordo a doppia curva +Brick = Mattone +Cobble = Ciottolato +Dirt = Terra +Leaves = Foglie +Sandstone = Arenaria +Stone = Pietra +Tree = Albero +Wooden = Legno diff --git a/technic_cnc/locale/template.txt b/technic_cnc/locale/template.txt new file mode 100644 index 0000000..bf3cb08 --- /dev/null +++ b/technic_cnc/locale/template.txt @@ -0,0 +1,36 @@ +## CNC +CNC Machine = +%s CNC Machine = +Cylinder = +Element Cross = +Element Cross Double = +Element Edge = +Element Edge Double = +Element End = +Element End Double = +Element Straight = +Element Straight Double = +Element T = +Element T Double = +Horizontal Cylinder = +One Curved Edge Block = +Pyramid = +Slope = +Slope Edge = +Slope Inner Edge = +Slope Lying = +Slope Upside Down = +Slope Upside Down Edge = +Slope Upside Down Inner Edge = +Sphere = +Spike = +Stick = +Two Curved Edge Block = +Brick = +Cobble = +Dirt = +Leaves = +Sandstone = +Stone = +Tree = +Wooden = diff --git a/technic/models/technic_cylinder.obj b/technic_cnc/models/technic_cnc_cylinder.obj index 2622347..2622347 100644 --- a/technic/models/technic_cylinder.obj +++ b/technic_cnc/models/technic_cnc_cylinder.obj diff --git a/technic/models/technic_cylinder_horizontal.obj b/technic_cnc/models/technic_cnc_cylinder_horizontal.obj index d00b1d6..d00b1d6 100644 --- a/technic/models/technic_cylinder_horizontal.obj +++ b/technic_cnc/models/technic_cnc_cylinder_horizontal.obj diff --git a/technic/models/technic_innercorner.obj b/technic_cnc/models/technic_cnc_innercorner.obj index c962aeb..c962aeb 100644 --- a/technic/models/technic_innercorner.obj +++ b/technic_cnc/models/technic_cnc_innercorner.obj diff --git a/technic/models/technic_innercorner_upsdown.obj b/technic_cnc/models/technic_cnc_innercorner_upsdown.obj index 68eb560..68eb560 100644 --- a/technic/models/technic_innercorner_upsdown.obj +++ b/technic_cnc/models/technic_cnc_innercorner_upsdown.obj diff --git a/technic/models/technic_oblate_spheroid.obj b/technic_cnc/models/technic_cnc_oblate_spheroid.obj index e949f5b..e949f5b 100644 --- a/technic/models/technic_oblate_spheroid.obj +++ b/technic_cnc/models/technic_cnc_oblate_spheroid.obj diff --git a/technic/models/technic_one_curved_edge.obj b/technic_cnc/models/technic_cnc_one_curved_edge.obj index bb82040..bb82040 100644 --- a/technic/models/technic_one_curved_edge.obj +++ b/technic_cnc/models/technic_cnc_one_curved_edge.obj diff --git a/technic/models/technic_outercorner.obj b/technic_cnc/models/technic_cnc_outercorner.obj index 60ccae6..60ccae6 100644 --- a/technic/models/technic_outercorner.obj +++ b/technic_cnc/models/technic_cnc_outercorner.obj diff --git a/technic/models/technic_outercorner_upsdown.obj b/technic_cnc/models/technic_cnc_outercorner_upsdown.obj index c89de8a..c89de8a 100644 --- a/technic/models/technic_outercorner_upsdown.obj +++ b/technic_cnc/models/technic_cnc_outercorner_upsdown.obj diff --git a/technic/models/technic_pyramid.obj b/technic_cnc/models/technic_cnc_pyramid.obj index a618dcf..a618dcf 100644 --- a/technic/models/technic_pyramid.obj +++ b/technic_cnc/models/technic_cnc_pyramid.obj diff --git a/technic/models/technic_pyramid_spike.obj b/technic_cnc/models/technic_cnc_pyramid_spike.obj index b305af2..b305af2 100644 --- a/technic/models/technic_pyramid_spike.obj +++ b/technic_cnc/models/technic_cnc_pyramid_spike.obj diff --git a/technic/models/technic_slope.obj b/technic_cnc/models/technic_cnc_slope.obj index f6f4860..f6f4860 100644 --- a/technic/models/technic_slope.obj +++ b/technic_cnc/models/technic_cnc_slope.obj diff --git a/technic/models/technic_slope_horizontal.obj b/technic_cnc/models/technic_cnc_slope_horizontal.obj index 4866a92..4866a92 100644 --- a/technic/models/technic_slope_horizontal.obj +++ b/technic_cnc/models/technic_cnc_slope_horizontal.obj diff --git a/technic/models/technic_slope_upsdown.obj b/technic_cnc/models/technic_cnc_slope_upsdown.obj index 6880595..6880595 100644 --- a/technic/models/technic_slope_upsdown.obj +++ b/technic_cnc/models/technic_cnc_slope_upsdown.obj diff --git a/technic/models/technic_sphere.obj b/technic_cnc/models/technic_cnc_sphere.obj index 772b570..772b570 100644 --- a/technic/models/technic_sphere.obj +++ b/technic_cnc/models/technic_cnc_sphere.obj diff --git a/technic/models/technic_two_curved_edge.obj b/technic_cnc/models/technic_cnc_two_curved_edge.obj index a468ddf..a468ddf 100644 --- a/technic/models/technic_two_curved_edge.obj +++ b/technic_cnc/models/technic_cnc_two_curved_edge.obj diff --git a/technic/textures/technic_cnc_bottom.png b/technic_cnc/textures/technic_cnc_bottom.png Binary files differindex e600cb1..e600cb1 100644 --- a/technic/textures/technic_cnc_bottom.png +++ b/technic_cnc/textures/technic_cnc_bottom.png diff --git a/technic/textures/technic_cnc_cylinder.png b/technic_cnc/textures/technic_cnc_cylinder.png Binary files differindex 48921bd..48921bd 100644 --- a/technic/textures/technic_cnc_cylinder.png +++ b/technic_cnc/textures/technic_cnc_cylinder.png diff --git a/technic/textures/technic_cnc_cylinder_horizontal.png b/technic_cnc/textures/technic_cnc_cylinder_horizontal.png Binary files differindex 82eb24c..82eb24c 100644 --- a/technic/textures/technic_cnc_cylinder_horizontal.png +++ b/technic_cnc/textures/technic_cnc_cylinder_horizontal.png diff --git a/technic/textures/technic_cnc_element_cross.png b/technic_cnc/textures/technic_cnc_element_cross.png Binary files differindex cc66571..cc66571 100644 --- a/technic/textures/technic_cnc_element_cross.png +++ b/technic_cnc/textures/technic_cnc_element_cross.png diff --git a/technic/textures/technic_cnc_element_edge.png b/technic_cnc/textures/technic_cnc_element_edge.png Binary files differindex 1245ea7..1245ea7 100644 --- a/technic/textures/technic_cnc_element_edge.png +++ b/technic_cnc/textures/technic_cnc_element_edge.png diff --git a/technic/textures/technic_cnc_element_end.png b/technic_cnc/textures/technic_cnc_element_end.png Binary files differindex 562eb2b..562eb2b 100644 --- a/technic/textures/technic_cnc_element_end.png +++ b/technic_cnc/textures/technic_cnc_element_end.png diff --git a/technic/textures/technic_cnc_element_straight.png b/technic_cnc/textures/technic_cnc_element_straight.png Binary files differindex d42966e..d42966e 100644 --- a/technic/textures/technic_cnc_element_straight.png +++ b/technic_cnc/textures/technic_cnc_element_straight.png diff --git a/technic/textures/technic_cnc_element_t.png b/technic_cnc/textures/technic_cnc_element_t.png Binary files differindex a462764..a462764 100644 --- a/technic/textures/technic_cnc_element_t.png +++ b/technic_cnc/textures/technic_cnc_element_t.png diff --git a/technic/textures/technic_cnc_front.png b/technic_cnc/textures/technic_cnc_front.png Binary files differindex 6cc0490..6cc0490 100644 --- a/technic/textures/technic_cnc_front.png +++ b/technic_cnc/textures/technic_cnc_front.png diff --git a/technic/textures/technic_cnc_front_active.png b/technic_cnc/textures/technic_cnc_front_active.png Binary files differindex f7a3c7f..f7a3c7f 100644 --- a/technic/textures/technic_cnc_front_active.png +++ b/technic_cnc/textures/technic_cnc_front_active.png diff --git a/technic/textures/technic_cnc_full.png b/technic_cnc/textures/technic_cnc_full.png Binary files differindex 60f8a81..60f8a81 100644 --- a/technic/textures/technic_cnc_full.png +++ b/technic_cnc/textures/technic_cnc_full.png diff --git a/technic/textures/technic_cnc_half.png b/technic_cnc/textures/technic_cnc_half.png Binary files differindex 2c4d3a8..2c4d3a8 100644 --- a/technic/textures/technic_cnc_half.png +++ b/technic_cnc/textures/technic_cnc_half.png diff --git a/technic/textures/technic_cnc_milling_background.png b/technic_cnc/textures/technic_cnc_milling_background.png Binary files differindex 6a9c2f4..6a9c2f4 100644 --- a/technic/textures/technic_cnc_milling_background.png +++ b/technic_cnc/textures/technic_cnc_milling_background.png diff --git a/technic/textures/technic_cnc_oblate_spheroid.png b/technic_cnc/textures/technic_cnc_oblate_spheroid.png Binary files differindex b196e7d..b196e7d 100644 --- a/technic/textures/technic_cnc_oblate_spheroid.png +++ b/technic_cnc/textures/technic_cnc_oblate_spheroid.png diff --git a/technic/textures/technic_cnc_onecurvededge.png b/technic_cnc/textures/technic_cnc_onecurvededge.png Binary files differindex 8325846..8325846 100644 --- a/technic/textures/technic_cnc_onecurvededge.png +++ b/technic_cnc/textures/technic_cnc_onecurvededge.png diff --git a/technic/textures/technic_cnc_pyramid.png b/technic_cnc/textures/technic_cnc_pyramid.png Binary files differindex d8cc713..d8cc713 100644 --- a/technic/textures/technic_cnc_pyramid.png +++ b/technic_cnc/textures/technic_cnc_pyramid.png diff --git a/technic/textures/technic_cnc_side.png b/technic_cnc/textures/technic_cnc_side.png Binary files differindex 1ecbbac..1ecbbac 100644 --- a/technic/textures/technic_cnc_side.png +++ b/technic_cnc/textures/technic_cnc_side.png diff --git a/technic/textures/technic_cnc_slope.png b/technic_cnc/textures/technic_cnc_slope.png Binary files differindex 493d560..493d560 100644 --- a/technic/textures/technic_cnc_slope.png +++ b/technic_cnc/textures/technic_cnc_slope.png diff --git a/technic/textures/technic_cnc_slope_edge.png b/technic_cnc/textures/technic_cnc_slope_edge.png Binary files differindex 1b601c4..1b601c4 100644 --- a/technic/textures/technic_cnc_slope_edge.png +++ b/technic_cnc/textures/technic_cnc_slope_edge.png diff --git a/technic/textures/technic_cnc_slope_edge_upsdwn.png b/technic_cnc/textures/technic_cnc_slope_edge_upsdwn.png Binary files differindex 350c22d..350c22d 100644 --- a/technic/textures/technic_cnc_slope_edge_upsdwn.png +++ b/technic_cnc/textures/technic_cnc_slope_edge_upsdwn.png diff --git a/technic/textures/technic_cnc_slope_inner_edge.png b/technic_cnc/textures/technic_cnc_slope_inner_edge.png Binary files differindex 3f5ab9e..3f5ab9e 100644 --- a/technic/textures/technic_cnc_slope_inner_edge.png +++ b/technic_cnc/textures/technic_cnc_slope_inner_edge.png diff --git a/technic/textures/technic_cnc_slope_inner_edge_upsdwn.png b/technic_cnc/textures/technic_cnc_slope_inner_edge_upsdwn.png Binary files differindex a1fee78..a1fee78 100644 --- a/technic/textures/technic_cnc_slope_inner_edge_upsdwn.png +++ b/technic_cnc/textures/technic_cnc_slope_inner_edge_upsdwn.png diff --git a/technic/textures/technic_cnc_slope_lying.png b/technic_cnc/textures/technic_cnc_slope_lying.png Binary files differindex 099ed59..099ed59 100644 --- a/technic/textures/technic_cnc_slope_lying.png +++ b/technic_cnc/textures/technic_cnc_slope_lying.png diff --git a/technic/textures/technic_cnc_slope_upsdwn.png b/technic_cnc/textures/technic_cnc_slope_upsdwn.png Binary files differindex 2a34b8b..2a34b8b 100644 --- a/technic/textures/technic_cnc_slope_upsdwn.png +++ b/technic_cnc/textures/technic_cnc_slope_upsdwn.png diff --git a/technic/textures/technic_cnc_sphere.png b/technic_cnc/textures/technic_cnc_sphere.png Binary files differindex 791b32b..791b32b 100644 --- a/technic/textures/technic_cnc_sphere.png +++ b/technic_cnc/textures/technic_cnc_sphere.png diff --git a/technic/textures/technic_cnc_spike.png b/technic_cnc/textures/technic_cnc_spike.png Binary files differindex b445b40..b445b40 100644 --- a/technic/textures/technic_cnc_spike.png +++ b/technic_cnc/textures/technic_cnc_spike.png diff --git a/technic/textures/technic_cnc_stick.png b/technic_cnc/textures/technic_cnc_stick.png Binary files differindex acaf1cb..acaf1cb 100644 --- a/technic/textures/technic_cnc_stick.png +++ b/technic_cnc/textures/technic_cnc_stick.png diff --git a/technic/textures/technic_cnc_top.png b/technic_cnc/textures/technic_cnc_top.png Binary files differindex 5123334..5123334 100644 --- a/technic/textures/technic_cnc_top.png +++ b/technic_cnc/textures/technic_cnc_top.png diff --git a/technic/textures/technic_cnc_top_active.png b/technic_cnc/textures/technic_cnc_top_active.png Binary files differindex 2bc9d81..2bc9d81 100644 --- a/technic/textures/technic_cnc_top_active.png +++ b/technic_cnc/textures/technic_cnc_top_active.png diff --git a/technic/textures/technic_cnc_twocurvededge.png b/technic_cnc/textures/technic_cnc_twocurvededge.png Binary files differindex b50a257..b50a257 100644 --- a/technic/textures/technic_cnc_twocurvededge.png +++ b/technic_cnc/textures/technic_cnc_twocurvededge.png |