built on 04/01/2022 19:43:30
This commit is contained in:
parent
793888ed80
commit
d9710a8213
@ -7,7 +7,7 @@
|
||||
|
||||
GPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Demo for a electrical power consuming node
|
||||
|
||||
]]--
|
||||
@ -62,7 +62,7 @@ end
|
||||
minetest.register_node("techage:sink", {
|
||||
description = "Sink",
|
||||
tiles = {'techage_electric_button.png^[colorize:#000000:50'},
|
||||
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
||||
if consumed == PWR_NEEDED then
|
||||
@ -76,7 +76,7 @@ minetest.register_node("techage:sink", {
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
light_source = 0,
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy = 2, cracky = 2, crumbly = 2},
|
||||
is_ground_content = false,
|
||||
@ -100,7 +100,7 @@ minetest.register_node("techage:sink_on", {
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
paramtype = "light",
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
paramtype2 = "facedir",
|
||||
diggable = false,
|
||||
drop = "",
|
||||
|
@ -8,11 +8,11 @@
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
The autocrafter is derived from pipeworks:
|
||||
The autocrafter is derived from pipeworks:
|
||||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> WTFPL
|
||||
|
||||
|
||||
TA2/TA3/TA4 Autocrafter
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -69,7 +69,7 @@ local function count_index(invlist)
|
||||
end
|
||||
|
||||
-- caches some recipe data
|
||||
local autocrafterCache = {}
|
||||
local autocrafterCache = {}
|
||||
|
||||
local function get_craft(pos, inventory, hash)
|
||||
hash = hash or minetest.hash_node_position(pos)
|
||||
@ -78,13 +78,13 @@ local function get_craft(pos, inventory, hash)
|
||||
local recipe = inventory:get_list("recipe")
|
||||
local output, decremented_input = minetest.get_craft_result(
|
||||
{method = "normal", width = 3, items = recipe})
|
||||
|
||||
|
||||
-- check if registered item
|
||||
if UncraftableItems[output.item:get_name()] then
|
||||
if UncraftableItems[output.item:get_name()] then
|
||||
output.item = ItemStack()
|
||||
end
|
||||
|
||||
craft = {recipe = recipe, consumption = count_index(recipe),
|
||||
|
||||
craft = {recipe = recipe, consumption = count_index(recipe),
|
||||
output = output, decremented_input = decremented_input}
|
||||
autocrafterCache[hash] = craft
|
||||
end
|
||||
@ -93,18 +93,18 @@ end
|
||||
|
||||
local function autocraft(pos, crd, nvm, inv)
|
||||
local craft = get_craft(pos, inv)
|
||||
if not craft then
|
||||
if not craft then
|
||||
crd.State:idle(pos, nvm)
|
||||
return
|
||||
end
|
||||
local output_item = craft.output.item
|
||||
if output_item:get_name() == "" then
|
||||
crd.State:idle(pos, nvm)
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- check if we have enough room in dst
|
||||
if not inv:room_for_item("dst", output_item) then
|
||||
if not inv:room_for_item("dst", output_item) then
|
||||
crd.State:blocked(pos, nvm)
|
||||
return
|
||||
end
|
||||
@ -112,9 +112,9 @@ local function autocraft(pos, crd, nvm, inv)
|
||||
local inv_index = count_index(inv:get_list("src"))
|
||||
-- check if we have enough material available
|
||||
for itemname, number in pairs(consumption) do
|
||||
if (not inv_index[itemname]) or inv_index[itemname] < number then
|
||||
if (not inv_index[itemname]) or inv_index[itemname] < number then
|
||||
crd.State:idle(pos, nvm)
|
||||
return
|
||||
return
|
||||
end
|
||||
end
|
||||
-- consume material
|
||||
@ -129,7 +129,7 @@ local function autocraft(pos, crd, nvm, inv)
|
||||
for i = 1, 9 do
|
||||
inv:add_item("dst", craft.decremented_input.items[i])
|
||||
end
|
||||
|
||||
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
end
|
||||
|
||||
@ -230,7 +230,7 @@ local function determine_recipe_items(pos, input)
|
||||
if num and idx then
|
||||
input = get_input_from_recipeblock(pos, num, idx)
|
||||
end
|
||||
|
||||
|
||||
if input then
|
||||
-- "<item>,<item>,..." input
|
||||
local items = string.split(input, ",", true, 8)
|
||||
@ -452,7 +452,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("autocrafter", S("Autocrafter"), tiles, {
|
||||
drawtype = "normal",
|
||||
cycle_time = CYCLE_TIME,
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
All items and liquids disappear.
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
local S = techage.S
|
||||
@ -70,7 +70,7 @@ minetest.register_craft({
|
||||
techage.register_node({"techage:blackhole"}, {
|
||||
on_pull_item = nil, -- not needed
|
||||
on_unpull_item = nil, -- not needed
|
||||
|
||||
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:get_int("push_dir") == in_dir then
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA2/TA3/TA4 Chest
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -76,7 +76,7 @@ minetest.register_node("techage:chest_ta2", {
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('main', 32)
|
||||
end,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
@ -86,7 +86,7 @@ minetest.register_node("techage:chest_ta2", {
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
return techage.logic.set_numbers(pos, numbers, player_name, S("TA2 Protected Chest"))
|
||||
end,
|
||||
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = after_dig_node,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
@ -126,7 +126,7 @@ minetest.register_node("techage:chest_ta3", {
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('main', 40)
|
||||
end,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local number = techage.add_node(pos, "techage:chest_ta3")
|
||||
@ -139,7 +139,7 @@ minetest.register_node("techage:chest_ta3", {
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
return techage.logic.set_numbers(pos, numbers, player_name, S("TA3 Protected Chest"))
|
||||
end,
|
||||
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = after_dig_node,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
@ -180,7 +180,7 @@ techage.register_node({"techage:chest_ta2", "techage:chest_ta3"}, {
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
local function formspec4(pos)
|
||||
@ -227,7 +227,7 @@ local function ta4_allow_metadata_inventory_put(pos, listname, index, stack, pla
|
||||
if not public and minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
if listname == "main" then
|
||||
return stack:get_count()
|
||||
else
|
||||
@ -240,7 +240,7 @@ local function ta4_allow_metadata_inventory_take(pos, listname, index, stack, pl
|
||||
if not public and minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
if listname == "main" then
|
||||
return stack:get_count()
|
||||
else
|
||||
@ -253,7 +253,7 @@ local function ta4_allow_metadata_inventory_move(pos, from_list, from_index, to_
|
||||
if not public and minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
if from_list == "main" then
|
||||
return count
|
||||
else
|
||||
@ -279,7 +279,7 @@ minetest.register_node("techage:chest_ta4", {
|
||||
inv:set_size('main', 50)
|
||||
inv:set_size('conf', 50)
|
||||
end,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local number = techage.add_node(pos, "techage:chest_ta4")
|
||||
@ -293,7 +293,7 @@ minetest.register_node("techage:chest_ta4", {
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if fields.tab == "1" then
|
||||
@ -320,11 +320,11 @@ minetest.register_node("techage:chest_ta4", {
|
||||
meta:set_string("formspec", formspec4_cfg(pos))
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
return techage.logic.set_numbers(pos, numbers, player_name, S("TA4 Protected Chest"))
|
||||
end,
|
||||
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = after_dig_node,
|
||||
allow_metadata_inventory_put = ta4_allow_metadata_inventory_put,
|
||||
@ -347,14 +347,14 @@ techage.register_node({"techage:chest_ta4"}, {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
|
||||
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
|
||||
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
|
||||
|
||||
|
||||
if inv:is_empty("main") then
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
if item_name then
|
||||
if mem.filter[item_name] or not mem.chest_configured then
|
||||
local taken = inv:remove_item("main", {name = item_name, count = num})
|
||||
@ -374,10 +374,10 @@ techage.register_node({"techage:chest_ta4"}, {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
|
||||
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
|
||||
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
|
||||
|
||||
|
||||
if mem.chest_configured then
|
||||
local name = item:get_name()
|
||||
local stacks = mem.filter[name] or mem.filter["unconfigured"]
|
||||
@ -390,10 +390,10 @@ techage.register_node({"techage:chest_ta4"}, {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
|
||||
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
|
||||
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
|
||||
|
||||
|
||||
if mem.chest_configured then
|
||||
local name = item:get_name()
|
||||
local stacks = mem.filter[name] or mem.filter["unconfigured"]
|
||||
@ -402,7 +402,7 @@ techage.register_node({"techage:chest_ta4"}, {
|
||||
return techage.put_items(inv, "main", item)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "state" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -412,7 +412,7 @@ techage.register_node({"techage:chest_ta4"}, {
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
|
@ -65,7 +65,7 @@ techage.register_node(names, {
|
||||
return techage.safe_push_items(pos, push_dir, stack)
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
})
|
||||
})
|
||||
|
||||
names = networks.register_junction("techage:ta4_concentrator", 2/8, Boxes, Tube, {
|
||||
description = S("TA4 Tube Concentrator"),
|
||||
@ -104,7 +104,7 @@ techage.register_node(names, {
|
||||
return techage.safe_push_items(pos, push_dir, stack)
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Consumer node basis functionality.
|
||||
It handles:
|
||||
- up to 4 stages of nodes (TA2/TA3/TA4/TA5)
|
||||
@ -54,7 +54,7 @@ end
|
||||
local function node_timer_pas(pos, elapsed)
|
||||
local crd = CRD(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
||||
|
||||
-- handle power consumption
|
||||
if crd.power_netw and techage.needs_power(nvm) then
|
||||
local consumed = power.consume_power(pos, crd.power_netw, nil, crd.power_consumption)
|
||||
@ -62,7 +62,7 @@ local function node_timer_pas(pos, elapsed)
|
||||
crd.State:start(pos, nvm)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- call the node timer routine
|
||||
if techage.is_operational(nvm) then
|
||||
nvm.node_timer_call_cyle = (nvm.node_timer_call_cyle or 0) + 1
|
||||
@ -77,7 +77,7 @@ end
|
||||
local function node_timer_act(pos, elapsed)
|
||||
local crd = CRD(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
||||
|
||||
-- handle power consumption
|
||||
if crd.power_netw and techage.needs_power(nvm) then
|
||||
local consumed = power.consume_power(pos, crd.power_netw, nil, crd.power_consumption)
|
||||
@ -85,7 +85,7 @@ local function node_timer_act(pos, elapsed)
|
||||
crd.State:nopower(pos, nvm)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- call the node timer routine
|
||||
if techage.is_operational(nvm) then
|
||||
nvm.node_timer_call_cyle = (nvm.node_timer_call_cyle or 0) + 1
|
||||
@ -111,7 +111,7 @@ local function prepare_tiles(tiles, stage, power_png)
|
||||
return tbl
|
||||
end
|
||||
|
||||
-- 'validStates' is optional and can be used to e.g. enable
|
||||
-- 'validStates' is optional and can be used to e.g. enable
|
||||
-- only one TA2 node {false, true, false, false}
|
||||
function techage.register_consumer(base_name, inv_name, tiles, tNode, validStates, node_name_prefix)
|
||||
local names = {}
|
||||
@ -163,7 +163,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
State = tState,
|
||||
-- number of items to be processed per cycle
|
||||
num_items = tNode.num_items and tNode.num_items[stage],
|
||||
power_consumption = power_used and
|
||||
power_consumption = power_used and
|
||||
tNode.power_consumption[stage] or 0,
|
||||
node_timer = tNode.node_timer,
|
||||
cycle_time = tNode.cycle_time,
|
||||
@ -204,7 +204,7 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
|
||||
tNode.groups.not_in_creative_inventory = 0
|
||||
|
||||
local def_pas = {
|
||||
@ -285,14 +285,14 @@ function techage.register_consumer(base_name, inv_name, tiles, tNode, validState
|
||||
def_act[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node(name_act, def_act)
|
||||
|
||||
if power_used then
|
||||
power.register_nodes({name_pas, name_act}, power_network, "con", sides)
|
||||
end
|
||||
techage.register_node({name_pas, name_act}, tNode.tubing)
|
||||
|
||||
|
||||
if tNode.tube_sides then
|
||||
Tube:set_valid_sides(name_pas, get_keys(tNode.tube_sides))
|
||||
Tube:set_valid_sides(name_act, get_keys(tNode.tube_sides))
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA2/TA3/TA4 Distributor
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -34,7 +34,7 @@ local INFO = [[Turn port on/off or read its state: command = 'port', payload = r
|
||||
|
||||
--local Side2Color = {B="red", L="green", F="blue", R="yellow"}
|
||||
local SlotColors = {"red", "green", "blue", "yellow"}
|
||||
local Num2Ascii = {"B", "L", "F", "R"}
|
||||
local Num2Ascii = {"B", "L", "F", "R"}
|
||||
local FilterCache = {} -- local cache for filter settings
|
||||
|
||||
local function filter_settings(pos)
|
||||
@ -72,9 +72,9 @@ local function filter_settings(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
FilterCache[minetest.hash_node_position(pos)] = {
|
||||
ItemFilter = ItemFilter,
|
||||
ItemFilter = ItemFilter,
|
||||
OpenPorts = OpenPorts,
|
||||
}
|
||||
end
|
||||
@ -88,7 +88,7 @@ local function get_filter_settings(pos)
|
||||
-- }
|
||||
-- local OpenPorts = {3}
|
||||
-- return ItemFilter, OpenPorts
|
||||
|
||||
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if FilterCache[hash] == nil then
|
||||
filter_settings(pos)
|
||||
@ -111,8 +111,8 @@ local function blocking_checkbox(pos, filter, is_hp)
|
||||
M(pos):set_int("blocking", 0) -- disable blocking
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
local filter = minetest.deserialize(M(pos):get_string("filter")) or {false,false,false,false}
|
||||
local is_hp = nvm.high_performance == true
|
||||
@ -185,7 +185,7 @@ end
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
local inv = M(pos):get_inventory()
|
||||
local list = inv:get_list(listname)
|
||||
|
||||
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
@ -247,7 +247,7 @@ local function tubelib2_on_update2(pos, outdir, tlib2, node)
|
||||
is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local crd = CRD(pos)
|
||||
if CRD(pos).stage == 4 and not is_ta4_tube then
|
||||
@ -295,10 +295,10 @@ local function distributing(pos, inv, crd, nvm)
|
||||
local sum_num_pushed = 0
|
||||
local num_pushed = 0
|
||||
local blocking_mode = M(pos):get_int("blocking") == 1
|
||||
|
||||
|
||||
-- start searching after last position
|
||||
local offs = nvm.last_index or 1
|
||||
|
||||
|
||||
for i = 1, SRC_INV_SIZE do
|
||||
local idx = ((i + offs - 1) % 8) + 1
|
||||
local stack = inv:get_stack("src", idx)
|
||||
@ -308,7 +308,7 @@ local function distributing(pos, inv, crd, nvm)
|
||||
local stack_to_push = stack:peek_item(num_to_push)
|
||||
local filter = item_filter[item_name]
|
||||
num_pushed = 0
|
||||
|
||||
|
||||
if filter and #filter > 0 then
|
||||
-- Push items based on filter
|
||||
num_pushed = push_item(pos, filter, stack_to_push, num_to_push, nvm)
|
||||
@ -320,16 +320,16 @@ local function distributing(pos, inv, crd, nvm)
|
||||
-- Push items based on open ports
|
||||
num_pushed = push_item(pos, open_ports, stack_to_push, num_to_push, nvm)
|
||||
end
|
||||
|
||||
|
||||
sum_num_pushed = sum_num_pushed + num_pushed
|
||||
stack:take_item(num_pushed)
|
||||
inv:set_stack("src", idx, stack)
|
||||
if sum_num_pushed >= (nvm.num_items or crd.num_items) then
|
||||
if sum_num_pushed >= (nvm.num_items or crd.num_items) then
|
||||
nvm.last_index = idx
|
||||
break
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if sum_num_pushed == 0 then
|
||||
crd.State:blocked(pos, nvm)
|
||||
else
|
||||
@ -370,9 +370,9 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
meta:set_int("blocking", fields.blocking == "true" and 1 or 0)
|
||||
end
|
||||
meta:set_string("filter", minetest.serialize(filter))
|
||||
|
||||
|
||||
filter_settings(pos)
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if fields.state_button ~= nil then
|
||||
crd.State:state_button_event(pos, nvm, fields)
|
||||
@ -391,9 +391,9 @@ local function change_filter_settings(pos, slot, val)
|
||||
filter[num] = val == "on"
|
||||
end
|
||||
meta:set_string("filter", minetest.serialize(filter))
|
||||
|
||||
|
||||
filter_settings(pos)
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
meta:set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
return true
|
||||
@ -474,7 +474,7 @@ local tubing = {
|
||||
else
|
||||
return change_filter_settings(pos, slot, val)
|
||||
end
|
||||
else
|
||||
else
|
||||
return CRD(pos).State:on_receive_message(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA2/TA3/TA4 Electronic Fab
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -109,14 +109,14 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local crd = CRD(pos)
|
||||
|
||||
if not nvm.running then
|
||||
|
||||
if not nvm.running then
|
||||
recipes.on_receive_fields(pos, formname, fields, player)
|
||||
end
|
||||
|
||||
|
||||
crd.State:state_button_event(pos, nvm, fields)
|
||||
M(pos):set_string("formspec", formspec(crd.State, pos, nvm))
|
||||
end
|
||||
@ -207,7 +207,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("electronic_fab", S("Electronic Fab"), tiles, {
|
||||
drawtype = "normal",
|
||||
cycle_time = CYCLE_TIME,
|
||||
@ -277,4 +277,3 @@ techage.recipes.register_craft_type("ta4_electronic_fab", {
|
||||
width = 2,
|
||||
height = 2,
|
||||
})
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Forceload block
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -38,7 +38,7 @@ end
|
||||
local function remove_list_elem(list, x)
|
||||
local n = nil
|
||||
for idx, v in ipairs(list) do
|
||||
if vector.equals(v, x) then
|
||||
if vector.equals(v, x) then
|
||||
n = idx
|
||||
break
|
||||
end
|
||||
@ -59,12 +59,12 @@ local function postload_area(pos)
|
||||
minetest.after(60, postload_area, pos)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function add_pos(pos, player)
|
||||
local meta = player:get_meta()
|
||||
local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {}
|
||||
if not in_list(lPos, pos) and (#lPos < techage.max_num_forceload_blocks or
|
||||
creative and creative.is_enabled_for and
|
||||
minetest.global_exists("creative") and creative.is_enabled_for and
|
||||
creative.is_enabled_for(player:get_player_name())) then
|
||||
lPos[#lPos+1] = pos
|
||||
local meta = player:get_meta()
|
||||
@ -73,7 +73,7 @@ local function add_pos(pos, player)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
local function del_pos(pos, player)
|
||||
local meta = player:get_meta()
|
||||
local lPos = minetest.deserialize(meta:get_string("techage_forceload_blocks")) or {}
|
||||
@ -116,7 +116,6 @@ local function formspec(name)
|
||||
local tRes = {}
|
||||
for idx,pos in ipairs(lPos) do
|
||||
local pos1, pos2 = calc_area(pos)
|
||||
local ypos = 0.2 + idx * 0.4
|
||||
tRes[#tRes+1] = idx
|
||||
tRes[#tRes+1] = minetest.formspec_escape(P2S(pos1))
|
||||
tRes[#tRes+1] = "to"
|
||||
@ -202,10 +201,10 @@ minetest.register_node("techage:forceload", {
|
||||
after_dig_node = after_dig_node,
|
||||
on_rightclick = on_rightclick,
|
||||
on_punch = on_punch,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {choppy=2, cracky=2, crumbly=2,
|
||||
groups = {choppy=2, cracky=2, crumbly=2,
|
||||
digtron_protected = 1,
|
||||
not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0},
|
||||
is_ground_content = false,
|
||||
@ -236,17 +235,17 @@ minetest.register_node("techage:forceloadtile", {
|
||||
{-4/16, -8/16, -4/16, 4/16, -15/32, 4/16},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
on_place = on_place,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
on_rightclick = on_rightclick,
|
||||
on_punch = on_punch,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = {choppy=2, cracky=2, crumbly=2,
|
||||
groups = {choppy=2, cracky=2, crumbly=2,
|
||||
not_in_creative_inventory = techage.max_num_forceload_blocks == 0 and 1 or 0},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
@ -7,16 +7,16 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Tube support for default chests and furnace
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
local OwnerCache = {
|
||||
}
|
||||
|
||||
-- Check if the chest is in the protected area of the owner
|
||||
local function is_owner(pos, meta)
|
||||
local function is_owner(pos, meta)
|
||||
local owner = meta:get_string("owner")
|
||||
local key = minetest.hash_node_position(pos)
|
||||
-- If successfull, store info in cache
|
||||
@ -27,7 +27,7 @@ local function is_owner(pos, meta)
|
||||
end
|
||||
return OwnerCache[key] == owner
|
||||
end
|
||||
|
||||
|
||||
|
||||
techage.register_node({"default:chest", "default:chest_open"}, {
|
||||
on_inv_request = function(pos, in_dir, access_type)
|
||||
@ -49,7 +49,7 @@ techage.register_node({"default:chest", "default:chest_open"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"default:chest_locked", "default:chest_locked_open"}, {
|
||||
on_inv_request = function(pos, in_dir, access_type)
|
||||
@ -75,7 +75,7 @@ techage.register_node({"default:chest_locked", "default:chest_locked_open"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"shop:shop"}, {
|
||||
on_inv_request = function(pos, in_dir, access_type)
|
||||
@ -101,7 +101,7 @@ techage.register_node({"shop:shop"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "register", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"default:furnace", "default:furnace_active"}, {
|
||||
on_pull_item = function(pos, in_dir, num)
|
||||
@ -124,7 +124,7 @@ techage.register_node({"default:furnace", "default:furnace_active"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "dst", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"mobs:beehive"}, {
|
||||
on_pull_item = function(pos, in_dir, num)
|
||||
@ -137,7 +137,7 @@ techage.register_node({"mobs:beehive"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "beehive", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"xdecor:hive"}, {
|
||||
on_pull_item = function(pos, in_dir, num)
|
||||
@ -150,4 +150,4 @@ techage.register_node({"xdecor:hive"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "honey", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA2 Gravel Rinser, washing sieved gravel to find more ores
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -146,7 +146,7 @@ local function washing(pos, crd, nvm, inv)
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local src = ItemStack("techage:sieved_gravel")
|
||||
local dst = ItemStack("default:sand")
|
||||
if inv:contains_item("src", src) then
|
||||
@ -255,7 +255,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("rinser", S("Gravel Rinser"), tiles, {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -329,8 +329,7 @@ function techage.add_rinser_recipe(recipe)
|
||||
recipe.items = {recipe.input}
|
||||
recipe.type = "rinsing"
|
||||
techage.recipes.register_craft(recipe)
|
||||
end
|
||||
end
|
||||
|
||||
techage.add_rinser_recipe({input="techage:sieved_gravel", output="techage:usmium_nuggets", probability=30})
|
||||
techage.add_rinser_recipe({input="techage:sieved_gravel", output="default:copper_lump", probability=15})
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA2/TA3/TA4 Gravel Sieve, sieving gravel to find ores
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -179,7 +179,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("gravelsieve", S("Gravel Sieve"), tiles, {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -265,17 +265,17 @@ techage.recipes.register_craft_type("ta4_gravelsieve", {
|
||||
height = 1,
|
||||
})
|
||||
techage.recipes.register_craft({
|
||||
output = "techage:sieved_basalt_gravel",
|
||||
output = "techage:sieved_basalt_gravel",
|
||||
items = {"techage:basalt_gravel"},
|
||||
type = "ta2_gravelsieve",
|
||||
})
|
||||
techage.recipes.register_craft({
|
||||
output = "techage:sieved_basalt_gravel",
|
||||
output = "techage:sieved_basalt_gravel",
|
||||
items = {"techage:basalt_gravel"},
|
||||
type = "ta3_gravelsieve",
|
||||
})
|
||||
techage.recipes.register_craft({
|
||||
output = "techage:sieved_basalt_gravel",
|
||||
output = "techage:sieved_basalt_gravel",
|
||||
items = {"techage:basalt_gravel"},
|
||||
type = "ta4_gravelsieve",
|
||||
})
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA2/TA3/TA4 Grinder, grinding Cobble/Basalt to Gravel
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -98,7 +98,7 @@ local function src_to_dst(src_stack, idx, src_name, num_items, inp_num, inv, dst
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
local function grinding(pos, crd, nvm, inv)
|
||||
local blocked = false -- idle
|
||||
for idx,stack in ipairs(inv:get_list("src")) do
|
||||
@ -211,7 +211,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("grinder", S("Grinder"), tiles, {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -313,7 +313,7 @@ techage.register_node({"techage:ta1_mill_base"}, {
|
||||
on_node_load = function(pos, node)
|
||||
minetest.get_node_timer(pos):start(4)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_mill_base",
|
||||
@ -369,19 +369,19 @@ function techage.add_grinder_recipe(recipe, ta1_permitted)
|
||||
if minetest.registered_items[name] then
|
||||
if ta1_permitted then
|
||||
RecipesTa1[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output}
|
||||
|
||||
|
||||
recipe.items = {recipe.input}
|
||||
recipe.type = "milling"
|
||||
techage.recipes.register_craft(table.copy(recipe))
|
||||
end
|
||||
|
||||
|
||||
Recipes[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output}
|
||||
|
||||
|
||||
recipe.items = {recipe.input}
|
||||
recipe.type = "grinding"
|
||||
techage.recipes.register_craft(recipe)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
techage.add_grinder_recipe({input="default:cobble", output="default:gravel"})
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Item Source Block
|
||||
]]--
|
||||
|
||||
@ -16,7 +16,7 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local CYCLE_TIME = 30
|
||||
|
||||
|
||||
local function formspec()
|
||||
return "size[8,7.2]"..
|
||||
default.gui_bg..
|
||||
@ -32,7 +32,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
@ -40,7 +40,7 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
@ -81,7 +81,7 @@ minetest.register_node("techage:itemsource", {
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
|
||||
@ -97,4 +97,4 @@ techage.register_node({"techage:itemsource"}, {
|
||||
on_node_load = function(pos)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA2/TA3 Bucket based Liquid Sampler
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -96,7 +96,7 @@ end
|
||||
local function keep_running(pos, elapsed)
|
||||
--if tubelib.data_not_corrupted(pos) then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local crd = CRD(pos)
|
||||
local crd = CRD(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
sample_liquid(pos, crd, nvm, inv)
|
||||
end
|
||||
@ -175,7 +175,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, _ =
|
||||
local node_name_ta2, node_name_ta3, _ =
|
||||
techage.register_consumer("liquidsampler", S("Liquid Sampler"), tiles, {
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
@ -220,4 +220,3 @@ minetest.register_craft({
|
||||
{"", "techage:vacuum_tube", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Tube support for digtron and protector chests
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ local CacheForFuelNodeNames = {}
|
||||
|
||||
local function is_fuel(stack)
|
||||
local name = stack:get_name()
|
||||
if CacheForFuelNodeNames[name] then
|
||||
if CacheForFuelNodeNames[name] then
|
||||
return true
|
||||
end
|
||||
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
|
||||
@ -53,7 +53,7 @@ techage.register_node({"digtron:inventory"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"digtron:fuelstore"}, {
|
||||
on_inv_request = function(pos, in_dir, access_type)
|
||||
@ -75,7 +75,7 @@ techage.register_node({"digtron:fuelstore"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "fuel", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"digtron:combined_storage"}, {
|
||||
on_inv_request = function(pos, in_dir, access_type)
|
||||
@ -102,7 +102,7 @@ techage.register_node({"digtron:combined_storage"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- protector
|
||||
@ -128,6 +128,4 @@ techage.register_node({"protector:chest"}, {
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA2/TA3/TA4 Pusher
|
||||
Nodes for push/pull operation of StackItems from chests or other
|
||||
inventory/server nodes to tubes or other inventory/server nodes.
|
||||
@ -33,7 +33,7 @@ local Tube = techage.Tube
|
||||
local STANDBY_TICKS = 2
|
||||
local COUNTDOWN_TICKS = 4
|
||||
local CYCLE_TIME = 2
|
||||
|
||||
|
||||
local function ta4_formspec(self, pos, nvm)
|
||||
if CRD(pos).stage == 4 then -- TA4 node?
|
||||
return "size[8,7.2]"..
|
||||
@ -56,12 +56,12 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
local list = inv:get_list(listname)
|
||||
if list[index]:get_count() == 0 then
|
||||
@ -76,12 +76,12 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_stack(listname, index, nil)
|
||||
return 0
|
||||
@ -118,7 +118,7 @@ local function keep_running(pos, elapsed)
|
||||
local crd = CRD(pos)
|
||||
pushing(pos, crd, M(pos), nvm)
|
||||
crd.State:is_active(nvm)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
if CRD(pos).stage ~= 4 then -- Not TA4 node?
|
||||
@ -148,14 +148,14 @@ local function tubelib2_on_update2(pos, outdir, tlib2, node)
|
||||
local pull_dir = M(pos):get_int("pull_dir")
|
||||
local push_dir = M(pos):get_int("push_dir")
|
||||
local is_ta4_tube = true
|
||||
|
||||
|
||||
for i, pos, node in Tube:get_tube_line(pos, pull_dir) do
|
||||
is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name]
|
||||
end
|
||||
for i, pos, node in Tube:get_tube_line(pos, push_dir) do
|
||||
is_ta4_tube = is_ta4_tube and techage.TA4tubes[node.name]
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local crd = CRD(pos)
|
||||
if CRD(pos).stage == 4 and not is_ta4_tube then
|
||||
@ -182,7 +182,7 @@ end
|
||||
|
||||
local function config_item(pos, payload)
|
||||
local name, count = unpack(payload:split(" "))
|
||||
if name and (minetest.registered_nodes[name] or minetest.registered_items[name]
|
||||
if name and (minetest.registered_nodes[name] or minetest.registered_items[name]
|
||||
or minetest.registered_craftitems[name]) then
|
||||
count = tonumber(count) or 1
|
||||
local inv = M(pos):get_inventory()
|
||||
@ -230,14 +230,14 @@ tiles.act = {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
local tubing = {
|
||||
-- push item through the pusher in opposit direction
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
return in_dir == M(pos):get_int("pull_dir") and techage.safe_push_items(pos, in_dir, stack)
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "pull" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
@ -257,8 +257,8 @@ local tubing = {
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("pusher", S("Pusher"), tiles, {
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
@ -285,7 +285,7 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
node_timer = keep_running,
|
||||
on_rotate = screwdriver.disallow,
|
||||
tubelib2_on_update2 = tubelib2_on_update2,
|
||||
|
||||
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
@ -319,4 +319,3 @@ minetest.register_craft({
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Quarry machine to dig stones and other ground blocks.
|
||||
|
||||
|
||||
The Quarry digs a hole (default) 5x5 blocks large and up to 80 blocks deep.
|
||||
It starts at the given level (0 is same level as the quarry block,
|
||||
1 is one level higher and so on)) and goes down to the given depth number.
|
||||
@ -34,7 +34,7 @@ local Side2Facedir = {F=0, R=1, B=2, L=3, D=4, U=5}
|
||||
local Depth2Idx = {[1]=1 ,[2]=2, [3]=3, [5]=4, [10]=5, [15]=6, [20]=7, [25]=8, [40]=9, [60]=10, [80]=11}
|
||||
local Holesize2Idx = {["3x3"] = 1, ["5x5"] = 2, ["7x7"] = 3, ["9x9"] = 4, ["11x11"] = 5}
|
||||
local Holesize2Diameter = {["3x3"] = 3, ["5x5"] = 5, ["7x7"] = 7, ["9x9"] = 9, ["11x11"] = 11}
|
||||
local Level2Idx = {[2]=1, [1]=2, [0]=3, [-1]=4, [-2]=5, [-3]=6,
|
||||
local Level2Idx = {[2]=1, [1]=2, [0]=3, [-1]=4, [-2]=5, [-3]=6,
|
||||
[-5]=7, [-10]=8, [-15]=9, [-20]=10}
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
@ -53,7 +53,7 @@ local function formspec(self, pos, nvm)
|
||||
elseif CRD(pos).stage == 2 then
|
||||
depth_list = "1,2,3,5,10,15,20"
|
||||
end
|
||||
|
||||
|
||||
return "size[8,8]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
@ -61,11 +61,11 @@ local function formspec(self, pos, nvm)
|
||||
"box[0,-0.1;7.8,0.5;#c6e8ff]"..
|
||||
"label[3.5,-0.1;"..minetest.colorize( "#000000", S("Quarry")).."]"..
|
||||
techage.question_mark_help(8, tooltip)..
|
||||
"dropdown[0,0.8;1.5;level;2,1,0,-1,-2,-3,-5,-10,-15,-20;"..level_idx.."]"..
|
||||
"dropdown[0,0.8;1.5;level;2,1,0,-1,-2,-3,-5,-10,-15,-20;"..level_idx.."]"..
|
||||
"label[1.6,0.9;"..S("Start level").."]"..
|
||||
"dropdown[0,1.8;1.5;depth;"..depth_list..";"..depth_idx.."]"..
|
||||
"dropdown[0,1.8;1.5;depth;"..depth_list..";"..depth_idx.."]"..
|
||||
"label[1.6,1.9;"..S("Digging depth").." ("..level..")]"..
|
||||
"dropdown[0,2.8;1.5;hole_size;"..hsize_list..";"..hsize_idx.."]"..
|
||||
"dropdown[0,2.8;1.5;hole_size;"..hsize_list..";"..hsize_idx.."]"..
|
||||
"label[1.6,2.9;"..S("Hole size").."]"..
|
||||
"list[context;main;5,0.8;3,3;]"..
|
||||
"image[4,0.8;1,1;"..techage.get_power_image(pos, nvm).."]"..
|
||||
@ -80,7 +80,7 @@ local function play_sound(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.handle or mem.handle == -1 then
|
||||
mem.handle = minetest.sound_play("techage_quarry", {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 1.5,
|
||||
max_hear_distance = 15,
|
||||
loop = true})
|
||||
@ -114,7 +114,7 @@ local function get_pos(pos, facedir, side, steps)
|
||||
facedir = (facedir + Side2Facedir[side]) % 4
|
||||
local dir = vector.multiply(minetest.facedir_to_dir(facedir), steps or 1)
|
||||
return vector.add(pos, dir)
|
||||
end
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
@ -147,7 +147,7 @@ local function get_corner_positions(pos, facedir, hole_diameter)
|
||||
return pos1, pos2
|
||||
end
|
||||
|
||||
local function is_air_level(pos1, pos2, hole_diameter)
|
||||
local function is_air_level(pos1, pos2, hole_diameter)
|
||||
return #minetest.find_nodes_in_area(pos1, pos2, {"air"}) == hole_diameter * hole_diameter
|
||||
end
|
||||
|
||||
@ -189,7 +189,7 @@ local function quarry_task(pos, crd, nvm)
|
||||
end
|
||||
return at_least_one_added
|
||||
end
|
||||
|
||||
|
||||
local pos1, pos2 = get_corner_positions(pos, facedir, nvm.hole_diameter)
|
||||
nvm.level = 1
|
||||
for y_curr = y_first, y_last, -1 do
|
||||
@ -197,16 +197,16 @@ local function quarry_task(pos, crd, nvm)
|
||||
pos2.y = y_curr
|
||||
|
||||
nvm.level = y_first - y_curr
|
||||
|
||||
|
||||
if minetest.is_area_protected(pos1, pos2, owner, 5) then
|
||||
crd.State:fault(pos, nvm, S("area is protected"))
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if not is_air_level(pos1, pos2, nvm.hole_diameter) then
|
||||
mark_area(pos1, pos2, owner)
|
||||
coroutine.yield()
|
||||
|
||||
|
||||
for zoffs = 1, nvm.hole_diameter do
|
||||
for xoffs = 1, nvm.hole_diameter do
|
||||
local qpos = get_quarry_pos(pos1, xoffs, zoffs)
|
||||
@ -226,20 +226,20 @@ local function quarry_task(pos, crd, nvm)
|
||||
end
|
||||
crd.State:stop(pos, nvm, S("finished"))
|
||||
end
|
||||
|
||||
|
||||
local function keep_running(pos, elapsed)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.co then
|
||||
mem.co = coroutine.create(quarry_task)
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local crd = CRD(pos)
|
||||
local _, err = coroutine.resume(mem.co, pos, crd, nvm)
|
||||
if err then
|
||||
minetest.log("error", "[TA4 Quarry Coroutine Error]" .. err)
|
||||
end
|
||||
|
||||
|
||||
if techage.is_activeformspec(pos) then
|
||||
M(pos):set_string("formspec", formspec(crd.State, pos, nvm))
|
||||
end
|
||||
@ -268,7 +268,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
|
||||
|
||||
if fields.depth then
|
||||
if tonumber(fields.depth) ~= nvm.quarry_depth then
|
||||
nvm.quarry_depth = tonumber(fields.depth)
|
||||
@ -281,7 +281,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
CRD(pos).State:stop(pos, nvm)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if fields.level then
|
||||
if tonumber(fields.level) ~= nvm.start_level then
|
||||
nvm.start_level = tonumber(fields.level)
|
||||
@ -373,7 +373,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("quarry", S("Quarry"), tiles, {
|
||||
drawtype = "normal",
|
||||
cycle_time = CYCLE_TIME,
|
||||
|
@ -91,7 +91,7 @@ local function get_recipe(inv)
|
||||
local input = table.concat(items, ",", 1, last_idx)
|
||||
local stack = inv:get_stack("output", 1)
|
||||
return {
|
||||
input = input,
|
||||
input = input,
|
||||
output = stack:get_name() .. " " .. stack:get_count()
|
||||
}
|
||||
end
|
||||
@ -129,7 +129,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
local list = inv:get_list(listname)
|
||||
stack:set_count(1)
|
||||
@ -142,7 +142,7 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_stack(listname, index, nil)
|
||||
after_recipe_change(pos, inv, listname)
|
||||
@ -153,7 +153,7 @@ local function allow_metadata_inventory_move(pos, from_list, from_index, to_list
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
if from_list == to_list then
|
||||
minetest.after(0.1, after_recipe_change, pos, inv, from_list)
|
||||
@ -176,7 +176,7 @@ minetest.register_node("techage:ta4_recipeblock", {
|
||||
inv:set_size('input', 9)
|
||||
inv:set_size('output', 1)
|
||||
end,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local number = techage.add_node(pos, "techage:ta4_chest")
|
||||
@ -190,7 +190,7 @@ minetest.register_node("techage:ta4_recipeblock", {
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.recipe_idx = nvm.recipe_idx or 1
|
||||
if fields.next == ">>" then
|
||||
@ -202,7 +202,7 @@ minetest.register_node("techage:ta4_recipeblock", {
|
||||
update_inventor(pos, inv, nvm.recipe_idx or 1)
|
||||
M(pos):set_string("formspec", formspec(pos, nvm))
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
@ -211,7 +211,7 @@ minetest.register_node("techage:ta4_recipeblock", {
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
@ -241,4 +241,3 @@ minetest.register_craft({
|
||||
{"default:steel_ingot", "techage:ta4_wlanchip", "default:steel_ingot"},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Recycler, recycling techage machines
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -112,9 +112,9 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
return stack:get_count()
|
||||
end
|
||||
|
||||
local function cook_reverse(stack, inv, idx, recipe)
|
||||
local function cook_reverse(stack, inv, idx, recipe)
|
||||
-- check space
|
||||
for _,item in ipairs(recipe.items) do
|
||||
for _,item in ipairs(recipe.items) do
|
||||
if not inv:room_for_item("dst", stack) then
|
||||
return false
|
||||
end
|
||||
@ -122,7 +122,7 @@ local function cook_reverse(stack, inv, idx, recipe)
|
||||
-- take item
|
||||
inv:remove_item("src", ItemStack(recipe.output))
|
||||
-- add items
|
||||
for _,item in ipairs(recipe.items) do
|
||||
for _,item in ipairs(recipe.items) do
|
||||
inv:add_item("dst", item)
|
||||
end
|
||||
return true
|
||||
@ -240,7 +240,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local _, _, node_name_ta4 =
|
||||
local _, _, node_name_ta4 =
|
||||
techage.register_consumer("recycler", S("Recycler"), tiles, {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -292,13 +292,13 @@ minetest.register_craft({
|
||||
-------------------------------------------------------------------------------
|
||||
-- Prepare recipes
|
||||
-------------------------------------------------------------------------------
|
||||
-- Nodes from mods that can be recycled
|
||||
-- Nodes from mods that can be recycled
|
||||
local ModNames = {
|
||||
techage = true,
|
||||
techage = true,
|
||||
hyperloop = true,
|
||||
}
|
||||
|
||||
local function get_item_list(inputs)
|
||||
local function get_item_list(inputs)
|
||||
local lst = {}
|
||||
for _,input in pairs(inputs or {}) do
|
||||
if SpecialItems[input] then
|
||||
@ -317,7 +317,7 @@ local function get_special_recipe(name)
|
||||
if SpecialItems[name] then
|
||||
return {
|
||||
output = name,
|
||||
items = {SpecialItems[name]}
|
||||
items = {SpecialItems[name]}
|
||||
}
|
||||
end
|
||||
end
|
||||
@ -325,22 +325,22 @@ end
|
||||
local function collect_recipes()
|
||||
local add = function(name, ndef)
|
||||
local _, _, mod, _ = string.find(name, "([%w_]+):([%w_]+)")
|
||||
local recipe = get_special_recipe(name) or
|
||||
techage.recipes.get_recipe(name) or
|
||||
local recipe = get_special_recipe(name) or
|
||||
techage.recipes.get_recipe(name) or
|
||||
minetest.get_craft_recipe(name)
|
||||
local items = get_item_list(recipe.items)
|
||||
|
||||
if ModNames[mod]
|
||||
and ndef.groups.not_in_creative_inventory ~= 1
|
||||
|
||||
if ModNames[mod]
|
||||
and ndef.groups.not_in_creative_inventory ~= 1
|
||||
and not ndef.tool_capabilities
|
||||
and recipe.output
|
||||
and recipe.output
|
||||
and next(items) then
|
||||
local s = table.concat(items, ", ")
|
||||
--print(string.format("%-36s {%s}", recipe.output, s))
|
||||
Recipes[name] = {output = recipe.output, items = items}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for name, ndef in pairs(minetest.registered_nodes) do
|
||||
add(name, ndef)
|
||||
end
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA2/TA3 Power Test Source
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -55,7 +55,7 @@ local function stop_node2(pos, nvm, state)
|
||||
end
|
||||
|
||||
local function start_node3(pos, nvm, state)
|
||||
local meta = M(pos)
|
||||
local meta = M(pos)
|
||||
nvm.running = true
|
||||
nvm.provided = 0
|
||||
techage.evaluate_charge_termination(nvm, meta)
|
||||
@ -241,7 +241,7 @@ techage.register_node({"techage:t4_source"}, {
|
||||
return State3:on_receive_message(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
control.register_nodes({"techage:t4_source"}, {
|
||||
on_receive = function(pos, tlib2, topic, payload)
|
||||
@ -256,11 +256,10 @@ control.register_nodes({"techage:t4_source"}, {
|
||||
running = nvm.running or false,
|
||||
available = PWR_PERF,
|
||||
provided = nvm.provided or 0,
|
||||
termpoint = meta:get_string("termpoint"),
|
||||
termpoint = meta:get_string("termpoint"),
|
||||
}
|
||||
end
|
||||
return false
|
||||
end,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 8x2000 Chest
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -36,7 +36,7 @@ local function repair_inv(nvm)
|
||||
nvm.inventory = nvm.inventory or {}
|
||||
for i = 1,8 do
|
||||
local item = nvm.inventory[i]
|
||||
if not item or type(item) ~= "table"
|
||||
if not item or type(item) ~= "table"
|
||||
or not item.name or type(item.name) ~= "string" or item.name == ""
|
||||
or not item.count or type(item.count) ~= "number" or item.count < 1
|
||||
then
|
||||
@ -102,8 +102,8 @@ end
|
||||
|
||||
local function get_stacksize(pos)
|
||||
local size = M(pos):get_int("stacksize")
|
||||
if size == 0 then
|
||||
return STACK_SIZE
|
||||
if size == 0 then
|
||||
return STACK_SIZE
|
||||
end
|
||||
return size
|
||||
end
|
||||
@ -362,15 +362,15 @@ local function get_front_chest_pos(pos)
|
||||
if nvm.front_chest_pos then
|
||||
return nvm.front_chest_pos
|
||||
end
|
||||
|
||||
|
||||
local node = techage.get_node_lvm(pos)
|
||||
if search_chest_in_front(pos, node) then
|
||||
return nvm.front_chest_pos
|
||||
end
|
||||
|
||||
|
||||
return pos
|
||||
end
|
||||
|
||||
|
||||
local function convert_to_chest_again(pos, node, player)
|
||||
local dir = techage.side_to_outdir("B", node.param2)
|
||||
local pos1 = tubelib2.get_pos(pos, dir)
|
||||
@ -389,8 +389,8 @@ local function convert_to_chest_again(pos, node, player)
|
||||
M(pos1):set_string("formspec", formspec(pos1))
|
||||
M(pos1):set_string("infotext", DESCRIPTION.." "..number)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local function unlock_chests(pos, player)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
for idx = 1,8 do
|
||||
@ -450,7 +450,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
for i = 1,8 do
|
||||
if fields["get"..i] ~= nil then
|
||||
inv_take_from_chest(pos, i)
|
||||
@ -469,7 +469,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
if fields.priority then
|
||||
M(pos):set_int("priority", fields.priority == "true" and 1 or 0)
|
||||
end
|
||||
|
||||
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
|
||||
@ -511,7 +511,7 @@ minetest.register_node("techage:ta4_chest", {
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_size('main', 8)
|
||||
end,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local node = minetest.get_node(pos)
|
||||
if search_chest_in_front(pos, node) then
|
||||
@ -530,7 +530,7 @@ minetest.register_node("techage:ta4_chest", {
|
||||
techage_set_numbers = function(pos, numbers, player_name)
|
||||
return techage.logic.set_numbers(pos, numbers, player_name, DESCRIPTION)
|
||||
end,
|
||||
|
||||
|
||||
on_rotate = on_rotate,
|
||||
on_rightclick = on_rightclick,
|
||||
on_receive_fields = on_receive_fields,
|
||||
@ -538,7 +538,7 @@ minetest.register_node("techage:ta4_chest", {
|
||||
after_dig_node = after_dig_node,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
|
||||
|
||||
on_metadata_inventory_put = on_metadata_inventory_put,
|
||||
on_metadata_inventory_move = on_metadata_inventory_move,
|
||||
on_metadata_inventory_take = on_metadata_inventory_take,
|
||||
@ -593,7 +593,7 @@ techage.register_node({"techage:ta4_chest"}, {
|
||||
end
|
||||
return res
|
||||
end,
|
||||
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "count" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
@ -608,7 +608,7 @@ techage.register_node({"techage:ta4_chest"}, {
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta4_chest_dummy"}, {
|
||||
on_pull_item = function(pos, in_dir, num, item_name)
|
||||
@ -635,7 +635,7 @@ techage.register_node({"techage:ta4_chest_dummy"}, {
|
||||
end
|
||||
return res
|
||||
end
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Injector
|
||||
|
||||
]]--
|
||||
@ -47,12 +47,12 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
local list = inv:get_list(listname)
|
||||
local cdr = CRD(pos)
|
||||
@ -69,12 +69,12 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if CRD(pos).State:get_state(nvm) ~= techage.STOPPED then
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_stack(listname, index, nil)
|
||||
return 0
|
||||
@ -148,7 +148,7 @@ local function pushing(pos, crd, meta, nvm)
|
||||
local filter = inv:get_list("filter")
|
||||
local pushed = false
|
||||
local pulled = false
|
||||
|
||||
|
||||
for idx, item in ipairs(filter) do
|
||||
local name = item:get_name()
|
||||
local num = math.min(item:get_count(), crd.num_items)
|
||||
@ -165,7 +165,7 @@ local function pushing(pos, crd, meta, nvm)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if not pulled then
|
||||
crd.State:idle(pos, nvm)
|
||||
elseif not pushed then
|
||||
@ -179,7 +179,7 @@ local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local crd = CRD(pos)
|
||||
pushing(pos, crd, M(pos), nvm)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
@ -188,7 +188,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if fields.pull_mode then
|
||||
nvm.pull_mode = fields.pull_mode == "true"
|
||||
end
|
||||
end
|
||||
CRD(pos).State:state_button_event(pos, nvm, fields)
|
||||
M(pos):set_string("formspec", formspec(CRD(pos).State, pos, nvm))
|
||||
end
|
||||
@ -231,14 +231,14 @@ tiles.act = {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
local tubing = {
|
||||
-- push item through the injector in opposit direction
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
return in_dir == M(pos):get_int("pull_dir") and techage.safe_push_items(pos, in_dir, stack)
|
||||
end,
|
||||
is_pusher = true, -- is a pulling/pushing node
|
||||
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
return CRD(pos).State:on_receive_message(pos, topic, payload)
|
||||
end,
|
||||
@ -246,8 +246,8 @@ local tubing = {
|
||||
CRD(pos).State:on_node_load(pos)
|
||||
end,
|
||||
}
|
||||
|
||||
local _, node_name_ta3, node_name_ta4 =
|
||||
|
||||
local _, node_name_ta3, node_name_ta4 =
|
||||
techage.register_consumer("injector", S("Injector"), tiles, {
|
||||
cycle_time = CYCLE_TIME,
|
||||
standby_ticks = STANDBY_TICKS,
|
||||
@ -271,7 +271,7 @@ local _, node_name_ta3, node_name_ta4 =
|
||||
on_receive_fields = on_receive_fields,
|
||||
node_timer = node_timer,
|
||||
on_rotate = screwdriver.disallow,
|
||||
|
||||
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA5 Hyperloop Chest
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -33,7 +33,7 @@ local function formspec(pos)
|
||||
local title = ndef.description .. " " .. status
|
||||
return "size[8,9]"..
|
||||
"box[0,-0.1;7.8,0.5;#c6e8ff]" ..
|
||||
"label[0.2,-0.1;" .. minetest.colorize( "#000000", title) .. "]" ..
|
||||
"label[0.2,-0.1;" .. minetest.colorize( "#000000", title) .. "]" ..
|
||||
"list[context;main;0,1;8,4;]"..
|
||||
"list[current_player;main;0,5.3;8,4;]"..
|
||||
"listring[context;main]"..
|
||||
@ -175,7 +175,7 @@ techage.register_node({"techage:ta5_hl_chest"}, {
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Assemble routines
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -28,7 +28,7 @@ local Face2Dir = {[0]=
|
||||
{x=0, y=1, z=0}
|
||||
}
|
||||
|
||||
-- Determine the destination position based on the base position,
|
||||
-- Determine the destination position based on the base position,
|
||||
-- param2, and a route table like : {0,3}
|
||||
-- 0 = forward, 1 = right, 2 = backward, 3 = left
|
||||
local function dest_pos(pos, param2, route, y_offs)
|
||||
@ -54,8 +54,8 @@ local function build(pos, param2, AssemblyPlan, idx)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.assemble_locked = false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- timer based function
|
||||
local function remove(pos, param2, AssemblyPlan, idx)
|
||||
local item = AssemblyPlan[idx]
|
||||
@ -68,7 +68,7 @@ local function remove(pos, param2, AssemblyPlan, idx)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.assemble_locked = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function check_space(pos, param2, AssemblyPlan, player_name)
|
||||
for _,item in ipairs(AssemblyPlan) do
|
||||
@ -78,7 +78,7 @@ local function check_space(pos, param2, AssemblyPlan, player_name)
|
||||
minetest.chat_send_player(player_name, S("[TA] Area is protected!"))
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
local node = techage.get_node_lvm(pos1)
|
||||
local ndef = minetest.registered_nodes[node.name]
|
||||
if not ndef or not ndef.buildable_to and node.name ~= node_name then
|
||||
@ -97,7 +97,7 @@ function techage.assemble.build(pos, AssemblyPlan, player_name)
|
||||
-- check protection
|
||||
if minetest.is_protected(pos, player_name) then
|
||||
return
|
||||
end
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if nvm.assemble_locked then
|
||||
return
|
||||
@ -114,7 +114,7 @@ function techage.assemble.remove(pos, AssemblyPlan, player_name)
|
||||
-- check protection
|
||||
if minetest.is_protected(pos, player_name) then
|
||||
return
|
||||
end
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if nvm.assemble_locked then
|
||||
return
|
||||
@ -130,7 +130,7 @@ end
|
||||
--------------------------------------------------------------------------------
|
||||
local function play_sound(pos, sound)
|
||||
minetest.sound_play(sound, {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 1,
|
||||
max_hear_distance = 10,
|
||||
})
|
||||
@ -232,7 +232,7 @@ function techage.assemble.count_items(AssemblyPlan)
|
||||
end
|
||||
end
|
||||
return t
|
||||
end
|
||||
end
|
||||
|
||||
-- Determine the destination position based on the given route
|
||||
-- param2, and a route table like : {0,3}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Boiler common functions
|
||||
|
||||
]]--
|
||||
@ -74,7 +74,7 @@ function techage.boiler.water_temperature(pos, nvm)
|
||||
nvm.temperature = math.max(nvm.temperature - HEAT_STEP, 20)
|
||||
end
|
||||
nvm.fire_trigger = false
|
||||
|
||||
|
||||
if nvm.water_level == 0 then
|
||||
if nvm.num_water > 0 then
|
||||
nvm.num_water = nvm.num_water - 1
|
||||
@ -119,7 +119,7 @@ function techage.boiler.on_punch(pos, node, puncher, pointed_thing)
|
||||
if mem.blocking_time > techage.SystemTime then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
nvm.num_water = nvm.num_water or 0
|
||||
local wielded_item = puncher:get_wielded_item():get_name()
|
||||
local item_count = puncher:get_wielded_item():get_count()
|
||||
@ -146,4 +146,3 @@ function techage.boiler.on_punch(pos, node, puncher, pointed_thing)
|
||||
M(pos):set_string("formspec", techage.boiler.formspec(pos, nvm))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Basis functions for inter-node communication
|
||||
|
||||
]]--
|
||||
@ -59,7 +59,7 @@ local function delete_nodeinfo_entry(number)
|
||||
return number
|
||||
end
|
||||
|
||||
-- Keep the cache size small by deleting entries randomly
|
||||
-- Keep the cache size small by deleting entries randomly
|
||||
local function keep_small(number)
|
||||
number = delete_nodeinfo_entry(number)
|
||||
minetest.after(10, keep_small, number)
|
||||
@ -82,13 +82,13 @@ end
|
||||
-- Determine position related node number for addressing purposes
|
||||
local function get_number(pos, new)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if meta:contains("node_number") then
|
||||
return meta:get_string("node_number")
|
||||
if meta:contains("node_number") then
|
||||
return meta:get_string("node_number")
|
||||
end
|
||||
-- generate new number
|
||||
if new then
|
||||
local num = backend.add_nodepos(pos)
|
||||
meta:set_string("node_number", num)
|
||||
meta:set_string("node_number", num)
|
||||
return num
|
||||
end
|
||||
end
|
||||
@ -141,15 +141,15 @@ end
|
||||
local function get_next_node(pos, out_dir)
|
||||
local res, npos, node = Tube:compatible_node(pos, out_dir)
|
||||
local in_dir = tubelib2.Turn180Deg[out_dir]
|
||||
return res, npos, in_dir, node.name
|
||||
return res, npos, in_dir, node.name
|
||||
end
|
||||
|
||||
local function get_dest_node(pos, out_dir)
|
||||
local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir)
|
||||
local _,node = Tube:get_node(spos)
|
||||
return spos, in_dir, node.name
|
||||
return spos, in_dir, node.name
|
||||
end
|
||||
|
||||
|
||||
local function item_handling_node(name)
|
||||
local node_def = name and NodeDef[name]
|
||||
if node_def then
|
||||
@ -181,17 +181,17 @@ end)
|
||||
-------------------------------------------------------------------
|
||||
-- API helper functions
|
||||
-------------------------------------------------------------------
|
||||
|
||||
|
||||
-- Function returns { pos, name } for the node referenced by number
|
||||
function techage.get_node_info(dest_num)
|
||||
return NodeInfoCache[dest_num] or update_nodeinfo(dest_num)
|
||||
end
|
||||
end
|
||||
|
||||
-- Function returns the node number from the given position or
|
||||
-- nil, if no node number for this position is assigned.
|
||||
function techage.get_node_number(pos)
|
||||
return get_number(pos)
|
||||
end
|
||||
end
|
||||
|
||||
function techage.get_pos(pos, side)
|
||||
local node = techage.get_node_lvm(pos)
|
||||
@ -200,11 +200,11 @@ function techage.get_pos(pos, side)
|
||||
dir = side_to_dir(side, node.param2)
|
||||
end
|
||||
return tubelib2.get_pos(pos, dir)
|
||||
end
|
||||
end
|
||||
|
||||
-- Function is used for available nodes with lost numbers, only.
|
||||
function techage.get_new_number(pos, name)
|
||||
-- store position
|
||||
-- store position
|
||||
return get_number(pos, true)
|
||||
end
|
||||
|
||||
@ -217,7 +217,7 @@ end
|
||||
-------------------------------------------------------------------
|
||||
-- Node construction/destruction functions
|
||||
-------------------------------------------------------------------
|
||||
|
||||
|
||||
-- Add node to the techage lists.
|
||||
-- Function determines and returns the node position number,
|
||||
-- needed for message communication.
|
||||
@ -227,7 +227,7 @@ function techage.add_node(pos, name, is_ta2)
|
||||
if item_handling_node(name) then
|
||||
Tube:after_place_node(pos)
|
||||
end
|
||||
if is_ta2 then
|
||||
if is_ta2 then
|
||||
return "-"
|
||||
end
|
||||
local key = minetest.hash_node_position(pos)
|
||||
@ -307,10 +307,10 @@ function techage.register_node(names, node_definition)
|
||||
for _,n in ipairs(names) do
|
||||
NodeDef[n] = node_definition
|
||||
end
|
||||
if node_definition.on_pull_item or node_definition.on_push_item or
|
||||
if node_definition.on_pull_item or node_definition.on_push_item or
|
||||
node_definition.is_pusher then
|
||||
Tube:add_secondary_node_names(names)
|
||||
|
||||
|
||||
for _,n in ipairs(names) do
|
||||
techage.KnownNodes[n] = true
|
||||
end
|
||||
@ -346,7 +346,7 @@ function techage.check_numbers(numbers, placer_name)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function techage.send_multi(src, numbers, topic, payload)
|
||||
--print("send_multi", src, numbers, topic)
|
||||
@ -360,7 +360,7 @@ function techage.send_multi(src, numbers, topic, payload)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function techage.send_single(src, number, topic, payload)
|
||||
--print("send_single", src, number, topic)
|
||||
@ -373,7 +373,7 @@ function techage.send_single(src, number, topic, payload)
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- The destination node location is either:
|
||||
-- A) a destination position, specified by pos
|
||||
@ -407,7 +407,7 @@ function techage.transfer(pos, outdir, topic, payload, network, nodenames)
|
||||
return ndef.on_transfer(dpos, indir, topic, payload)
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Client side Push/Pull item functions
|
||||
@ -430,10 +430,10 @@ end
|
||||
function techage.push_items(pos, out_dir, stack, idx)
|
||||
local npos, in_dir, name = get_dest_node(pos, out_dir)
|
||||
if npos and NodeDef[name] and NodeDef[name].on_push_item then
|
||||
return NodeDef[name].on_push_item(npos, in_dir, stack, idx)
|
||||
return NodeDef[name].on_push_item(npos, in_dir, stack, idx)
|
||||
elseif is_air_like(name) or is_cart_available(npos) then
|
||||
minetest.add_item(npos, stack)
|
||||
return true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -470,9 +470,9 @@ function techage.unpull_items(pos, out_dir, stack)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Client side Push/Pull item functions for hopper like nodes
|
||||
-- Client side Push/Pull item functions for hopper like nodes
|
||||
-- (nodes with no tube support)
|
||||
-------------------------------------------------------------------
|
||||
|
||||
@ -486,10 +486,10 @@ end
|
||||
function techage.neighbour_push_items(pos, out_dir, stack)
|
||||
local res, npos, in_dir, name = get_next_node(pos, out_dir)
|
||||
if res and NodeDef[name] and NodeDef[name].on_push_item then
|
||||
return NodeDef[name].on_push_item(npos, in_dir, stack)
|
||||
return NodeDef[name].on_push_item(npos, in_dir, stack)
|
||||
elseif name == "air" then
|
||||
minetest.add_item(npos, stack)
|
||||
return true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Configured inventory lib
|
||||
Assuming the inventory has the name "conf"
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -38,7 +38,7 @@ function inv_lib.item_filter(pos, size)
|
||||
for idx = 1, size do
|
||||
local item_name = inv:get_stack("conf", idx):get_name()
|
||||
if item_name == "" then item_name = "unconfigured" end
|
||||
if not filter[item_name] then
|
||||
if not filter[item_name] then
|
||||
filter[item_name] = {}
|
||||
end
|
||||
table.insert(filter[item_name], idx)
|
||||
@ -49,7 +49,7 @@ end
|
||||
function inv_lib.allow_conf_inv_put(pos, listname, index, stack, player)
|
||||
local inv = M(pos):get_inventory()
|
||||
local list = inv:get_list(listname)
|
||||
|
||||
|
||||
if list[index]:get_count() == 0 then
|
||||
stack:set_count(1)
|
||||
inv:set_stack(listname, index, stack)
|
||||
@ -104,6 +104,6 @@ function inv_lib.take_item(pos, inv, listname, num, stacks)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return inv_lib
|
||||
|
||||
return inv_lib
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Count techage commands player related
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
local PlayerName
|
||||
@ -43,10 +43,10 @@ local function output()
|
||||
if val > MAX_POINTS then
|
||||
local obj = minetest.get_player_by_name(name)
|
||||
if obj then
|
||||
minetest.chat_send_player(name,
|
||||
minetest.chat_send_player(name,
|
||||
S("[techage] The limit for 'number of commands per minute' has been exceeded.") ..
|
||||
" " .. string.format(MAX_POINTS .. " " .. S("is allowed. Current value is") .. " " .. val));
|
||||
minetest.log("action", "[techage] " .. name ..
|
||||
minetest.log("action", "[techage] " .. name ..
|
||||
" exceeds the limit for commands per minute. value = " .. val)
|
||||
local factor = 100 / (obj:get_armor_groups().fleshy or 100)
|
||||
obj:punch(obj, 1.0, {full_punch_interval=1.0, damage_groups = {fleshy=factor * 5}})
|
||||
@ -65,8 +65,7 @@ minetest.register_chatcommand("ta_limit", {
|
||||
description = "Get your current techage command limit value",
|
||||
func = function(name)
|
||||
local num = LastPlayerPoints[name] or 0
|
||||
return true, S("Your current value is") .. " " .. num .. " " .. S("per minute") .. ". " ..
|
||||
return true, S("Your current value is") .. " " .. num .. " " .. S("per minute") .. ". " ..
|
||||
MAX_POINTS .. " " .. S("is allowed")
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Fake Player
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- Map method names to their return values
|
||||
@ -115,4 +115,3 @@ for method_name, return_value in pairs(methods) do
|
||||
return return_value
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Firebox basic functions
|
||||
|
||||
]]--
|
||||
@ -43,7 +43,7 @@ local function determine_burntimes()
|
||||
local fuel,_ = minetest.get_craft_result({method = "fuel", width = 1, items = {k}})
|
||||
techage.firebox.Burntime[k] = fuel.time
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.after(1, determine_burntimes)
|
||||
|
||||
function techage.firebox.formspec(nvm)
|
||||
@ -147,5 +147,4 @@ function techage.firebox.set_firehole(pos, on)
|
||||
minetest.swap_node(pos2, {name="air"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Block fly/move library
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -22,7 +22,7 @@ local flylib = {}
|
||||
|
||||
local function lvect_add_vec(lvect1, offs)
|
||||
if not lvect1 or not offs then return end
|
||||
|
||||
|
||||
local lvect2 = {}
|
||||
for _, v in ipairs(lvect1) do
|
||||
lvect2[#lvect2 + 1] = vector.add(v, offs)
|
||||
@ -32,7 +32,7 @@ end
|
||||
|
||||
local function lvect_add(lvect1, lvect2)
|
||||
if not lvect1 or not lvect2 then return end
|
||||
|
||||
|
||||
local lvect3 = {}
|
||||
for i, v in ipairs(lvect1) do
|
||||
lvect3[#lvect3 + 1] = vector.add(v, lvect2[i])
|
||||
@ -42,7 +42,7 @@ end
|
||||
|
||||
local function lvect_subtract(lvect1, lvect2)
|
||||
if not lvect1 or not lvect2 then return end
|
||||
|
||||
|
||||
local lvect3 = {}
|
||||
for i, v in ipairs(lvect1) do
|
||||
lvect3[#lvect3 + 1] = vector.subtract(v, lvect2[i])
|
||||
@ -58,7 +58,7 @@ local function rotate(v, yaw)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- to_path function for the fly/move path
|
||||
-- to_path function for the fly/move path
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
local function strsplit(text)
|
||||
@ -79,9 +79,9 @@ function flylib.to_vector(s)
|
||||
local x,y,z = unpack(string.split(s, ","))
|
||||
if x and y and z then
|
||||
return {
|
||||
x=tonumber(x) or 0,
|
||||
y=tonumber(y) or 0,
|
||||
z=tonumber(z) or 0,
|
||||
x=tonumber(x) or 0,
|
||||
y=tonumber(y) or 0,
|
||||
z=tonumber(z) or 0,
|
||||
}
|
||||
end
|
||||
end
|
||||
@ -89,7 +89,7 @@ end
|
||||
function flylib.to_path(s, max_dist)
|
||||
local tPath
|
||||
local dist = 0
|
||||
|
||||
|
||||
for _, line in ipairs(strsplit(s)) do
|
||||
line = trim(line)
|
||||
line = string.split(line, "--", true, 1)[1] or ""
|
||||
@ -125,7 +125,7 @@ local function reverse_path(lpath)
|
||||
end
|
||||
return lres
|
||||
end
|
||||
|
||||
|
||||
local function dest_offset(lpath)
|
||||
local offs = {x=0, y=0, z=0}
|
||||
for i = 1,#lpath do
|
||||
@ -133,9 +133,9 @@ local function dest_offset(lpath)
|
||||
end
|
||||
return offs
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Entity / Move / Attach / Detach
|
||||
-- Entity / Move / Attach / Detach
|
||||
-------------------------------------------------------------------------------
|
||||
local MIN_SPEED = 0.4
|
||||
local MAX_SPEED = 8
|
||||
@ -167,7 +167,7 @@ end
|
||||
-- Check access conflicts with other mods
|
||||
local function lock_player(player)
|
||||
local meta = player:get_meta()
|
||||
if meta:get_int("player_physics_locked") == 0 then
|
||||
if meta:get_int("player_physics_locked") == 0 then
|
||||
meta:set_int("player_physics_locked", 1)
|
||||
meta:set_string("player_physics_locked_by", "ta_flylib")
|
||||
return true
|
||||
@ -177,7 +177,7 @@ end
|
||||
|
||||
local function unlock_player(player)
|
||||
local meta = player:get_meta()
|
||||
if meta:get_int("player_physics_locked") == 1 then
|
||||
if meta:get_int("player_physics_locked") == 1 then
|
||||
if meta:get_string("player_physics_locked_by") == "ta_flylib" then
|
||||
meta:set_int("player_physics_locked", 0)
|
||||
meta:set_string("player_physics_locked_by", "")
|
||||
@ -294,7 +294,7 @@ local function entity_to_node(pos, obj)
|
||||
nvm.running = nil
|
||||
end
|
||||
obj:remove()
|
||||
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef1 = minetest.registered_nodes[name]
|
||||
local ndef2 = minetest.registered_nodes[node.name]
|
||||
@ -321,7 +321,7 @@ end
|
||||
local function node_to_entity(start_pos)
|
||||
local meta = M(start_pos)
|
||||
local node, metadata
|
||||
|
||||
|
||||
if meta:contains("ta_move_block") then
|
||||
-- Move-block stored as metadata
|
||||
node = minetest.deserialize(meta:get_string("ta_move_block"))
|
||||
@ -335,17 +335,17 @@ local function node_to_entity(start_pos)
|
||||
end
|
||||
local obj = minetest.add_entity(start_pos, "techage:move_item")
|
||||
if obj then
|
||||
local self = obj:get_luaentity()
|
||||
local self = obj:get_luaentity()
|
||||
local rot = techage.facedir_to_rotation(node.param2)
|
||||
obj:set_rotation(rot)
|
||||
obj:set_properties({wield_item=node.name})
|
||||
obj:set_armor_groups({immortal=1})
|
||||
|
||||
|
||||
-- To be able to revert to node
|
||||
self.item_name = node.name
|
||||
self.param2 = node.param2
|
||||
self.metadata = metadata or {}
|
||||
|
||||
|
||||
-- Prepare for attachments
|
||||
self.players = {}
|
||||
self.entities = {}
|
||||
@ -412,7 +412,7 @@ local function handover_to(obj, self, pos1)
|
||||
nvm.lpos1 = nvm.lpos1 or {}
|
||||
if self.move2to1 then
|
||||
nvm.lpos1[self.pos1_idx] = pos2
|
||||
|
||||
|
||||
else
|
||||
nvm.lpos1[self.pos1_idx] = pos1
|
||||
end
|
||||
@ -435,7 +435,7 @@ minetest.register_entity("techage:move_item", {
|
||||
visual_size = {x=0.67, y=0.67, z=0.67},
|
||||
selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
},
|
||||
|
||||
|
||||
get_staticdata = function(self)
|
||||
return minetest.serialize({
|
||||
item_name = self.item_name,
|
||||
@ -454,7 +454,7 @@ minetest.register_entity("techage:move_item", {
|
||||
respawn = true,
|
||||
})
|
||||
end,
|
||||
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
if staticdata then
|
||||
local tbl = minetest.deserialize(staticdata) or {}
|
||||
@ -478,7 +478,7 @@ minetest.register_entity("techage:move_item", {
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
on_step = function(self, dtime, moveresult)
|
||||
local stop_obj = function(obj, self)
|
||||
local dest_pos = self.dest_pos
|
||||
@ -490,14 +490,14 @@ minetest.register_entity("techage:move_item", {
|
||||
self.ttl = 2
|
||||
return dest_pos
|
||||
end
|
||||
|
||||
|
||||
if self.dest_pos then
|
||||
local obj = self.object
|
||||
local pos = obj:get_pos()
|
||||
local dist = vector.distance(pos, self.dest_pos)
|
||||
local speed = calc_speed(obj:get_velocity())
|
||||
self.old_dist = self.old_dist or dist
|
||||
|
||||
|
||||
-- Landing
|
||||
if self.lpath and self.lpath[self.path_idx] then
|
||||
if dist < 1 or dist > self.old_dist then
|
||||
@ -520,26 +520,26 @@ minetest.register_entity("techage:move_item", {
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
self.old_dist = dist
|
||||
|
||||
-- Braking or limit max speed
|
||||
|
||||
-- Braking or limit max speed
|
||||
if self.handover then
|
||||
if speed > (dist * 4) or speed > self.max_speed then
|
||||
speed = math.min(speed, math.max(dist * 4, MIN_SPEED))
|
||||
speed = math.min(speed, math.max(dist * 4, MIN_SPEED))
|
||||
local vel = vector.multiply(self.dir,speed)
|
||||
obj:set_velocity(vel)
|
||||
obj:set_acceleration({x=0, y=0, z=0})
|
||||
end
|
||||
else
|
||||
if speed > (dist * 2) or speed > self.max_speed then
|
||||
speed = math.min(speed, math.max(dist * 2, MIN_SPEED))
|
||||
speed = math.min(speed, math.max(dist * 2, MIN_SPEED))
|
||||
local vel = vector.multiply(self.dir,speed)
|
||||
obj:set_velocity(vel)
|
||||
obj:set_acceleration({x=0, y=0, z=0})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
elseif self.ttl then
|
||||
self.ttl = self.ttl - dtime
|
||||
if self.ttl < 0 then
|
||||
@ -566,19 +566,19 @@ end
|
||||
local function is_simple_node(pos)
|
||||
-- special handling
|
||||
local name = minetest.get_node(pos).name
|
||||
if SimpleNodes[name] ~= nil then
|
||||
return SimpleNodes[name]
|
||||
if SimpleNodes[name] ~= nil then
|
||||
return SimpleNodes[name]
|
||||
end
|
||||
|
||||
|
||||
local ndef = minetest.registered_nodes[name]
|
||||
if not ndef or name == "air" or name == "ignore" then return false end
|
||||
-- don't remove nodes with some intelligence or undiggable nodes
|
||||
if ndef.drop == "" then return false end
|
||||
if ndef.diggable == false then return false end
|
||||
if ndef.after_dig_node then return false end
|
||||
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local function move_node(pos, pos1_idx, start_pos, lpath, max_speed, height, move2to1, handover, cpos)
|
||||
local pos2 = next_path_pos(start_pos, lpath, 1)
|
||||
@ -618,7 +618,7 @@ local function move_nodes(pos, meta, nvm, lpath, max_speed, height, move2to1, ha
|
||||
--print("move_nodes", dump(nvm), dump(lpath), max_speed, height, move2to1, handover)
|
||||
local owner = meta:get_string("owner")
|
||||
techage.counting_add(owner, #nvm.lpos1 * #lpath)
|
||||
|
||||
|
||||
for idx = 1, #nvm.lpos1 do
|
||||
local pos1 = nvm.lpos1[idx]
|
||||
local pos2 = nvm.lpos2[idx]
|
||||
@ -650,27 +650,27 @@ local function move_nodes(pos, meta, nvm, lpath, max_speed, height, move2to1, ha
|
||||
return true
|
||||
end
|
||||
|
||||
function flylib.move_to_other_pos(pos, move2to1)
|
||||
function flylib.move_to_other_pos(pos, move2to1)
|
||||
local meta = M(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local lpath, err = flylib.to_path(meta:get_string("path")) or {}
|
||||
local max_speed = meta:contains("max_speed") and meta:get_int("max_speed") or MAX_SPEED
|
||||
local height = meta:contains("height") and meta:get_float("height") or 1
|
||||
local handover
|
||||
|
||||
|
||||
if err then return false end
|
||||
|
||||
|
||||
height = techage.in_range(height, 0, 1)
|
||||
max_speed = techage.in_range(max_speed, MIN_SPEED, MAX_SPEED)
|
||||
nvm.lpos1 = nvm.lpos1 or {}
|
||||
|
||||
|
||||
local offs = dest_offset(lpath)
|
||||
if move2to1 then
|
||||
lpath = reverse_path(lpath)
|
||||
end
|
||||
-- calc destination positions
|
||||
nvm.lpos2 = lvect_add_vec(nvm.lpos1, offs)
|
||||
|
||||
|
||||
if move2to1 then
|
||||
handover = meta:contains("handoverA") and meta:get_string("handoverA")
|
||||
else
|
||||
@ -688,9 +688,9 @@ function flylib.rotate_nodes(pos, posses1, rot)
|
||||
local posses2 = techage.rotate_around_center(posses1, rot, cpos)
|
||||
local param2
|
||||
local nodes2 = {}
|
||||
|
||||
|
||||
techage.counting_add(owner, #posses1 * 2)
|
||||
|
||||
|
||||
for i, pos1 in ipairs(posses1) do
|
||||
local node = techage.get_node_lvm(pos1)
|
||||
if rot == "l" then
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Keep only one formspec active per player
|
||||
|
||||
]]--
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Oil fuel burning lib
|
||||
|
||||
]]--
|
||||
@ -51,7 +51,7 @@ function techage.fuel.fuel_container(x, y, nvm)
|
||||
fuel_percent..":default_furnace_fire_fg.png]"..
|
||||
techage.item_image(0.1, 1.1, itemname)..
|
||||
"container_end[]"
|
||||
end
|
||||
end
|
||||
|
||||
local function help(x, y)
|
||||
local tooltip = S("To add fuel punch\nthis block\nwith a fuel container")
|
||||
@ -108,17 +108,17 @@ function techage.fuel.on_punch(pos, node, puncher, pointed_thing)
|
||||
if mem.blocking_time > techage.SystemTime then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local wielded_item = puncher:get_wielded_item():get_name()
|
||||
local item_count = puncher:get_wielded_item():get_count()
|
||||
local new_item = techage.liquid.fill_on_punch(nvm, wielded_item, item_count, puncher)
|
||||
local new_item = techage.liquid.fill_on_punch(nvm, wielded_item, item_count, puncher)
|
||||
if new_item then
|
||||
puncher:set_wielded_item(new_item)
|
||||
M(pos):set_string("formspec", techage.fuel.formspec(pos, nvm))
|
||||
mem.blocking_time = techage.SystemTime + BLOCKING_TIME
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local ldef = techage.liquid.get_liquid_def(wielded_item)
|
||||
if ldef and ValidOilFuels[ldef.inv_item] then
|
||||
local lqd = (minetest.registered_nodes[node.name] or {}).liquid
|
||||
@ -139,7 +139,7 @@ function techage.fuel.get_fuel(nvm)
|
||||
nvm.liquid.amount = nvm.liquid.amount - 1
|
||||
return nvm.liquid.name
|
||||
end
|
||||
nvm.liquid.name = nil
|
||||
nvm.liquid.name = nil
|
||||
end
|
||||
return nil
|
||||
end
|
||||
@ -194,4 +194,4 @@ function techage.fuel.get_liquid_table(valid_fuel, capacity, start_firebox)
|
||||
return leftover
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Gravel Sieve basis functions
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- Increase the probability over the natural occurrence
|
||||
@ -36,12 +36,12 @@ local function add_ores()
|
||||
and drop ~= ""
|
||||
and item.ore_type == "scatter"
|
||||
and item.wherein == "default:stone"
|
||||
and item.clust_scarcity ~= nil and item.clust_scarcity > 0
|
||||
and item.clust_num_ores ~= nil and item.clust_num_ores > 0
|
||||
and item.clust_scarcity ~= nil and item.clust_scarcity > 0
|
||||
and item.clust_num_ores ~= nil and item.clust_num_ores > 0
|
||||
and item.y_max ~= nil and item.y_min ~= nil then
|
||||
local factor = 0.5
|
||||
if item.y_max < -250 then
|
||||
factor = -250 / item.y_max
|
||||
if item.y_max < -250 then
|
||||
factor = -250 / item.y_max
|
||||
end
|
||||
local probability = (techage.ore_rarity / PROBABILITY_FACTOR) * item.clust_scarcity /
|
||||
(item.clust_num_ores * factor)
|
||||
@ -64,7 +64,7 @@ local function add_ores()
|
||||
overall_probability = overall_probability + 1.0/probability
|
||||
end
|
||||
minetest.log("info", string.format("[techage] Overall probability %g", overall_probability))
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(1, add_ores)
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
For chests and tanks with hyperloop support
|
||||
|
||||
]]--
|
||||
@ -85,7 +85,7 @@ end
|
||||
local function update_node_data(pos, state, conn_name, remote_name, rmt_pos)
|
||||
local meta = M(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
||||
|
||||
if state == "server_connected" then
|
||||
Stations:update(pos, {conn_name=conn_name, single="nil"})
|
||||
meta:set_string("status", "server")
|
||||
@ -138,7 +138,7 @@ techage.hyperloop.SUBMENU = {
|
||||
choices = "",
|
||||
on_dropdown = on_dropdown,
|
||||
name = "remote_name",
|
||||
label = S("Remote name"),
|
||||
label = S("Remote name"),
|
||||
tooltip = S("Connection name of the remote block"),
|
||||
},
|
||||
}
|
||||
@ -153,7 +153,7 @@ function techage.hyperloop.is_client(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function techage.hyperloop.is_server(pos)
|
||||
if HYPERLOOP then
|
||||
if M(pos):get_string("status") == "server" then
|
||||
@ -184,28 +184,28 @@ function techage.hyperloop.remote_pos(pos)
|
||||
end
|
||||
return pos
|
||||
end
|
||||
|
||||
|
||||
function techage.hyperloop.after_place_node(pos, placer, node_type)
|
||||
if HYPERLOOP then
|
||||
Stations:set(pos, node_type, {owner=placer:get_player_name()})
|
||||
M(pos):set_string("node_type", node_type)
|
||||
Tube:after_place_node(pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function techage.hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
if HYPERLOOP then
|
||||
local conn_name = oldmetadata.fields.conn_name
|
||||
local remote_name = oldmetadata.fields.remote_name
|
||||
local loc_pos, rmt_pos = pos, techage.get_nvm(pos).rmt_pos
|
||||
|
||||
|
||||
-- Close connections
|
||||
if remote_name and rmt_pos then -- Connected client
|
||||
update_node_data(rmt_pos, "server_not_connected", remote_name, "")
|
||||
elseif conn_name and rmt_pos then -- Connected server
|
||||
update_node_data(rmt_pos, "client_not_connected", "", conn_name)
|
||||
end
|
||||
|
||||
|
||||
Tube:after_dig_node(pos)
|
||||
Stations:delete(pos)
|
||||
end
|
||||
@ -218,7 +218,7 @@ function techage.hyperloop.after_formspec(pos, fields)
|
||||
local remote_name = meta:get_string("remote_name")
|
||||
local status = meta:contains("status") and meta:get_string("status") or "not connected"
|
||||
local loc_pos, rmt_pos = pos, techage.get_nvm(pos).rmt_pos
|
||||
|
||||
|
||||
if status == "not connected" then
|
||||
if fields.remote_name ~= "" then -- Client
|
||||
local rmt_pos = get_remote_pos(pos, fields.remote_name)
|
||||
@ -232,4 +232,3 @@ function techage.hyperloop.after_formspec(pos, fields)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
For the transition from v0.26 to v1.0
|
||||
|
||||
]]--
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Helper functions
|
||||
|
||||
]]--
|
||||
@ -69,8 +69,8 @@ local RotationViaYAxis = {}
|
||||
for _,row in ipairs(ROTATION) do
|
||||
for i = 1,4 do
|
||||
local val = row[i]
|
||||
local left = row[i == 1 and 4 or i - 1]
|
||||
local right = row[i == 4 and 1 or i + 1]
|
||||
local left = row[i == 1 and 4 or i - 1]
|
||||
local right = row[i == 4 and 1 or i + 1]
|
||||
RotationViaYAxis[val] = {left, right}
|
||||
end
|
||||
end
|
||||
@ -250,8 +250,8 @@ end
|
||||
|
||||
-- returns true, if node can be dug, otherwise false
|
||||
function techage.can_node_dig(node, ndef)
|
||||
if RegisteredNodesToBeDug[node.name] then
|
||||
return true
|
||||
if RegisteredNodesToBeDug[node.name] then
|
||||
return true
|
||||
end
|
||||
if not ndef then return false end
|
||||
if node.name == "ignore" then return false end
|
||||
@ -329,7 +329,7 @@ function techage.dropped_node(node, ndef)
|
||||
return handle_drop(ndef.drop)
|
||||
end
|
||||
return ndef.drop or node.name
|
||||
end
|
||||
end
|
||||
|
||||
-- needed for windmill plants
|
||||
local function determine_ocean_ids()
|
||||
@ -375,7 +375,7 @@ function techage.item_image(x, y, itemname, count)
|
||||
end
|
||||
label = "label["..(x + offs)..","..(y + 0.45)..";"..tostring(size).."]"
|
||||
end
|
||||
|
||||
|
||||
return "box["..x..","..y..";0.85,0.9;#808080]"..
|
||||
"item_image["..x..","..y..";1,1;"..itemname.."]"..
|
||||
tooltip..
|
||||
@ -386,12 +386,12 @@ function techage.item_image_small(x, y, itemname, tooltip_prefix)
|
||||
local name = unpack(string.split(itemname, " "))
|
||||
local tooltip = ""
|
||||
local ndef = minetest.registered_nodes[name] or minetest.registered_items[name] or minetest.registered_craftitems[name]
|
||||
|
||||
|
||||
if ndef and ndef.description then
|
||||
local text = minetest.formspec_escape(ndef.description)
|
||||
tooltip = "tooltip["..x..","..y..";0.8,0.8;"..tooltip_prefix..": "..text..";#0C3D32;#FFFFFF]"
|
||||
end
|
||||
|
||||
|
||||
return "box["..x..","..y..";0.65,0.7;#808080]"..
|
||||
"item_image["..x..","..y..";0.8,0.8;"..name.."]"..
|
||||
tooltip
|
||||
@ -470,7 +470,7 @@ local BUFFER_DEPTH = 10
|
||||
function techage.historybuffer_add(pos, s)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.hisbuf = mem.hisbuf or {}
|
||||
|
||||
|
||||
if #s > 2 then
|
||||
table.insert(mem.hisbuf, s)
|
||||
if #mem.hisbuf > BUFFER_DEPTH then
|
||||
@ -484,7 +484,7 @@ function techage.historybuffer_priv(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.hisbuf = mem.hisbuf or {}
|
||||
mem.hisbuf_idx = mem.hisbuf_idx or 1
|
||||
|
||||
|
||||
mem.hisbuf_idx = math.max(1, mem.hisbuf_idx - 1)
|
||||
return mem.hisbuf[mem.hisbuf_idx]
|
||||
end
|
||||
@ -493,7 +493,7 @@ function techage.historybuffer_next(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.hisbuf = mem.hisbuf or {}
|
||||
mem.hisbuf_idx = mem.hisbuf_idx or 1
|
||||
|
||||
|
||||
mem.hisbuf_idx = math.min(#mem.hisbuf, mem.hisbuf_idx + 1)
|
||||
return mem.hisbuf[mem.hisbuf_idx]
|
||||
end
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Liquid lib
|
||||
|
||||
]]--
|
||||
@ -55,7 +55,7 @@ function techage.liquid.formspec(pos, nvm, title)
|
||||
help(7.4, -0.1)..
|
||||
techage.item_image(3.5, 1, itemname)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function techage.liquid.is_empty(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
@ -75,7 +75,7 @@ techage.liquid.recv_message = {
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
-- like: register_liquid("techage:ta3_barrel_oil", "techage:ta3_barrel_empty", 10, "techage:oil")
|
||||
function techage.register_liquid(full_container, empty_container, container_size, inv_item)
|
||||
@ -88,7 +88,7 @@ end
|
||||
local function get_liquid_def(full_container)
|
||||
return LiquidDef[full_container]
|
||||
end
|
||||
|
||||
|
||||
local function get_container_def(container_name)
|
||||
return ContainerDef[container_name]
|
||||
end
|
||||
@ -109,7 +109,7 @@ local function fill_container(pos, inv, empty_container)
|
||||
local full_container = get_full_container(empty_container, nvm.liquid.name)
|
||||
if empty_container and full_container then
|
||||
local ldef = get_liquid_def(full_container)
|
||||
if ldef and nvm.liquid.amount - ldef.size >= 0 then
|
||||
if ldef and nvm.liquid.amount - ldef.size >= 0 then
|
||||
if inv:room_for_item("dst", {name = full_container}) then
|
||||
inv:add_item("dst", {name = full_container})
|
||||
nvm.liquid.amount = nvm.liquid.amount - ldef.size
|
||||
@ -134,7 +134,7 @@ local function empty_container(pos, inv, full_container)
|
||||
local tank_size = (ndef_lqd and ndef_lqd.capa) or 0
|
||||
local ldef = get_liquid_def(full_container)
|
||||
if ldef and (not nvm.liquid.name or ldef.inv_item == nvm.liquid.name) then
|
||||
if nvm.liquid.amount + ldef.size <= tank_size then
|
||||
if nvm.liquid.amount + ldef.size <= tank_size then
|
||||
if inv:room_for_item("dst", {name = ldef.container}) then
|
||||
inv:add_item("dst", {name = ldef.container})
|
||||
nvm.liquid.amount = nvm.liquid.amount + ldef.size
|
||||
@ -157,22 +157,22 @@ local function fill_on_punch(nvm, empty_container, item_count, puncher)
|
||||
if empty_container and full_container then
|
||||
local item = {name = full_container}
|
||||
local ldef = get_liquid_def(full_container)
|
||||
if ldef and nvm.liquid.amount - ldef.size >= 0 then
|
||||
if ldef and nvm.liquid.amount - ldef.size >= 0 then
|
||||
if item_count > 1 then -- can't be simply replaced?
|
||||
-- check for extra free space
|
||||
local inv = puncher:get_inventory()
|
||||
if inv:room_for_item("main", {name = full_container}) then
|
||||
-- add full container and return
|
||||
-- the empty once - 1
|
||||
inv:add_item("main", {name = full_container})
|
||||
inv:add_item("main", {name = full_container})
|
||||
item = {name = empty_container, count = item_count - 1}
|
||||
else
|
||||
return -- no free space
|
||||
end
|
||||
end
|
||||
nvm.liquid.amount = nvm.liquid.amount - ldef.size
|
||||
if nvm.liquid.amount == 0 then
|
||||
nvm.liquid.name = nil
|
||||
if nvm.liquid.amount == 0 then
|
||||
nvm.liquid.name = nil
|
||||
end
|
||||
return item -- to be added to the players inv.
|
||||
end
|
||||
@ -181,8 +181,8 @@ local function fill_on_punch(nvm, empty_container, item_count, puncher)
|
||||
local count = math.max(nvm.liquid.amount, 99)
|
||||
local name = nvm.liquid.name
|
||||
nvm.liquid.amount = nvm.liquid.amount - count
|
||||
if nvm.liquid.amount == 0 then
|
||||
nvm.liquid.name = nil
|
||||
if nvm.liquid.amount == 0 then
|
||||
nvm.liquid.name = nil
|
||||
end
|
||||
return {name = name, count = count}
|
||||
end
|
||||
@ -195,7 +195,7 @@ local function legacy_items(full_container, item_count)
|
||||
elseif full_container == "techage:oil_source" then
|
||||
return {container = "", size = item_count, inv_item = full_container}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- check if the wielded full container can be emptied into the tank
|
||||
local function empty_on_punch(pos, nvm, full_container, item_count)
|
||||
@ -203,10 +203,10 @@ local function empty_on_punch(pos, nvm, full_container, item_count)
|
||||
nvm.liquid.amount = nvm.liquid.amount or 0
|
||||
local lqd_def = get_liquid_def(full_container) or legacy_items(full_container, item_count)
|
||||
local ndef_lqd = LQD(pos)
|
||||
if lqd_def and ndef_lqd then
|
||||
if lqd_def and ndef_lqd then
|
||||
local tank_size = ndef_lqd.capa or 0
|
||||
if not nvm.liquid.name or lqd_def.inv_item == nvm.liquid.name then
|
||||
if nvm.liquid.amount + lqd_def.size <= tank_size then
|
||||
if nvm.liquid.amount + lqd_def.size <= tank_size then
|
||||
nvm.liquid.amount = nvm.liquid.amount + lqd_def.size
|
||||
nvm.liquid.name = lqd_def.inv_item
|
||||
return {name = lqd_def.container}
|
||||
@ -227,10 +227,10 @@ function techage.liquid.on_punch(pos, node, puncher, pointed_thing)
|
||||
if mem.blocking_time > techage.SystemTime then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local wielded_item = puncher:get_wielded_item():get_name()
|
||||
local item_count = puncher:get_wielded_item():get_count()
|
||||
local new_item = fill_on_punch(nvm, wielded_item, item_count, puncher)
|
||||
local new_item = fill_on_punch(nvm, wielded_item, item_count, puncher)
|
||||
or empty_on_punch(pos, nvm, wielded_item, item_count)
|
||||
if new_item then
|
||||
puncher:set_wielded_item(new_item)
|
||||
|
@ -89,5 +89,3 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
mark.lua:
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
local marker_region = {}
|
||||
@ -27,9 +27,9 @@ end
|
||||
function techage.mark_region(name, pos1, pos2, owner, secs)
|
||||
|
||||
if not name or not pos1 or not pos2 then return end
|
||||
|
||||
|
||||
techage.unmark_region(name)
|
||||
|
||||
|
||||
local thickness = 0.2
|
||||
local sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2
|
||||
local markers = {}
|
||||
@ -96,4 +96,3 @@ minetest.register_entity(":techage:region_cube", {
|
||||
techage.unmark_region(self.player_name)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
mark.lua:
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
local marker_region = {}
|
||||
@ -44,7 +44,7 @@ function techage.mark_cube(name, pos1, pos2, nametag, color, time)
|
||||
local size_x = math.abs(pos1.x - pos2.x) + 1
|
||||
local size_y = math.abs(pos1.y - pos2.y) + 1
|
||||
local size_z = math.abs(pos1.z - pos2.z) + 1
|
||||
|
||||
|
||||
local marker = minetest.add_entity(
|
||||
{x = new_x, y = new_y, z = new_z}, "techage:position_cube")
|
||||
if marker ~= nil then
|
||||
@ -126,4 +126,3 @@ minetest.register_entity(":techage:position_side", {
|
||||
techage.unmark_position(self.player_name)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -9,12 +9,12 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Block marker lib for door/move/fly controller
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
local marker = {}
|
||||
|
||||
local MarkedNodes = {} -- t[player] = {{entity, pos},...}
|
||||
local MarkedNodes = {} -- t[player] = {{entity, pos},...}
|
||||
local MaxNumber = {}
|
||||
local CurrentPos -- to mark punched entities
|
||||
|
||||
@ -67,11 +67,11 @@ end
|
||||
minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
|
||||
if puncher and puncher:is_player() then
|
||||
local name = puncher:get_player_name()
|
||||
|
||||
|
||||
if not MarkedNodes[name] then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
mark_position(name, pointed_thing.under)
|
||||
end
|
||||
end)
|
||||
@ -119,4 +119,4 @@ minetest.register_entity(":techage:block_marker", {
|
||||
end,
|
||||
})
|
||||
|
||||
return marker
|
||||
return marker
|
||||
|
@ -13,33 +13,33 @@
|
||||
]]--
|
||||
|
||||
|
||||
--[[
|
||||
--[[
|
||||
|
||||
Node states:
|
||||
|
||||
+-----------------------------------+ +------------+
|
||||
| | | |
|
||||
| V V |
|
||||
| +---------+ |
|
||||
| | | |
|
||||
| +---------| STOPPED | |
|
||||
| | | | |
|
||||
| button | +---------+ |
|
||||
| | ^ |
|
||||
button | V | button |
|
||||
| +---------+ | | button
|
||||
| +--------->| |---------+ |
|
||||
| | power | RUNNING | |
|
||||
| | +------| |---------+ |
|
||||
| | | +---------+ | |
|
||||
| | | ^ | | |
|
||||
| | | | | | |
|
||||
| | V | V V |
|
||||
| +---------+ +----------+ +---------+ |
|
||||
| | | | | | | |
|
||||
+---| NOPOWER | | STANDBY/ | | FAULT |----------+
|
||||
| | | BLOCKED | | |
|
||||
+---------+ +----------+ +---------+
|
||||
| | | |
|
||||
| V V |
|
||||
| +---------+ |
|
||||
| | | |
|
||||
| +---------| STOPPED | |
|
||||
| | | | |
|
||||
| button | +---------+ |
|
||||
| | ^ |
|
||||
button | V | button |
|
||||
| +---------+ | | button
|
||||
| +--------->| |---------+ |
|
||||
| | power | RUNNING | |
|
||||
| | +------| |---------+ |
|
||||
| | | +---------+ | |
|
||||
| | | ^ | | |
|
||||
| | | | | | |
|
||||
| | V | V V |
|
||||
| +---------+ +----------+ +---------+ |
|
||||
| | | | | | | |
|
||||
+---| NOPOWER | | STANDBY/ | | FAULT |----------+
|
||||
| | | BLOCKED | | |
|
||||
+---------+ +----------+ +---------+
|
||||
|
||||
|
||||
| cycle time operational needs power
|
||||
@ -74,12 +74,12 @@ techage.FAULT = 5 -- any fault state (e.g. wrong source items), which can be f
|
||||
techage.STOPPED = 6 -- not operational/turned off
|
||||
|
||||
techage.StatesImg = {
|
||||
"techage_inv_button_on.png",
|
||||
"techage_inv_button_on.png",
|
||||
"techage_inv_button_warning.png",
|
||||
"techage_inv_button_standby.png",
|
||||
"techage_inv_button_nopower.png",
|
||||
"techage_inv_button_standby.png",
|
||||
"techage_inv_button_nopower.png",
|
||||
"techage_inv_button_error.png",
|
||||
"techage_inv_button_off.png",
|
||||
"techage_inv_button_off.png",
|
||||
}
|
||||
|
||||
local function error(pos, msg)
|
||||
@ -176,7 +176,7 @@ function NodeStates:new(attr)
|
||||
-- optional
|
||||
countdown_ticks = attr.countdown_ticks or 1,
|
||||
node_name_passive = attr.node_name_passive,
|
||||
node_name_active = attr.node_name_active,
|
||||
node_name_active = attr.node_name_active,
|
||||
infotext_name = attr.infotext_name,
|
||||
has_power = attr.has_power or has_power,
|
||||
can_start = attr.can_start or can_start,
|
||||
@ -274,7 +274,7 @@ function NodeStates:start(pos, nvm)
|
||||
self.on_state_change(pos, state, RUNNING)
|
||||
end
|
||||
start_timer_delayed(pos, self.cycle_time)
|
||||
|
||||
|
||||
if self.quick_start and state == STOPPED then
|
||||
self.quick_start(pos, 0)
|
||||
end
|
||||
@ -305,7 +305,7 @@ function NodeStates:standby(pos, nvm, err_string)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
-- special case of standby for pushing nodes
|
||||
function NodeStates:blocked(pos, nvm, err_string)
|
||||
@ -330,7 +330,7 @@ function NodeStates:blocked(pos, nvm, err_string)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function NodeStates:nopower(pos, nvm, err_string)
|
||||
local state = nvm.techage_state or RUNNING
|
||||
@ -354,7 +354,7 @@ function NodeStates:nopower(pos, nvm, err_string)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function NodeStates:fault(pos, nvm, err_string)
|
||||
local state = nvm.techage_state or STOPPED
|
||||
@ -379,7 +379,7 @@ function NodeStates:fault(pos, nvm, err_string)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function NodeStates:get_state(nvm)
|
||||
return nvm.techage_state or techage.STOPPED
|
||||
@ -431,7 +431,7 @@ function NodeStates:state_button_event(pos, nvm, fields)
|
||||
if state == STOPPED or state == STANDBY or state == BLOCKED then
|
||||
if not self:start(pos, nvm) and (state == STANDBY or state == BLOCKED) then
|
||||
self:stop(pos, nvm)
|
||||
end
|
||||
end
|
||||
elseif state == RUNNING or state == FAULT or state == NOPOWER then
|
||||
self:stop(pos, nvm)
|
||||
end
|
||||
@ -478,7 +478,7 @@ function NodeStates:on_receive_message(pos, topic, payload)
|
||||
return "unsupported"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- restart timer
|
||||
function NodeStates:on_node_load(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Data storage system for node related volatile and non-volatile data.
|
||||
Non-volatile data is stored from time to time and at shutdown.
|
||||
Volatile data is lost at every shutdown.
|
||||
@ -41,14 +41,14 @@ local function get_keys(pos)
|
||||
end
|
||||
|
||||
local function pos_from_key(key1, key2)
|
||||
|
||||
|
||||
local x1 = (math.floor(key1 / (4096 * 4096)) - 2048) * 16
|
||||
local y1 = ((math.floor(key1 / 4096) % 4096) - 2048) * 16
|
||||
local z1 = ((key1 % 4096) - 2048) * 16
|
||||
local x2 = math.floor(key2 / (16 * 16))
|
||||
local y2 = math.floor(key2 / 16) % 16
|
||||
local z2 = key2 % 16
|
||||
|
||||
|
||||
return {x = x1 + x2, y = y1 + y2, z = z1 + z2}
|
||||
end
|
||||
|
||||
@ -66,8 +66,8 @@ local function debug(key1, item)
|
||||
end
|
||||
print("mapblock", string.format("%09X", key1), cnt.." nodes")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Storage scheduler
|
||||
-------------------------------------------------------------------
|
||||
@ -137,12 +137,12 @@ end
|
||||
-- Returns non-volatile node data as table
|
||||
function techage.get_nvm(pos)
|
||||
local key1, key2 = get_keys(pos)
|
||||
|
||||
|
||||
if not NvmStore[key1] then
|
||||
NvmStore[key1] = backend.get_mapblock_data(key1)
|
||||
push(key1)
|
||||
end
|
||||
|
||||
|
||||
local block = NvmStore[key1]
|
||||
block.in_use = true
|
||||
if not block[key2] then
|
||||
@ -161,7 +161,7 @@ end
|
||||
function techage.del_mem(pos)
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
MemStore[hash] = nil
|
||||
|
||||
|
||||
local key1, key2 = get_keys(pos)
|
||||
NvmStore[key1] = NvmStore[key1] or backend.get_mapblock_data(key1)
|
||||
NvmStore[key1][key2] = nil
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Storage backend for node related data as node metadata
|
||||
|
||||
]]--
|
||||
@ -35,7 +35,7 @@ if use_marshal then
|
||||
if not marshal then
|
||||
error("Please install marshal via 'luarocks install lua-marshal'")
|
||||
end
|
||||
|
||||
|
||||
serialize = marshal.encode
|
||||
|
||||
deserialize = function(s)
|
||||
@ -76,12 +76,12 @@ end
|
||||
function api.get_node_data(pos)
|
||||
local tbl = {}
|
||||
local s = M(pos):get_string("ta_data")
|
||||
|
||||
|
||||
if s ~= "" then
|
||||
tbl = deserialize(s) or {}
|
||||
end
|
||||
tbl._POS_ = table.copy(pos)
|
||||
|
||||
|
||||
return tbl
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Storage backend for node related data via sqlite database
|
||||
|
||||
]]--
|
||||
@ -44,7 +44,7 @@ if sqlite3 then sqlite3 = nil end
|
||||
|
||||
db:exec[[
|
||||
CREATE TABLE mapblocks(id INTEGER PRIMARY KEY, key INTEGER, data BLOB);
|
||||
CREATE UNIQUE INDEX idx ON mapblocks(key);
|
||||
CREATE UNIQUE INDEX idx ON mapblocks(key);
|
||||
]]
|
||||
|
||||
local set = db:prepare("INSERT or REPLACE INTO mapblocks VALUES(NULL, ?, ?);")
|
||||
@ -54,7 +54,7 @@ local function set_block(key, data)
|
||||
set:reset()
|
||||
set:bind(1, key)
|
||||
set:bind_blob(2, data)
|
||||
set:step()
|
||||
set:step()
|
||||
return true
|
||||
end
|
||||
|
||||
@ -76,8 +76,8 @@ function api.store_mapblock_data(key, mapblock_data)
|
||||
--local s = marshal.encode(mapblock_data)
|
||||
local s = minetest.serialize(mapblock_data)
|
||||
return set_block(key, s)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function api.get_mapblock_data(key)
|
||||
local s = get_block(key)
|
||||
if s then
|
||||
@ -89,8 +89,8 @@ function api.get_mapblock_data(key)
|
||||
end
|
||||
api.store_mapblock_data(key, {})
|
||||
return {}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function api.get_node_data(pos)
|
||||
-- legacy data available?
|
||||
local s = M(pos):get_string("ta_data")
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Storage backend for node number mapping via sqlite database
|
||||
|
||||
]]--
|
||||
@ -46,7 +46,7 @@ if sqlite3 then sqlite3 = nil end
|
||||
|
||||
db:exec[[
|
||||
CREATE TABLE numbers(id INTEGER PRIMARY KEY, number INTEGER, x INTEGER, y INTEGER, z INTEGER);
|
||||
CREATE UNIQUE INDEX idx ON numbers(number);
|
||||
CREATE UNIQUE INDEX idx ON numbers(number);
|
||||
]]
|
||||
|
||||
local set = db:prepare("INSERT or REPLACE INTO numbers VALUES(NULL, ?, ?, ?, ?);")
|
||||
@ -58,7 +58,7 @@ local function set_block(number, pos)
|
||||
set:bind(2, pos.x)
|
||||
set:bind(3, pos.y)
|
||||
set:bind(4, pos.z)
|
||||
set:step()
|
||||
set:step()
|
||||
return true
|
||||
end
|
||||
|
||||
@ -94,7 +94,7 @@ if Version == 3 then
|
||||
storage:set_string(number, "")
|
||||
end
|
||||
end
|
||||
elseif Version == 4 then
|
||||
elseif Version == 4 then
|
||||
NextNumber = storage:get_int("NextNumber")
|
||||
else
|
||||
error("[] Invalid version number for 'number to pos mapping' table!")
|
||||
@ -108,28 +108,28 @@ local api = {}
|
||||
|
||||
function api.get_nodepos(number)
|
||||
return get_block(number)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function api.set_nodepos(number, pos)
|
||||
set_block(number, pos)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function api.add_nodepos(pos)
|
||||
local num = tostring(NextNumber)
|
||||
NextNumber = NextNumber + 1
|
||||
storage:set_int("NextNumber", NextNumber)
|
||||
set_block(num, pos)
|
||||
return num
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function api.del_nodepos(number)
|
||||
del_block(number)
|
||||
end
|
||||
end
|
||||
|
||||
-- delete invalid entries
|
||||
function api.delete_invalid_entries(node_def)
|
||||
minetest.log("info", "[TechAge] Data maintenance started")
|
||||
for id, num, x, y, z in db:urows('SELECT * FROM numbers') do
|
||||
for id, num, x, y, z in db:urows('SELECT * FROM numbers') do
|
||||
local pos = {x = x, y = y, z = z}
|
||||
local name = techage.get_node_lvm(pos).name
|
||||
if not node_def[name] then
|
||||
@ -137,6 +137,6 @@ function api.delete_invalid_entries(node_def)
|
||||
end
|
||||
end
|
||||
minetest.log("info", "[TechAge] Data maintenance finished")
|
||||
end
|
||||
end
|
||||
|
||||
return api
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Storage backend for node number mapping via mod storage
|
||||
|
||||
]]--
|
||||
@ -59,23 +59,23 @@ storage:set_int("Version", Version)
|
||||
-------------------------------------------------------------------
|
||||
function backend.get_nodepos(number)
|
||||
return minetest.string_to_pos(storage:get_string(number))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function backend.set_nodepos(number, pos)
|
||||
storage:set_string(number, minetest.pos_to_string(pos))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function backend.add_nodepos(pos)
|
||||
local num = tostring(NextNumber)
|
||||
NextNumber = NextNumber + 1
|
||||
storage:set_int("NextNumber", NextNumber)
|
||||
storage:set_string(num, minetest.pos_to_string(pos))
|
||||
return num
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function backend.del_nodepos(number)
|
||||
storage:set_string(number, "")
|
||||
end
|
||||
end
|
||||
|
||||
-- delete invalid entries
|
||||
function backend.delete_invalid_entries(node_def)
|
||||
@ -88,11 +88,11 @@ function backend.delete_invalid_entries(node_def)
|
||||
if not node_def[name] then
|
||||
backend.del_nodepos(number)
|
||||
else
|
||||
minetest.get_meta(pos):set_string("node_number", number)
|
||||
minetest.get_meta(pos):set_string("node_number", number)
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.log("info", "[TechAge] Data maintenance finished")
|
||||
end
|
||||
end
|
||||
|
||||
return backend
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Recipe lib for formspecs
|
||||
|
||||
]]--
|
||||
@ -38,7 +38,7 @@ local GROUP_ITEMS = {
|
||||
local RECIPE = {
|
||||
output = {name = "", num = 0},
|
||||
waste = {name = "", num = 0},
|
||||
input = {
|
||||
input = {
|
||||
{name = "", num =0},
|
||||
{name = "", num =0},
|
||||
{name = "", num =0},
|
||||
@ -52,7 +52,7 @@ local function filter_recipes_based_on_points(recipes, owner)
|
||||
local player = minetest.get_player_by_name(owner)
|
||||
ex_points = techage.get_expoints(player) or 0
|
||||
end
|
||||
|
||||
|
||||
local tbl = {}
|
||||
for _,item in ipairs(recipes) do
|
||||
if ex_points >= (item.ex_points or 0) then
|
||||
@ -78,7 +78,7 @@ function techage.recipes.get(nvm, rtype)
|
||||
local recipes = Recipes[rtype] or {}
|
||||
return recipes[nvm.recipe_idx or 1]
|
||||
end
|
||||
|
||||
|
||||
-- Add 4 input/output/waste recipe
|
||||
-- {
|
||||
-- output = "<item-name> <units>", -- units = 1..n
|
||||
@ -92,7 +92,7 @@ function techage.recipes.add(rtype, recipe)
|
||||
if not Recipes[rtype] then
|
||||
Recipes[rtype] = {}
|
||||
end
|
||||
|
||||
|
||||
local name, num, output
|
||||
local item = {input = {}}
|
||||
for idx = 1,4 do
|
||||
@ -100,7 +100,7 @@ function techage.recipes.add(rtype, recipe)
|
||||
name, num = unpack(string.split(inp, " "))
|
||||
item.input[idx] = {name = name or "", num = tonumber(num) or 0}
|
||||
end
|
||||
if recipe.waste then
|
||||
if recipe.waste then
|
||||
name, num = unpack(string.split(recipe.waste, " "))
|
||||
else
|
||||
name, num = "", "0"
|
||||
@ -114,12 +114,12 @@ function techage.recipes.add(rtype, recipe)
|
||||
output = name
|
||||
|
||||
techage.recipes.register_craft({
|
||||
output = recipe.output,
|
||||
output = recipe.output,
|
||||
items = recipe.input,
|
||||
type = rtype,
|
||||
})
|
||||
NormalizedRecipes[output] = {
|
||||
output = recipe.output,
|
||||
output = recipe.output,
|
||||
items = recipe.input,
|
||||
}
|
||||
end
|
||||
@ -151,9 +151,9 @@ function techage.recipes.on_receive_fields(pos, formname, fields, player)
|
||||
return
|
||||
end
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
||||
|
||||
nvm.recipe_idx = nvm.recipe_idx or 1
|
||||
if not nvm.running then
|
||||
if not nvm.running then
|
||||
if fields.next == ">>" then
|
||||
nvm.recipe_idx = nvm.recipe_idx + 1
|
||||
elseif fields.priv == "<<" then
|
||||
@ -165,8 +165,8 @@ end
|
||||
function techage.recipes.get_recipe(name)
|
||||
return NormalizedRecipes[name]
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
function techage.recipes.get_default_group_item_name(item_name)
|
||||
if item_name and item_name:sub(1, 6) == "group:" then
|
||||
local default_name = GROUP_ITEMS[item_name:sub(7)]
|
||||
@ -182,7 +182,7 @@ function techage.recipes.add_group_item(group, default_item_name)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Borrowed from ghaydn
|
||||
-- Borrowed from ghaydn
|
||||
-------------------------------------------------------------------------------
|
||||
local has_i3 = minetest.get_modpath("i3")
|
||||
local has_ui = minetest.get_modpath("unified_inventory")
|
||||
|
@ -34,7 +34,7 @@ function techage.shared_inv.node_timer(pos, elapsed)
|
||||
if techage.is_activeformspec(pos) then
|
||||
copy_inventory_list(rmt_pos, pos, "main")
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@ -64,6 +64,5 @@ function techage.shared_inv.on_rightclick(pos, clicker, listname)
|
||||
copy_inventory_list(rmt_pos, pos, listname)
|
||||
techage.set_activeformspec(pos, clicker)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -21,6 +21,7 @@ techage.shared_tank = {}
|
||||
local liquid = networks.liquid
|
||||
local hyperloop = techage.hyperloop
|
||||
local remote_pos = techage.hyperloop.remote_pos
|
||||
local is_paired = techage.hyperloop.is_paired
|
||||
local menu = techage.menu
|
||||
|
||||
local function formspec(pos)
|
||||
@ -36,10 +37,10 @@ local function formspec(pos)
|
||||
end
|
||||
|
||||
function techage.shared_tank.node_timer(pos)
|
||||
if techage.is_activeformspec(pos) then
|
||||
if techage.is_activeformspec(pos) and is_paired(pos) then
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@ -47,10 +48,10 @@ function techage.shared_tank.on_rightclick(pos, node, clicker)
|
||||
--if hyperloop.is_client(pos) then
|
||||
techage.set_activeformspec(pos, clicker)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
--end
|
||||
--end
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
|
||||
|
||||
function techage.shared_tank.can_dig(pos, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return false
|
||||
@ -60,26 +61,47 @@ function techage.shared_tank.can_dig(pos, player)
|
||||
end
|
||||
|
||||
function techage.shared_tank.peek_liquid(pos, indir)
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return liquid.srv_peek(nvm)
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return liquid.srv_peek(nvm)
|
||||
end
|
||||
end
|
||||
|
||||
function techage.shared_tank.take_liquid(pos, indir, name, amount)
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
amount, name = liquid.srv_take(nvm, name, amount)
|
||||
if techage.is_activeformspec(pos) then
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
amount, name = liquid.srv_take(nvm, name, amount)
|
||||
if techage.is_activeformspec(pos) then
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
return amount, name
|
||||
end
|
||||
return amount, name
|
||||
return 0, name
|
||||
end
|
||||
|
||||
|
||||
function techage.shared_tank.put_liquid(pos, indir, name, amount)
|
||||
pos = remote_pos(pos)
|
||||
-- check if it is not powder
|
||||
local ndef = minetest.registered_craftitems[name] or {}
|
||||
if not ndef.groups or ndef.groups.powder ~= 1 then
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
-- check if it is not powder
|
||||
local ndef = minetest.registered_craftitems[name] or {}
|
||||
if not ndef.groups or ndef.groups.powder ~= 1 then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local ndef = NDEF(pos)
|
||||
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
|
||||
if techage.is_activeformspec(pos) then
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
return leftover
|
||||
end
|
||||
end
|
||||
return amount
|
||||
end
|
||||
|
||||
function techage.shared_tank.untake_liquid(pos, indir, name, amount)
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local ndef = NDEF(pos)
|
||||
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
|
||||
@ -91,15 +113,4 @@ function techage.shared_tank.put_liquid(pos, indir, name, amount)
|
||||
return amount
|
||||
end
|
||||
|
||||
function techage.shared_tank.untake_liquid(pos, indir, name, amount)
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local ndef = NDEF(pos)
|
||||
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
|
||||
if techage.is_activeformspec(pos) then
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
return leftover
|
||||
end
|
||||
|
||||
techage.shared_tank.formspec = formspec
|
||||
techage.shared_tank.formspec = formspec
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
A formspec control to generate formspec strings for machine settings and monitoring
|
||||
]]--
|
||||
|
||||
@ -43,7 +43,7 @@ local function generate_formspec_substring(pos, meta, form_def, player_name)
|
||||
local player_inv_needed = false
|
||||
if meta and form_def then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
|
||||
|
||||
for i,elem in ipairs(form_def) do
|
||||
local offs = (i - 1) * 0.9 - 0.2
|
||||
tbl[#tbl+1] = "label[0," .. offs .. ";" .. minetest.formspec_escape(elem.label) .. ":]"
|
||||
@ -133,7 +133,7 @@ local function generate_formspec_substring(pos, meta, form_def, player_name)
|
||||
tbl[#tbl+1] = "label[0," .. offs .. ";" .. S("Note: You can't change any values while the block is running!") .. "]"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return player_inv_needed, table.concat(tbl, "")
|
||||
end
|
||||
|
||||
@ -143,23 +143,23 @@ local function value_check(elem, value)
|
||||
end
|
||||
return value ~= nil
|
||||
end
|
||||
|
||||
|
||||
local function evaluate_data(pos, meta, form_def, fields, player_name)
|
||||
local res = true
|
||||
|
||||
|
||||
if meta and form_def then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if nvm.running or techage.is_running(nvm) then
|
||||
return res
|
||||
end
|
||||
for idx,elem in ipairs(form_def) do
|
||||
if elem.type == "number" then
|
||||
if elem.type == "number" then
|
||||
if fields[elem.name] then
|
||||
if fields[elem.name] == "" then
|
||||
if fields[elem.name] == "" then
|
||||
meta:set_string(elem.name, "")
|
||||
elseif fields[elem.name]:find("^[%d ]+$") then
|
||||
local val = tonumber(fields[elem.name])
|
||||
if value_check(elem, val) then
|
||||
if value_check(elem, val) then
|
||||
meta:set_int(elem.name, val)
|
||||
--print("set_int", elem.name, val)
|
||||
else
|
||||
@ -169,11 +169,11 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
||||
res = false
|
||||
end
|
||||
end
|
||||
elseif elem.type == "numbers" then
|
||||
elseif elem.type == "numbers" then
|
||||
if fields[elem.name] then
|
||||
if fields[elem.name] == "" then
|
||||
if fields[elem.name] == "" then
|
||||
meta:set_string(elem.name, "")
|
||||
elseif fields[elem.name]:find("^[%d ]+$") and value_check(elem, fields[elem.name]) then
|
||||
elseif fields[elem.name]:find("^[%d ]+$") and value_check(elem, fields[elem.name]) then
|
||||
meta:set_string(elem.name, fields[elem.name])
|
||||
else
|
||||
res = false
|
||||
@ -184,13 +184,13 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
||||
meta:set_string(elem.name, "")
|
||||
elseif fields[elem.name] then
|
||||
local val = tonumber(fields[elem.name])
|
||||
if val and value_check(elem, val) then
|
||||
if val and value_check(elem, val) then
|
||||
meta:set_string(elem.name, val)
|
||||
else
|
||||
res = false
|
||||
end
|
||||
end
|
||||
elseif elem.type == "ascii" then
|
||||
elseif elem.type == "ascii" then
|
||||
if fields[elem.name] == ""then
|
||||
meta:set_string(elem.name, "")
|
||||
elseif fields[elem.name] then
|
||||
@ -200,11 +200,11 @@ local function evaluate_data(pos, meta, form_def, fields, player_name)
|
||||
res = false
|
||||
end
|
||||
end
|
||||
elseif elem.type == "dropdown" then
|
||||
elseif elem.type == "dropdown" then
|
||||
if fields[elem.name] ~= nil then
|
||||
meta:set_string(elem.name, fields[elem.name])
|
||||
end
|
||||
elseif elem.type == "items" and player_name then
|
||||
elseif elem.type == "items" and player_name then
|
||||
local inv_name = minetest.formspec_escape(player_name) .. "_techage_wrench_menu"
|
||||
local dinv = minetest.get_inventory({type = "detached", name = inv_name})
|
||||
local ninv = minetest.get_inventory({type = "node", pos = pos})
|
||||
@ -232,7 +232,7 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name)
|
||||
allow_take = allow_take})
|
||||
local dinv = minetest.get_inventory({type = "detached", name = inv_name})
|
||||
local ninv = minetest.get_inventory({type = "node", pos = pos})
|
||||
if dinv and ninv then
|
||||
if dinv and ninv then
|
||||
dinv:set_size('cfg', ninv:get_size("cfg"))
|
||||
for i = 1, ninv:get_size("cfg") do
|
||||
dinv:set_stack("cfg", i, ninv:get_stack("cfg", i))
|
||||
@ -243,7 +243,7 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name)
|
||||
local title = ndef.description .. " (" .. number .. ")"
|
||||
local player_inv_needed, text = generate_formspec_substring(pos, meta, form_def, player_name)
|
||||
local buttons
|
||||
|
||||
|
||||
if player_inv_needed then
|
||||
buttons = "button[0.5,6.2;3,1;refresh;" .. S("Refresh") .. "]" ..
|
||||
"button_exit[3.5,6.2;3,1;cancel;" .. S("Cancel") .. "]" ..
|
||||
@ -254,7 +254,7 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name)
|
||||
"button_exit[3.5,8.4;3,1;cancel;" .. S("Cancel") .. "]" ..
|
||||
"button[6.5,8.4;3,1;save;" .. S("Save") .. "]"
|
||||
end
|
||||
|
||||
|
||||
if #form_def > 8 then
|
||||
local size = (#form_def * 10) - 60
|
||||
return "size[10,9]" ..
|
||||
@ -287,10 +287,10 @@ function techage.menu.generate_formspec(pos, ndef, form_def, player_name)
|
||||
return ""
|
||||
end
|
||||
|
||||
function techage.menu.eval_input(pos, form_def, fields, player_name)
|
||||
function techage.menu.eval_input(pos, form_def, fields, player_name)
|
||||
if fields.save or fields.key_enter_field then
|
||||
local meta = minetest.get_meta(pos)
|
||||
evaluate_data(pos, meta, form_def, fields, player_name)
|
||||
end
|
||||
return fields.refresh or fields.save or fields.key_enter_field
|
||||
return fields.refresh or fields.save or fields.key_enter_field
|
||||
end
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
For tupe/pipe blocks with teleport support
|
||||
|
||||
]]--
|
||||
@ -67,7 +67,7 @@ local TELE_MENU = {
|
||||
choices = "",
|
||||
on_dropdown = get_free_server_list,
|
||||
name = "remote_name",
|
||||
label = S("Remote name"),
|
||||
label = S("Remote name"),
|
||||
tooltip = S("Connection name of the remote block"),
|
||||
},
|
||||
{
|
||||
@ -83,7 +83,7 @@ function techage.teleport.formspec(pos)
|
||||
local ndef = NDEF(pos)
|
||||
return menu.generate_formspec(pos, ndef, TELE_MENU)
|
||||
end
|
||||
|
||||
|
||||
local function store_connection(pos, peer_pos)
|
||||
local meta = M(pos)
|
||||
local status = S("connected to") .. " " .. P2S(peer_pos)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Tube wall entry
|
||||
|
||||
]]--
|
||||
@ -27,7 +27,7 @@ minetest.register_node("techage:tube_wall_entry", {
|
||||
"basic_materials_concrete_block.png^techage_tube_hole.png",
|
||||
"basic_materials_concrete_block.png^techage_tube_hole.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
if not Tube:after_place_tube(pos, placer, pointed_thing) then
|
||||
minetest.remove_node(pos)
|
||||
@ -35,11 +35,11 @@ minetest.register_node("techage:tube_wall_entry", {
|
||||
end
|
||||
return false
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Tube:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir", -- important!
|
||||
on_rotate = screwdriver.disallow, -- important!
|
||||
groups = {crumbly = 2, cracky = 2, snappy = 2},
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Tubes based on tubelib2
|
||||
|
||||
]]--
|
||||
@ -27,13 +27,13 @@ techage.KnownNodes = {
|
||||
local Tube = tubelib2.Tube:new({
|
||||
-- North, East, South, West, Down, Up
|
||||
dirs_to_check = {1,2,3,4,5,6},
|
||||
max_tube_length = 200,
|
||||
max_tube_length = 200,
|
||||
show_infotext = false,
|
||||
primary_node_names = {
|
||||
"techage:tubeS", "techage:tubeA",
|
||||
"techage:tubeS", "techage:tubeA",
|
||||
"techage:ta4_tubeS", "techage:ta4_tubeA",
|
||||
"techage:tube_wall_entry",
|
||||
},
|
||||
},
|
||||
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
|
||||
local name = minetest.get_node(pos).name
|
||||
if name == "techage:tubeS" or name == "techage:tubeA" then
|
||||
@ -58,7 +58,7 @@ minetest.register_node("techage:tubeS", {
|
||||
"techage_tube_hole.png",
|
||||
"techage_tube_hole.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
if not Tube:after_place_tube(pos, placer, pointed_thing) then
|
||||
minetest.remove_node(pos)
|
||||
@ -66,11 +66,11 @@ minetest.register_node("techage:tubeS", {
|
||||
end
|
||||
return false
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Tube:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -106,11 +106,11 @@ minetest.register_node("techage:tubeA", {
|
||||
"techage_tube_knee2.png",
|
||||
"techage_tube_hole2.png",
|
||||
},
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Tube:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Tubes in TA4 design based on tubelib2
|
||||
|
||||
]]--
|
||||
@ -25,7 +25,7 @@ minetest.register_node("techage:ta4_tubeS", {
|
||||
"techage_tube_hole.png",
|
||||
"techage_tube_hole.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
if not Tube:after_place_tube(pos, placer, pointed_thing) then
|
||||
minetest.remove_node(pos)
|
||||
@ -33,11 +33,11 @@ minetest.register_node("techage:ta4_tubeS", {
|
||||
end
|
||||
return false
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Tube:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -73,11 +73,11 @@ minetest.register_node("techage:ta4_tubeA", {
|
||||
"techage_tubeta4_knee2.png",
|
||||
"techage_tubeta4_hole2.png",
|
||||
},
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Tube:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Wind turbine helper function
|
||||
|
||||
]]--
|
||||
@ -49,15 +49,15 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines)
|
||||
num = #minetest.find_nodes_in_area(pos1, pos2, {"air", "ignore"})
|
||||
if num < (41 * 41 * 21 * 0.9) then
|
||||
techage.mark_region(player_name, pos1, pos2, "")
|
||||
return chat_message(player_name,
|
||||
return chat_message(player_name,
|
||||
S("Here is not enough wind\n(A free air space of 41x41x21 m is necessary)!"))
|
||||
end
|
||||
-- Check for water surface (occean)
|
||||
pos1 = {x=pos.x-20, y=1, z=pos.z-20}
|
||||
pos2 = {x=pos.x+20, y=1, z=pos.z+20}
|
||||
num = #minetest.find_nodes_in_area(pos1, pos2,
|
||||
num = #minetest.find_nodes_in_area(pos1, pos2,
|
||||
{"default:water_source", "default:water_flowing", "ignore"})
|
||||
|
||||
|
||||
if num < (41*41 * 0.8) then
|
||||
techage.mark_region(player_name, pos1, pos2, "")
|
||||
return chat_message(player_name, S("Here is not enough water (41x41 m)!"))
|
||||
@ -71,7 +71,7 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines)
|
||||
techage.mark_region(player_name, pos1, pos2, "")
|
||||
return chat_message(player_name, S("The next wind turbines is too close!"))
|
||||
end
|
||||
|
||||
|
||||
if num_turbines == 0 then
|
||||
chat_message(player_name, minetest.pos_to_string(pos).." "..
|
||||
S("is a suitable place for a wind turbine!"))
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA3 Chest Cart
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -59,7 +59,7 @@ end
|
||||
minetest.register_node("techage:chest_cart", {
|
||||
description = S("TA Chest Cart"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
-- up, down, right, left, back, front
|
||||
"techage_chest_cart_top.png",
|
||||
"techage_chest_cart_bottom.png",
|
||||
"techage_chest_cart_side.png",
|
||||
@ -83,13 +83,13 @@ minetest.register_node("techage:chest_cart", {
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2},
|
||||
node_placement_prediction = "",
|
||||
diggable = false,
|
||||
|
||||
|
||||
on_place = minecart.on_nodecart_place,
|
||||
on_punch = minecart.on_nodecart_punch,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_size('main', 4)
|
||||
@ -99,14 +99,14 @@ minetest.register_node("techage:chest_cart", {
|
||||
M(pos):set_string("formspec", formspec())
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
set_cargo = function(pos, data)
|
||||
local inv = M(pos):get_inventory()
|
||||
for idx, stack in ipairs(data) do
|
||||
inv:set_stack("main", idx, stack)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
get_cargo = function(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
local data = {}
|
||||
@ -159,7 +159,7 @@ techage.register_node({"techage:chest_cart"}, {
|
||||
return "unsupported"
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
Tube:set_valid_sides("techage:chest_cart", {"L", "R", "F", "B"})
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA3 Tank Cart
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -20,7 +20,7 @@ local S2P = minetest.string_to_pos
|
||||
local Pipe = techage.LiquidPipe
|
||||
local MP = minetest.get_modpath("minecart")
|
||||
|
||||
local liquid = networks.liquid
|
||||
local liquid = networks.liquid
|
||||
local CAPACITY = 100
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
@ -41,7 +41,7 @@ local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm))
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@ -58,7 +58,7 @@ local function take_liquid(pos, indir, name, amount)
|
||||
end
|
||||
return amount, name
|
||||
end
|
||||
|
||||
|
||||
local function put_liquid(pos, indir, name, amount)
|
||||
-- check if it is not powder
|
||||
local ndef = minetest.registered_craftitems[name] or {}
|
||||
@ -85,7 +85,7 @@ end
|
||||
minetest.register_node("techage:tank_cart", {
|
||||
description = S("TA Tank Cart"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
-- up, down, right, left, back, front
|
||||
"techage_tank_cart_top.png",
|
||||
"techage_tank_cart_bottom.png",
|
||||
"techage_tank_cart_side.png",
|
||||
@ -110,7 +110,7 @@ minetest.register_node("techage:tank_cart", {
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2},
|
||||
node_placement_prediction = "",
|
||||
diggable = false,
|
||||
|
||||
|
||||
on_place = minecart.on_nodecart_place,
|
||||
on_punch = minecart.on_nodecart_punch,
|
||||
|
||||
@ -119,31 +119,31 @@ minetest.register_node("techage:tank_cart", {
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm))
|
||||
-- Delete the network between pump and cart
|
||||
Pipe:after_dig_node(pos)
|
||||
Pipe:after_dig_node(pos)
|
||||
Pipe:after_place_node(pos)
|
||||
end,
|
||||
|
||||
|
||||
set_cargo = function(pos, data)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.liquid = data
|
||||
end,
|
||||
|
||||
|
||||
get_cargo = function(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local data = nvm.liquid
|
||||
nvm.liquid = {}
|
||||
return data
|
||||
end,
|
||||
|
||||
|
||||
has_cargo = function(pos)
|
||||
return not techage.liquid.is_empty(pos)
|
||||
end,
|
||||
|
||||
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
})
|
||||
|
||||
techage.register_node({"techage:tank_cart"}, techage.liquid.recv_message)
|
||||
techage.register_node({"techage:tank_cart"}, techage.liquid.recv_message)
|
||||
|
||||
liquid.register_nodes({"techage:tank_cart"},
|
||||
Pipe, "tank", {"U"}, {
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Doser
|
||||
|
||||
]]--
|
||||
@ -54,14 +54,14 @@ local function get_liquids(pos)
|
||||
Liquids[hash] = tbl
|
||||
return Liquids[hash]
|
||||
end
|
||||
|
||||
|
||||
local function del_liquids(pos)
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
Liquids[hash] = nil
|
||||
end
|
||||
|
||||
|
||||
-- if liquids are missing, update the cached liquid table
|
||||
local function reload_liquids(pos)
|
||||
local function reload_liquids(pos)
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
-- determine the available input liquids
|
||||
local tbl = {}
|
||||
@ -73,11 +73,11 @@ local function reload_liquids(pos)
|
||||
end
|
||||
Liquids[hash] = tbl
|
||||
return Liquids[hash]
|
||||
end
|
||||
end
|
||||
|
||||
local function reactor_cmnd(pos, cmnd, payload)
|
||||
return techage.transfer(
|
||||
pos,
|
||||
pos,
|
||||
6, -- outdir
|
||||
cmnd, -- topic
|
||||
payload, -- payload
|
||||
@ -136,7 +136,7 @@ local function untake(pos, taken)
|
||||
for _,item in pairs(taken) do
|
||||
liquid.untake(pos, Pipe, item.outdir, item.name, item.num)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function dosing(pos, nvm, elapsed)
|
||||
-- trigger reactor (power)
|
||||
@ -177,13 +177,13 @@ local function dosing(pos, nvm, elapsed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- check leftover
|
||||
local leftover
|
||||
local mem = techage.get_mem(pos)
|
||||
if mem.waste_leftover then
|
||||
leftover = reactor_cmnd(pos, "waste", {
|
||||
name = mem.waste_leftover.name,
|
||||
name = mem.waste_leftover.name,
|
||||
amount = mem.waste_leftover.num}) or mem.waste_leftover.num
|
||||
if leftover > 0 then
|
||||
mem.waste_leftover.num = leftover
|
||||
@ -194,7 +194,7 @@ local function dosing(pos, nvm, elapsed)
|
||||
end
|
||||
if mem.output_leftover then
|
||||
leftover = reactor_cmnd(pos, "output", {
|
||||
name = mem.output_leftover.name,
|
||||
name = mem.output_leftover.name,
|
||||
amount = mem.output_leftover.num}) or mem.output_leftover.num
|
||||
if leftover > 0 then
|
||||
mem.output_leftover.num = leftover
|
||||
@ -203,11 +203,11 @@ local function dosing(pos, nvm, elapsed)
|
||||
end
|
||||
mem.output_leftover = nil
|
||||
end
|
||||
|
||||
|
||||
-- inputs
|
||||
local taken = {}
|
||||
mem.dbg_cycles = (mem.dbg_cycles or 0) - 1
|
||||
|
||||
|
||||
for _,item in pairs(recipe.input) do
|
||||
if item.name ~= "" then
|
||||
local outdir = liquids[item.name] or reload_liquids(pos)[item.name]
|
||||
@ -231,7 +231,7 @@ local function dosing(pos, nvm, elapsed)
|
||||
-- waste
|
||||
if recipe.waste.name ~= "" then
|
||||
leftover = reactor_cmnd(pos, "waste", {
|
||||
name = recipe.waste.name,
|
||||
name = recipe.waste.name,
|
||||
amount = recipe.waste.num}) or recipe.waste.num
|
||||
if leftover > 0 then
|
||||
mem.waste_leftover = {name = recipe.waste.name, num = leftover}
|
||||
@ -243,7 +243,7 @@ local function dosing(pos, nvm, elapsed)
|
||||
end
|
||||
-- output
|
||||
leftover = reactor_cmnd(pos, "output", {
|
||||
name = recipe.output.name,
|
||||
name = recipe.output.name,
|
||||
amount = recipe.output.num}) or recipe.output.num
|
||||
if leftover > 0 then
|
||||
mem.output_leftover = {name = recipe.output.name, num = leftover}
|
||||
@ -252,13 +252,13 @@ local function dosing(pos, nvm, elapsed)
|
||||
return
|
||||
end
|
||||
State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
end
|
||||
end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
dosing(pos, nvm, elapsed)
|
||||
return State:is_active(nvm)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_rightclick(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
@ -269,9 +269,9 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if not nvm.running then
|
||||
if not nvm.running then
|
||||
recipes.on_receive_fields(pos, formname, fields, player)
|
||||
end
|
||||
local mem = techage.get_mem(pos)
|
||||
@ -345,7 +345,7 @@ minetest.register_node("techage:ta4_doser_on", {
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
diggable = false,
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Liquid Filter
|
||||
|
||||
]]--
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Reactor
|
||||
|
||||
]]--
|
||||
@ -51,10 +51,10 @@ minetest.register_node("techage:ta4_reactor_fillerpipe", {
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
end,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
groups = {cracky=2},
|
||||
@ -64,7 +64,7 @@ minetest.register_node("techage:ta4_reactor_fillerpipe", {
|
||||
|
||||
local function stand_cmnd(pos, cmnd, payload)
|
||||
return techage.transfer(
|
||||
{x = pos.x, y = pos.y-1, z = pos.z},
|
||||
{x = pos.x, y = pos.y-1, z = pos.z},
|
||||
5, -- outdir
|
||||
cmnd, -- topic
|
||||
payload, -- payload
|
||||
@ -83,11 +83,11 @@ techage.register_node({"techage:ta4_reactor_fillerpipe"}, {
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
if topic == "check" then
|
||||
local pos2,node = Pipe:get_node(pos, 5)
|
||||
if not node or node.name ~= "techage:ta4_reactor" then
|
||||
if not node or node.name ~= "techage:ta4_reactor" then
|
||||
return false
|
||||
end
|
||||
pos2,node = Pipe:get_node(pos2, 5)
|
||||
if not node or node.name ~= "techage:ta4_reactor_stand" then
|
||||
if not node or node.name ~= "techage:ta4_reactor_stand" then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
@ -95,7 +95,7 @@ techage.register_node({"techage:ta4_reactor_fillerpipe"}, {
|
||||
return base_waste(pos, payload or {})
|
||||
elseif topic == "catalyst" then
|
||||
local pos2,node = Pipe:get_node(pos, 5)
|
||||
if not node or node.name ~= "techage:ta4_reactor" then
|
||||
if not node or node.name ~= "techage:ta4_reactor" then
|
||||
return
|
||||
end
|
||||
local inv = M(pos2):get_inventory()
|
||||
@ -158,7 +158,7 @@ minetest.register_node("techage:ta4_reactor", {
|
||||
end,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
paramtype2 = "facedir",
|
||||
@ -191,7 +191,7 @@ minetest.register_lbm({
|
||||
name = "techage:update_reactor",
|
||||
|
||||
nodenames = {
|
||||
"techage:ta4_reactor",
|
||||
"techage:ta4_reactor",
|
||||
},
|
||||
|
||||
run_at_every_load = true,
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Reactor Stand and Base
|
||||
|
||||
]]--
|
||||
@ -26,7 +26,7 @@ local function play_sound(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.handle or mem.handle == -1 then
|
||||
mem.handle = minetest.sound_play("techage_reactor", {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 0.5,
|
||||
max_hear_distance = 10,
|
||||
loop = true})
|
||||
@ -58,8 +58,8 @@ local function on_nopower(pos)
|
||||
nvm.running = false
|
||||
end
|
||||
|
||||
local function is_running(pos, nvm)
|
||||
return nvm.running
|
||||
local function is_running(pos, nvm)
|
||||
return nvm.running
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta4_reactor_stand", {
|
||||
@ -76,14 +76,14 @@ minetest.register_node("techage:ta4_reactor_stand", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
fixed = {
|
||||
{ -8/16, 2/16, -8/16, 8/16, 4/16, 8/16 },
|
||||
|
||||
|
||||
{ -8/16, -8/16, -8/16, -6/16, 8/16, -6/16 },
|
||||
{ 6/16, -8/16, -8/16, 8/16, 8/16, -6/16 },
|
||||
{ -8/16, -8/16, 6/16, -6/16, 8/16, 8/16 },
|
||||
{ 6/16, -8/16, 6/16, 8/16, 8/16, 8/16 },
|
||||
|
||||
|
||||
{-1/8, -4/8, -1/8, 1/8, 4/8, 1/8},
|
||||
{-4/8, -1/8, -1/8, 4/8, 1/8, 1/8},
|
||||
{-4/8, -1/8, -3/8, -3/8, 1/8, 3/8},
|
||||
@ -94,7 +94,7 @@ minetest.register_node("techage:ta4_reactor_stand", {
|
||||
type = "fixed",
|
||||
fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
M(pos):set_string("infotext", S("off"))
|
||||
@ -117,7 +117,7 @@ minetest.register_node("techage:ta4_reactor_stand", {
|
||||
Cable:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
paramtype2 = "facedir",
|
||||
@ -155,7 +155,7 @@ techage.register_node({"techage:ta4_reactor_stand"}, {
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if nvm.has_power then
|
||||
play_sound(pos)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@ -170,7 +170,7 @@ minetest.register_node("techage:ta4_reactor_base", {
|
||||
"techage_concrete.png",
|
||||
"techage_concrete.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
|
||||
Pipe:after_place_node(pos)
|
||||
@ -178,7 +178,7 @@ minetest.register_node("techage:ta4_reactor_base", {
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
groups = {cracky=2},
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Coal Power Station Boiler Base
|
||||
|
||||
]]--
|
||||
@ -39,7 +39,7 @@ minetest.register_node("techage:coalboiler_base", {
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -49,7 +49,7 @@ minetest.register_node("techage:coalboiler_base", {
|
||||
})
|
||||
|
||||
Pipe:add_secondary_node_names({"techage:coalboiler_base"})
|
||||
|
||||
|
||||
-- for logical communication
|
||||
techage.register_node({"techage:coalboiler_base"}, {
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
@ -65,4 +65,3 @@ minetest.register_craft({
|
||||
{"default:stone", "default:stone", "default:stone"},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Coal Power Station Boiler Top
|
||||
|
||||
]]--
|
||||
@ -62,14 +62,14 @@ minetest.register_node("techage:coalboiler_top", {
|
||||
type = "fixed",
|
||||
fixed = {-13/32, -48/32, -13/32, 13/32, 16/32, 13/32},
|
||||
},
|
||||
|
||||
|
||||
can_dig = boiler.can_dig,
|
||||
on_timer = node_timer,
|
||||
on_rightclick = boiler.on_rightclick,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
on_punch = boiler.on_punch,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1},
|
||||
@ -108,4 +108,3 @@ minetest.register_craft({
|
||||
{"default:stone", "", "default:stone"},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Cooler
|
||||
|
||||
]]--
|
||||
@ -19,7 +19,7 @@ local S = techage.S
|
||||
local Pipe = techage.SteamPipe
|
||||
|
||||
local function transfer(pos, in_dir, topic, payload)
|
||||
return techage.transfer(pos, in_dir, topic, payload, Pipe,
|
||||
return techage.transfer(pos, in_dir, topic, payload, Pipe,
|
||||
{"techage:coalboiler_base"})
|
||||
end
|
||||
|
||||
@ -61,10 +61,10 @@ minetest.register_node("techage:cooler", {
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -102,10 +102,10 @@ minetest.register_node("techage:cooler_on", {
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drop = "techage:cooler",
|
||||
groups = {cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1},
|
||||
@ -131,4 +131,3 @@ minetest.register_craft({
|
||||
{"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Coal Power Station Firebox
|
||||
|
||||
]]--
|
||||
@ -25,7 +25,7 @@ local BURN_CYCLE_FACTOR = 0.5
|
||||
local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local power = techage.transfer(
|
||||
{x=pos.x, y=pos.y+2, z=pos.z},
|
||||
{x=pos.x, y=pos.y+2, z=pos.z},
|
||||
nil, -- outdir
|
||||
"trigger", -- topic
|
||||
nil, -- payload
|
||||
@ -34,7 +34,7 @@ local function node_timer(pos, elapsed)
|
||||
)
|
||||
nvm.burn_cycles = (nvm.burn_cycles or 0) - math.max((power or 0.02), 0.02)
|
||||
if nvm.burn_cycles <= 0 then
|
||||
local taken = firebox.get_fuel(pos)
|
||||
local taken = firebox.get_fuel(pos)
|
||||
if taken then
|
||||
nvm.burn_cycles = (firebox.Burntime[taken:get_name()] or 1) / CYCLE_TIME * BURN_CYCLE_FACTOR
|
||||
nvm.burn_cycles_total = nvm.burn_cycles
|
||||
@ -83,7 +83,7 @@ minetest.register_node("techage:coalfirebox", {
|
||||
allow_metadata_inventory_put = firebox.allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = firebox.allow_metadata_inventory_take,
|
||||
on_rightclick = firebox.on_rightclick,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
if firebox.is_free_position(pos, placer:get_player_name()) then
|
||||
techage.add_node(pos, "techage:coalfirebox")
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Power Station Generator
|
||||
|
||||
]]--
|
||||
@ -30,7 +30,7 @@ local function formspec(self, pos, nvm)
|
||||
end
|
||||
|
||||
local function transfer_turbine(pos, topic, payload)
|
||||
return techage.transfer(pos, "L", topic, payload, nil,
|
||||
return techage.transfer(pos, "L", topic, payload, nil,
|
||||
{"techage:turbine", "techage:turbine_on"})
|
||||
end
|
||||
|
||||
@ -145,7 +145,7 @@ minetest.register_node("techage:generator", {
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png",
|
||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png^[transformFX]",
|
||||
},
|
||||
|
||||
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
@ -190,7 +190,7 @@ minetest.register_node("techage:generator_on", {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
@ -247,7 +247,7 @@ control.register_nodes({"techage:generator", "techage:generator_on"}, {
|
||||
running = techage.is_running(nvm) or false,
|
||||
available = PWR_PERF,
|
||||
provided = nvm.provided or 0,
|
||||
termpoint = meta:get_string("termpoint"),
|
||||
termpoint = meta:get_string("termpoint"),
|
||||
}
|
||||
end
|
||||
return false
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Coal Power Station Firebox
|
||||
|
||||
]]--
|
||||
@ -28,7 +28,7 @@ local BURN_CYCLE_FACTOR = 0.5
|
||||
local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local power = techage.transfer(
|
||||
{x=pos.x, y=pos.y+2, z=pos.z},
|
||||
{x=pos.x, y=pos.y+2, z=pos.z},
|
||||
nil, -- outdir
|
||||
"trigger", -- topic
|
||||
nil, -- payload
|
||||
@ -85,7 +85,7 @@ minetest.register_node("techage:oilfirebox", {
|
||||
can_dig = fuel.can_dig,
|
||||
on_rightclick = fuel.on_rightclick,
|
||||
on_receive_fields = fuel.on_receive_fields,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
if firebox.is_free_position(pos, placer:get_player_name()) then
|
||||
techage.add_node(pos, "techage:oilfirebox")
|
||||
@ -103,7 +103,7 @@ minetest.register_node("techage:oilfirebox", {
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
on_destruct = function(pos)
|
||||
firebox.set_firehole(pos, nil)
|
||||
end,
|
||||
@ -142,5 +142,3 @@ minetest.register_craft({
|
||||
{'', '', ''},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Power Station Turbine
|
||||
|
||||
]]--
|
||||
@ -19,12 +19,12 @@ local S = techage.S
|
||||
local Pipe = techage.SteamPipe
|
||||
|
||||
local function transfer_cooler(pos, topic, payload)
|
||||
return techage.transfer(pos, 6, topic, payload, Pipe,
|
||||
return techage.transfer(pos, 6, topic, payload, Pipe,
|
||||
{"techage:cooler", "techage:cooler_on"})
|
||||
end
|
||||
|
||||
local function transfer_generator(pos, topic, payload)
|
||||
return techage.transfer(pos, "R", topic, payload, nil,
|
||||
return techage.transfer(pos, "R", topic, payload, nil,
|
||||
{"techage:generator", "techage:generator_on"})
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ local function play_sound(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.handle or mem.handle == -1 then
|
||||
mem.handle = minetest.sound_play("techage_turbine", {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 1,
|
||||
max_hear_distance = 15,
|
||||
loop = true})
|
||||
@ -69,7 +69,7 @@ local function after_dig_node(pos, oldnode)
|
||||
techage.del_mem(pos)
|
||||
end
|
||||
|
||||
local function tubelib2_on_update2(pos, outdir, tlib2, node)
|
||||
local function tubelib2_on_update2(pos, outdir, tlib2, node)
|
||||
swap_node(pos, "techage:turbine")
|
||||
stop_sound(pos)
|
||||
end
|
||||
@ -85,11 +85,11 @@ minetest.register_node("techage:turbine", {
|
||||
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png",
|
||||
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
tubelib2_on_update2 = tubelib2_on_update2,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -125,9 +125,9 @@ minetest.register_node("techage:turbine_on", {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
tubelib2_on_update2 = tubelib2_on_update2,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
diggable = false,
|
||||
@ -168,7 +168,7 @@ techage.register_node({"techage:turbine", "techage:turbine_on"}, {
|
||||
on_node_load = function(pos, node)
|
||||
if node.name == "techage:turbine_on" then
|
||||
play_sound(pos)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@ -180,4 +180,3 @@ minetest.register_craft({
|
||||
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Cooler as part of the Collider
|
||||
|
||||
]]--
|
||||
@ -60,7 +60,7 @@ minetest.register_node("techage:ta4_collider_cooler", {
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
Pipe:after_place_node(pos)
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
@ -78,7 +78,7 @@ techage.register_node({"techage:ta4_collider_cooler"}, {
|
||||
return false
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_collider_cooler",
|
||||
@ -88,4 +88,3 @@ minetest.register_craft({
|
||||
{'', 'techage:aluminum', ''},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -43,7 +43,7 @@ local Schedule = {[0] =
|
||||
|
||||
local function play_sound(pos)
|
||||
minetest.sound_play("techage_hum", {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 0.5,
|
||||
max_hear_distance = 10,
|
||||
})
|
||||
@ -52,12 +52,12 @@ end
|
||||
local function terminal_message(pos, msg)
|
||||
local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num")
|
||||
local own_num = M(pos):get_string("node_number")
|
||||
|
||||
|
||||
if term_num and own_num then
|
||||
techage.send_single(own_num, term_num, "text", msg)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function experience_points(pos)
|
||||
if math.random(PROBABILITY) == 1 then
|
||||
local owner = M(pos):get_string("owner")
|
||||
@ -92,11 +92,11 @@ local function check_state(pos)
|
||||
nvm.ticks = (nvm.ticks or 0) + 1
|
||||
local idx = nvm.ticks % TIME_SLOTS
|
||||
local item = Schedule[idx]
|
||||
|
||||
|
||||
if idx == 1 then
|
||||
nvm.result = true
|
||||
end
|
||||
|
||||
|
||||
if item then
|
||||
if item.name == "shell" then
|
||||
local res, err = check_shell(pos, param2)
|
||||
@ -130,7 +130,7 @@ local function check_state(pos)
|
||||
return nvm.result
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function add_laser(pos)
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
local pos1 = getpos(pos, param2, {3,3}, 1)
|
||||
@ -144,14 +144,14 @@ local function create_task(pos, task)
|
||||
if not mem.co then
|
||||
mem.co = coroutine.create(task)
|
||||
end
|
||||
|
||||
|
||||
local _, err = coroutine.resume(mem.co, pos)
|
||||
if err then
|
||||
mem.co = nil
|
||||
--print(err)
|
||||
return
|
||||
end
|
||||
minetest.after(0.4, create_task, pos)
|
||||
minetest.after(0.4, create_task, pos, task)
|
||||
end
|
||||
|
||||
-- Call on_cyclic_check of all magents so that the magnets don't need a FLB.
|
||||
@ -227,10 +227,10 @@ minetest.register_node("techage:ta4_detector_core", {
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.on_remove_collider(digger)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
})
|
||||
@ -247,7 +247,7 @@ local function start_task(pos)
|
||||
local own_num = M(pos):get_string("node_number")
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.magnet_positions = {}
|
||||
|
||||
|
||||
if term_num and param2 and pos2 then
|
||||
techage.send_single(own_num, term_num, "text", "#### Start ####")
|
||||
|
||||
@ -267,7 +267,7 @@ local function start_task(pos)
|
||||
return
|
||||
end
|
||||
techage.send_single(own_num, term_num, "append", "ok")
|
||||
|
||||
|
||||
coroutine.yield()
|
||||
techage.send_single(own_num, term_num, "text", "- Start magnets...")
|
||||
local t = {}
|
||||
@ -285,7 +285,7 @@ local function start_task(pos)
|
||||
end
|
||||
nvm.magnet_positions = t
|
||||
techage.send_single(own_num, term_num, "append", "ok")
|
||||
|
||||
|
||||
coroutine.yield()
|
||||
techage.send_single(own_num, term_num, "text", "- Check magnets...")
|
||||
-- The check will be performed by the timer, so wait 5 sec.
|
||||
@ -298,7 +298,7 @@ local function start_task(pos)
|
||||
nvm.locked = false
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
coroutine.yield()
|
||||
techage.send_single(own_num, term_num, "text", "- Check detector...")
|
||||
for _,item in ipairs(Schedule)do
|
||||
@ -333,14 +333,14 @@ local function start_task(pos)
|
||||
end
|
||||
end
|
||||
techage.send_single(own_num, term_num, "append", "ok")
|
||||
|
||||
|
||||
coroutine.yield()
|
||||
techage.send_single(own_num, term_num, "text", "Collider started.")
|
||||
nvm.ticks = 0
|
||||
nvm.running = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function test_magnet(pos, payload)
|
||||
local term_num = M(pos):contains("term_num") and M(pos):get_string("term_num")
|
||||
local param2 = minetest.get_node(pos).param2
|
||||
@ -363,7 +363,7 @@ techage.register_node({"techage:ta4_detector_core"}, {
|
||||
return true
|
||||
elseif topic == "start" then
|
||||
-- Worker block
|
||||
nvm.locked = true
|
||||
nvm.locked = true
|
||||
create_task(pos, start_task)
|
||||
return true
|
||||
elseif topic == "stop" then
|
||||
@ -381,7 +381,7 @@ techage.register_node({"techage:ta4_detector_core"}, {
|
||||
end
|
||||
elseif topic == "test"then
|
||||
if payload and tonumber(payload) then
|
||||
test_magnet(pos, payload)
|
||||
test_magnet(pos, payload)
|
||||
return true
|
||||
else
|
||||
return "Invalid magnet number"
|
||||
@ -400,7 +400,7 @@ techage.register_node({"techage:ta4_detector_core"}, {
|
||||
on_node_load = function(pos)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
@ -411,4 +411,3 @@ minetest.register_craft({
|
||||
{'default:steel_ingot', '', 'techage:aluminum'},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Tube/Pipe Inputs/Outputs as part of the Collider
|
||||
|
||||
]]--
|
||||
@ -64,7 +64,7 @@ minetest.register_node("techage:ta4_collider_tube_inlet", {
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
VTube:after_place_node(pos)
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode)
|
||||
VTube:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
@ -87,10 +87,10 @@ techage.register_node({"techage:ta4_collider_tube_inlet"}, {
|
||||
return true
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
-- Used by the detector to check the tube connection
|
||||
function techage.tube_inlet_command(pos, command, payload)
|
||||
function techage.tube_inlet_command(pos, command, payload)
|
||||
if command == "distance" then
|
||||
local pos2 = techage.transfer(pos, "F", command, payload, VTube, {"techage:ta4_magnet"})
|
||||
if type(pos2) == "table" then
|
||||
@ -144,7 +144,7 @@ minetest.register_node("techage:ta4_collider_pipe_inlet", {
|
||||
Pipe:after_place_node(pos)
|
||||
nvm.liquid = {}
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
@ -180,10 +180,10 @@ techage.register_node({"techage:ta4_collider_pipe_inlet"}, {
|
||||
return true
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
-- Used by the detector to check for gas pressure
|
||||
function techage.gas_inlet_check(pos, node, meta, nvm)
|
||||
function techage.gas_inlet_check(pos, node, meta, nvm)
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
if nvm.liquid.amount == GAS_CAPA and nvm.liquid.name == "techage:isobutane" then
|
||||
return true
|
||||
@ -192,7 +192,7 @@ function techage.gas_inlet_check(pos, node, meta, nvm)
|
||||
end
|
||||
|
||||
-- Used by the detector to check for cooler connection
|
||||
function techage.cooler_check(pos, node, meta, nvm)
|
||||
function techage.cooler_check(pos, node, meta, nvm)
|
||||
if nvm.detector_received then
|
||||
nvm.detector_received = nil
|
||||
return true
|
||||
@ -247,7 +247,7 @@ minetest.register_node("techage:ta4_collider_pipe_outlet", {
|
||||
init_air(nvm)
|
||||
Pipe:after_place_node(pos)
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode)
|
||||
Pipe:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
@ -275,7 +275,7 @@ liquid.register_nodes({"techage:ta4_collider_pipe_outlet"}, Pipe, "tank", {"U"},
|
||||
})
|
||||
|
||||
-- Used by the detector to check the vacuum
|
||||
function techage.air_outlet_check(pos, node, meta, nvm)
|
||||
function techage.air_outlet_check(pos, node, meta, nvm)
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
if nvm.liquid.amount == 0 then
|
||||
return true
|
||||
@ -283,7 +283,7 @@ function techage.air_outlet_check(pos, node, meta, nvm)
|
||||
return false, "no vacuum"
|
||||
end
|
||||
|
||||
function techage.air_outlet_reset(pos)
|
||||
function techage.air_outlet_reset(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
init_air(nvm)
|
||||
end
|
||||
@ -325,13 +325,13 @@ minetest.register_node("techage:ta4_collider_cable_inlet", {
|
||||
Cable:after_place_node(pos)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end,
|
||||
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
||||
return true
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode)
|
||||
Cable:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
@ -339,7 +339,7 @@ minetest.register_node("techage:ta4_collider_cable_inlet", {
|
||||
})
|
||||
|
||||
-- Used by the detector to check for power
|
||||
function techage.power_inlet_check(pos, node, meta, nvm)
|
||||
function techage.power_inlet_check(pos, node, meta, nvm)
|
||||
if nvm.consumed == PWR_NEEDED then
|
||||
return true
|
||||
end
|
||||
@ -352,7 +352,7 @@ techage.register_node({"techage:ta4_collider_cable_inlet"}, {
|
||||
on_node_load = function(pos)
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_collider_cable_inlet",
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Magnet as part of the Collider
|
||||
|
||||
]]--
|
||||
@ -60,9 +60,9 @@ minetest.register_node("techage:ta4_detector_magnet", {
|
||||
minetest.register_node("techage:ta4_magnet", {
|
||||
description = S("TA4 Collider Magnet"),
|
||||
inventory_image = minetest.inventorycube(
|
||||
"techage_collider_magnet.png^techage_appl_hole_electric.png",
|
||||
"techage_collider_magnet.png^techage_appl_hole_electric.png",
|
||||
"techage_collider_magnet.png^techage_appl_hole_pipe.png",
|
||||
"techage_collider_magnet.png^techage_collider_magnet_tube.png"),
|
||||
"techage_collider_magnet.png^techage_collider_magnet_tube.png"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_collider_magnet.png^techage_appl_hole_electric.png",
|
||||
@ -111,7 +111,7 @@ minetest.register_node("techage:ta4_magnet", {
|
||||
VTube:after_place_node(pos)
|
||||
M(pos):set_string("infotext", S("TA4 Collider Magnet") .. " #0")
|
||||
end,
|
||||
|
||||
|
||||
-- To be called by the detector
|
||||
on_cyclic_check = function(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
@ -120,15 +120,15 @@ minetest.register_node("techage:ta4_magnet", {
|
||||
if nvm.tube_damage then
|
||||
nvm.tube_damage = nil
|
||||
return -1
|
||||
elseif nvm.liquid.amount == CAPACITY and
|
||||
nvm.liquid.name == "techage:isobutane" and
|
||||
elseif nvm.liquid.amount == CAPACITY and
|
||||
nvm.liquid.name == "techage:isobutane" and
|
||||
nvm.consumed == PWR_NEEDED then
|
||||
return 0
|
||||
end
|
||||
return -2
|
||||
end,
|
||||
|
||||
tubelib2_on_update2 = function(pos, outdir, tlib2, node)
|
||||
|
||||
tubelib2_on_update2 = function(pos, outdir, tlib2, node)
|
||||
if tlib2.tube_type == "vtube" then
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.tube_damage = true
|
||||
@ -138,7 +138,7 @@ minetest.register_node("techage:ta4_magnet", {
|
||||
nvm.liquid.amount = 0
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode)
|
||||
Pipe:after_dig_node(pos)
|
||||
Cable:after_dig_node(pos)
|
||||
@ -172,14 +172,14 @@ VTube:add_secondary_node_names({"techage:ta4_magnet"})
|
||||
VTube:set_valid_sides("techage:ta4_magnet", {"R", "L"})
|
||||
|
||||
local function send_to_next(pos, in_dir, topic, payload)
|
||||
return techage.transfer(pos, in_dir, topic, payload, VTube,
|
||||
return techage.transfer(pos, in_dir, topic, payload, VTube,
|
||||
{"techage:ta4_magnet", "techage:ta4_collider_tube_inlet"})
|
||||
end
|
||||
|
||||
--[[
|
||||
Commands
|
||||
--------
|
||||
|
||||
--------
|
||||
|
||||
distance : Check distance between all magnets.
|
||||
Returns pos of next magnet or the number of the defect magnet.
|
||||
enumerate : Give each magnet a unique number (1...n)
|
||||
@ -231,7 +231,7 @@ techage.register_node({"techage:ta4_magnet"}, {
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta4_magnet_base", {
|
||||
description = S("TA4 Collider Magnet Base"),
|
||||
@ -302,4 +302,4 @@ minetest.register_lbm({
|
||||
nvm.liquid.name = "techage:isobutane"
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
@ -9,7 +9,7 @@
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA4 Terminal
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
local M = minetest.get_meta
|
||||
@ -25,7 +25,7 @@ machine.
|
||||
Commands can have up to 80 characters.
|
||||
Local commands:
|
||||
- clear = clear screen
|
||||
- help = this message
|
||||
- help = this message
|
||||
- pub = switch to public use
|
||||
- priv = switch to private use
|
||||
- connect <num> = connect the machine
|
||||
@ -77,7 +77,7 @@ end
|
||||
local function command(pos, mem, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
|
||||
|
||||
if mem.command == "clear" then
|
||||
mem.output = ""
|
||||
mem.command = ""
|
||||
@ -103,12 +103,12 @@ local function command(pos, mem, player)
|
||||
output(pos, "Switched to private use!")
|
||||
elseif meta:get_int("public") == 1 or owner == player then
|
||||
if mem.command == "clear" then
|
||||
mem.output =
|
||||
mem.output =
|
||||
mem.command = ""
|
||||
meta:set_string("formspec", formspec2(mem))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta4_terminal", {
|
||||
description = "TA4 Collider Terminal",
|
||||
@ -136,7 +136,7 @@ minetest.register_node("techage:ta4_terminal", {
|
||||
{-12/32, -14/32, 12/32, 12/32, 6/32, 14/32},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local number = techage.add_node(pos, minetest.get_node(pos).name)
|
||||
local meta = minetest.get_meta(pos)
|
||||
@ -169,11 +169,11 @@ minetest.register_node("techage:ta4_terminal", {
|
||||
meta:set_string("formspec", formspec2(mem))
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Vacuum Tube as part of the Collider
|
||||
|
||||
]]--
|
||||
@ -18,10 +18,10 @@ local S = techage.S
|
||||
|
||||
local VTube = tubelib2.Tube:new({
|
||||
dirs_to_check = {1,2,3,4},
|
||||
max_tube_length = 5,
|
||||
max_tube_length = 5,
|
||||
tube_type = "vtube",
|
||||
show_infotext = false,
|
||||
primary_node_names = {"techage:ta4_vtubeS", "techage:ta4_vtubeA"},
|
||||
primary_node_names = {"techage:ta4_vtubeS", "techage:ta4_vtubeA"},
|
||||
secondary_node_names = {"techage:ta4_magnet"},
|
||||
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
||||
minetest.swap_node(pos, {name = "techage:ta4_vtube"..tube_type, param2 = param2})
|
||||
@ -63,11 +63,11 @@ minetest.register_node("techage:ta4_vtubeS", {
|
||||
end
|
||||
return false
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
VTube:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir", -- important!
|
||||
on_rotate = screwdriver.disallow, -- important!
|
||||
paramtype = "light",
|
||||
@ -108,7 +108,7 @@ minetest.register_node("techage:ta4_vtubeA", {
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
VTube:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "facedir", -- important!
|
||||
on_rotate = screwdriver.disallow, -- important!
|
||||
paramtype = "light",
|
||||
|
@ -19,7 +19,7 @@ local S = techage.S
|
||||
local AssemblyPlan = {
|
||||
-- y-offs, path, facedir-offs, name
|
||||
-- 0 = forward, 1 = right, 2 = backward, 3 = left
|
||||
|
||||
|
||||
-- level 1
|
||||
-- left/right
|
||||
{ 1, {3,3,3,2}, 0, "techage:ta4_colliderblock"},
|
||||
@ -45,7 +45,7 @@ local AssemblyPlan = {
|
||||
{ 1, {3}, 0, "techage:ta4_detector_magnet"},
|
||||
{ 1, {1}, 0, "techage:ta4_detector_magnet"},
|
||||
{ 1, {1,1}, 0, "techage:ta4_detector_magnet"},
|
||||
|
||||
|
||||
-- level 2
|
||||
-- left/right
|
||||
{ 2, {3,3,3,2}, 1, "techage:ta4_collider_pipe_inlet"},
|
||||
@ -93,7 +93,7 @@ local AssemblyPlan = {
|
||||
{ 3, {}, 0, "techage:ta4_collider_pipe_outlet"},
|
||||
{ 3, {1}, 0, "techage:ta4_detector_magnet"},
|
||||
{ 3, {1,1}, 0, "techage:ta4_detector_magnet"},
|
||||
|
||||
|
||||
-- Core block
|
||||
{ 1, {}, 0, "techage:ta4_detector_core"},
|
||||
}
|
||||
@ -156,12 +156,12 @@ minetest.register_node("techage:ta4_collider_detector_worker", {
|
||||
inv:set_size("src", 9)
|
||||
M(pos):set_string("formspec", formspec())
|
||||
end,
|
||||
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if fields.build then
|
||||
if not nvm.assemble_locked then
|
||||
@ -176,7 +176,7 @@ minetest.register_node("techage:ta4_collider_detector_worker", {
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
@ -207,4 +207,3 @@ minetest.register_craft({
|
||||
{'default:steel_ingot', 'default:mese_crystal', 'techage:aluminum'},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -58,7 +58,7 @@ local function plan(images)
|
||||
end
|
||||
end
|
||||
return table.concat(tbl)
|
||||
end
|
||||
end
|
||||
|
||||
local function formspec_help(meta, manual)
|
||||
local bttn
|
||||
@ -123,13 +123,13 @@ minetest.register_node("techage:construction_board", {
|
||||
drawtype = "nodebox",
|
||||
node_box = board_box,
|
||||
selection_box = board_box,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("index", 1)
|
||||
meta:set_string("formspec", formspec_help(meta, techage.manual_DE))
|
||||
end,
|
||||
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
local player_name = player:get_player_name()
|
||||
if minetest.is_protected(pos, player_name) then
|
||||
@ -149,7 +149,7 @@ minetest.register_node("techage:construction_board", {
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "wallmounted",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
@ -175,13 +175,13 @@ minetest.register_node("techage:construction_board_EN", {
|
||||
drawtype = "nodebox",
|
||||
node_box = board_box,
|
||||
selection_box = board_box,
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("index", 1)
|
||||
meta:set_string("formspec", formspec_help(meta, techage.manual_EN))
|
||||
end,
|
||||
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
local player_name = player:get_player_name()
|
||||
if minetest.is_protected(pos, player_name) then
|
||||
@ -201,7 +201,7 @@ minetest.register_node("techage:construction_board_EN", {
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
paramtype2 = "wallmounted",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA Items Table
|
||||
|
||||
]]--
|
||||
@ -118,7 +118,7 @@ techage.Items = {
|
||||
ta3_programmer = "techage:programmer",
|
||||
ta3_doorcontroller = "techage:ta3_doorcontroller",
|
||||
ta3_drill_pipe_wrench = "techage:ta3_drill_pipe_wrench",
|
||||
ta3_pipe = "techage:ta3_pipeS",
|
||||
ta3_pipe = "techage:ta3_pipeS",
|
||||
ta3_pipe_wall_entry = "techage:ta3_pipe_wall_entry",
|
||||
ta3_mesecons_converter = "techage:ta3_mesecons_converter",
|
||||
ta3_valve = "techage:ta3_valve_closed",
|
||||
@ -132,13 +132,13 @@ techage.Items = {
|
||||
ta4_blinklamp = "techage:rotor_signal_lamp_off",
|
||||
ta4_nacelle = "techage:ta4_wind_turbine_nacelle",
|
||||
ta4_minicell = "techage:ta4_solar_minicell",
|
||||
ta4_pipe = "techage:ta4_pipeS",
|
||||
ta4_tube = "techage:ta4_tubeS",
|
||||
ta4_junctionpipe = "techage:ta4_junctionpipe25",
|
||||
ta4_pipeinlet = "techage:ta4_pipe_inlet",
|
||||
ta4_pipe = "techage:ta4_pipeS",
|
||||
ta4_tube = "techage:ta4_tubeS",
|
||||
ta4_junctionpipe = "techage:ta4_junctionpipe25",
|
||||
ta4_pipeinlet = "techage:ta4_pipe_inlet",
|
||||
ta4_turbine = "techage:ta4_turbine",
|
||||
ta4_generator = "techage:ta4_generator",
|
||||
ta4_heatexchanger = "techage:heatexchanger3",
|
||||
ta4_heatexchanger = "techage:heatexchanger3",
|
||||
ta4_powercable = "techage:ta4_power_cableS",
|
||||
ta4_powerbox = "techage:ta4_power_box",
|
||||
ta4_solarmodule = "techage:ta4_solar_module",
|
||||
@ -204,9 +204,11 @@ techage.Items = {
|
||||
ta4_recipeblock = "techage:ta4_recipeblock",
|
||||
----------------------------
|
||||
ta5_flycontroller = "techage:ta5_flycontroller",
|
||||
ta5_aichip = "techage:ta5_aichip",
|
||||
ta5_tele_pipe = "techage:ta5_tele_pipe",
|
||||
ta5_tele_tube = "techage:ta5_tele_tube",
|
||||
ta5_aichip = "techage:ta5_aichip",
|
||||
ta5_tele_pipe = "techage:ta5_tele_pipe",
|
||||
ta5_tele_tube = "techage:ta5_tele_tube",
|
||||
ta5_chest = "techage:ta5_hl_chest",
|
||||
ta5_tank = "techage:ta5_hl_tank",
|
||||
|
||||
}
|
||||
|
||||
@ -214,4 +216,4 @@ function techage.add_manual_items(table_with_items)
|
||||
for name, tbl in pairs(table_with_items) do
|
||||
techage.Items[name] = tbl
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -237,12 +237,13 @@ techage.manual_DE.aTitel = {
|
||||
"3,TA5 Flug Controller",
|
||||
"3,TA5 Hyperloop Kiste / TA5 Hyperloop Chest",
|
||||
"3,TA5 Hyperloop Tank / TA5 Hyperloop Tank",
|
||||
"3,Hyperloop Teleport Blöcke (geplant)",
|
||||
"3,TA5 Container (geplant)",
|
||||
"3,TA5-Raumgleiter (geplant)",
|
||||
"2,Teleport Blöcke",
|
||||
"3,TA5 Teleport Block Gegenstände / TA5 Teleport Block Items",
|
||||
"3,TA5 Teleport Block Flüssigkeiten / TA5 Teleport Block Liquids",
|
||||
"3,TA5-Raumgleiter (geplant)",
|
||||
"3,Hyperloop Teleport Blöcke (geplant)",
|
||||
"2,Weitere TA5 Blöcke/Items",
|
||||
"3,TA5 Container (geplant)",
|
||||
"3,TA5 KI Chip / TA5 AI Chip",
|
||||
}
|
||||
|
||||
@ -2019,35 +2020,39 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden.\n"..
|
||||
"\n",
|
||||
"Mit Teleport-Blöcken können Dinge zwischen zwei Teleport-Blöcken übertragen werden\\, ohne dass sich dazwischen eine Röhre oder Leitung befinden muss. Für das Pairing der Blöcke musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden. Das Pairung kann nur von einem Spieler durchgeführt werden (Spielername wird geprüft) und muss vor einem Server-Neustart abgeschlossen sein. Anderenfalls gehen die Pairing-Daten verloren.\n"..
|
||||
"\n"..
|
||||
"Der Plan rechts zeigt\\, wie die Blöcke genutzt werden können.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Diese Teleport-Blöcke erlauben die Übertragung von Gegenständen und ersetzen somit eine Röhre. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n"..
|
||||
"\n"..
|
||||
"Ein Teleport-Block benötigt 12 ku Strom.\n"..
|
||||
"\n"..
|
||||
"Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Diese Teleport-Blöcke erlauben die Übertragung von Flüssigkeiten und ersetzen somit eine gelbe Leitung. Dabei können Entfernungen von bis zu 200 Blöcken überbrückt werden.\n"..
|
||||
"\n"..
|
||||
"Ein Teleport-Block benötigt 12 ku Strom.\n"..
|
||||
"\n"..
|
||||
"Für die Nutzung der Teleport-Blöcke werden 60 Erfahrungspunkte benötigt.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Die Hyperloop Teleport Blöcke erlauben den Aufbau von Hyperloop Netzwerk ohne Hyperloop-Röhren.\n"..
|
||||
"\n"..
|
||||
"Die Nutzung der Hyperloop Teleport Blöcke benötigt 120 Erfahrungspunkte.\n"..
|
||||
"\n",
|
||||
"",
|
||||
"Der TA5 Container erlaubt Techage Anlagen ein- und an einer anderen Stelle wieder auszupacken.\n"..
|
||||
"\n"..
|
||||
"Für die Nutzung des TA5 Containers werden 80 Erfahrungspunkte benötigt.\n"..
|
||||
"\n",
|
||||
"Teleportblöcke erlauben den Item-Transport ohne Röhren bis zu einer Entfernung von 200 Blöcken.\n"..
|
||||
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
|
||||
"\n"..
|
||||
"Teleportblöcke benötigen jeweils 12 ku Strom.\n"..
|
||||
"\n"..
|
||||
"Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Teleportblöcke erlauben den Flüssigkeiten-Transport ohne Leitungen bis zu einer Entfernung von 200 Blöcken.\n"..
|
||||
"Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Block eingeben\\, dann kannst du bei dem anderen Block diesen Namen auswählen und so die beiden Blöcke verbinden.\n"..
|
||||
"\n"..
|
||||
"Teleportblöcke benötigen jeweils 12 ku Strom.\n"..
|
||||
"\n"..
|
||||
"Für die Nutzung der Teleportblöcke werden 60 Erfahrungspunkte benötigt.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Dank einem Spezialantrieb für Lichtgeschwindigkeit können mit dem Raumgleiter auch große Entfernungen sehr schnell überwunden werden.\n"..
|
||||
"\n",
|
||||
"",
|
||||
"Der TA5 KI Chip wird teilweise zur Herstellung von TA5 Blöcken benötigt. Der TA5 KI Chip kann nur auf der TA4 Elektronik Fab hergestellt werden. Dazu werden 10 Erfahrungspunkte benötigt.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
@ -2289,14 +2294,15 @@ techage.manual_DE.aItemName = {
|
||||
"",
|
||||
"",
|
||||
"ta5_flycontroller",
|
||||
"ta4_chest",
|
||||
"ta4_tank",
|
||||
"ta5_chest",
|
||||
"ta5_tank",
|
||||
"",
|
||||
"",
|
||||
"ta5_tele_tube",
|
||||
"ta5_tele_pipe",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta5_aichip",
|
||||
}
|
||||
|
||||
@ -2538,6 +2544,7 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta5_teleport",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
@ -2545,4 +2552,3 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -237,11 +237,12 @@ techage.manual_EN.aTitel = {
|
||||
"3,TA5 Flight Controller",
|
||||
"3,TA5 Hyperloop Chest",
|
||||
"3,TA5 Hyperloop Tank",
|
||||
"3,Hyperloop Teleport Blocks (planned)",
|
||||
"3,TA5 Container (planned)",
|
||||
"2,Teleport Blocks",
|
||||
"3,TA5 Teleport Block Items",
|
||||
"3,TA5 Teleport Block Liquids",
|
||||
"2,More TA5 Blocks / Items",
|
||||
"3,Hyperloop Teleport Blocks (planned)",
|
||||
"2,More TA5 Blocks/Items",
|
||||
"3,TA5 Container (planned)",
|
||||
"3,TA5 AI Chip",
|
||||
}
|
||||
|
||||
@ -2016,33 +2017,37 @@ techage.manual_EN.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Teleport blocks allow things to be transferred between two teleport blocks without the need for a pipe or tube in between. To pair the blocks\\, you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks. Pairing can only be carried out by one player (player name is checked) and must be completed before the server is restarted. Otherwise the pairing data will be lost.\n"..
|
||||
"\n"..
|
||||
"The map on the right shows how the blocks can be used. \n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"These teleport blocks allow the transfer of items and thus replace a tube. Distances of up to 200 blocks can be bridged.\n"..
|
||||
"\n"..
|
||||
"Each Teleport blocks requires 12 ku of electricity.\n"..
|
||||
"\n"..
|
||||
"60 experience points are required to use the teleport blocks. \n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"These teleport blocks allow the transfer of liquids and thus replace a pipe. Distances of up to 200 blocks can be bridged.\n"..
|
||||
"\n"..
|
||||
"Each Teleport blocks requires 12 ku of electricity.\n"..
|
||||
"\n"..
|
||||
"60 experience points are required to use the teleport blocks. \n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"The Hyperloop Teleport Blocks allow the construction of a Hyperloop network without Hyperloop tubes.\n"..
|
||||
"\n"..
|
||||
"The use of the Hyperloop Teleport Blocks requires 120 experience points.\n"..
|
||||
"\n",
|
||||
"",
|
||||
"The TA5 container allows Techage systems to be packed and unpacked at another location.\n"..
|
||||
"\n"..
|
||||
"80 experience points are required to use the TA5 container.\n"..
|
||||
"\n",
|
||||
"Teleport blocks allow items to be transported without tubes up to a distance of 200 blocks.\n"..
|
||||
"For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n"..
|
||||
"\n"..
|
||||
"Teleport blocks each require 12 ku of electricity.\n"..
|
||||
"\n"..
|
||||
"60 experience points are required to use the Teleport blocks.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Teleport blocks allow liquids to be transported without pipes up to a distance of 200 blocks.\n"..
|
||||
"For pairing you first have to enter a name for the block on one side\\, then you can select this name for the other block and thus connect the two blocks.\n"..
|
||||
"\n"..
|
||||
"Teleport blocks each require 12 ku of electricity.\n"..
|
||||
"\n"..
|
||||
"60 experience points are required to use the Teleport blocks.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"",
|
||||
"The TA5 AI Chip is partly required for the production of TA5 blocks. The TA5 AI Chip can only be manufactured at the TA4 Electronics Fab. This requires 10 experience points.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
@ -2284,13 +2289,14 @@ techage.manual_EN.aItemName = {
|
||||
"",
|
||||
"",
|
||||
"ta5_flycontroller",
|
||||
"ta4_chest",
|
||||
"ta4_tank",
|
||||
"",
|
||||
"ta5_chest",
|
||||
"ta5_tank",
|
||||
"",
|
||||
"ta5_tele_tube",
|
||||
"ta5_tele_pipe",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta5_aichip",
|
||||
}
|
||||
|
||||
@ -2531,6 +2537,7 @@ techage.manual_EN.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta5_teleport",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
@ -2538,4 +2545,3 @@ techage.manual_EN.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -7,14 +7,14 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
API to add further chapters to the manuals
|
||||
|
||||
]]--
|
||||
|
||||
function techage.add_to_manual(language, titles, texts, items, plans)
|
||||
local tbl
|
||||
|
||||
|
||||
if language == "DE" then
|
||||
tbl = techage.manual_DE
|
||||
elseif language == "EN" then
|
||||
@ -37,5 +37,3 @@ function techage.add_to_manual(language, titles, texts, items, plans)
|
||||
tbl.aPlanTable[#tbl.aPlanTable + 1] = item
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Constructioon Plans for TA machines
|
||||
|
||||
]]--
|
||||
@ -162,8 +162,8 @@ techage.ConstructionPlans["steamengine"] = {
|
||||
{false, BOIL2, false, PI090, false, false, false},
|
||||
{false, BOIL1, false, PI090, false, false, false},
|
||||
{false, FIBOX, false, PK090, CYLIN, FLYWH, false},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
--
|
||||
-- TA2 Storage
|
||||
--
|
||||
@ -185,7 +185,7 @@ techage.ConstructionPlans["ta2_storage"] = {
|
||||
{false, false, false, AXL90, WCHST, false, false},
|
||||
{false, false, false, AXL90, false, false, false},
|
||||
{AXL00, AXL00, AXL00, GRBOX, false, false, false},
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
-- Item Transport
|
||||
@ -201,7 +201,7 @@ techage.ConstructionPlans["itemtransport"] = {
|
||||
{false},
|
||||
{false},
|
||||
{CHEST, PUSHR, TB000, GRIND, PUSHR, DISTR, TB000, SIEV2, PUSHR, TB000, CHEST},
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
-- Gravel Rinser
|
||||
@ -215,7 +215,7 @@ local TK090 = {"techage_tube_knee.png^[transformR90", "techage:tubeS"} -- '7'
|
||||
local TK180 = {"techage_tube_knee.png^[transformR180", "techage:tubeS"}
|
||||
local TK270 = {"techage_tube_knee.png^[transformR270", "techage:tubeS"}
|
||||
|
||||
techage.ConstructionPlans["gravelrinser"] = {
|
||||
techage.ConstructionPlans["gravelrinser"] = {
|
||||
{false, false, false, SIDEV, false, false, false, false},
|
||||
{false, GLASS, WATER, GLASS, GLASS, GLASS, GLASS, GLASS},
|
||||
{false, DDIRT, DDIRT, TK000, RINSR, TK270, HOPPR, CHEST},
|
||||
@ -290,8 +290,8 @@ techage.ConstructionPlans["ta3_tank"] = {
|
||||
--
|
||||
-- TA3 Oil Loading station
|
||||
--
|
||||
local MCART = {minetest.inventorycube("carts_cart_top.png",
|
||||
"carts_cart_side.png^minecart_logo.png", "carts_cart_side.png^minecart_logo.png"),
|
||||
local MCART = {minetest.inventorycube("carts_cart_top.png",
|
||||
"carts_cart_side.png^minecart_logo.png", "carts_cart_side.png^minecart_logo.png"),
|
||||
"minecart:cart"}
|
||||
local PRAIL = {"carts_rail_straight_pwr.png", "carts:powerrail"}
|
||||
local PRAIH = {"carts_rail_straight_pwr.png^[transformR90", "carts:powerrail"}
|
||||
@ -493,6 +493,26 @@ techage.ConstructionPlans["ta4_cooler"] = {
|
||||
{false, false, false, false, false, false, false, false, false},
|
||||
}
|
||||
|
||||
--
|
||||
-- TA5 Teleport Blocks
|
||||
--
|
||||
local TELEP = {"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png", "techage:ta5_tele_pipe"}
|
||||
local TELET = {"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_teleport.png", "techage:ta5_tele_tube"}
|
||||
local PUMP4 = {"techage_filling_ta4.png^techage_appl_pump.png^techage_frame_ta4.png", "techage:t4_pump"}
|
||||
local ARROW = {"techage_form_arrow.png"}
|
||||
|
||||
techage.ConstructionPlans["ta5_teleport"] = {
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, CHEST, PushR, TELET, false, ARROW, false, TELET, Tubes, CHEST, false},
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, CHEST, Tubes, TELET, false, ARROW, false, TELET, PushR, CHEST, false},
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, TANK4, PUMP4, TELEP, false, ARROW, false, TELEP, PIPEH, TANK4, false},
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, TANK4, PIPEH, TELEP, false, ARROW, false, TELEP, PUMP4, TANK4, false},
|
||||
}
|
||||
|
||||
function techage.add_manual_plans(table_with_plans)
|
||||
for name, tbl in pairs(table_with_plans) do
|
||||
techage.ConstructionPlans[name] = tbl
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 TES Generator (dummy)
|
||||
- can be started and stopped
|
||||
- provides netID of cable network
|
||||
@ -40,7 +40,7 @@ minetest.register_node("techage:ta4_generator", {
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_generator.png^[transformFX]",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos)
|
||||
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
|
||||
Cable:after_place_node(pos)
|
||||
@ -86,7 +86,7 @@ minetest.register_node("techage:ta4_generator_on", {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
@ -128,5 +128,3 @@ minetest.register_craft({
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Heat Exchanger1 (bottom part)
|
||||
- has a connection to storage and turbine (via pipes)
|
||||
- acts as a cable junction for Exchanger2
|
||||
@ -44,7 +44,7 @@ minetest.register_node("techage:heatexchanger1", {
|
||||
"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png",
|
||||
"techage_filling_ta4.png^techage_frameB_ta4.png^techage_appl_hole_electric.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
Cable:after_place_node(pos)
|
||||
Pipe:after_place_node(pos)
|
||||
@ -99,4 +99,3 @@ minetest.register_craft({
|
||||
{"", "techage:baborium_ingot", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Heat Exchanger2 (middle part)
|
||||
(alternatively used as cooler for the TA4 collider)
|
||||
|
||||
@ -35,13 +35,13 @@ local DOWN = 5
|
||||
local PWR_NEEDED = 5
|
||||
|
||||
local function heatexchanger1_cmnd(pos, topic, payload)
|
||||
return techage.transfer({x = pos.x, y = pos.y - 1, z = pos.z},
|
||||
return techage.transfer({x = pos.x, y = pos.y - 1, z = pos.z},
|
||||
nil, topic, payload, nil,
|
||||
{"techage:heatexchanger1"})
|
||||
end
|
||||
|
||||
local function heatexchanger3_cmnd(pos, topic, payload)
|
||||
return techage.transfer({x = pos.x, y = pos.y + 1, z = pos.z},
|
||||
return techage.transfer({x = pos.x, y = pos.y + 1, z = pos.z},
|
||||
nil, topic, payload, nil,
|
||||
{"techage:heatexchanger3"})
|
||||
end
|
||||
@ -59,7 +59,7 @@ local function play_sound(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.handle or mem.handle == -1 then
|
||||
mem.handle = minetest.sound_play("techage_booster", {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 0.3,
|
||||
max_hear_distance = 10,
|
||||
loop = true})
|
||||
@ -95,7 +95,7 @@ local function can_start(pos, nvm)
|
||||
return S("No power")
|
||||
end
|
||||
end
|
||||
-- Used as heat exchanger
|
||||
-- Used as heat exchanger
|
||||
local netID = networks.determine_netID(pos, Cable, DOWN)
|
||||
if heatexchanger1_cmnd(pos, "netID") ~= netID then
|
||||
return S("Power network connection error")
|
||||
@ -139,7 +139,7 @@ end
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
local data
|
||||
|
||||
|
||||
if nvm.used_as_cooler then
|
||||
return cooler_formspec(self, pos, nvm)
|
||||
end
|
||||
@ -182,7 +182,7 @@ local function check_TES_integrity(pos, nvm)
|
||||
end
|
||||
nvm.check_once_again = true
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local State = techage.NodeStates:new({
|
||||
node_name_passive = "techage:heatexchanger2",
|
||||
@ -200,7 +200,7 @@ local function cooler_timer(pos, nvm)
|
||||
if power.consume_power(pos, Cable, DOWN, PWR_NEEDED) ~= PWR_NEEDED then
|
||||
State:fault(pos, nvm, "No power")
|
||||
stop_sound(pos)
|
||||
return true
|
||||
return true
|
||||
end
|
||||
|
||||
-- Cyclically check pipe connections
|
||||
@ -218,7 +218,7 @@ local function cooler_timer(pos, nvm)
|
||||
State:fault(pos, nvm, "Pipe connection error")
|
||||
stop_sound(pos)
|
||||
end
|
||||
return true
|
||||
return true
|
||||
end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
@ -233,7 +233,7 @@ local function node_timer(pos, elapsed)
|
||||
heatexchanger1_cmnd(pos, "stop")
|
||||
power.start_storage_calc(pos, Cable, DOWN)
|
||||
end
|
||||
|
||||
|
||||
if techage.is_running(nvm) then
|
||||
local capa = power.get_storage_load(pos, Cable, DOWN, nvm.capa_max) or 0
|
||||
if capa > 0 then
|
||||
@ -243,7 +243,7 @@ local function node_timer(pos, elapsed)
|
||||
if techage.is_activeformspec(pos) then
|
||||
M(pos):set_string("formspec", formspec(State, pos, nvm))
|
||||
end
|
||||
return true
|
||||
return true
|
||||
end
|
||||
|
||||
local function can_dig(pos, player)
|
||||
@ -273,7 +273,7 @@ local function after_place_node(pos, placer)
|
||||
Cable:after_place_node(pos, {DOWN})
|
||||
State:node_init(pos, nvm, own_num)
|
||||
end
|
||||
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
Cable:after_dig_node(pos)
|
||||
techage.del_mem(pos)
|
||||
@ -283,7 +283,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
local nvm = techage.get_nvm(pos)
|
||||
State:state_button_event(pos, nvm, fields)
|
||||
M(pos):set_string("formspec", formspec(State, pos, nvm))
|
||||
@ -309,12 +309,12 @@ minetest.register_node("techage:heatexchanger2", {
|
||||
"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png",
|
||||
"techage_filling_ta4.png^techage_frameM_ta4.png^techage_appl_ribsB.png",
|
||||
},
|
||||
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/2, -1.5/2, -1/2, 1/2, 1/2, 1/2},
|
||||
},
|
||||
|
||||
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_rightclick = on_rightclick,
|
||||
on_timer = node_timer,
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Heat Exchanger3 (top part)
|
||||
|
||||
]]--
|
||||
@ -63,10 +63,10 @@ minetest.register_node("techage:heatexchanger3", {
|
||||
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png",
|
||||
"techage_filling_ta4.png^techage_frameT_ta4.png^techage_appl_ribsT.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
networks = {
|
||||
pipe2 = {},
|
||||
},
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Pipe Inlet
|
||||
|
||||
]]--
|
||||
@ -40,10 +40,10 @@ minetest.register_node("techage:ta4_pipe_inlet", {
|
||||
"basic_materials_concrete_block.png^techage_tes_inlet.png",
|
||||
"basic_materials_concrete_block.png^techage_tes_inlet.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
networks = {
|
||||
pipe2 = {},
|
||||
},
|
||||
@ -72,7 +72,7 @@ local Numbers = {
|
||||
local function get_diameter(pos, in_dir)
|
||||
local dir = tubelib2.Dir6dToVector[in_dir]
|
||||
local pos2, node
|
||||
|
||||
|
||||
pos2 = vector.add(pos, vector.multiply(dir, 4))
|
||||
node = minetest.get_node(pos2)
|
||||
if node.name == "techage:ta3_pipe_wall_entry" then
|
||||
@ -81,7 +81,7 @@ local function get_diameter(pos, in_dir)
|
||||
if node.name == "techage:ta4_pipe_inlet" then
|
||||
return 5
|
||||
end
|
||||
|
||||
|
||||
pos2 = vector.add(pos, vector.multiply(dir, 6))
|
||||
node = minetest.get_node(pos2)
|
||||
if node.name == "techage:ta3_pipe_wall_entry" then
|
||||
@ -90,7 +90,7 @@ local function get_diameter(pos, in_dir)
|
||||
if node.name == "techage:ta4_pipe_inlet" then
|
||||
return 7
|
||||
end
|
||||
|
||||
|
||||
pos2 = vector.add(pos, vector.multiply(dir, 8))
|
||||
node = minetest.get_node(pos2)
|
||||
if node.name == "techage:ta3_pipe_wall_entry" then
|
||||
@ -116,11 +116,11 @@ local function check_volume(pos, in_dir, owner)
|
||||
-- calculate size
|
||||
local pos1 = {x = cpos.x - radius, y = cpos.y - radius, z = cpos.z - radius}
|
||||
local pos2 = {x = cpos.x + radius, y = cpos.y + radius, z = cpos.z + radius}
|
||||
local _, node_tbl = minetest.find_nodes_in_area(pos1, pos2,
|
||||
{"default:gravel", "techage:ta4_pipe_inlet",
|
||||
local _, node_tbl = minetest.find_nodes_in_area(pos1, pos2,
|
||||
{"default:gravel", "techage:ta4_pipe_inlet",
|
||||
"basic_materials:concrete_block", "default:obsidian_glass",
|
||||
"techage:glow_gravel"})
|
||||
if node_tbl["default:obsidian_glass"] > 1 then
|
||||
if node_tbl["default:obsidian_glass"] > 1 then
|
||||
return S("one window maximum")
|
||||
elseif node_tbl["default:obsidian_glass"] + node_tbl["basic_materials:concrete_block"] ~= Numbers.shell[radius] then
|
||||
return S("wrong number of shell nodes")
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Nodes
|
||||
|
||||
]]--
|
||||
@ -34,4 +34,3 @@ minetest.register_node("techage:glow_gravel", {
|
||||
sounds = default.node_sound_gravel_defaults(),
|
||||
drop = "",
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 TES Gas Turbine
|
||||
|
||||
]]--
|
||||
@ -19,7 +19,7 @@ local S = techage.S
|
||||
local Pipe = techage.LiquidPipe
|
||||
|
||||
local function generator_cmnd(pos, topic, payload)
|
||||
return techage.transfer(pos, "R", topic, payload, nil,
|
||||
return techage.transfer(pos, "R", topic, payload, nil,
|
||||
{"techage:ta4_generator", "techage:ta4_generator_on"})
|
||||
end
|
||||
|
||||
@ -36,7 +36,7 @@ local function play_sound(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.handle or mem.handle == -1 then
|
||||
mem.handle = minetest.sound_play("techage_turbine", {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 0.4,
|
||||
max_hear_distance = 10,
|
||||
loop = true})
|
||||
@ -65,7 +65,7 @@ minetest.register_node("techage:ta4_turbine", {
|
||||
"techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png",
|
||||
"techage_filling_ta4.png^techage_appl_turbine.png^techage_frame_ta4.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos)
|
||||
Pipe:after_place_node(pos)
|
||||
end,
|
||||
@ -112,8 +112,8 @@ minetest.register_node("techage:ta4_turbine_on", {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
tubelib2_on_update2 = function(pos, outdir, tlib2, node)
|
||||
|
||||
tubelib2_on_update2 = function(pos, outdir, tlib2, node)
|
||||
swap_node(pos, "techage:ta4_turbine")
|
||||
stop_sound(pos)
|
||||
generator_cmnd(pos, "stop")
|
||||
@ -151,7 +151,7 @@ techage.register_node({"techage:ta4_turbine", "techage:ta4_turbine_on"}, {
|
||||
on_node_load = function(pos, node)
|
||||
if node.name == "techage:ta4_turbine_on" then
|
||||
play_sound(pos)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@ -163,4 +163,3 @@ minetest.register_craft({
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Biogas flare
|
||||
|
||||
]]--
|
||||
@ -65,7 +65,7 @@ for idx,ratio in ipairs(lRatio) do
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
after_destruct = function(pos, oldnode)
|
||||
pos.y = pos.y + 1
|
||||
local node = minetest.get_node(pos)
|
||||
@ -73,7 +73,7 @@ for idx,ratio in ipairs(lRatio) do
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
use_texture_alpha = true,
|
||||
inventory_image = "techage_flame.png",
|
||||
paramtype = "light",
|
||||
@ -93,16 +93,16 @@ end
|
||||
|
||||
local function start_flarestack(pos, playername)
|
||||
if minetest.is_protected(
|
||||
{x=pos.x, y=pos.y+1, z=pos.z},
|
||||
{x=pos.x, y=pos.y+1, z=pos.z},
|
||||
playername) then
|
||||
return
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
flame({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
local handle = minetest.sound_play("gasflare", {
|
||||
pos = pos,
|
||||
max_hear_distance = 20,
|
||||
gain = 1,
|
||||
pos = pos,
|
||||
max_hear_distance = 20,
|
||||
gain = 1,
|
||||
loop = true})
|
||||
--print("handle", handle)
|
||||
meta:set_int("handle", handle)
|
||||
@ -123,7 +123,7 @@ minetest.register_node("techage:gasflare", {
|
||||
"techage_gasflare.png",
|
||||
"techage_gasflare.png^techage_appl_hole2.png",
|
||||
},
|
||||
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
if node.name ~= "air" then
|
||||
@ -131,14 +131,14 @@ minetest.register_node("techage:gasflare", {
|
||||
end
|
||||
minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name = "techage:gasflare2"})
|
||||
end,
|
||||
|
||||
|
||||
on_punch = function(pos, node, puncher)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local handle = meta:get_int("handle")
|
||||
minetest.sound_stop(handle)
|
||||
start_flarestack(pos, puncher:get_player_name())
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
--print(dump(oldmetadata))
|
||||
stop_flarestack(pos, oldmetadata.fields.handle)
|
||||
@ -149,7 +149,7 @@ minetest.register_node("techage:gasflare", {
|
||||
end,
|
||||
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
@ -163,7 +163,7 @@ minetest.register_node("techage:gasflare2", {
|
||||
"techage_gasflare.png^techage_appl_hole2.png",
|
||||
"techage_gasflare.png"
|
||||
},
|
||||
|
||||
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -173,7 +173,7 @@ minetest.register_node("techage:gasflare2", {
|
||||
},
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = 0,
|
||||
light_source = 0,
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
diggable = false,
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Booster
|
||||
|
||||
]]--
|
||||
@ -39,7 +39,7 @@ local function play_sound(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
if not mem.handle or mem.handle == -1 then
|
||||
mem.handle = minetest.sound_play("techage_booster", {
|
||||
pos = pos,
|
||||
pos = pos,
|
||||
gain = 1,
|
||||
max_hear_distance = 7,
|
||||
loop = true})
|
||||
@ -82,7 +82,7 @@ minetest.register_node("techage:ta3_booster", {
|
||||
"techage_filling_ta3.png^techage_appl_compressor.png^techage_frame_ta3.png",
|
||||
"techage_filling_ta3.png^techage_appl_compressor.png^[transformFX^techage_frame_ta3.png",
|
||||
},
|
||||
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
||||
if consumed == PWR_NEEDED then
|
||||
@ -94,7 +94,7 @@ minetest.register_node("techage:ta3_booster", {
|
||||
end,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -130,7 +130,7 @@ minetest.register_node("techage:ta3_booster_on", {
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
||||
if consumed < PWR_NEEDED then
|
||||
@ -142,7 +142,7 @@ minetest.register_node("techage:ta3_booster_on", {
|
||||
end,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
diggable = false,
|
||||
@ -185,7 +185,7 @@ techage.register_node({"techage:ta3_booster", "techage:ta3_booster_on"}, {
|
||||
on_node_load = function(pos, node)
|
||||
if node.name == "techage:ta3_booster_on" then
|
||||
play_sound(pos)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@ -197,4 +197,3 @@ minetest.register_craft({
|
||||
{"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Cooking routines for furnace
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
@ -40,7 +40,7 @@ local function all_ingredients_available(output, ingr)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Return a list with all outputs of the given list of ingredients
|
||||
local function get_recipes(ingr)
|
||||
@ -60,7 +60,7 @@ local function get_recipes(ingr)
|
||||
return KeyList
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function techage.furnace.get_ingredients(pos)
|
||||
local inv = M(pos):get_inventory()
|
||||
local tbl = {}
|
||||
@ -116,7 +116,7 @@ local function process(inv, recipe, output)
|
||||
end
|
||||
end
|
||||
return techage.RUNNING
|
||||
end
|
||||
end
|
||||
|
||||
function techage.furnace.check_if_worth_to_wakeup(pos, nvm)
|
||||
local inv = M(pos):get_inventory()
|
||||
@ -141,7 +141,7 @@ function techage.furnace.check_if_worth_to_wakeup(pos, nvm)
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
function techage.furnace.smelting(pos, nvm, elapsed)
|
||||
local inv = M(pos):get_inventory()
|
||||
@ -154,11 +154,11 @@ function techage.furnace.smelting(pos, nvm, elapsed)
|
||||
if not recipe then
|
||||
return techage.FAULT, "recipe error"
|
||||
end
|
||||
|
||||
|
||||
elapsed = elapsed + (nvm.leftover or 0)
|
||||
while elapsed >= recipe.time do
|
||||
state = process(inv, recipe, nvm.output)
|
||||
if state ~= techage.RUNNING then
|
||||
if state ~= techage.RUNNING then
|
||||
return state
|
||||
end
|
||||
elapsed = elapsed - recipe.time
|
||||
@ -225,4 +225,4 @@ function techage.furnace.register_recipe(recipe)
|
||||
recipe.items = recipe.recipe
|
||||
recipe.type = "ta3_melting"
|
||||
techage.recipes.register_craft(recipe)
|
||||
end
|
||||
end
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Industrial Furnace Firebox
|
||||
|
||||
]]--
|
||||
@ -72,7 +72,7 @@ end
|
||||
|
||||
local function booster_cmnd(pos, cmnd)
|
||||
return techage.transfer(
|
||||
pos,
|
||||
pos,
|
||||
"L", -- outdir
|
||||
cmnd, -- topic
|
||||
nil, -- payload
|
||||
@ -102,7 +102,7 @@ minetest.register_node("techage:furnace_firebox", {
|
||||
on_punch = fuel.on_punch,
|
||||
on_receive_fields = fuel.on_receive_fields,
|
||||
on_rightclick = fuel.on_rightclick,
|
||||
|
||||
|
||||
on_construct = function(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
techage.add_node(pos, "techage:furnace_firebox")
|
||||
@ -145,7 +145,7 @@ minetest.register_node("techage:furnace_firebox_on", {
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
drop = "techage:furnace_firebox",
|
||||
|
||||
|
||||
on_timer = node_timer,
|
||||
can_dig = fuel.can_dig,
|
||||
on_receive_fields = fuel.on_receive_fields,
|
||||
@ -197,9 +197,9 @@ techage.register_node({"techage:furnace_firebox", "techage:furnace_firebox_on"},
|
||||
nvm.liquid.amount = (nvm.liquid.amount or 0) + count
|
||||
nvm.liquid.name = "techage:gasoline"
|
||||
inv:set_stack("fuel", 1, nil)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
liquid.register_nodes({"techage:furnace_firebox", "techage:furnace_firebox_on"},
|
||||
Pipe, "tank", nil, fuel.get_liquid_table(fuel.BT_OIL, fuel.CAPACITY, start_firebox))
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA3 Industrial Furnace Top
|
||||
|
||||
]]--
|
||||
@ -54,12 +54,12 @@ local function formspec(self, pos, nvm)
|
||||
"tooltip[2,2;1,1;"..self:get_state_tooltip(nvm).."]"..
|
||||
|
||||
"list[context;dst;3,0;2,2;]"..
|
||||
|
||||
|
||||
"label[6,0;"..S("Outp")..": "..idx.."/"..num.."]"..
|
||||
"item_image_button[6.5,0.5;1,1;"..outp..";b1;]"..
|
||||
"button[6,1.5;1,1;priv;<<]"..
|
||||
"button[7,1.5;1,1;next;>>]"..
|
||||
|
||||
|
||||
"list[current_player;main;0,3.5;8,4;]" ..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;src]" ..
|
||||
@ -76,7 +76,7 @@ end
|
||||
|
||||
local function firebox_cmnd(pos, cmnd)
|
||||
return techage.transfer(
|
||||
{x=pos.x, y=pos.y-1, z=pos.z},
|
||||
{x=pos.x, y=pos.y-1, z=pos.z},
|
||||
nil, -- outdir
|
||||
cmnd, -- topic
|
||||
nil, -- payload
|
||||
@ -120,7 +120,7 @@ local function keep_running(pos, elapsed)
|
||||
if nvm.toggle then -- progress bar/arrow
|
||||
M(pos):set_string("formspec", formspec(crd.State, pos, nvm))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
@ -259,7 +259,7 @@ local tubing = {
|
||||
end,
|
||||
}
|
||||
|
||||
local _, node_name_ta3, _ =
|
||||
local _, node_name_ta3, _ =
|
||||
techage.register_consumer("furnace", S("Furnace Top"), tiles, {
|
||||
drawtype = "normal",
|
||||
cycle_time = CYCLE_TIME,
|
||||
@ -298,4 +298,3 @@ minetest.register_craft({
|
||||
{"", "techage:vacuum_tube", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Industrial Furnace Heater
|
||||
|
||||
]]--
|
||||
@ -52,7 +52,7 @@ minetest.register_node("techage:furnace_heater", {
|
||||
"techage_concrete.png^techage_frame_ta3.png",
|
||||
"techage_concrete.png^techage_appl_heater.png^techage_frame_ta3.png",
|
||||
},
|
||||
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
||||
if consumed == PWR_NEEDED then
|
||||
@ -62,7 +62,7 @@ minetest.register_node("techage:furnace_heater", {
|
||||
end,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -81,7 +81,7 @@ minetest.register_node("techage:furnace_heater_on", {
|
||||
"techage_concrete.png^techage_frame_ta3.png",
|
||||
"techage_concrete.png^techage_appl_heater_on.png^techage_frame_ta3.png",
|
||||
},
|
||||
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local consumed = power.consume_power(pos, Cable, nil, PWR_NEEDED)
|
||||
if consumed < PWR_NEEDED then
|
||||
@ -91,7 +91,7 @@ minetest.register_node("techage:furnace_heater_on", {
|
||||
end,
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
|
||||
|
||||
light_source = 8,
|
||||
paramtype2 = "facedir",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
@ -124,7 +124,7 @@ techage.register_node({"techage:furnace_heater", "techage:furnace_heater_on"}, {
|
||||
return true
|
||||
end
|
||||
end
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:furnace_heater",
|
||||
|
@ -7,42 +7,42 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
Cooking recipes for furnace
|
||||
|
||||
|
||||
]]--
|
||||
|
||||
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:iron_ingot",
|
||||
recipe = {"default:iron_lump"},
|
||||
output = "techage:iron_ingot",
|
||||
recipe = {"default:iron_lump"},
|
||||
time = 2,
|
||||
})
|
||||
|
||||
techage.furnace.register_recipe({
|
||||
output = "default:obsidian",
|
||||
recipe = {"default:cobble"},
|
||||
output = "default:obsidian",
|
||||
recipe = {"default:cobble"},
|
||||
time = 8,
|
||||
})
|
||||
|
||||
if techage.modified_recipes_enabled then
|
||||
techage.furnace.register_recipe({
|
||||
output = "default:bronze_ingot 4",
|
||||
recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"},
|
||||
output = "default:bronze_ingot 4",
|
||||
recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"},
|
||||
time = 2,
|
||||
})
|
||||
|
||||
techage.furnace.register_recipe({
|
||||
output = "default:steel_ingot 4",
|
||||
recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"},
|
||||
output = "default:steel_ingot 4",
|
||||
recipe = {"default:coal_lump", "default:iron_lump", "default:iron_lump", "default:iron_lump"},
|
||||
time = 4,
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.global_exists("wielded_light") then
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:meridium_ingot",
|
||||
recipe = {"default:steel_ingot", "default:mese_crystal_fragment"},
|
||||
output = "techage:meridium_ingot",
|
||||
recipe = {"default:steel_ingot", "default:mese_crystal_fragment"},
|
||||
heat = 4,
|
||||
time = 3,
|
||||
})
|
||||
@ -68,15 +68,15 @@ minetest.after(1, function()
|
||||
if recipe.items[1] and string.split(recipe.items[1], ":")[1] == "group" then
|
||||
for _,item in ipairs(node_group(string.split(recipe.items[1], ":")[2])) do
|
||||
techage.furnace.register_recipe({
|
||||
output = recipe.output,
|
||||
recipe = {item},
|
||||
output = recipe.output,
|
||||
recipe = {item},
|
||||
time = math.floor((recipe.width + 1) / 2),
|
||||
})
|
||||
end
|
||||
else
|
||||
techage.furnace.register_recipe({
|
||||
output = recipe.output,
|
||||
recipe = recipe.items,
|
||||
output = recipe.output,
|
||||
recipe = recipe.items,
|
||||
time = math.floor((recipe.width + 1) / 2),
|
||||
})
|
||||
end
|
||||
@ -90,8 +90,8 @@ end)
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:basalt_glass2",
|
||||
recipe = {
|
||||
"techage:basalt_gravel",
|
||||
"techage:basalt_gravel",
|
||||
"techage:basalt_gravel",
|
||||
"techage:basalt_gravel",
|
||||
},
|
||||
time = 4,
|
||||
})
|
||||
@ -99,8 +99,8 @@ techage.furnace.register_recipe({
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:basalt_glass",
|
||||
recipe = {
|
||||
"techage:sieved_basalt_gravel",
|
||||
"techage:sieved_basalt_gravel",
|
||||
"techage:sieved_basalt_gravel",
|
||||
"techage:sieved_basalt_gravel",
|
||||
},
|
||||
time = 4,
|
||||
})
|
||||
@ -108,7 +108,7 @@ techage.furnace.register_recipe({
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:basalt_glass_thin2 2",
|
||||
recipe = {
|
||||
"techage:basalt_gravel",
|
||||
"techage:basalt_gravel",
|
||||
},
|
||||
time = 4,
|
||||
})
|
||||
@ -116,7 +116,7 @@ techage.furnace.register_recipe({
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:basalt_glass_thin 2",
|
||||
recipe = {
|
||||
"techage:sieved_basalt_gravel",
|
||||
"techage:sieved_basalt_gravel",
|
||||
},
|
||||
time = 4,
|
||||
})
|
||||
@ -124,7 +124,7 @@ techage.furnace.register_recipe({
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:basalt_glass_thin_xl2",
|
||||
recipe = {
|
||||
"techage:basalt_gravel",
|
||||
"techage:basalt_gravel",
|
||||
},
|
||||
time = 4,
|
||||
})
|
||||
@ -132,7 +132,7 @@ techage.furnace.register_recipe({
|
||||
techage.furnace.register_recipe({
|
||||
output = "techage:basalt_glass_thin_xl",
|
||||
recipe = {
|
||||
"techage:sieved_basalt_gravel",
|
||||
"techage:sieved_basalt_gravel",
|
||||
},
|
||||
time = 4,
|
||||
})
|
||||
@ -140,7 +140,7 @@ techage.furnace.register_recipe({
|
||||
techage.furnace.register_recipe({
|
||||
output = "basic_materials:concrete_block 4",
|
||||
recipe = {
|
||||
"basic_materials:wet_cement",
|
||||
"basic_materials:wet_cement",
|
||||
"default:sand",
|
||||
"default:gravel",
|
||||
"techage:steelmat",
|
||||
@ -149,12 +149,12 @@ techage.furnace.register_recipe({
|
||||
})
|
||||
|
||||
if minetest.global_exists("moreores") then
|
||||
|
||||
|
||||
if techage.modified_recipes_enabled then
|
||||
minetest.clear_craft({output = "moreores:mithril_ingot"})
|
||||
minetest.clear_craft({output = "moreores:silver_ingot"})
|
||||
end
|
||||
|
||||
|
||||
techage.furnace.register_recipe({
|
||||
output = 'moreores:silver_ingot',
|
||||
recipe = {'moreores:silver_lump'},
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Electrolyzer
|
||||
|
||||
]]--
|
||||
@ -58,7 +58,7 @@ end
|
||||
local function can_start(pos, nvm, state)
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
nvm.liquid.amount = nvm.liquid.amount or 0
|
||||
|
||||
|
||||
if nvm.liquid.amount < CAPACITY then
|
||||
return true
|
||||
end
|
||||
@ -99,7 +99,7 @@ local function generating(pos, nvm)
|
||||
nvm.num_pwr_units = nvm.num_pwr_units - PWR_UNITS_PER_HYDROGEN_ITEM
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- converts power into hydrogen
|
||||
local function node_timer(pos, elapsed)
|
||||
@ -107,7 +107,7 @@ local function node_timer(pos, elapsed)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
nvm.liquid.amount = nvm.liquid.amount or 0
|
||||
|
||||
|
||||
if nvm.liquid.amount < CAPACITY then
|
||||
local in_dir = meta:get_int("in_dir")
|
||||
local curr_load = power.get_storage_load(pos, Cable, in_dir, 1)
|
||||
@ -183,7 +183,7 @@ local tool_config = {
|
||||
{
|
||||
type = "const",
|
||||
name = "needed",
|
||||
label = S("Maximum power consumption [ku]"),
|
||||
label = S("Maximum power consumption [ku]"),
|
||||
tooltip = S("Maximum possible\ncurrent consumption"),
|
||||
value = PWR_NEEDED,
|
||||
},
|
||||
@ -191,7 +191,7 @@ local tool_config = {
|
||||
type = "dropdown",
|
||||
choices = "20%,40%,60%,80%,100%",
|
||||
name = "reduction",
|
||||
label = S("Current limitation"),
|
||||
label = S("Current limitation"),
|
||||
tooltip = S("Configurable value\nfor the current limit"),
|
||||
default = "100%",
|
||||
},
|
||||
@ -199,12 +199,12 @@ local tool_config = {
|
||||
type = "dropdown",
|
||||
choices = "0%,20%,40%,60%,80%",
|
||||
name = "turnoff",
|
||||
label = S("Turnoff point"),
|
||||
label = S("Turnoff point"),
|
||||
tooltip = S("If the charge of the storage\nsystem exceeds the configured value,\nthe block switches off"),
|
||||
default = "0%",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
minetest.register_node("techage:ta4_electrolyzer", {
|
||||
description = S("TA4 Electrolyzer"),
|
||||
tiles = {
|
||||
@ -223,14 +223,14 @@ minetest.register_node("techage:ta4_electrolyzer", {
|
||||
end
|
||||
return liquid.is_empty(pos)
|
||||
end,
|
||||
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
on_punch = liquid.on_punch,
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -272,7 +272,7 @@ minetest.register_node("techage:ta4_electrolyzer_on", {
|
||||
on_punch = liquid.on_punch,
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -339,7 +339,7 @@ techage.register_node({"techage:ta4_electrolyzer", "techage:ta4_electrolyzer_on"
|
||||
meta:set_string("turnoff", "0%")
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta4_electrolyzer",
|
||||
@ -349,4 +349,3 @@ minetest.register_craft({
|
||||
{'default:steel_ingot', "techage:ta4_wlanchip", 'default:steel_ingot'},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
|
||||
TA4 Fuel Cell
|
||||
|
||||
]]--
|
||||
@ -67,7 +67,7 @@ local function can_start(pos, nvm, state)
|
||||
end
|
||||
|
||||
|
||||
local function consuming(pos, nvm)
|
||||
local function consuming(pos, nvm)
|
||||
if nvm.num_pwr_units <= 0 then
|
||||
nvm.num_pwr_units = nvm.num_pwr_units + PWR_UNITS_PER_HYDROGEN_ITEM
|
||||
nvm.liquid.amount = nvm.liquid.amount - 1
|
||||
@ -190,7 +190,7 @@ minetest.register_node("techage:ta4_fuelcell", {
|
||||
end
|
||||
return liquid.is_empty(pos)
|
||||
end,
|
||||
|
||||
|
||||
after_place_node = after_place_node,
|
||||
after_dig_node = after_dig_node,
|
||||
get_generator_data = get_generator_data,
|
||||
@ -199,7 +199,7 @@ minetest.register_node("techage:ta4_fuelcell", {
|
||||
on_timer = node_timer,
|
||||
on_rightclick = on_rightclick,
|
||||
ta4_formspec = techage.generator_settings("ta4", PWR_PERF),
|
||||
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=2, crumbly=2, choppy=2},
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -304,7 +304,7 @@ techage.register_node({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, {
|
||||
return State:on_receive_message(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
})
|
||||
})
|
||||
|
||||
control.register_nodes({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, {
|
||||
on_receive = function(pos, tlib2, topic, payload)
|
||||
@ -319,7 +319,7 @@ control.register_nodes({"techage:ta4_fuelcell", "techage:ta4_fuelcell_on"}, {
|
||||
running = techage.is_running(nvm) or false,
|
||||
available = PWR_PERF,
|
||||
provided = nvm.provided or 0,
|
||||
termpoint = meta:get_string("termpoint"),
|
||||
termpoint = meta:get_string("termpoint"),
|
||||
}
|
||||
end
|
||||
return false
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user