V2.02, Logic Not added, output reduction on Harvester, Fermenter, and Gravel Sieve

This commit is contained in:
Joachim Stolberg 2019-01-28 21:51:38 +01:00
parent 1af6d380d3
commit b457f3011f
12 changed files with 127 additions and 56 deletions

@ -1,4 +1,4 @@
# TechPack V2.01
# TechPack V2.02
TechPack, a Mining, Crafting, & Farming Modpack for Minetest.
@ -43,6 +43,7 @@ TechPack provides:
- two Sequencer nodes for a waiting time controlled sending of commands (on/off)
- an item Detector node sending commands (on/off)
- a Repeater node to distribute received commands to connected nodes
- a Logic Not node to invert on/off commands
- Gate/Door nodes in different textures to be controlled via on/off commands
- an Access Lock node with number key field
- a Mesecon Converter node to translate tubelib commands in mesecon commands and vice versa
@ -145,6 +146,7 @@ tubelib_addons1 optional: unified_inventory
- 2018-12-29 V2.00 * beta
- 2019-01-12 V2.00 * release
- 2019-01-27 V2.01 * SaferLua Controller Terminal added
- 2019-01-28 V2.02 * Logic Not added, output reduction on Harvester, Fermenter, and Gravel Sieve
## New in v2 (from players point of view)

@ -2,4 +2,4 @@
# 1.0 is according to the mapgen generator
# 2.0 means half as many ores as result
# 0.5 means twice as many ores as result
gravelsieve_ore_rarity (Rarity factor to find ores) float 1
gravelsieve_ore_rarity (Rarity factor to find ores) float 1.5

@ -2,6 +2,23 @@
## V2.02 (2019-01-28)
### Additions
- Tubelib_addons2 "Logic Not" added
- second (classical) SaferLua Terminal added
### Removals
### Changes
- Output reduction on Harvester (cycle time from 4 to 6 s),
Fermenter (from 2 to 3 input items needed per bio gas),
and Gravel Sieve (rarity from 1 to 1.5)
### Fixes
- removing the Gate block returns the original block
## V2.01 (2019-01-27)
### Additions

