pusher, tubes, and legacy_nodes added
56
basic_machines/legacy_nodes.lua
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
Tube Library
|
||||||
|
============
|
||||||
|
|
||||||
|
Copyright (C) 2017 Joachim Stolberg
|
||||||
|
|
||||||
|
LGPLv2.1+
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
legacy_nodes.lua:
|
||||||
|
|
||||||
|
Tubelib support for chests and furnace
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
techage.register_node("default:chest", {"default:chest_open"}, {
|
||||||
|
on_pull_item = function(pos, in_dir, num)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.get_items(inv, "main", num)
|
||||||
|
end,
|
||||||
|
on_push_item = function(pos, in_dir, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.put_item(inv, "main", stack)
|
||||||
|
end,
|
||||||
|
on_unpull_item = function(pos, in_dir, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.put_item(inv, "main", stack)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.register_node("default:furnace", {"default:furnace_active"}, {
|
||||||
|
on_pull_item = function(pos, in_dir, num)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.get_items(inv, "dst", num)
|
||||||
|
end,
|
||||||
|
on_push_item = function(pos, side, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
minetest.get_node_timer(pos):start(1.0)
|
||||||
|
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
|
||||||
|
return techage.put_item(inv, "fuel", stack)
|
||||||
|
else
|
||||||
|
return techage.put_item(meta, "src", stack)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_unpull_item = function(pos, side, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
return techage.put_item(meta, "dst", stack)
|
||||||
|
end,
|
||||||
|
})
|
@ -18,7 +18,6 @@
|
|||||||
IN (L) -->| |X--> OUT (R)
|
IN (L) -->| |X--> OUT (R)
|
||||||
| PUSHER | +
|
| PUSHER | +
|
||||||
| |/
|
| |/
|
||||||
|
|
||||||
+--------+
|
+--------+
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
@ -27,8 +26,9 @@
|
|||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local MEM = tubelib2.get_mem
|
-- Techage Related Data
|
||||||
local RND = function(meta) return RegNodeData[meta:get_int('ta_stage')]] end
|
local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
||||||
|
local TRDN = function(node) return (minetest.registered_nodes[node.name] or {}).techage end
|
||||||
|
|
||||||
-- Load support for intllib.
|
-- Load support for intllib.
|
||||||
local MP = minetest.get_modpath("tubelib2")
|
local MP = minetest.get_modpath("tubelib2")
|
||||||
@ -38,93 +38,110 @@ local STANDBY_TICKS = 10
|
|||||||
local COUNTDOWN_TICKS = 10
|
local COUNTDOWN_TICKS = 10
|
||||||
local CYCLE_TIME = 2
|
local CYCLE_TIME = 2
|
||||||
|
|
||||||
local RegNodeData = {}
|
local function pushing(pos, trd, meta, mem)
|
||||||
|
local pull_dir = meta:get_int("pull_dir")
|
||||||
|
local push_dir = meta:get_int("push_dir")
|
||||||
|
local items = techage.pull_items(pos, pull_dir, TRD(pos).num_items)
|
||||||
|
if items ~= nil then
|
||||||
|
if techage.push_items(pos, push_dir, items) == false then
|
||||||
|
-- place item back
|
||||||
|
techage.unpull_items(pos, pull_dir, items)
|
||||||
|
trd.State:blocked(pos, mem)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
trd.State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
trd.State:idle(pos, mem)
|
||||||
|
end
|
||||||
|
|
||||||
local function register_pusher(idx)
|
local function keep_running(pos, elapsed)
|
||||||
RegNodeData[idx] = {}
|
local mem = tubelib2.get_mem(pos)
|
||||||
RegNodeData[idx].State = techage.NodeStates:new({
|
local trd = TRD(pos)
|
||||||
node_name_passive= "techage:ta"..idx.."_pusher",
|
pushing(pos, trd, M(pos), mem)
|
||||||
node_name_active = "techage:ta"..idx.."_pusher_active",
|
return trd.State:is_active(mem)
|
||||||
node_name_defect = "techage:ta"..idx.."_pusher_defect",
|
end
|
||||||
infotext_name = "TA"..idx.." Pusher",
|
|
||||||
|
local function on_rightclick(pos, node, clicker)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
if not minetest.is_protected(pos, clicker:get_player_name()) then
|
||||||
|
if TRD(pos).State:is_active(mem) then
|
||||||
|
TRD(pos).State:stop(pos, mem)
|
||||||
|
else
|
||||||
|
TRD(pos).State:start(pos, mem)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
techage.remove_node(pos)
|
||||||
|
TRDN(oldnode).State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function register_pusher(stage, num_items)
|
||||||
|
local State = techage.NodeStates:new({
|
||||||
|
node_name_passive= "techage:ta"..stage.."_pusher",
|
||||||
|
node_name_active = "techage:ta"..stage.."_pusher_active",
|
||||||
|
node_name_defect = "techage:ta"..stage.."_pusher_defect",
|
||||||
|
infotext_name = "TA"..stage..I(" Pusher"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
aging_factor = 10,
|
aging_factor = 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
local function pushing(pos, rnd, mem)
|
minetest.register_node("techage:ta"..stage.."_pusher", {
|
||||||
local items = techage.pull_items(pos, mem.pull_dir, rnd.num_items)
|
description = "TA"..stage..I(" Pusher"),
|
||||||
if items ~= nil then
|
|
||||||
if techage.push_items(pos, mem.push_dir, items) == false then
|
|
||||||
-- place item back
|
|
||||||
techage.unpull_items(pos, mem.pull_dir, items)
|
|
||||||
rnd.State:blocked(pos, mem)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
rnd.State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
rnd.State:idle(pos, mem)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function keep_running(pos, elapsed)
|
|
||||||
local meta = M(pos)
|
|
||||||
pushing(pos, meta)
|
|
||||||
return State:is_active(meta)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:pusher", {
|
|
||||||
description = "Tubelib Pusher",
|
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_pusher1.png',
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage.."_top.png^techage_appl_arrow.png",
|
||||||
'tubelib_pusher1.png',
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png",
|
||||||
'tubelib_outp.png',
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png",
|
||||||
'tubelib_inp.png',
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png",
|
||||||
"tubelib_pusher1.png^[transformR180]",
|
"techage_pusher.png^[transformR180]^techage_frame_ta"..stage..".png",
|
||||||
"tubelib_pusher1.png",
|
"techage_pusher.png^techage_frame_ta"..stage..".png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
techage = {
|
||||||
|
State = State,
|
||||||
local meta = minetest.get_meta(pos)
|
num_items = num_items,
|
||||||
meta:set_string("player_name", placer:get_player_name())
|
},
|
||||||
local number = tubelib.add_node(pos, "tubelib:pusher") -- <<=== tubelib
|
|
||||||
|
|
||||||
this:node_init(pos, number)
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
|
||||||
if not minetest.is_protected(pos, clicker:get_player_name()) then
|
|
||||||
State:start(pos, M(pos))
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
tubelib.remove_node(pos) -- <<=== tubelib
|
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
end,
|
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local mem = tubelib2.init_mem(pos)
|
||||||
|
local meta = M(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
meta:set_int("pull_dir", techage.side_to_outdir("L", node.param2))
|
||||||
|
meta:set_int("push_dir", techage.side_to_outdir("R", node.param2))
|
||||||
|
local number = "-"
|
||||||
|
if stage > 2 then
|
||||||
|
number = techage.add_node(pos, "techage:ta"..stage.."_pusher")
|
||||||
|
end
|
||||||
|
TRD(pos).State:node_init(pos, mem, number)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_rightclick = on_rightclick,
|
||||||
|
after_dig_node = after_dig_node,
|
||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
drop = "",
|
drop = "",
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {choppy=2, cracky=2, crumbly=2},
|
groups = {choppy=2, cracky=2, crumbly=2},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techage:ta"..stage.."_pusher_active", {
|
||||||
minetest.register_node("tubelib:pusher_active", {
|
description = "TA"..stage..I(" Pusher"),
|
||||||
description = "Tubelib Pusher",
|
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage.."_top.png^techage_appl_arrow.png",
|
||||||
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png",
|
||||||
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png",
|
||||||
|
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png",
|
||||||
{
|
{
|
||||||
image = "tubelib_pusher.png",
|
image = "techage_pusher14.png^[transformR180]^techage_frame14_ta"..stage..".png",
|
||||||
backface_culling = false,
|
backface_culling = false,
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
@ -134,29 +151,7 @@ local function register_pusher(idx)
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
image = "tubelib_pusher.png",
|
image = "techage_pusher14.png^techage_frame14_ta"..stage..".png",
|
||||||
backface_culling = false,
|
|
||||||
animation = {
|
|
||||||
type = "vertical_frames",
|
|
||||||
aspect_w = 32,
|
|
||||||
aspect_h = 32,
|
|
||||||
length = 2.0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'tubelib_outp.png',
|
|
||||||
'tubelib_inp.png',
|
|
||||||
{
|
|
||||||
image = "tubelib_pusher.png^[transformR180]",
|
|
||||||
backface_culling = false,
|
|
||||||
animation = {
|
|
||||||
type = "vertical_frames",
|
|
||||||
aspect_w = 32,
|
|
||||||
aspect_h = 32,
|
|
||||||
length = 2.0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
image = "tubelib_pusher.png",
|
|
||||||
backface_culling = false,
|
backface_culling = false,
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
@ -167,25 +162,26 @@ local function register_pusher(idx)
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
techage = {
|
||||||
if not minetest.is_protected(pos, clicker:get_player_name()) then
|
State = State,
|
||||||
State:stop(pos, M(pos))
|
num_items = num_items,
|
||||||
end
|
},
|
||||||
end,
|
|
||||||
|
|
||||||
|
on_rightclick = on_rightclick,
|
||||||
|
after_dig_node = after_dig_node,
|
||||||
on_timer = keep_running,
|
on_timer = keep_running,
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
on_timer = keep_running,
|
||||||
|
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
diggable = false,
|
||||||
groups = {crumbly=0, not_in_creative_inventory=1},
|
groups = {crumbly=0, not_in_creative_inventory=1},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib:pusher_defect", {
|
minetest.register_node("techage:ta"..stage.."_pusher_defect", {
|
||||||
description = "Tubelib Pusher",
|
description = "TA"..stage.." Pusher",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_pusher1.png',
|
'tubelib_pusher1.png',
|
||||||
@ -196,23 +192,26 @@ local function register_pusher(idx)
|
|||||||
"tubelib_pusher1.png^tubelib_defect.png",
|
"tubelib_pusher1.png^tubelib_defect.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
techage = {
|
||||||
|
State = State,
|
||||||
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = minetest.get_meta(pos)
|
local mem = tubelib2.get_init(pos)
|
||||||
meta:set_string("player_name", placer:get_player_name())
|
local number = "-"
|
||||||
local number = tubelib.add_node(pos, "tubelib:pusher") -- <<=== tubelib
|
if stage > 2 then
|
||||||
State:node_init(pos, number)
|
number = techage.add_node(pos, "techage:ta"..stage.."_pusher")
|
||||||
State:defect(pos, meta)
|
end
|
||||||
|
TRD(pos).State:node_init(pos, mem, number)
|
||||||
|
TRD(pos).State:defect(pos, mem)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
tubelib.remove_node(pos) -- <<=== tubelib
|
techage.remove_node(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = keep_running,
|
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
|
|
||||||
paramtype = "light",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
@ -229,29 +228,42 @@ local function register_pusher(idx)
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
--------------------------------------------------------------- tubelib
|
if stage == 2 then
|
||||||
tubelib.register_node("tubelib:pusher",
|
techage.register_node("techage:ta"..stage.."_pusher",
|
||||||
{"tubelib:pusher_active", "tubelib:pusher_defect"}, {
|
{"techage:ta"..stage.."_pusher_active", "techage:ta"..stage.."_pusher_defect"}, {
|
||||||
on_pull_item = nil, -- pusher has no inventory
|
is_pusher = true, -- is a pulling/pushing node
|
||||||
on_push_item = nil, -- pusher has no inventory
|
|
||||||
on_unpull_item = nil, -- pusher has no inventory
|
on_node_load = function(pos)
|
||||||
is_pusher = true, -- is a pulling/pushing node
|
TRD(pos).State:on_node_load(pos)
|
||||||
|
end,
|
||||||
on_recv_message = function(pos, topic, payload)
|
on_node_repair = function(pos)
|
||||||
local resp = State:on_receive_message(pos, topic, payload)
|
return TRD(pos).State:on_node_repair(pos)
|
||||||
if resp then
|
end,
|
||||||
return resp
|
})
|
||||||
else
|
else
|
||||||
return "unsupported"
|
techage.register_node("techage:ta"..stage.."_pusher",
|
||||||
end
|
{"techage:ta"..stage.."_pusher_active", "techage:ta"..stage.."_pusher_defect"}, {
|
||||||
end,
|
is_pusher = true, -- is a pulling/pushing node
|
||||||
on_node_load = function(pos)
|
|
||||||
State:on_node_load(pos)
|
on_recv_message = function(pos, topic, payload)
|
||||||
end,
|
local resp = TRD(pos).State:on_receive_message(pos, topic, payload)
|
||||||
on_node_repair = function(pos)
|
if resp then
|
||||||
return State:on_node_repair(pos)
|
return resp
|
||||||
end,
|
else
|
||||||
})
|
return "unsupported"
|
||||||
--------------------------------------------------------------- tubelib
|
end
|
||||||
|
end,
|
||||||
|
on_node_load = function(pos)
|
||||||
|
TRD(pos).State:on_node_load(pos)
|
||||||
|
end,
|
||||||
|
on_node_repair = function(pos)
|
||||||
|
return TRD(pos).State:on_node_repair(pos)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
register_pusher(2, 2)
|
||||||
|
register_pusher(3, 6)
|
||||||
|
register_pusher(4, 18)
|
||||||
|
|
||||||
|
@ -125,6 +125,8 @@ local function side_to_dir(side, param2)
|
|||||||
return dir
|
return dir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
techage.side_to_outdir = side_to_dir
|
||||||
|
|
||||||
local function get_dest_node(pos, out_dir)
|
local function get_dest_node(pos, out_dir)
|
||||||
local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir)
|
local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir)
|
||||||
local _,node = Tube:get_node(spos)
|
local _,node = Tube:get_node(spos)
|
||||||
@ -237,9 +239,9 @@ end
|
|||||||
-- Param add_names: Alternativ node names if needded, e.g.: "techage:pusher_active"
|
-- Param add_names: Alternativ node names if needded, e.g.: "techage:pusher_active"
|
||||||
-- Param node_definition: A table according to:
|
-- Param node_definition: A table according to:
|
||||||
-- {
|
-- {
|
||||||
-- on_pull_item = func(pos, side, player_name, num),
|
-- on_pull_item = func(pos, in_dir, num),
|
||||||
-- on_push_item = func(pos, side, item, player_name),
|
-- on_push_item = func(pos, in_dir, item),
|
||||||
-- on_unpull_item = func(pos, side, item, player_name),
|
-- on_unpull_item = func(pos, in_dir, item),
|
||||||
-- on_recv_message = func(pos, topic, payload),
|
-- on_recv_message = func(pos, topic, payload),
|
||||||
-- on_node_load = func(pos), -- LBM function
|
-- on_node_load = func(pos), -- LBM function
|
||||||
-- on_node_repair = func(pos), -- repair defect (feature!) nodes
|
-- on_node_repair = func(pos), -- repair defect (feature!) nodes
|
||||||
@ -333,11 +335,11 @@ function techage.push_items(pos, out_dir, stack)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.unpull_items(pos, out_dir, items)
|
function techage.unpull_items(pos, out_dir, stack)
|
||||||
local npos, in_dir, name = get_dest_node(pos, out_dir)
|
local npos, in_dir, name = get_dest_node(pos, out_dir)
|
||||||
if npos == nil then return end
|
if npos == nil then return end
|
||||||
if NodeDef[name] and NodeDef[name].on_unpull_item then
|
if NodeDef[name] and NodeDef[name].on_unpull_item then
|
||||||
return NodeDef[name].on_unpull_item(npos, in_dir, items)
|
return NodeDef[name].on_unpull_item(npos, in_dir, stack)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -41,8 +41,7 @@ Node states:
|
|||||||
| | | BLOCKED | | |
|
| | | BLOCKED | | |
|
||||||
+---------+ +----------+ +---------+
|
+---------+ +----------+ +---------+
|
||||||
|
|
||||||
Node metadata:
|
Node mem data:
|
||||||
"techage_number" - string with tubelib number, like "123"
|
|
||||||
"techage_state" - node state, like "RUNNING"
|
"techage_state" - node state, like "RUNNING"
|
||||||
"techage_item_meter" - node item/runtime counter
|
"techage_item_meter" - node item/runtime counter
|
||||||
"techage_countdown" - countdown to stadby mode
|
"techage_countdown" - countdown to stadby mode
|
||||||
@ -146,7 +145,7 @@ end
|
|||||||
|
|
||||||
function NodeStates:node_init(pos, mem, number)
|
function NodeStates:node_init(pos, mem, number)
|
||||||
mem.techage_state = STOPPED
|
mem.techage_state = STOPPED
|
||||||
mem.techage_number = number
|
M(pos):set_string("node_number", number)
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": stopped")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": stopped")
|
||||||
end
|
end
|
||||||
@ -172,7 +171,7 @@ function NodeStates:stop(pos, mem)
|
|||||||
swap_node(pos, self.node_name_passive)
|
swap_node(pos, self.node_name_passive)
|
||||||
end
|
end
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
local number = mem.techage_number
|
local number = M(pos):get_string("node_number")
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": stopped")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": stopped")
|
||||||
end
|
end
|
||||||
if self.formspec_func then
|
if self.formspec_func then
|
||||||
@ -206,7 +205,7 @@ function NodeStates:start(pos, mem, called_from_on_timer)
|
|||||||
swap_node(pos, self.node_name_active)
|
swap_node(pos, self.node_name_active)
|
||||||
end
|
end
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
local number = mem.techage_number
|
local number = M(pos):get_string("node_number")
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": running")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": running")
|
||||||
end
|
end
|
||||||
if self.formspec_func then
|
if self.formspec_func then
|
||||||
@ -229,7 +228,7 @@ function NodeStates:standby(pos, mem)
|
|||||||
swap_node(pos, self.node_name_passive)
|
swap_node(pos, self.node_name_passive)
|
||||||
end
|
end
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
local number = mem.techage_number
|
local number = M(pos):get_string("node_number")
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": standby")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": standby")
|
||||||
end
|
end
|
||||||
if self.formspec_func then
|
if self.formspec_func then
|
||||||
@ -251,7 +250,7 @@ function NodeStates:blocked(pos, mem)
|
|||||||
swap_node(pos, self.node_name_passive)
|
swap_node(pos, self.node_name_passive)
|
||||||
end
|
end
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
local number = mem.techage_number
|
local number = M(pos):get_string("node_number")
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": blocked")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": blocked")
|
||||||
end
|
end
|
||||||
if self.formspec_func then
|
if self.formspec_func then
|
||||||
@ -270,7 +269,7 @@ function NodeStates:fault(pos, mem)
|
|||||||
swap_node(pos, self.node_name_passive)
|
swap_node(pos, self.node_name_passive)
|
||||||
end
|
end
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
local number = mem.techage_number
|
local number = M(pos):get_string("node_number")
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": fault")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": fault")
|
||||||
end
|
end
|
||||||
if self.formspec_func then
|
if self.formspec_func then
|
||||||
@ -288,7 +287,7 @@ function NodeStates:defect(pos, mem)
|
|||||||
swap_node(pos, self.node_name_defect)
|
swap_node(pos, self.node_name_defect)
|
||||||
end
|
end
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
local number = mem.techage_number
|
local number = M(pos):get_string("node_number")
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": defect")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": defect")
|
||||||
end
|
end
|
||||||
if self.formspec_func then
|
if self.formspec_func then
|
||||||
@ -389,37 +388,15 @@ function NodeStates:on_receive_message(pos, topic, payload)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- repair corrupt node data and/or migrate node to state2
|
-- repair corrupt node data
|
||||||
function NodeStates:on_node_load(pos, not_start_timer)
|
function NodeStates:on_node_load(pos, not_start_timer)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
|
||||||
-- legacy node number/state/counter?
|
-- Meta data corrupt?
|
||||||
local number = mem.number
|
local number = M(pos):get_string("node_number")
|
||||||
if number ~= "" and number ~= nil then
|
if number == "" then
|
||||||
mem.techage_number = number
|
swap_node(pos, "techage:defect_dummy")
|
||||||
mem.techage_state = techage.state(mem.running)
|
return
|
||||||
if self.has_item_meter then
|
|
||||||
mem.techage_item_meter = mem.counter
|
|
||||||
end
|
|
||||||
if self.aging_level1 then
|
|
||||||
mem.techage_aging = 0
|
|
||||||
end
|
|
||||||
mem.number = nil
|
|
||||||
mem.running = 0
|
|
||||||
mem.counter = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- node number corrupt?
|
|
||||||
number = mem.techage_number
|
|
||||||
if number == "" then
|
|
||||||
number = techage.get_new_number(pos, self.node_name_passive)
|
|
||||||
mem.techage_number = number
|
|
||||||
else
|
|
||||||
local info = techage.get_node_info(number)
|
|
||||||
if not info or info.pos ~= pos then
|
|
||||||
number = techage.get_new_number(pos, self.node_name_passive)
|
|
||||||
mem.techage_number = number
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- state corrupt?
|
-- state corrupt?
|
||||||
@ -455,7 +432,7 @@ function NodeStates:on_node_repair(pos)
|
|||||||
mem.techage_aging = 0
|
mem.techage_aging = 0
|
||||||
end
|
end
|
||||||
if self.infotext_name then
|
if self.infotext_name then
|
||||||
local number = mem.techage_number
|
local number = M(pos):get_string("node_number")
|
||||||
M(pos):set_string("infotext", self.infotext_name.." "..number..": stopped")
|
M(pos):set_string("infotext", self.infotext_name.." "..number..": stopped")
|
||||||
end
|
end
|
||||||
if self.formspec_func then
|
if self.formspec_func then
|
||||||
@ -483,20 +460,17 @@ function NodeStates:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return "full", "loaded", or "empty" depending
|
minetest.register_node("techage:defect_dummy", {
|
||||||
-- on the number of fuel stack items.
|
description = "Corrupted Node (to be replaced)",
|
||||||
-- Function only works on fuel inventories with one stacks/99 items
|
tiles = {
|
||||||
function techage.fuelstate(meta, listname, item)
|
"techage_filling_ta2.png^techage_frame_ta2.png",
|
||||||
if meta == nil or meta.get_inventory == nil then return nil end
|
"techage_filling_ta2.png^techage_frame_ta2.png",
|
||||||
local inv = meta:get_inventory()
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_defect.png",
|
||||||
if inv:is_empty(listname) then
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_defect.png",
|
||||||
return "empty"
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_defect.png",
|
||||||
end
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_defect.png",
|
||||||
local list = inv:get_list(listname)
|
},
|
||||||
if #list == 1 and list[1]:get_count() == 99 then
|
drop = "",
|
||||||
return "full"
|
groups = {cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1},
|
||||||
else
|
is_ground_content = false,
|
||||||
return "loaded"
|
})
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local TP = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
-- Techage Related Data
|
||||||
local TN = function(node) return (minetest.registered_nodes[node.name] or {}).techage end
|
local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
||||||
|
local TRDN = function(node) return (minetest.registered_nodes[node.name] or {}).techage end
|
||||||
|
|
||||||
-- Used to determine the already passed nodes while power distribution
|
-- Used to determine the already passed nodes while power distribution
|
||||||
local Route = {}
|
local Route = {}
|
||||||
@ -52,7 +53,7 @@ end
|
|||||||
local function get_power_dir(pos)
|
local function get_power_dir(pos)
|
||||||
local key = minetest.hash_node_position(pos)
|
local key = minetest.hash_node_position(pos)
|
||||||
if not PowerInDir[key] then
|
if not PowerInDir[key] then
|
||||||
PowerInDir[key] = tubelib2.Turn180Deg[side_to_dir(pos, TP(pos).power_side or 'L')]
|
PowerInDir[key] = tubelib2.Turn180Deg[side_to_dir(pos, TRD(pos).power_side or 'L')]
|
||||||
end
|
end
|
||||||
return PowerInDir[key]
|
return PowerInDir[key]
|
||||||
end
|
end
|
||||||
@ -61,9 +62,9 @@ local power_consumption = nil
|
|||||||
|
|
||||||
local function call_read_power_consumption(pos, in_dir)
|
local function call_read_power_consumption(pos, in_dir)
|
||||||
if not pos_already_reached(pos) then
|
if not pos_already_reached(pos) then
|
||||||
local this = TP(pos)
|
local trd = TRD(pos)
|
||||||
if this and this.read_power_consumption then
|
if trd and trd.read_power_consumption then
|
||||||
return this.read_power_consumption(pos, in_dir)
|
return trd.read_power_consumption(pos, in_dir)
|
||||||
else
|
else
|
||||||
return power_consumption(pos, in_dir)
|
return power_consumption(pos, in_dir)
|
||||||
end
|
end
|
||||||
@ -100,14 +101,14 @@ local turn_on = nil
|
|||||||
|
|
||||||
local function call_turn_on(pos, in_dir, sum)
|
local function call_turn_on(pos, in_dir, sum)
|
||||||
if not pos_already_reached(pos) then
|
if not pos_already_reached(pos) then
|
||||||
local this = TP(pos)
|
local trd = TRD(pos)
|
||||||
if this and (not this.valid_power_dir or this.valid_power_dir(pos, get_power_dir(pos), in_dir)) then
|
if trd and (not trd.valid_power_dir or trd.valid_power_dir(pos, get_power_dir(pos), in_dir)) then
|
||||||
if this.turn_on then
|
if trd.turn_on then
|
||||||
this.turn_on(pos, in_dir, sum)
|
trd.turn_on(pos, in_dir, sum)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if this and this.animated_power_network then
|
if trd and trd.animated_power_network then
|
||||||
turn_tube_on(pos, in_dir, this.power_network, sum > 0)
|
turn_tube_on(pos, in_dir, trd.power_network, sum > 0)
|
||||||
end
|
end
|
||||||
-- Needed for junctions which could have a local "turn_on" in addition
|
-- Needed for junctions which could have a local "turn_on" in addition
|
||||||
turn_on(pos, in_dir, sum)
|
turn_on(pos, in_dir, sum)
|
||||||
@ -145,7 +146,7 @@ techage.generator = {}
|
|||||||
function techage.generator.after_place_node(pos)
|
function techage.generator.after_place_node(pos)
|
||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
mem.power_produce = 0
|
mem.power_produce = 0
|
||||||
TP(pos).power_network:after_place_node(pos)
|
TRD(pos).power_network:after_place_node(pos)
|
||||||
return mem
|
return mem
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -183,7 +184,7 @@ function techage.generator.read_power_consumption(pos, in_dir)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function techage.generator.after_dig_node(pos, oldnode)
|
function techage.generator.after_dig_node(pos, oldnode)
|
||||||
TN(oldnode).power_network:after_dig_node(pos)
|
TRDN(oldnode).power_network:after_dig_node(pos)
|
||||||
tubelib2.del_mem(pos)
|
tubelib2.del_mem(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ techage.distributor = {}
|
|||||||
|
|
||||||
function techage.distributor.after_place_node(pos, placer)
|
function techage.distributor.after_place_node(pos, placer)
|
||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
TP(pos).power_network:after_place_node(pos)
|
TRD(pos).power_network:after_place_node(pos)
|
||||||
return mem
|
return mem
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -218,11 +219,11 @@ end
|
|||||||
|
|
||||||
-- Needed if the junction consumes power in addition
|
-- Needed if the junction consumes power in addition
|
||||||
function techage.distributor.read_power_consumption(pos, in_dir)
|
function techage.distributor.read_power_consumption(pos, in_dir)
|
||||||
return power_consumption(pos, in_dir) - TP(pos).power_consumption or 0
|
return power_consumption(pos, in_dir) - TRD(pos).power_consumption or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.distributor.after_dig_node(pos, oldnode)
|
function techage.distributor.after_dig_node(pos, oldnode)
|
||||||
TN(oldnode).power_network:after_dig_node(pos)
|
TRDN(oldnode).power_network:after_dig_node(pos)
|
||||||
tubelib2.del_mem(pos)
|
tubelib2.del_mem(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -235,7 +236,7 @@ function techage.consumer.after_place_node(pos, placer)
|
|||||||
local mem = tubelib2.init_mem(pos)
|
local mem = tubelib2.init_mem(pos)
|
||||||
-- Power_dir is in-dir
|
-- Power_dir is in-dir
|
||||||
mem.power_consumption = 0
|
mem.power_consumption = 0
|
||||||
TP(pos).power_network:after_place_node(pos)
|
TRD(pos).power_network:after_place_node(pos)
|
||||||
return mem
|
return mem
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -244,7 +245,7 @@ function techage.consumer.after_tube_update(node, pos, out_dir, peer_pos, peer_i
|
|||||||
local pwr_dir = get_power_dir(pos)
|
local pwr_dir = get_power_dir(pos)
|
||||||
mem.connections = mem.connections or {}
|
mem.connections = mem.connections or {}
|
||||||
-- Check direction
|
-- Check direction
|
||||||
if not TP(pos).valid_power_dir(pos, pwr_dir, tubelib2.Turn180Deg[out_dir]) then return end
|
if not TRD(pos).valid_power_dir(pos, pwr_dir, tubelib2.Turn180Deg[out_dir]) then return end
|
||||||
-- Only one connection is allowed, which can be overwritten, if necessary.
|
-- Only one connection is allowed, which can be overwritten, if necessary.
|
||||||
if not peer_pos or not next(mem.connections) or mem.connections[out_dir] then
|
if not peer_pos or not next(mem.connections) or mem.connections[out_dir] then
|
||||||
if not peer_in_dir then
|
if not peer_in_dir then
|
||||||
@ -269,11 +270,11 @@ end
|
|||||||
function techage.consumer.read_power_consumption(pos, in_dir)
|
function techage.consumer.read_power_consumption(pos, in_dir)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
-- Check direction
|
-- Check direction
|
||||||
if not TP(pos).valid_power_dir(pos, get_power_dir(pos), in_dir) then return 0 end
|
if not TRD(pos).valid_power_dir(pos, get_power_dir(pos), in_dir) then return 0 end
|
||||||
return -(mem.power_consumption or 0)
|
return -(mem.power_consumption or 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.consumer.after_dig_node(pos, oldnode)
|
function techage.consumer.after_dig_node(pos, oldnode)
|
||||||
TN(oldnode).power_network:after_dig_node(pos)
|
TRDN(oldnode).power_network:after_dig_node(pos)
|
||||||
tubelib2.del_mem(pos)
|
tubelib2.del_mem(pos)
|
||||||
end
|
end
|
||||||
|
@ -37,12 +37,12 @@ techage.Tube = Tube
|
|||||||
minetest.register_node("techage:tubeS", {
|
minetest.register_node("techage:tubeS", {
|
||||||
description = "TechAge Tube",
|
description = "TechAge Tube",
|
||||||
tiles = { -- Top, base, right, left, front, back
|
tiles = { -- Top, base, right, left, front, back
|
||||||
"techage_tube.png^[transformR90",
|
"techage_tube_tube.png^[transformR90",
|
||||||
"techage_tube.png^[transformR90",
|
"techage_tube_tube.png^[transformR90",
|
||||||
"techage_tube.png",
|
"techage_tube_tube.png",
|
||||||
"techage_tube.png",
|
"techage_tube_tube.png",
|
||||||
"techage_hole.png",
|
"techage_tube_hole.png",
|
||||||
"techage_hole.png",
|
"techage_tube_hole.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
@ -84,12 +84,12 @@ minetest.register_node("techage:tubeS", {
|
|||||||
minetest.register_node("techage:tubeA", {
|
minetest.register_node("techage:tubeA", {
|
||||||
description = "TechAge Tube",
|
description = "TechAge Tube",
|
||||||
tiles = { -- Top, base, right, left, front, back
|
tiles = { -- Top, base, right, left, front, back
|
||||||
"techage_knee2.png",
|
"techage_tube_knee2.png",
|
||||||
"techage_hole2.png^[transformR180",
|
"techage_tube_hole2.png^[transformR180",
|
||||||
"techage_knee.png^[transformR270",
|
"techage_tube_knee.png^[transformR270",
|
||||||
"techage_knee.png",
|
"techage_tube_knee.png",
|
||||||
"techage_knee2.png",
|
"techage_tube_knee2.png",
|
||||||
"techage_hole2.png",
|
"techage_tube_hole2.png",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
@ -155,6 +155,7 @@ minetest.register_node("techage:power", {
|
|||||||
turn_on = generator_turn_on_clbk,
|
turn_on = generator_turn_on_clbk,
|
||||||
read_power_consumption = generator.read_power_consumption,
|
read_power_consumption = generator.read_power_consumption,
|
||||||
power_network = Cable,
|
power_network = Cable,
|
||||||
|
power_side = "R",
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = generator.after_place_node,
|
after_place_node = generator.after_place_node,
|
||||||
|
7
init.lua
@ -17,6 +17,8 @@ dofile(MP.."/basis/power.lua") -- power distribution
|
|||||||
dofile(MP.."/basis/node_states.lua")
|
dofile(MP.."/basis/node_states.lua")
|
||||||
dofile(MP.."/basis/trowel.lua") -- hidden networks
|
dofile(MP.."/basis/trowel.lua") -- hidden networks
|
||||||
dofile(MP.."/basis/junction.lua") -- network junction box
|
dofile(MP.."/basis/junction.lua") -- network junction box
|
||||||
|
dofile(MP.."/basis/tubes.lua") -- tubelib replacement
|
||||||
|
dofile(MP.."/basis/command.lua") -- tubelib replacement
|
||||||
|
|
||||||
-- Steam Engine
|
-- Steam Engine
|
||||||
dofile(MP.."/steam_engine/drive_axle.lua")
|
dofile(MP.."/steam_engine/drive_axle.lua")
|
||||||
@ -33,12 +35,13 @@ dofile(MP.."/electric/test.lua")
|
|||||||
dofile(MP.."/electric/generator.lua")
|
dofile(MP.."/electric/generator.lua")
|
||||||
dofile(MP.."/electric/consumer.lua")
|
dofile(MP.."/electric/consumer.lua")
|
||||||
|
|
||||||
--dofile(MP.."/basic_machines/pusher.lua")
|
dofile(MP.."/basic_machines/pusher.lua")
|
||||||
|
dofile(MP.."/basic_machines/legacy_nodes.lua")
|
||||||
|
|
||||||
|
|
||||||
--dofile(MP.."/fermenter/biogas_pipe.lua")
|
--dofile(MP.."/fermenter/biogas_pipe.lua")
|
||||||
--dofile(MP.."/fermenter/gasflare.lua")
|
--dofile(MP.."/fermenter/gasflare.lua")
|
||||||
|
|
||||||
|
|
||||||
--dofile(MP.."/nodes/test.lua")
|
dofile(MP.."/nodes/test.lua")
|
||||||
--dofile(MP.."/mechanic/perf_test.lua")
|
--dofile(MP.."/mechanic/perf_test.lua")
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local TP = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
|
||||||
local TN = function(node) return (minetest.registered_nodes[node.name] or {}).techage end
|
|
||||||
|
|
||||||
-- Load support for intllib.
|
-- Load support for intllib.
|
||||||
local MP = minetest.get_modpath("tubelib2")
|
local MP = minetest.get_modpath("tubelib2")
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local TP = function(pos) return minetest.registered_nodes[minetest.get_node(pos).name].techage end
|
|
||||||
local TN = function(node) return minetest.registered_nodes[node.name].techage end
|
|
||||||
|
|
||||||
-- Load support for intllib.
|
-- Load support for intllib.
|
||||||
local MP = minetest.get_modpath("tubelib2")
|
local MP = minetest.get_modpath("tubelib2")
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local TP = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
-- Techage Related Data
|
||||||
local TN = function(name) return (minetest.registered_nodes[name] or {}).techage end
|
local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
||||||
|
|
||||||
-- Load support for intllib.
|
-- Load support for intllib.
|
||||||
local MP = minetest.get_modpath("tubelib2")
|
local MP = minetest.get_modpath("tubelib2")
|
||||||
@ -45,9 +45,9 @@ end
|
|||||||
|
|
||||||
local function start_cylinder(pos, on)
|
local function start_cylinder(pos, on)
|
||||||
local pos2 = techage.get_pos(pos, 'L')
|
local pos2 = techage.get_pos(pos, 'L')
|
||||||
local that = TP(pos2)
|
local trd = TRD(pos2)
|
||||||
if that and that.start_cylinder then
|
if trd and trd.start_cylinder then
|
||||||
return that.start_cylinder(pos2, on)
|
return trd.start_cylinder(pos2, on)
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
BIN
textures/techage_defect.png
Normal file
After Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
BIN
textures/techage_frame_ta2_top.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
textures/techage_frame_ta3_top.png
Normal file
After Width: | Height: | Size: 985 B |
BIN
textures/techage_frame_ta4_top.png
Normal file
After Width: | Height: | Size: 238 B |
BIN
textures/techage_pusher.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
textures/techage_tube_hole.png
Normal file
After Width: | Height: | Size: 194 B |
BIN
textures/techage_tube_hole2.png
Normal file
After Width: | Height: | Size: 278 B |
BIN
textures/techage_tube_knee.png
Normal file
After Width: | Height: | Size: 373 B |
BIN
textures/techage_tube_knee2.png
Normal file
After Width: | Height: | Size: 324 B |
BIN
textures/techage_tube_tube.png
Normal file
After Width: | Height: | Size: 321 B |