v.1.11 with a new item detector node as part of tubelib_addons1
tubelib_addons1 textures shrinked
@ -1,4 +1,4 @@
|
||||
# TechPack V1.10
|
||||
# TechPack V1.11
|
||||
|
||||
TechPack, a Mining, Crafting, & Farming Modpack for Minetest.
|
||||
|
||||
@ -39,6 +39,7 @@ TechPack provides:
|
||||
- a Funnel node to collect dropped items
|
||||
- two Timer nodes for a daytime controlled sending of commands (on/off)
|
||||
- two Sequencer nodes for a waiting time controlled sending of commands (on/off)
|
||||
- a item Detector node sending commands (on/off)
|
||||
- a Repeater node to distribute received commands to connected nodes
|
||||
- Gate/Door nodes in different textures to be controlled via on/off commands
|
||||
- an Access Lock node with number key field
|
||||
|
@ -76,11 +76,11 @@ minetest.register_node("tubelib:button", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local own_num = tubelib.add_node(pos, "tubelib:button")
|
||||
meta:set_string("own_num", own_num)
|
||||
meta:set_string("formspec", "size[5,6]"..
|
||||
meta:set_string("formspec", "size[7.5,6]"..
|
||||
"dropdown[0.2,0;3;type;switch,button 2s,button 4s,button 8s,button 16s;1]"..
|
||||
"field[0.5,2;3,1;numbers;Insert destination block number(s);]" ..
|
||||
"field[0.5,2;7,1;numbers;Insert destination node number(s);]" ..
|
||||
"checkbox[1,3;public;public;false]"..
|
||||
"button_exit[1,4;2,1;exit;Save]")
|
||||
"button_exit[2,4;3,1;exit;Save]")
|
||||
meta:set_string("placer_name", placer:get_player_name())
|
||||
meta:set_string("public", "false")
|
||||
meta:set_int("cycle_time", 0)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Tubelib Extension with Mining, Farming, and Crafting Nodes \[tubelib_addons1\]
|
||||
|
||||
This Mod provides Quarry, Harvester, Grinder, Autocrafter, Fermenter, Funnel, and Reformer nodes and thus allows
|
||||
This Mod provides Quarry, Harvester, Grinder, Autocrafter, Fermenter, Funnel, Detector, and Reformer nodes and thus allows
|
||||
the automated mining, farming, and crafting.
|
||||
|
||||
A Tutorial to this Mod is available as ![Wiki](https://github.com/joe7575/techpack/wiki)
|
||||
|
131
tubelib_addons1/detector.lua
Normal file
@ -0,0 +1,131 @@
|
||||
--[[
|
||||
|
||||
Tubelib Addons 1
|
||||
================
|
||||
|
||||
Copyright (C) 2017-2018 Joachim Stolberg
|
||||
|
||||
LGPLv2.1+
|
||||
See LICENSE.txt for more information
|
||||
|
||||
detector.lua:
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
local function switch_on(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
node.name = "tubelib_addons1:detector_active"
|
||||
minetest.swap_node(pos, node)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local own_num = meta:get_string("own_num")
|
||||
local numbers = meta:get_string("numbers")
|
||||
local placer_name = meta:get_string("placer_name")
|
||||
tubelib.send_message(numbers, placer_name, nil, "on", own_num)
|
||||
end
|
||||
|
||||
local function switch_off(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
node.name = "tubelib_addons1:detector"
|
||||
minetest.swap_node(pos, node)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local own_num = meta:get_string("own_num")
|
||||
local numbers = meta:get_string("numbers")
|
||||
local placer_name = meta:get_string("placer_name")
|
||||
tubelib.send_message(numbers, placer_name, nil, "off", own_num)
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("tubelib_addons1:detector", {
|
||||
description = "Tubelib Detector",
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
'tubelib_front.png',
|
||||
'tubelib_front.png',
|
||||
'tubelib_outp.png',
|
||||
'tubelib_inp.png',
|
||||
'tubelib_addons1_detector.png^[transformFX',
|
||||
"tubelib_addons1_detector.png",
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local own_num = tubelib.add_node(pos, "tubelib_addons1:detector")
|
||||
meta:set_string("own_num", own_num)
|
||||
meta:set_string("formspec", "size[7.5,3]"..
|
||||
"field[0.5,1;7,1;numbers;Insert destination node number(s);]" ..
|
||||
"button_exit[2,2;3,1;exit;Save]")
|
||||
meta:set_string("placer_name", placer:get_player_name())
|
||||
meta:set_string("infotext", "Tubelib Detector, unconfigured")
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if tubelib.check_numbers(fields.numbers) then
|
||||
meta:set_string("numbers", fields.numbers)
|
||||
local own_num = meta:get_string("own_num")
|
||||
meta:set_string("infotext", "Tubelib Detector, connected")
|
||||
meta:set_string("formspec", "size[7.5,3]"..
|
||||
"field[0.5,1;7,1;numbers;Insert destination node number(s);"..fields.numbers.."]" ..
|
||||
"button_exit[2,2;3,1;exit;Save]")
|
||||
end
|
||||
end,
|
||||
|
||||
on_rotate = screwdriver.disallow,
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("tubelib_addons1:detector_active", {
|
||||
description = "Tubelib Detector",
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
'tubelib_front.png',
|
||||
'tubelib_front.png',
|
||||
'tubelib_outp.png',
|
||||
'tubelib_inp.png',
|
||||
'tubelib_addons1_detector_active.png^[transformFX',
|
||||
"tubelib_addons1_detector_active.png",
|
||||
},
|
||||
|
||||
on_timer = switch_off,
|
||||
on_rotate = screwdriver.disallow,
|
||||
|
||||
paramtype = "light",
|
||||
light_source = 2,
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "tubelib_addons1:detector",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "tubelib_addons1:detector",
|
||||
recipe = {
|
||||
{"", "group:wood", ""},
|
||||
{"tubelib:tube1", "tubelib:wlanchip", "tubelib:tube1"},
|
||||
{"", "group:wood", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
tubelib.register_node("tubelib_addons1:detector", {"tubelib_addons1:detector_active"}, {
|
||||
on_push_item = function(pos, side, item)
|
||||
local player_name = minetest.get_meta(pos):get_string("player_name")
|
||||
if tubelib.push_items(pos, "R", item, player_name) then
|
||||
switch_on(pos)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
})
|
||||
|
@ -19,4 +19,5 @@ dofile(minetest.get_modpath("tubelib_addons1") .. '/fermenter.lua')
|
||||
dofile(minetest.get_modpath("tubelib_addons1") .. '/reformer.lua')
|
||||
dofile(minetest.get_modpath("tubelib_addons1") .. '/funnel.lua')
|
||||
dofile(minetest.get_modpath("tubelib_addons1") .. "/pusher_fast.lua")
|
||||
dofile(minetest.get_modpath("tubelib_addons1") .. "/detector.lua")
|
||||
dofile(minetest.get_modpath("tubelib_addons1") .. '/chest.lua')
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 557 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 763 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 576 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 866 B |
BIN
tubelib_addons1/textures/tubelib_addons1_detector.png
Normal file
After Width: | Height: | Size: 506 B |
BIN
tubelib_addons1/textures/tubelib_addons1_detector_active.png
Normal file
After Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 956 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 842 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 578 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 435 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 496 B |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 2.9 KiB |