@ -24,6 +24,8 @@ Local commands:
- help = this message
- pub = switch to public use
- priv = switch to private use
Test commands:
- send <num> on/off = send on/off event
]]
local function formspec1()
@ -80,16 +82,65 @@ local function command(pos, cmnd, player)
output(pos, player..":$ "..cmnd)
output(pos, "Switched to private use!")
elseif meta:get_int("public") == 1 or owner == player then
local number = meta:get_string("number") or "0000"
output(pos, player..":$ "..cmnd)
tubelib.send_message(number, owner, nil, "term", cmnd)
local num, topic = cmnd:match('^send%s+([0-9]+)%s+([onff]+)$')
if num and topic then
local own_number = meta:get_string("own_number")
output(pos, player..":$ send "..num.." "..topic)
tubelib.send_message(num, owner, nil, topic, own_number)
else
local number = meta:get_string("number") or "0000"
output(pos, player..":$ "..cmnd)
tubelib.send_message(number, owner, nil, "term", cmnd)
end
end
end
end
minetest.register_node("sl_controller:terminal", {
description = "SaferLua Controller Terminal",
tiles = {
local function register_terminal(num, tiles, node_box, selection_box)
minetest.register_node("sl_controller:terminal"..num, {
description = "SaferLua Controller Terminal",
tiles = tiles,
drawtype = "nodebox",
node_box = node_box,
selection_box = selection_box,
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, minetest.get_node(pos).name)
local meta = minetest.get_meta(pos)
meta:set_string("own_number", number)
meta:set_string("formspec", formspec1())
meta:set_string("owner", placer:get_player_name())
meta:set_string("infotext", "SaferLua Controller Terminal "..number..": not connected")
end,
on_receive_fields = function(pos, formname, fields, player)
local meta = minetest.get_meta(pos)
if fields.number and fields.number ~= "" then
if tubelib.check_numbers(fields.number) then
meta:set_string("number", fields.number)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "SaferLua Controller Terminal "..own_number..": connected with "..fields.number)
meta:set_string("formspec", formspec2(meta))
end
elseif (fields.key_enter == "true" or fields.ok == "Enter") and fields.cmnd ~= "" then
command(pos, fields.cmnd, player:get_player_name())
end
end,
after_dig_node = function(pos)
tubelib.remove_node(pos)
end,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
end
register_terminal("", {
-- up, down, right, left, back, front
'sl_controller_terminal_top.png',
'sl_controller_terminal_bottom.png',
@ -98,51 +149,13 @@ minetest.register_node("sl_controller:terminal", {
'sl_controller_terminal_bottom.png',
"sl_controller_terminal_front.png",
},
drawtype = "nodebox",
node_box = {
{
type = "fixed",
fixed = {
{-12/32, -16/32, -8/32, 12/32, -14/32, 12/32},
{-12/32, -14/32, 12/32, 12/32, 6/32, 14/32},
},
},
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "sl_controller:terminal")
local meta = minetest.get_meta(pos)
meta:set_string("own_number", number)
meta:set_string("formspec", formspec1())
meta:set_string("owner", placer:get_player_name())
meta:set_string("infotext", "SaferLua Controller Terminal "..number..": not connected")
end,
on_receive_fields = function(pos, formname, fields, player)
local meta = minetest.get_meta(pos)
if fields.number and fields.number ~= "" then
if tubelib.check_numbers(fields.number) then
meta:set_string("number", fields.number)
local own_number = meta:get_string("own_number")
meta:set_string("infotext", "SaferLua Controller Terminal "..own_number..": connected with "..fields.number)
meta:set_string("formspec", formspec2(meta))
end
elseif (fields.key_enter == "true" or fields.ok == "Enter") and fields.cmnd ~= "" then
command(pos, fields.cmnd, player:get_player_name())
end
end,
after_dig_node = function(pos)
tubelib.remove_node(pos)
end,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false,
sounds = default.node_sound_metal_defaults(),
})
})
minetest.register_craft({
output = "sl_controller:terminal",
@ -153,7 +166,44 @@ minetest.register_craft({
},
})
tubelib.register_node("sl_controller:terminal", {}, {
register_terminal("2", {
-- up, down, right, left, back, front
'sl_controller_terminal2_top.png',
'sl_controller_terminal2_side.png',
'sl_controller_terminal2_side.png^[transformFX',
'sl_controller_terminal2_side.png',
'sl_controller_terminal2_back.png',
"sl_controller_terminal2_front.png",
},
{
type = "fixed",
fixed = {
{-12/32, -16/32, -16/32, 12/32, -14/32, 16/32},
{-12/32, -14/32, -3/32, 12/32, 6/32, 16/32},
{-10/32, -12/32, 14/32, 10/32, 4/32, 18/32},
{-12/32, 4/32, -4/32, 12/32, 6/32, 16/32},
{-12/32, -16/32, -4/32, -10/32, 6/32, 16/32},
{ 10/32, -16/32, -4/32, 12/32, 6/32, 16/32},
{-12/32, -14/32, -4/32, 12/32, -12/32, 16/32},
},
},
{
type = "fixed",
fixed = {
{-12/32, -16/32, -4/32, 12/32, 6/32, 16/32},
},
})
minetest.register_craft({
output = "sl_controller:terminal2",
recipe = {
{"", "smartline:display", ""},
{"", "", ""},
{"dye:grey", "tubelib:wlanchip", "default:copper_ingot"},
},
})
tubelib.register_node("sl_controller:terminal", {"sl_controller:terminal2", "sl_controller:terminal3"}, {
on_recv_message = function(pos, topic, payload)
if topic == "term" then
output(pos, payload)

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

@ -10,7 +10,7 @@
fermenter.lua
The Fermenter converts 2 leave items of any kind into one Bio Gas item,
The Fermenter converts 3 leave items of any kind into one Bio Gas item,
needed by the Reformer to produce Bio Fuel.
]]--
@ -23,6 +23,7 @@ local M = minetest.get_meta
local STANDBY_TICKS = 4
local COUNTDOWN_TICKS = 4
local CYCLE_TIME = 2
local NUM_LEAVES = 3 -- to produce on bio gas
local function formspec(self, pos, meta)
return "size[8,8]"..
@ -113,10 +114,10 @@ local function convert_leaves_to_biogas(pos, meta)
return
end
-- take 2 items
-- take NUM_LEAVES items
local items = {}
local fault = false
for i = 1, 2 do
for i = 1, NUM_LEAVES do
items[i] = tubelib.get_num_items(meta, "src", 1)
if items[i] then -- input available?
if not is_leaves(items[i]:get_name()) then
@ -127,7 +128,7 @@ local function convert_leaves_to_biogas(pos, meta)
end
-- put result into dst inventory
if #items == 2 then
if #items == NUM_LEAVES then
inv:add_item("dst", biogas)
State:keep_running(pos, meta, COUNTDOWN_TICKS)
return

@ -14,7 +14,7 @@
The machine is able to harvest an square area of up to 33x33 blocks (radius = 16).
The base node has to be placed in the middle of the harvesting area.
The Harvester processes one node every 4 seconds.
The Harvester processes one node every 6 seconds.
It requires one item Bio Fuel per 20 nodes.
]]--
@ -24,7 +24,7 @@ local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local P = minetest.string_to_pos
local M = minetest.get_meta
local CYCLE_TIME = 4
local CYCLE_TIME = 6
local MAX_HEIGHT = 18 -- harvesting altitude
local MAX_DIAMETER = 33
local BURNING_TIME = 20 -- fuel

@ -73,7 +73,7 @@ for idx,pgn in ipairs(tPgns) do
sounds = default.node_sound_stone_defaults(),
groups = {cracky=2, choppy=2, crumbly=2, not_in_creative_inventory = idx==NUM_TEXTURES and 0 or 1},
is_ground_content = false,
drop = "tubelib_addons2:gateblock15",
drop = "tubelib_addons2:gateblock1",
})
not_in_inventory = 1

@ -15,6 +15,7 @@ dofile(minetest.get_modpath("tubelib_addons2") .. "/sequencer.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/gateblock.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/doorblock.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/repeater.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/logic_not.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/programmer.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/accesscontrol.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/streetlamp.lua")