further nodes added
@ -412,3 +412,12 @@ minetest.register_craft({
|
|||||||
{"group:wood", "techage:iron_ingot", "group:wood"},
|
{"group:wood", "techage:iron_ingot", "group:wood"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = node_name_ta3,
|
||||||
|
recipe = {
|
||||||
|
{"", "default:diamond", ""},
|
||||||
|
{"", node_name_ta2, ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ -277,3 +277,9 @@ minetest.register_craft({
|
|||||||
output = "techage:chest_ta2",
|
output = "techage:chest_ta2",
|
||||||
recipe = {"default:chest", "techage:tubeS", "techage:iron_ingot"}
|
recipe = {"default:chest", "techage:tubeS", "techage:iron_ingot"}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "techage:chest_ta3",
|
||||||
|
recipe = {"techage:chest_ta2", "techage:tubeS", "techage:vacuum_tube"}
|
||||||
|
})
|
||||||
|
@ -418,3 +418,12 @@ minetest.register_craft({
|
|||||||
{"group:wood", "techage:iron_ingot", "group:wood"},
|
{"group:wood", "techage:iron_ingot", "group:wood"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = node_name_ta3,
|
||||||
|
recipe = {
|
||||||
|
{"", "techage:iron_ingot", ""},
|
||||||
|
{"", node_name_ta2, ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ -34,6 +34,7 @@ local ValidInput = {
|
|||||||
["default:glass"] = true,
|
["default:glass"] = true,
|
||||||
["basic_materials:copper_wire"] = true,
|
["basic_materials:copper_wire"] = true,
|
||||||
["basic_materials:plastic_sheet"] = true,
|
["basic_materials:plastic_sheet"] = true,
|
||||||
|
["techage:usmium_nuggets"] = true,
|
||||||
},
|
},
|
||||||
{}, -- 3
|
{}, -- 3
|
||||||
{}, -- 4
|
{}, -- 4
|
||||||
@ -41,7 +42,7 @@ local ValidInput = {
|
|||||||
|
|
||||||
local Input = {
|
local Input = {
|
||||||
{}, -- 1
|
{}, -- 1
|
||||||
{"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet"}, --2
|
{"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet", "techage:usmium_nuggets"}, --2
|
||||||
{}, -- 3
|
{}, -- 3
|
||||||
{}, -- 4
|
{}, -- 4
|
||||||
}
|
}
|
||||||
@ -273,6 +274,12 @@ minetest.register_craftitem("techage:vacuum_tube", {
|
|||||||
inventory_image = "techage_vacuum_tube.png",
|
inventory_image = "techage_vacuum_tube.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("techage:wlanchip", {
|
||||||
|
description = I("TA4 WLAN Chip"),
|
||||||
|
inventory_image = "techage_wlanchip.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
if minetest.global_exists("unified_inventory") then
|
if minetest.global_exists("unified_inventory") then
|
||||||
unified_inventory.register_craft_type("electronic_fab", {
|
unified_inventory.register_craft_type("electronic_fab", {
|
||||||
description = I("Electronic Fab"),
|
description = I("Electronic Fab"),
|
||||||
@ -282,7 +289,11 @@ if minetest.global_exists("unified_inventory") then
|
|||||||
})
|
})
|
||||||
unified_inventory.register_craft({
|
unified_inventory.register_craft({
|
||||||
output = "techage:vacuum_tube",
|
output = "techage:vacuum_tube",
|
||||||
items = {"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet"},
|
items = {"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet", "techage:usmium_nuggets"},
|
||||||
type = "electronic_fab",
|
type = "electronic_fab",
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA2 Electronic Fab"),
|
||||||
|
I([[Used to produce Vacuum Pipes,
|
||||||
|
needed for TA3 machines.]]), "techage:ta2_electronic_fab_pas")
|
||||||
|
327
basic_machines/gravelrinser.lua
Normal file
@ -0,0 +1,327 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
LGPLv2.1+
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
TA2/TA3/TA4 Gravel Rinser, washing sieved gravel to find more ores
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- for lazy programmers
|
||||||
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
|
local P = minetest.string_to_pos
|
||||||
|
local M = minetest.get_meta
|
||||||
|
-- Techage Related Data
|
||||||
|
local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
|
||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath("techage")
|
||||||
|
local I,_ = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
local STANDBY_TICKS = 10
|
||||||
|
local COUNTDOWN_TICKS = 10
|
||||||
|
local CYCLE_TIME = 4
|
||||||
|
|
||||||
|
local function formspec(self, pos, mem)
|
||||||
|
return "size[8,8]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
"list[context;src;0,0;3,3;]"..
|
||||||
|
"item_image[0,0;1,1;default:gravel]"..
|
||||||
|
"image[0,0;1,1;techage_form_mask.png]"..
|
||||||
|
"image[3.5,0;1,1;"..techage.get_power_image(pos, mem).."]"..
|
||||||
|
"image[3.5,1;1,1;techage_form_arrow.png]"..
|
||||||
|
"image_button[3.5,2;1,1;".. self:get_state_button_image(mem) ..";state_button;]"..
|
||||||
|
"list[context;dst;5,0;3,3;]"..
|
||||||
|
"list[current_player;main;0,4;8,4;]"..
|
||||||
|
"listring[context;dst]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[context;src]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
default.get_hotbar_bg(0, 4)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
if listname == "src" then
|
||||||
|
TRD(pos).State:start_if_standby(pos)
|
||||||
|
return stack:get_count()
|
||||||
|
elseif listname == "dst" then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
local stack = inv:get_stack(from_list, from_index)
|
||||||
|
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
local function determine_water_dir(pos)
|
||||||
|
local pos1 = {x=pos.x+1, y=pos.y, z=pos.z}
|
||||||
|
local pos2 = {x=pos.x-1, y=pos.y, z=pos.z}
|
||||||
|
local pos3 = {x=pos.x, y=pos.y, z=pos.z+1}
|
||||||
|
local pos4 = {x=pos.x, y=pos.y, z=pos.z-1}
|
||||||
|
local node1 = minetest.get_node(pos1)
|
||||||
|
local node2 = minetest.get_node(pos2)
|
||||||
|
local node3 = minetest.get_node(pos3)
|
||||||
|
local node4 = minetest.get_node(pos4)
|
||||||
|
local ndef1 = minetest.registered_nodes[node1.name]
|
||||||
|
local ndef2 = minetest.registered_nodes[node2.name]
|
||||||
|
local ndef3 = minetest.registered_nodes[node3.name]
|
||||||
|
local ndef4 = minetest.registered_nodes[node4.name]
|
||||||
|
|
||||||
|
if ndef1 and ndef1.liquidtype == "flowing" and ndef2 and ndef2.liquidtype == "flowing" then
|
||||||
|
if node1.param2 > node2.param2 then
|
||||||
|
return 4
|
||||||
|
elseif node1.param2 < node2.param2 then
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
elseif ndef3 and ndef3.liquidtype == "flowing" and ndef4 and ndef4.liquidtype == "flowing" then
|
||||||
|
if node3.param2 > node4.param2 then
|
||||||
|
return 3
|
||||||
|
elseif node3.param2 < node4.param2 then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function remove_obj(obj)
|
||||||
|
if obj then
|
||||||
|
obj:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function set_velocity(obj, pos, vel)
|
||||||
|
if obj then
|
||||||
|
obj:set_velocity(vel)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function add_object(pos, name)
|
||||||
|
local dir = determine_water_dir(pos)
|
||||||
|
if dir then
|
||||||
|
local obj = minetest.add_item(pos, ItemStack(name))
|
||||||
|
local vel = vector.multiply(tubelib2.Dir6dToVector[dir], 0.3)
|
||||||
|
minetest.after(0.8, set_velocity, obj, pos, vel)
|
||||||
|
minetest.after(20, remove_obj, obj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function washing(pos, trd, mem, inv)
|
||||||
|
local src = ItemStack("techage:sieved_gravel")
|
||||||
|
local dst = ItemStack("default:sand")
|
||||||
|
if inv:contains_item("src", src) then
|
||||||
|
if math.random(40) == 1 then
|
||||||
|
add_object({x=pos.x, y=pos.y+1, z=pos.z}, "techage:usmium_nuggets")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
trd.State:idle(pos, mem)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not inv:room_for_item("dst", dst) then
|
||||||
|
trd.State:idle(pos, mem)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
inv:add_item("dst", dst)
|
||||||
|
inv:remove_item("src", src)
|
||||||
|
trd.State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function keep_running(pos, elapsed)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
local trd = TRD(pos)
|
||||||
|
local inv = M(pos):get_inventory()
|
||||||
|
washing(pos, trd, mem, inv)
|
||||||
|
return trd.State:is_active(mem)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_receive_fields(pos, formname, fields, player)
|
||||||
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
TRD(pos).State:state_button_event(pos, mem, fields)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function can_dig(pos, player)
|
||||||
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local inv = M(pos):get_inventory()
|
||||||
|
return inv:is_empty("dst") and inv:is_empty("src")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local tiles = {}
|
||||||
|
-- '#' will be replaced by the stage number
|
||||||
|
-- '{power}' will be replaced by the power PNG
|
||||||
|
tiles.pas = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
"techage_appl_rinser_top.png^techage_frame_ta#_top.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
|
||||||
|
"techage_filling_ta#.png^techage_appl_rinser.png^techage_frame_ta#.png",
|
||||||
|
"techage_filling_ta#.png^techage_appl_rinser.png^techage_frame_ta#.png",
|
||||||
|
}
|
||||||
|
tiles.act = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
{
|
||||||
|
image = "techage_appl_rinser4_top.png^techage_frame4_ta#_top.png",
|
||||||
|
backface_culling = false,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 32,
|
||||||
|
aspect_h = 32,
|
||||||
|
length = 2.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png",
|
||||||
|
"techage_filling_ta#.png^techage_appl_rinser.png^techage_frame_ta#.png",
|
||||||
|
"techage_filling_ta#.png^techage_appl_rinser.png^techage_frame_ta#.png",
|
||||||
|
}
|
||||||
|
tiles.def = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
"techage_appl_rinser_top.png^techage_frame_ta#_top.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_outp.png^techage_appl_defect.png",
|
||||||
|
"techage_filling_ta#.png^techage_frame_ta#.png^techage_appl_inp.png^techage_appl_defect.png",
|
||||||
|
"techage_filling_ta#.png^techage_appl_rinser.png^techage_frame_ta#.png^techage_appl_defect.png",
|
||||||
|
"techage_filling_ta#.png^techage_appl_rinser.png^techage_frame_ta#.png^techage_appl_defect.png",
|
||||||
|
}
|
||||||
|
|
||||||
|
local tubing = {
|
||||||
|
on_pull_item = function(pos, in_dir, num)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if meta:get_int("pull_dir") == in_dir then
|
||||||
|
local inv = M(pos):get_inventory()
|
||||||
|
return techage.get_items(inv, "dst", num)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_push_item = function(pos, in_dir, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if meta:get_int("push_dir") == in_dir or in_dir == 5 then
|
||||||
|
local inv = M(pos):get_inventory()
|
||||||
|
return techage.put_items(inv, "src", stack)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_unpull_item = function(pos, in_dir, stack)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
if meta:get_int("pull_dir") == in_dir then
|
||||||
|
local inv = M(pos):get_inventory()
|
||||||
|
return techage.put_items(inv, "dst", stack)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_recv_message = function(pos, topic, payload)
|
||||||
|
local resp = TRD(pos).State:on_receive_message(pos, topic, payload)
|
||||||
|
if resp then
|
||||||
|
return resp
|
||||||
|
else
|
||||||
|
return "unsupported"
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
|
||||||
|
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||||
|
techage.register_consumer("rinser", I("Gravel Rinser"), tiles, {
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-8/16, -8/16, -8/16, 8/16, 8/16, -6/16},
|
||||||
|
{-8/16, -8/16, 6/16, 8/16, 8/16, 8/16},
|
||||||
|
{-8/16, -8/16, -8/16, -6/16, 8/16, 8/16},
|
||||||
|
{ 6/16, -8/16, -8/16, 8/16, 8/16, 8/16},
|
||||||
|
{-6/16, -8/16, -6/16, 6/16, 6/16, 6/16},
|
||||||
|
{-6/16, 6/16, -1/16, 6/16, 8/16, 1/16},
|
||||||
|
{-1/16, 6/16, -6/16, 1/16, 8/16, 6/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-8/16, -8/16, -8/16, 8/16, 8/16, 8/16},
|
||||||
|
},
|
||||||
|
cycle_time = CYCLE_TIME,
|
||||||
|
standby_ticks = STANDBY_TICKS,
|
||||||
|
has_item_meter = true,
|
||||||
|
aging_factor = 10,
|
||||||
|
formspec = formspec,
|
||||||
|
tubing = tubing,
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local inv = M(pos):get_inventory()
|
||||||
|
inv:set_size('src', 9)
|
||||||
|
inv:set_size('dst', 9)
|
||||||
|
end,
|
||||||
|
can_dig = can_dig,
|
||||||
|
node_timer = keep_running,
|
||||||
|
on_receive_fields = on_receive_fields,
|
||||||
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||||
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||||
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||||
|
groups = {choppy=2, cracky=2, crumbly=2},
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
num_items = {0,1,2,4},
|
||||||
|
power_consumption = {0,3,4,5},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = node_name_ta2,
|
||||||
|
recipe = {
|
||||||
|
{"group:wood", "default:mese_crystal", "group:wood"},
|
||||||
|
{"techage:tubeS", "techage:sieve", "techage:tubeS"},
|
||||||
|
{"group:wood", "default:tin_ingot", "group:wood"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.global_exists("unified_inventory") then
|
||||||
|
unified_inventory.register_craft_type("rinsing", {
|
||||||
|
description = I("Rinsing"),
|
||||||
|
icon = "techage_appl_rinser_top.png^techage_frame_ta2_top.png",
|
||||||
|
width = 2,
|
||||||
|
height = 2,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function techage.add_rinser_recipe(recipe)
|
||||||
|
if minetest.global_exists("unified_inventory") then
|
||||||
|
recipe.items = {recipe.input}
|
||||||
|
recipe.type = "rinsing"
|
||||||
|
unified_inventory.register_craft(recipe)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
techage.add_rinser_recipe({input="techage:sieved_gravel", output="techage:usmium_nuggets"})
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA2 Gravel Rinser"),
|
||||||
|
I([[Used to wash Sieved Gravel to get Usmium Nuggets.
|
||||||
|
The block has to be placed under flowing water.
|
||||||
|
The washed-out nuggets must be
|
||||||
|
sucked in with a Hopper.]]), "techage:ta2_rinser_pas")
|
@ -247,3 +247,12 @@ minetest.register_craft({
|
|||||||
{"group:wood", "techage:iron_ingot", "group:wood"},
|
{"group:wood", "techage:iron_ingot", "group:wood"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = node_name_ta3,
|
||||||
|
recipe = {
|
||||||
|
{"", "default:mese_crystal", ""},
|
||||||
|
{"", node_name_ta2, ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ -260,6 +260,15 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = node_name_ta3,
|
||||||
|
recipe = {
|
||||||
|
{"", "default:mese_crystal", ""},
|
||||||
|
{"", node_name_ta2, ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
if minetest.global_exists("unified_inventory") then
|
if minetest.global_exists("unified_inventory") then
|
||||||
unified_inventory.register_craft_type("grinding", {
|
unified_inventory.register_craft_type("grinding", {
|
||||||
description = I("Grinding"),
|
description = I("Grinding"),
|
||||||
|
@ -178,3 +178,12 @@ minetest.register_craft({
|
|||||||
{"group:wood", "techage:iron_ingot", "group:wood"},
|
{"group:wood", "techage:iron_ingot", "group:wood"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = node_name_ta3,
|
||||||
|
recipe = {
|
||||||
|
{"", "techage:iron_ingot", ""},
|
||||||
|
{"", node_name_ta2, ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
@ -92,4 +92,3 @@ function techage.gravelsieve_get_random_basalt_ore()
|
|||||||
return ItemStack("techage:sieved_basalt_gravel")
|
return ItemStack("techage:sieved_basalt_gravel")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -50,20 +50,26 @@ end
|
|||||||
-- 'boxes' is a table with 6 table elements for the 6 possible connection arms
|
-- 'boxes' is a table with 6 table elements for the 6 possible connection arms
|
||||||
-- 'network' is the tubelib2 instance
|
-- 'network' is the tubelib2 instance
|
||||||
-- 'node' is the node definition with tiles, callback functions, and so on
|
-- 'node' is the node definition with tiles, callback functions, and so on
|
||||||
|
-- 'techage' is the power network definition
|
||||||
function techage.register_junction(name, size, boxes, network, node)
|
function techage.register_junction(name, size, boxes, network, node)
|
||||||
for idx = 0,63 do
|
for idx = 0,63 do
|
||||||
node.groups.techage_trowel = 1
|
local node1 = table.copy(node)
|
||||||
node.groups.not_in_creative_inventory = idx
|
node1.groups.techage_trowel = 1
|
||||||
node.drawtype = "nodebox"
|
if idx == 0 then
|
||||||
node.node_box = get_node_box(idx, size, boxes)
|
node1.groups.not_in_creative_inventory = 0
|
||||||
node.paramtype2 = "facedir"
|
else
|
||||||
node.on_rotate = screwdriver.disallow
|
node1.groups.not_in_creative_inventory = 1
|
||||||
node.paramtype = "light"
|
end
|
||||||
node.sunlight_propagates = true
|
node1.drawtype = "nodebox"
|
||||||
node.is_ground_content = false
|
node1.node_box = get_node_box(idx, size, boxes)
|
||||||
node.drop = name.."0"
|
node1.paramtype2 = "facedir"
|
||||||
|
node1.on_rotate = screwdriver.disallow
|
||||||
minetest.register_node(name..idx, table.copy(node))
|
node1.paramtype = "light"
|
||||||
|
node1.sunlight_propagates = true
|
||||||
|
node1.is_ground_content = false
|
||||||
|
node1.drop = name.."0"
|
||||||
|
--node.techage = techage
|
||||||
|
minetest.register_node(name..idx, node1)
|
||||||
network:add_secondary_node_names({name..idx})
|
network:add_secondary_node_names({name..idx})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -50,6 +50,14 @@ function techage.get_pos(pos, side)
|
|||||||
return tubelib2.get_pos(pos, dir)
|
return tubelib2.get_pos(pos, dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Both nodes are from the same power network type?
|
||||||
|
local function matching_nodes(pos, peer_pos)
|
||||||
|
local tube_type1 = pos and TRD(pos) and TRD(pos).power_network.tube_type
|
||||||
|
local tube_type2 = peer_pos and TRD(peer_pos) and TRD(peer_pos).power_network.tube_type
|
||||||
|
print(tube_type1, tube_type2)
|
||||||
|
return not tube_type1 or not tube_type2 or tube_type1 == tube_type2
|
||||||
|
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
|
||||||
@ -152,7 +160,7 @@ function techage.power.start_dedicated_node(pos, out_dir, node_name, sum)
|
|||||||
if trd and (not trd.valid_power_dir or
|
if trd and (not trd.valid_power_dir or
|
||||||
trd.valid_power_dir(conn.pos, get_power_dir(conn.pos), conn.in_dir)) then
|
trd.valid_power_dir(conn.pos, get_power_dir(conn.pos), conn.in_dir)) then
|
||||||
if trd.turn_on then
|
if trd.turn_on then
|
||||||
return trd.turn_on(pos, conn.in_dir, sum)
|
return trd.turn_on(conn.pos, conn.in_dir, sum)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -177,7 +185,7 @@ function techage.generator.after_tube_update(node, pos, out_dir, peer_pos, peer_
|
|||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
local pwr_dir = get_power_dir(pos)
|
local pwr_dir = get_power_dir(pos)
|
||||||
if tubelib2.Turn180Deg[out_dir] == pwr_dir then
|
if tubelib2.Turn180Deg[out_dir] == pwr_dir then
|
||||||
if not peer_in_dir then
|
if not peer_in_dir or not matching_nodes(pos, peer_pos) then
|
||||||
mem.connections = {} -- del connection
|
mem.connections = {} -- del connection
|
||||||
else
|
else
|
||||||
-- Generator accept one dir only
|
-- Generator accept one dir only
|
||||||
@ -230,7 +238,7 @@ end
|
|||||||
function techage.distributor.after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir)
|
function techage.distributor.after_tube_update(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
mem.connections = mem.connections or {}
|
mem.connections = mem.connections or {}
|
||||||
if not peer_in_dir then
|
if not peer_in_dir or not matching_nodes(pos, peer_pos) then
|
||||||
mem.connections[out_dir] = nil -- del connection
|
mem.connections[out_dir] = nil -- del connection
|
||||||
else
|
else
|
||||||
mem.connections[out_dir] = {pos = peer_pos, in_dir = peer_in_dir}
|
mem.connections[out_dir] = {pos = peer_pos, in_dir = peer_in_dir}
|
||||||
@ -269,7 +277,7 @@ function techage.consumer.after_tube_update(node, pos, out_dir, peer_pos, peer_i
|
|||||||
local trd = TRD(pos)
|
local trd = TRD(pos)
|
||||||
-- Check direction
|
-- Check direction
|
||||||
if not trd.valid_power_dir(pos, pwr_dir, tubelib2.Turn180Deg[out_dir]) then return end
|
if not trd.valid_power_dir(pos, pwr_dir, tubelib2.Turn180Deg[out_dir]) then return end
|
||||||
if not peer_in_dir then
|
if not peer_in_dir or not matching_nodes(pos, peer_pos) then
|
||||||
mem.connections[out_dir] = nil -- del connection
|
mem.connections[out_dir] = nil -- del connection
|
||||||
else
|
else
|
||||||
mem.connections[out_dir] = {pos = peer_pos, in_dir = peer_in_dir}
|
mem.connections[out_dir] = {pos = peer_pos, in_dir = peer_in_dir}
|
||||||
|
@ -22,8 +22,6 @@ local MP = minetest.get_modpath("techage")
|
|||||||
local I,_ = dofile(MP.."/intllib.lua")
|
local I,_ = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
local POWER_CONSUMPTION = 2
|
local POWER_CONSUMPTION = 2
|
||||||
local STANDBY_TICKS = 4
|
|
||||||
local CYCLE_TIME = 4
|
|
||||||
|
|
||||||
local Pipe = techage.SteamPipe
|
local Pipe = techage.SteamPipe
|
||||||
local consumer = techage.consumer
|
local consumer = techage.consumer
|
||||||
@ -32,37 +30,8 @@ local function valid_power_dir(pos, power_dir, in_dir)
|
|||||||
return power_dir == in_dir
|
return power_dir == in_dir
|
||||||
end
|
end
|
||||||
|
|
||||||
local function start_node(pos, mem, state)
|
|
||||||
consumer.turn_power_on(pos, POWER_CONSUMPTION)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function stop_node(pos, mem, state)
|
|
||||||
consumer.turn_power_on(pos, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
local State = techage.NodeStates:new({
|
|
||||||
node_name_passive = "techage:coalboiler_base",
|
|
||||||
cycle_time = CYCLE_TIME,
|
|
||||||
standby_ticks = STANDBY_TICKS,
|
|
||||||
start_node = start_node,
|
|
||||||
stop_node = stop_node,
|
|
||||||
})
|
|
||||||
|
|
||||||
local function turn_on_clbk(pos, in_dir, sum)
|
local function turn_on_clbk(pos, in_dir, sum)
|
||||||
local mem = tubelib2.get_mem(pos)
|
return true
|
||||||
local state = State:get_state(mem)
|
|
||||||
|
|
||||||
if sum > 0 and state == techage.STOPPED then
|
|
||||||
State:start(pos, mem)
|
|
||||||
elseif sum <= 0 and state == techage.RUNNING then
|
|
||||||
State:stop(pos, mem)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
|
||||||
print("node_timer")
|
|
||||||
local mem = tubelib2.get_mem(pos)
|
|
||||||
return State:is_active(mem)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("techage:coalboiler_base", {
|
minetest.register_node("techage:coalboiler_base", {
|
||||||
@ -85,17 +54,11 @@ minetest.register_node("techage:coalboiler_base", {
|
|||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local mem = consumer.after_place_node(pos, placer)
|
local mem = consumer.after_place_node(pos, placer)
|
||||||
State:node_init(pos, mem, "")
|
mem.power_consumption = POWER_CONSUMPTION
|
||||||
State:start(pos, mem)
|
|
||||||
end,
|
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
State:after_dig_node(pos, oldnode, oldmetadata, digger)
|
|
||||||
consumer.after_dig_node(pos, oldnode)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_tube_update = consumer.after_tube_update,
|
after_tube_update = consumer.after_tube_update,
|
||||||
--on_timer = node_timer,
|
after_dig_node = consumer.after_dig_node,
|
||||||
|
|
||||||
drop = "",
|
drop = "",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -249,7 +249,6 @@ minetest.register_node("techage:coalboiler_top", {
|
|||||||
trigger_boiler = function(pos)
|
trigger_boiler = function(pos)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
mem.fire_trigger = true
|
mem.fire_trigger = true
|
||||||
print("trigger_boiler")
|
|
||||||
if not minetest.get_node_timer(pos):is_started() then
|
if not minetest.get_node_timer(pos):is_started() then
|
||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
end
|
end
|
||||||
|
@ -22,8 +22,6 @@ local MP = minetest.get_modpath("techage")
|
|||||||
local I,_ = dofile(MP.."/intllib.lua")
|
local I,_ = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
local POWER_CONSUMPTION = 2
|
local POWER_CONSUMPTION = 2
|
||||||
local STANDBY_TICKS = 4
|
|
||||||
local CYCLE_TIME = 4
|
|
||||||
|
|
||||||
local Power = techage.SteamPipe
|
local Power = techage.SteamPipe
|
||||||
local consumer = techage.consumer
|
local consumer = techage.consumer
|
||||||
@ -43,12 +41,18 @@ local function valid_power_dir(pos, power_dir, in_dir)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- called from pipe network
|
-- called from pipe network
|
||||||
local function turn_on(pos, dir, sum)
|
local function turn_on(pos, in_dir, sum)
|
||||||
if sum > 0 then
|
if techage.power.start_dedicated_node(pos, in_dir, "techage:coalboiler_base", sum) then
|
||||||
swap_node(pos, "techage:cooler_on")
|
if sum > 0 then
|
||||||
|
swap_node(pos, "techage:cooler_on")
|
||||||
|
else
|
||||||
|
swap_node(pos, "techage:cooler")
|
||||||
|
end
|
||||||
|
return true
|
||||||
else
|
else
|
||||||
swap_node(pos, "techage:cooler")
|
swap_node(pos, "techage:cooler")
|
||||||
end
|
end
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("techage:cooler", {
|
minetest.register_node("techage:cooler", {
|
||||||
@ -59,8 +63,8 @@ minetest.register_node("techage:cooler", {
|
|||||||
"techage_filling_ta3.png^techage_appl_cooler.png^techage_frame_ta3.png",
|
"techage_filling_ta3.png^techage_appl_cooler.png^techage_frame_ta3.png",
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||||
},
|
},
|
||||||
techage = {
|
techage = {
|
||||||
turn_on = turn_on,
|
turn_on = turn_on,
|
||||||
@ -111,8 +115,8 @@ minetest.register_node("techage:cooler_on", {
|
|||||||
},
|
},
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_steam_hole.png",
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||||
"techage_filling_ta3.png^techage_frame_ta3.png",
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||||
},
|
},
|
||||||
techage = {
|
techage = {
|
||||||
turn_on = turn_on,
|
turn_on = turn_on,
|
||||||
@ -134,3 +138,15 @@ minetest.register_node("techage:cooler_on", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Power:add_secondary_node_names({"techage:cooler", "techage:cooler_on"})
|
Power:add_secondary_node_names({"techage:cooler", "techage:cooler_on"})
|
||||||
|
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA3 Cooler"),
|
||||||
|
I([[Part of the steam engine.
|
||||||
|
Has to be placed on top of the Firebox
|
||||||
|
and filled with water.
|
||||||
|
(see TA2 Steam Engine)]]), "techage:boiler1")
|
||||||
|
|
||||||
|
techage.register_help_page(I("TA2 Boiler Top"),
|
||||||
|
I([[Part of the steam engine.
|
||||||
|
Has to be placed on top of TA2 Boiler Base.
|
||||||
|
(see TA2 Steam Engine)]]), "techage:boiler2")
|
@ -185,7 +185,7 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
techage.register_node("techage:firebox", {"techage:firebox_on"}, {
|
techage.register_node("techage:coalfirebox", {}, {
|
||||||
on_push_item = function(pos, in_dir, stack)
|
on_push_item = function(pos, in_dir, stack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
@ -197,3 +197,14 @@ techage.register_node("techage:firebox", {"techage:firebox_on"}, {
|
|||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "[techage] Steam engine firebox",
|
||||||
|
name = "techage:steam_engine",
|
||||||
|
nodenames = {"techage:coalfirebox"},
|
||||||
|
run_at_every_load = true,
|
||||||
|
action = function(pos, node)
|
||||||
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
@ -43,29 +43,19 @@ local function formspec(self, pos, mem)
|
|||||||
default.get_hotbar_bg(0, 3)
|
default.get_hotbar_bg(0, 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function start_turbine(pos, on, mem)
|
local function turbine_running(pos)
|
||||||
local pos2 = techage.get_pos(pos, 'L')
|
local pos1 = techage.get_pos(pos, 'L')
|
||||||
local trd = TRD(pos2)
|
local node = minetest.get_node(pos1)
|
||||||
if trd and trd.start_turbine then
|
return node.name == "techage:turbine_on"
|
||||||
return trd.start_turbine(pos2, on, mem)
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function can_start(pos, mem, state)
|
|
||||||
return start_turbine(pos, true, mem)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local function start_node(pos, mem, state)
|
local function start_node(pos, mem, state)
|
||||||
generator.turn_power_on(pos, POWER_CAPACITY)
|
generator.turn_power_on(pos, POWER_CAPACITY)
|
||||||
mem.techage_state = techage.RUNNING
|
mem.techage_state = techage.RUNNING
|
||||||
play_sound(pos)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stop_node(pos, mem, state)
|
local function stop_node(pos, mem, state)
|
||||||
mem.techage_state = techage.STOPPED
|
mem.techage_state = techage.STOPPED
|
||||||
start_turbine(pos, false, mem)
|
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -75,7 +65,7 @@ local State = techage.NodeStates:new({
|
|||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
formspec_func = formspec,
|
formspec_func = formspec,
|
||||||
can_start = can_start,
|
can_start = turbine_running,
|
||||||
start_node = start_node,
|
start_node = start_node,
|
||||||
stop_node = stop_node,
|
stop_node = stop_node,
|
||||||
})
|
})
|
||||||
@ -85,19 +75,16 @@ local function distibuting(pos, mem)
|
|||||||
State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
State:keep_running(pos, mem, COUNTDOWN_TICKS)
|
||||||
else
|
else
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_turbine(pos, false, mem)
|
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
local function node_timer(pos, elapsed)
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
local pos2 = techage.get_pos(pos, 'L')
|
if turbine_running(pos) then
|
||||||
if minetest.get_node(pos2).name == "techage:turbine_on" and tubelib2.get_mem(pos2).running then
|
|
||||||
distibuting(pos, mem)
|
distibuting(pos, mem)
|
||||||
else
|
else
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_turbine(pos, false, mem)
|
|
||||||
generator.turn_power_on(pos, 0)
|
generator.turn_power_on(pos, 0)
|
||||||
end
|
end
|
||||||
return State:is_active(mem)
|
return State:is_active(mem)
|
||||||
@ -113,7 +100,6 @@ local function turn_power_on(pos, in_dir, sum)
|
|||||||
mem.power_result = sum
|
mem.power_result = sum
|
||||||
if State:is_active(mem) and sum <= 0 then
|
if State:is_active(mem) and sum <= 0 then
|
||||||
State:fault(pos, mem)
|
State:fault(pos, mem)
|
||||||
start_turbine(pos, false, mem)
|
|
||||||
-- No automatic turn on
|
-- No automatic turn on
|
||||||
mem.power_capacity = 0
|
mem.power_capacity = 0
|
||||||
end
|
end
|
||||||
@ -153,7 +139,6 @@ minetest.register_node("techage:generator", {
|
|||||||
read_power_consumption = generator.read_power_consumption,
|
read_power_consumption = generator.read_power_consumption,
|
||||||
power_network = Cable,
|
power_network = Cable,
|
||||||
power_side = "R",
|
power_side = "R",
|
||||||
animated_power_network = true,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
@ -214,7 +199,6 @@ minetest.register_node("techage:generator_on", {
|
|||||||
read_power_consumption = generator.read_power_consumption,
|
read_power_consumption = generator.read_power_consumption,
|
||||||
power_network = Cable,
|
power_network = Cable,
|
||||||
power_side = "R",
|
power_side = "R",
|
||||||
animated_power_network = true,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
@ -244,6 +228,7 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Cable:add_secondary_node_names({"techage:generator", "techage:generator_on"})
|
||||||
|
|
||||||
techage.register_help_page(I("TA3 Generator"),
|
techage.register_help_page(I("TA3 Generator"),
|
||||||
I([[Part of the Coal Power Station.
|
I([[Part of the Coal Power Station.
|
||||||
|
54
coal_power_station/help.lua
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
LGPLv2.1+
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
TA3 Coal Power Station Help
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath("techage")
|
||||||
|
local S, NS = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
techage.register_chap_page(S("Electrical Age (TA3)"), S([[The Electrical Age is the third level of the available technic stages.
|
||||||
|
The goal of TA3 is build a Coal Power Station and machines
|
||||||
|
to produce ores and chips for smart devices and machines in TA4.]]), "techage:wlanchip")
|
||||||
|
|
||||||
|
local HelpText = S([[1. Build a Coal Power Station according
|
||||||
|
to the plan with TA3 Firebox, TA3 Boiler,
|
||||||
|
Steam Pipes, TA3 Cooler, Turbine and Generator.
|
||||||
|
2. Heat the Firebox with coal/charcoal
|
||||||
|
3. Fill the boiler with water (more than one bucket is needed)
|
||||||
|
4. Wait until the water is heated
|
||||||
|
5. Open the steam ventil
|
||||||
|
6. Start the Generator
|
||||||
|
7. Connect the Generator with your machines by means of cables and junction boxes]])
|
||||||
|
|
||||||
|
local Images = {
|
||||||
|
|
||||||
|
{false, false, false, false, false, false, false},
|
||||||
|
{"techage_steam_knee.png", 'techage_steam_pipe.png', 'techage_steam_pipe.png',
|
||||||
|
'techage_steam_pipe.png', 'techage_steam_pipe.png', 'techage_steam_pipe.png', "techage_steam_knee.png^[transformR270"},
|
||||||
|
{'techage_steam_pipe.png^[transformR90', "techage_boiler_top_ta3.png", 'techage_steam_pipe.png',
|
||||||
|
'techage_steam_knee.png^[transformR270', 'techage_steam_knee.png',
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_cooler.png",
|
||||||
|
"techage_steam_knee.png^[transformR180"},
|
||||||
|
{"techage_steam_knee.png^[transformR90", "techage_boiler_bottom_ta3.png", false, 'techage_steam_pipe.png^[transformR90',
|
||||||
|
'techage_steam_pipe.png^[transformR90'},
|
||||||
|
{false, "techage_firebox_ta3.png", false, "techage_steam_knee.png^[transformR90",
|
||||||
|
"techage_filling_ta3.png^techage_appl_turbine.png^techage_frame_ta3.png",
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_generator.png"},
|
||||||
|
}
|
||||||
|
|
||||||
|
techage.register_help_page("Coal Power Station", HelpText, nil, Images)
|
||||||
|
|
||||||
|
|
||||||
|
techage.register_help_page(S("TA3 Electronic Fab"),
|
||||||
|
S([[Used to produce WLAN Chips,
|
||||||
|
needed for TA4 machines.]]), "techage:ta3_electronic_fab_pas")
|
16
init.lua
@ -8,6 +8,8 @@ elseif minetest.global_exists("ironage") then
|
|||||||
minetest.log("error", "[techage] Techage can't be used together with the mod ironage!")
|
minetest.log("error", "[techage] Techage can't be used together with the mod ironage!")
|
||||||
elseif minetest.global_exists("techpack") then
|
elseif minetest.global_exists("techpack") then
|
||||||
minetest.log("error", "[techage] Techage can't be used together with the modpack techpack!")
|
minetest.log("error", "[techage] Techage can't be used together with the modpack techpack!")
|
||||||
|
elseif minetest.global_exists("tubelib2") and tubelib2.version < 1.4 then
|
||||||
|
minetest.log("error", "[techage] Techage requires tubelib2 version 1.4 or newer!")
|
||||||
else
|
else
|
||||||
techage.max_num_forceload_blocks = tonumber(minetest.setting_get("techage_max_num_forceload_blocks")) or 12
|
techage.max_num_forceload_blocks = tonumber(minetest.setting_get("techage_max_num_forceload_blocks")) or 12
|
||||||
techage.basalt_stone_enabled = minetest.setting_get("techage_basalt_stone_enabled") == "true"
|
techage.basalt_stone_enabled = minetest.setting_get("techage_basalt_stone_enabled") == "true"
|
||||||
@ -34,15 +36,16 @@ else
|
|||||||
|
|
||||||
-- Tools
|
-- Tools
|
||||||
dofile(MP.."/tools/trowel.lua")
|
dofile(MP.."/tools/trowel.lua")
|
||||||
--dofile(MP.."/tools/repairkit.lua")
|
dofile(MP.."/tools/repairkit.lua")
|
||||||
|
|
||||||
-- Nodes
|
-- Nodes
|
||||||
dofile(MP.."/nodes/baborium.lua")
|
dofile(MP.."/nodes/baborium.lua")
|
||||||
|
dofile(MP.."/nodes/usmium.lua")
|
||||||
|
|
||||||
-- Power networks
|
-- Power networks
|
||||||
dofile(MP.."/power/drive_axle.lua")
|
dofile(MP.."/power/drive_axle.lua")
|
||||||
dofile(MP.."/power/steam_pipe.lua")
|
dofile(MP.."/power/steam_pipe.lua")
|
||||||
dofile(MP.."/power/biogas_pipe.lua")
|
--dofile(MP.."/power/biogas_pipe.lua")
|
||||||
dofile(MP.."/power/electric_cable.lua")
|
dofile(MP.."/power/electric_cable.lua")
|
||||||
|
|
||||||
-- Iron Age
|
-- Iron Age
|
||||||
@ -77,6 +80,7 @@ else
|
|||||||
dofile(MP.."/basic_machines/grinder.lua")
|
dofile(MP.."/basic_machines/grinder.lua")
|
||||||
dofile(MP.."/basic_machines/distributor.lua")
|
dofile(MP.."/basic_machines/distributor.lua")
|
||||||
dofile(MP.."/basic_machines/gravelsieve.lua")
|
dofile(MP.."/basic_machines/gravelsieve.lua")
|
||||||
|
dofile(MP.."/basic_machines/gravelrinser.lua")
|
||||||
dofile(MP.."/basic_machines/chest.lua")
|
dofile(MP.."/basic_machines/chest.lua")
|
||||||
dofile(MP.."/basic_machines/autocrafter.lua")
|
dofile(MP.."/basic_machines/autocrafter.lua")
|
||||||
dofile(MP.."/basic_machines/mark.lua")
|
dofile(MP.."/basic_machines/mark.lua")
|
||||||
@ -87,6 +91,7 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Coal power station
|
-- Coal power station
|
||||||
|
dofile(MP.."/coal_power_station/help.lua")
|
||||||
dofile(MP.."/coal_power_station/firebox.lua")
|
dofile(MP.."/coal_power_station/firebox.lua")
|
||||||
dofile(MP.."/coal_power_station/boiler_base.lua")
|
dofile(MP.."/coal_power_station/boiler_base.lua")
|
||||||
dofile(MP.."/coal_power_station/boiler_top.lua")
|
dofile(MP.."/coal_power_station/boiler_top.lua")
|
||||||
@ -95,11 +100,12 @@ else
|
|||||||
dofile(MP.."/coal_power_station/cooler.lua")
|
dofile(MP.."/coal_power_station/cooler.lua")
|
||||||
|
|
||||||
|
|
||||||
--dofile(MP.."/test/battery.lua")
|
dofile(MP.."/test/lamp.lua")
|
||||||
--dofile(MP.."/test/test.lua")
|
|
||||||
dofile(MP.."/test/generator.lua")
|
dofile(MP.."/test/generator.lua")
|
||||||
--dofile(MP.."/test/consumer.lua")
|
-- dofile(MP.."/test/consumer.lua")
|
||||||
--dofile(MP.."/test/consumer2.lua")
|
--dofile(MP.."/test/consumer2.lua")
|
||||||
|
--dofile(MP.."/test/test.lua")
|
||||||
|
--dofile(MP.."/test/battery.lua")
|
||||||
|
|
||||||
|
|
||||||
--dofile(MP.."/fermenter/gasflare.lua")
|
--dofile(MP.."/fermenter/gasflare.lua")
|
||||||
|
@ -72,13 +72,11 @@ local function remove_flame(pos, height)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function calc_num_coal(meta)
|
local function calc_num_coal(height, burn_time)
|
||||||
local t = minetest.get_gametime() - meta:get_int("ignite")
|
local num = height
|
||||||
local num = meta:get_int("height")
|
if burn_time < 0 then
|
||||||
t = t - COAL_BURN_TIME
|
local x = (COAL_BURN_TIME * 0.2) / height
|
||||||
if t > 0 then
|
num = math.max(height + math.floor(burn_time/x), 0)
|
||||||
local x = (COAL_BURN_TIME * 0.2) / num
|
|
||||||
num = math.max(num - math.floor(t/x), 0)
|
|
||||||
end
|
end
|
||||||
return num
|
return num
|
||||||
end
|
end
|
||||||
@ -173,7 +171,8 @@ function techage.start_burner(pos, playername)
|
|||||||
end
|
end
|
||||||
if num_cobble(pos, height) == height * 8 then
|
if num_cobble(pos, height) == height * 8 then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_int("ignite", minetest.get_gametime())
|
--meta:set_int("ignite", minetest.get_gametime())
|
||||||
|
meta:set_int("burn_time", COAL_BURN_TIME)
|
||||||
meta:set_int("height", height)
|
meta:set_int("height", height)
|
||||||
start_burner(pos, height)
|
start_burner(pos, height)
|
||||||
flame(pos, height, height, true)
|
flame(pos, height, height, true)
|
||||||
@ -196,33 +195,40 @@ function techage.keep_running_burner(pos)
|
|||||||
minetest.sound_stop(handle)
|
minetest.sound_stop(handle)
|
||||||
meta:set_int("handle", 0)
|
meta:set_int("handle", 0)
|
||||||
end
|
end
|
||||||
if num_cobble(pos, height) == height * 8 then
|
local burn_time = meta:get_int("burn_time")
|
||||||
local num = calc_num_coal(meta)
|
print("keep_running_burner", burn_time)
|
||||||
if num > 0 then
|
-- burner hole is open
|
||||||
if num_air(pos) == 0 then
|
if num_air(pos) == 1 then
|
||||||
-- pause the burner
|
meta:set_int("burn_time", burn_time - CYCLE_TIME)
|
||||||
meta:set_int("ignite", meta:get_int("ignite") + CYCLE_TIME)
|
-- tower intact
|
||||||
meta:set_int("paused", 1)
|
if num_cobble(pos, height) == height * 8 then
|
||||||
return true
|
local num_coal = calc_num_coal(height, burn_time)
|
||||||
end
|
print("num_coal", num_coal)
|
||||||
if meta:get_int("paused") == 1 then
|
if num_coal > 0 then
|
||||||
flame(pos, height, num, true)
|
if meta:get_int("paused") == 1 then
|
||||||
meta:set_int("paused", 0)
|
flame(pos, height, num_coal, true)
|
||||||
|
meta:set_int("paused", 0)
|
||||||
|
else
|
||||||
|
flame(pos, height, num_coal, false)
|
||||||
|
end
|
||||||
|
handle = minetest.sound_play("techage_gasflare", {
|
||||||
|
pos = {x=pos.x, y=pos.y+height, z=pos.z},
|
||||||
|
max_hear_distance = 32,
|
||||||
|
gain = num_coal/12.0,
|
||||||
|
loop = true})
|
||||||
|
meta:set_int("handle", handle)
|
||||||
else
|
else
|
||||||
flame(pos, height, num, false)
|
minetest.swap_node(pos, {name="techage:ash"})
|
||||||
|
remove_coal(pos, height)
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
handle = minetest.sound_play("techage_gasflare", {
|
|
||||||
pos = {x=pos.x, y=pos.y+height, z=pos.z},
|
|
||||||
max_hear_distance = 32,
|
|
||||||
gain = num/12.0,
|
|
||||||
loop = true})
|
|
||||||
meta:set_int("handle", handle)
|
|
||||||
else
|
else
|
||||||
minetest.swap_node(pos, {name="techage:ash"})
|
minetest.swap_node(pos, {name="techage:ash"})
|
||||||
remove_coal(pos, height)
|
remove_coal(pos, height)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
else
|
||||||
|
meta:set_int("paused", 1)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -234,6 +240,7 @@ function techage.stop_burner(pos)
|
|||||||
remove_coal(pos, height)
|
remove_coal(pos, height)
|
||||||
local handle = meta:get_int("handle")
|
local handle = meta:get_int("handle")
|
||||||
minetest.sound_stop(handle)
|
minetest.sound_stop(handle)
|
||||||
|
meta:set_int("burn_time", 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ minetest.register_node("techage:lighter_burn", {
|
|||||||
drop = "",
|
drop = "",
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {crumbly = 2, not_in_creative_inventory=1},
|
groups = {crumbly = 1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ minetest.register_node("techage:coal_lighter_burn", {
|
|||||||
drop = "",
|
drop = "",
|
||||||
light_source = 10,
|
light_source = 10,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {not_in_creative_inventory=1},
|
groups = {crumbly = 1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ minetest.register_node("techage:lighter", {
|
|||||||
meta:set_string("playername", placer:get_player_name())
|
meta:set_string("playername", placer:get_player_name())
|
||||||
end,
|
end,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {crumbly = 2, flammable = 2},
|
groups = {crumbly = 1, flammable = 2},
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
19
nodes/usmium.lua
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
LGPLv2.1+
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
Usminum
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
minetest.register_craftitem("techage:usmium_nuggets", {
|
||||||
|
description = "Usmium Nuggets",
|
||||||
|
inventory_image = "techage_usmium_nuggets.png",
|
||||||
|
})
|
||||||
|
|
@ -26,6 +26,7 @@ local Pipe = tubelib2.Tube:new({
|
|||||||
dirs_to_check = {1,2,3,4,5,6},
|
dirs_to_check = {1,2,3,4,5,6},
|
||||||
max_tube_length = 1000,
|
max_tube_length = 1000,
|
||||||
show_infotext = false,
|
show_infotext = false,
|
||||||
|
tube_type = "biogas_pipe",
|
||||||
primary_node_names = {"techage:biogas_pipeS", "techage:biogas_pipeA"},
|
primary_node_names = {"techage:biogas_pipeS", "techage:biogas_pipeA"},
|
||||||
secondary_node_names = {"techage:gasflare", "techage:compressor"},
|
secondary_node_names = {"techage:gasflare", "techage:compressor"},
|
||||||
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
|
after_place_tube = function(pos, param2, tube_type, num_tubes, tbl)
|
||||||
|
@ -24,8 +24,9 @@ local I,_ = dofile(MP.."/intllib.lua")
|
|||||||
|
|
||||||
local Axle = tubelib2.Tube:new({
|
local Axle = tubelib2.Tube:new({
|
||||||
dirs_to_check = {1,2,3,4,5,6},
|
dirs_to_check = {1,2,3,4,5,6},
|
||||||
max_tube_length = 5,
|
max_tube_length = 8,
|
||||||
show_infotext = false,
|
show_infotext = false,
|
||||||
|
tube_type = "axle",
|
||||||
primary_node_names = {"techage:axle", "techage:axle_on"},
|
primary_node_names = {"techage:axle", "techage:axle_on"},
|
||||||
secondary_node_names = {"techage:flywheel", "techage:flywheel_on", "techage:gearbox", "techage:gearbox_on"},
|
secondary_node_names = {"techage:flywheel", "techage:flywheel_on", "techage:gearbox", "techage:gearbox_on"},
|
||||||
after_place_tube = function(pos, param2, tube_type, num_tubes, state)
|
after_place_tube = function(pos, param2, tube_type, num_tubes, state)
|
||||||
|
@ -26,9 +26,9 @@ local Cable = tubelib2.Tube:new({
|
|||||||
max_tube_length = 1000,
|
max_tube_length = 1000,
|
||||||
show_infotext = false,
|
show_infotext = false,
|
||||||
force_to_use_tubes = true,
|
force_to_use_tubes = true,
|
||||||
|
tube_type = "electric_cable",
|
||||||
primary_node_names = {"techage:electric_cableS", "techage:electric_cableA"},
|
primary_node_names = {"techage:electric_cableS", "techage:electric_cableA"},
|
||||||
secondary_node_names = {"techage:lamp", "techage:lamp_on", "techage:power", "techage:generator",
|
secondary_node_names = {},
|
||||||
"techage:ele_consumer", "techage:ele_consumer_on"},
|
|
||||||
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
||||||
minetest.swap_node(pos, {name = "techage:electric_cable"..tube_type, param2 = param2 % 32})
|
minetest.swap_node(pos, {name = "techage:electric_cable"..tube_type, param2 = param2 % 32})
|
||||||
M(pos):set_int("tl2_param2", param2)
|
M(pos):set_int("tl2_param2", param2)
|
||||||
@ -53,7 +53,7 @@ end)
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("techage:electric_cableS", {
|
minetest.register_node("techage:electric_cableS", {
|
||||||
description = I("TA4 Electric Cable"),
|
description = I("TA Electric Cable"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"techage_electric_cable.png",
|
"techage_electric_cable.png",
|
||||||
@ -96,7 +96,7 @@ minetest.register_node("techage:electric_cableS", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techage:electric_cableA", {
|
minetest.register_node("techage:electric_cableA", {
|
||||||
description = I("TA4 Electric Cable"),
|
description = I("TA Electric Cable"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"techage_electric_cable.png",
|
"techage_electric_cable.png",
|
||||||
@ -147,15 +147,16 @@ local Boxes = {
|
|||||||
{{-size, -size, -size, size, 0.5, size}}, -- y+
|
{{-size, -size, -size, size, 0.5, size}}, -- y+
|
||||||
}
|
}
|
||||||
|
|
||||||
techage.register_junction("techage:electric_junction", 2/8, Boxes, techage.ElectricCable, {
|
techage.register_junction("techage:electric_junction", 2/8, Boxes, Cable, {
|
||||||
description = I("TA4 Electricity Junction Box"),
|
description = I("TA Electricity Junction Box"),
|
||||||
tiles = {"techage_electric_junction.png"},
|
tiles = {"techage_electric_junction.png"},
|
||||||
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, techage_trowel = 1},
|
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, techage_trowel = 1},
|
||||||
sounds = default.node_sound_defaults(),
|
sounds = default.node_sound_defaults(),
|
||||||
techage = {
|
techage = {
|
||||||
|
read_power_consumption = distributor.read_power_consumption,
|
||||||
power_network = techage.ElectricCable,
|
power_network = techage.ElectricCable,
|
||||||
|
power_consumption = 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
after_place_node = distributor.after_place_node,
|
after_place_node = distributor.after_place_node,
|
||||||
after_dig_node = distributor.after_dig_node,
|
after_dig_node = distributor.after_dig_node,
|
||||||
|
|
||||||
@ -165,4 +166,22 @@ techage.register_junction("techage:electric_junction", 2/8, Boxes, techage.Elect
|
|||||||
local name = "techage:electric_junction"..techage.junction_type(mem.connections)
|
local name = "techage:electric_junction"..techage.junction_type(mem.connections)
|
||||||
minetest.swap_node(pos, {name = name, param2 = 0})
|
minetest.swap_node(pos, {name = name, param2 = 0})
|
||||||
end,
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:electric_cableS 6",
|
||||||
|
recipe = {
|
||||||
|
{"basic_materials:plastic_sheet", "", ""},
|
||||||
|
{"", "default:copper_ingot", ""},
|
||||||
|
{"", "", "basic_materials:plastic_sheet"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:electric_junction0 2",
|
||||||
|
recipe = {
|
||||||
|
{"", "basic_materials:plastic_sheet", ""},
|
||||||
|
{"basic_materials:plastic_sheet", "default:copper_ingot", "basic_materials:plastic_sheet"},
|
||||||
|
{"", "basic_materials:plastic_sheet", ""},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
@ -24,9 +24,10 @@ local I,_ = dofile(MP.."/intllib.lua")
|
|||||||
|
|
||||||
local Pipe = tubelib2.Tube:new({
|
local Pipe = tubelib2.Tube:new({
|
||||||
dirs_to_check = {1,2,3,4,5,6},
|
dirs_to_check = {1,2,3,4,5,6},
|
||||||
max_tube_length = 6,
|
max_tube_length = 12,
|
||||||
show_infotext = false,
|
show_infotext = false,
|
||||||
force_to_use_tubes = true,
|
force_to_use_tubes = true,
|
||||||
|
tube_type = "steam_pipe",
|
||||||
primary_node_names = {"techage:steam_pipeS", "techage:steam_pipeA"},
|
primary_node_names = {"techage:steam_pipeS", "techage:steam_pipeA"},
|
||||||
secondary_node_names = {"techage:cylinder", "techage:cylinder_on", "techage:boiler2"},
|
secondary_node_names = {"techage:cylinder", "techage:cylinder_on", "techage:boiler2"},
|
||||||
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
||||||
|
@ -26,7 +26,7 @@ local I,_ = dofile(MP.."/intllib.lua")
|
|||||||
local STANDBY_TICKS = 4
|
local STANDBY_TICKS = 4
|
||||||
local COUNTDOWN_TICKS = 4
|
local COUNTDOWN_TICKS = 4
|
||||||
local CYCLE_TIME = 8
|
local CYCLE_TIME = 8
|
||||||
local POWER_CAPACITY = 20
|
local POWER_CAPACITY = 25
|
||||||
|
|
||||||
local Axle = techage.Axle
|
local Axle = techage.Axle
|
||||||
local generator = techage.generator
|
local generator = techage.generator
|
||||||
|
@ -21,7 +21,7 @@ The goal of TA2 is build a steam engine and machines
|
|||||||
to produce ores and vacuum tubes for the first
|
to produce ores and vacuum tubes for the first
|
||||||
electronic devices and machines in TA3.]]), "techage:vacuum_tube")
|
electronic devices and machines in TA3.]]), "techage:vacuum_tube")
|
||||||
|
|
||||||
local HelpText = S([[1. Build a steam machine according
|
local HelpText = S([[1. Build a steam engine according
|
||||||
to the plan with TA2 Firebox, TA2 Boiler,
|
to the plan with TA2 Firebox, TA2 Boiler,
|
||||||
Steam Pipes, TA2 Cyclinder and TA2 Flywheel.
|
Steam Pipes, TA2 Cyclinder and TA2 Flywheel.
|
||||||
2. Heat the Firebox with coal/charcoal
|
2. Heat the Firebox with coal/charcoal
|
||||||
@ -44,6 +44,6 @@ local Images = {
|
|||||||
"techage_filling_ta2.png^techage_frame_ta2.png^techage_flywheel.png^[transformFX]"},
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_flywheel.png^[transformFX]"},
|
||||||
}
|
}
|
||||||
|
|
||||||
techage.register_help_page("Steam Machine", HelpText, nil, Images)
|
techage.register_help_page("Steam Engine", HelpText, nil, Images)
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ local function lamp_turn_on_clbk(pos, in_dir, sum)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
local function node_timer(pos, elapsed)
|
||||||
print("node_timer")
|
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
return State:is_active(mem)
|
return State:is_active(mem)
|
||||||
end
|
end
|
||||||
|
@ -12,8 +12,8 @@ local COUNTDOWN_TICKS = 4
|
|||||||
local CYCLE_TIME = 16
|
local CYCLE_TIME = 16
|
||||||
local POWER_CAPACITY = 30
|
local POWER_CAPACITY = 30
|
||||||
|
|
||||||
--local Power = techage.ElectricCable
|
local Power = techage.ElectricCable
|
||||||
local Power = techage.SteamPipe
|
--local Power = techage.SteamPipe
|
||||||
local generator = techage.generator
|
local generator = techage.generator
|
||||||
|
|
||||||
local function formspec(self, pos, mem)
|
local function formspec(self, pos, mem)
|
||||||
@ -47,7 +47,6 @@ local State = techage.NodeStates:new({
|
|||||||
|
|
||||||
|
|
||||||
local function node_timer(pos, elapsed)
|
local function node_timer(pos, elapsed)
|
||||||
print("node_timer")
|
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
return State:is_active(mem)
|
return State:is_active(mem)
|
||||||
end
|
end
|
||||||
|
120
test/lamp.lua
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
-- for lazy programmers
|
||||||
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
|
local P = minetest.string_to_pos
|
||||||
|
local M = minetest.get_meta
|
||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath("techage")
|
||||||
|
local I,_ = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
local POWER_CONSUMPTION = 2
|
||||||
|
|
||||||
|
local Power = techage.ElectricCable
|
||||||
|
local consumer = techage.consumer
|
||||||
|
|
||||||
|
local function swap_node(pos, name)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
node.name = name
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- called from pipe network
|
||||||
|
local function valid_power_dir(pos, power_dir, in_dir)
|
||||||
|
print("valid_power_dir", power_dir, in_dir)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lamp_turn_on_clbk(pos, in_dir, sum)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
print("lamp_turn_on_clbk", sum, dump(mem))
|
||||||
|
if sum > 0 and mem.running then
|
||||||
|
swap_node(pos, "techage:test_lamp_on")
|
||||||
|
else
|
||||||
|
swap_node(pos, "techage:test_lamp")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function lamp_on_rightclick(pos, node, clicker)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
print("lamp_on_rightclick", dump(mem))
|
||||||
|
if not mem.running then
|
||||||
|
swap_node(pos, "techage:test_lamp_on")
|
||||||
|
mem.running = true
|
||||||
|
M(pos):set_string("infotext", "On")
|
||||||
|
consumer.turn_power_on(pos, POWER_CONSUMPTION)
|
||||||
|
else
|
||||||
|
swap_node(pos, "techage:test_lamp")
|
||||||
|
mem.running = false
|
||||||
|
M(pos):set_string("infotext", "Off")
|
||||||
|
consumer.turn_power_on(pos, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("techage:test_lamp", {
|
||||||
|
description = "TechAge Lamp",
|
||||||
|
tiles = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
'techage_electric_button.png',
|
||||||
|
'techage_electric_button.png',
|
||||||
|
'techage_electric_button.png',
|
||||||
|
'techage_electric_button.png',
|
||||||
|
'techage_electric_button.png',
|
||||||
|
'techage_electric_button.png',
|
||||||
|
},
|
||||||
|
techage = {
|
||||||
|
turn_on = lamp_turn_on_clbk,
|
||||||
|
read_power_consumption = consumer.read_power_consumption,
|
||||||
|
power_network = Power,
|
||||||
|
power_side = "L",
|
||||||
|
valid_power_dir = valid_power_dir,
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local mem = consumer.after_place_node(pos, placer)
|
||||||
|
mem.power_consumption = POWER_CONSUMPTION
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_tube_update = consumer.after_tube_update,
|
||||||
|
after_dig_node = consumer.after_dig_node,
|
||||||
|
on_rightclick = lamp_on_rightclick,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 0,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {choppy=2, cracky=2, crumbly=2},
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techage:test_lamp_on", {
|
||||||
|
description = "TechAge Lamp",
|
||||||
|
tiles = {
|
||||||
|
'techage_electric_button.png',
|
||||||
|
},
|
||||||
|
techage = {
|
||||||
|
turn_on = lamp_turn_on_clbk,
|
||||||
|
read_power_consumption = consumer.read_power_consumption,
|
||||||
|
power_network = Power,
|
||||||
|
power_side = "L",
|
||||||
|
valid_power_dir = valid_power_dir,
|
||||||
|
},
|
||||||
|
|
||||||
|
after_tube_update = consumer.after_tube_update,
|
||||||
|
after_dig_node = consumer.after_dig_node,
|
||||||
|
on_rightclick = lamp_on_rightclick,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = LIGHT_MAX,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
drop = "techage:test_lamp",
|
||||||
|
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
||||||
|
is_ground_content = false,
|
||||||
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
Power:add_secondary_node_names({"techage:test_lamp", "techage:test_lamp_on"})
|
215
test/test.lua
@ -3,164 +3,93 @@ 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 POWER_CONSUMPTION = 2
|
local function determine_water_dir(pos)
|
||||||
local POWER_CAPACITY = 8
|
local pos1 = {x=pos.x+1, y=pos.y+1, z=pos.z}
|
||||||
|
local pos2 = {x=pos.x-1, y=pos.y+1, z=pos.z}
|
||||||
|
local pos3 = {x=pos.x, y=pos.y+1, z=pos.z+1}
|
||||||
local Cable = techage.ElectricCable
|
local pos4 = {x=pos.x, y=pos.y+1, z=pos.z-1}
|
||||||
local consumer = techage.consumer
|
local node1 = minetest.get_node(pos1)
|
||||||
local generator = techage.generator
|
local node2 = minetest.get_node(pos2)
|
||||||
|
local node3 = minetest.get_node(pos3)
|
||||||
local function swap_node(pos, name)
|
local node4 = minetest.get_node(pos4)
|
||||||
local node = minetest.get_node(pos)
|
if node1.name == "default:water_flowing" and node2.name == "default:water_flowing" then
|
||||||
if node.name == name then
|
if node1.param2 > node2.param2 then
|
||||||
return
|
return 4
|
||||||
|
elseif node1.param2 < node2.param2 then
|
||||||
|
return 2
|
||||||
|
end
|
||||||
|
elseif node3.name == "default:water_flowing" and node4.name == "default:water_flowing" then
|
||||||
|
if node3.param2 > node4.param2 then
|
||||||
|
return 3
|
||||||
|
elseif node3.param2 < node4.param2 then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
node.name = name
|
return 0
|
||||||
minetest.swap_node(pos, node)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function valid_power_dir(pos, power_dir, in_dir)
|
local function remove(obj)
|
||||||
--print("valid_power_dir", power_dir, in_dir)
|
obj:remove()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function velocity(obj, dir)
|
||||||
|
obj:set_velocity(vector.multiply(tubelib2.Dir6dToVector[dir], 0.3))
|
||||||
|
minetest.after(10, remove, obj)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function node_timer(pos, elapsed)
|
||||||
|
local node = minetest.get_node(techage.get_pos(pos, 'U'))
|
||||||
|
local obj = minetest.add_item({x=pos.x, y=pos.y+1, z=pos.z}, ItemStack("default:gold_lump"))
|
||||||
|
minetest.after(0.8, velocity, obj, M(pos):get_int("water_dir"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function lamp_turn_on_clbk(pos, in_dir, sum)
|
minetest.register_node("techage:rinser", {
|
||||||
local mem = tubelib2.get_mem(pos)
|
description = "TechAge Rinser",
|
||||||
if sum > 0 and mem.running then
|
|
||||||
swap_node(pos, "techage:lamp_on")
|
|
||||||
else
|
|
||||||
swap_node(pos, "techage:lamp")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function lamp_on_rightclick(pos, node, clicker)
|
|
||||||
local mem = tubelib2.get_mem(pos)
|
|
||||||
if not mem.running then
|
|
||||||
swap_node(pos, "techage:lamp_on")
|
|
||||||
mem.running = true
|
|
||||||
M(pos):set_string("infotext", "On")
|
|
||||||
consumer.turn_power_on(pos, POWER_CONSUMPTION)
|
|
||||||
else
|
|
||||||
swap_node(pos, "techage:lamp")
|
|
||||||
mem.running = false
|
|
||||||
M(pos):set_string("infotext", "Off")
|
|
||||||
consumer.turn_power_on(pos, 0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node("techage:lamp", {
|
|
||||||
description = "TechAge Lamp",
|
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
|
{
|
||||||
|
image = "techage_appl_sieve4_top.png^techage_frame4_ta2_top.png",
|
||||||
|
backface_culling = false,
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 32,
|
||||||
|
aspect_h = 32,
|
||||||
|
length = 2.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
'techage_electric_button.png',
|
'techage_electric_button.png',
|
||||||
'techage_electric_button.png',
|
|
||||||
'techage_electric_button.png',
|
|
||||||
'techage_electric_button.png',
|
|
||||||
'techage_electric_button.png',
|
|
||||||
'techage_electric_button.png',
|
|
||||||
},
|
|
||||||
techage = {
|
|
||||||
turn_on = lamp_turn_on_clbk,
|
|
||||||
read_power_consumption = consumer.read_power_consumption,
|
|
||||||
power_network = Cable,
|
|
||||||
power_side = "L",
|
|
||||||
valid_power_dir = valid_power_dir,
|
|
||||||
},
|
|
||||||
|
|
||||||
after_place_node = consumer.after_place_node,
|
|
||||||
after_tube_update = consumer.after_tube_update,
|
|
||||||
after_dig_node = consumer.after_dig_node,
|
|
||||||
on_rightclick = lamp_on_rightclick,
|
|
||||||
|
|
||||||
paramtype = "light",
|
|
||||||
light_source = 0,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
groups = {choppy=2, cracky=2, crumbly=2},
|
|
||||||
is_ground_content = false,
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("techage:lamp_on", {
|
|
||||||
description = "TechAge Lamp",
|
|
||||||
tiles = {
|
|
||||||
'techage_electric_button.png',
|
|
||||||
},
|
|
||||||
techage = {
|
|
||||||
turn_on = lamp_turn_on_clbk,
|
|
||||||
read_power_consumption = consumer.read_power_consumption,
|
|
||||||
power_network = Cable,
|
|
||||||
valid_power_dir = valid_power_dir,
|
|
||||||
},
|
|
||||||
|
|
||||||
after_tube_update = consumer.after_tube_update,
|
|
||||||
after_dig_node = consumer.after_dig_node,
|
|
||||||
on_rightclick = lamp_on_rightclick,
|
|
||||||
|
|
||||||
paramtype = "light",
|
|
||||||
light_source = LIGHT_MAX,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
drop = "techage:lamp",
|
|
||||||
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
|
||||||
is_ground_content = false,
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
})
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
local function generator_turn_on_clbk(pos, in_dir, sum)
|
|
||||||
print("generator_turn_on_clbk")
|
|
||||||
local mem = tubelib2.get_mem(pos)
|
|
||||||
if sum > 0 then
|
|
||||||
-- No automatic turn on
|
|
||||||
elseif mem.running == true then
|
|
||||||
M(pos):set_string("infotext", "Err: "..sum.." / "..8)
|
|
||||||
mem.running = false
|
|
||||||
mem.power_capacity = 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function generator_on_rightclick(pos, node, clicker)
|
|
||||||
local mem = tubelib2.get_mem(pos)
|
|
||||||
if not mem.running then
|
|
||||||
mem.running = true
|
|
||||||
M(pos):set_string("infotext", "On")
|
|
||||||
generator.turn_power_on(pos, POWER_CAPACITY)
|
|
||||||
else
|
|
||||||
generator.turn_power_on(pos, 0)
|
|
||||||
mem.running = false
|
|
||||||
M(pos):set_string("infotext", "Off")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node("techage:power", {
|
|
||||||
description = "TechAge Power",
|
|
||||||
tiles = {
|
|
||||||
-- up, down, right, left, back, front
|
|
||||||
'techage_electric_button.png^techage_electric_power.png',
|
|
||||||
'techage_electric_button.png^techage_electric_power.png',
|
|
||||||
'techage_electric_button.png^techage_electric_power.png^techage_electric_plug.png',
|
|
||||||
'techage_electric_button.png^techage_electric_power.png',
|
|
||||||
'techage_electric_button.png^techage_electric_power.png',
|
|
||||||
'techage_electric_button.png^techage_electric_power.png',
|
|
||||||
},
|
},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2, crumbly=2, choppy=2},
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
|
||||||
techage = {
|
after_place_node = function(pos, placer)
|
||||||
turn_on = generator_turn_on_clbk,
|
minetest.get_node_timer(pos):start(5)
|
||||||
read_power_consumption = generator.read_power_consumption,
|
local dir = determine_water_dir(pos)
|
||||||
power_network = Cable,
|
M(pos):set_int("water_dir", dir)
|
||||||
power_side = "R",
|
end,
|
||||||
},
|
|
||||||
|
|
||||||
after_place_node = generator.after_place_node,
|
on_timer = node_timer,
|
||||||
after_tube_update = generator.after_tube_update,
|
})
|
||||||
after_dig_node = generator.after_dig_node,
|
|
||||||
on_rightclick = generator_on_rightclick,
|
local function remove_objects(pos)
|
||||||
|
for _, object in pairs(minetest.get_objects_inside_radius(pos, 1)) do
|
||||||
|
local lua_entity = object:get_luaentity()
|
||||||
|
if not object:is_player() and lua_entity and lua_entity.name == "__builtin:item" then
|
||||||
|
object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "[techage] Rinser update",
|
||||||
|
name = "techage:update",
|
||||||
|
nodenames = {"techage:rinser"},
|
||||||
|
run_at_every_load = true,
|
||||||
|
action = function(pos, node)
|
||||||
|
remove_objects({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
BIN
textures/techage_appl_rinser.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
textures/techage_appl_rinser4_top.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
textures/techage_appl_rinser_top.png
Normal file
After Width: | Height: | Size: 704 B |
BIN
textures/techage_boiler_bottom_ta3.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
BIN
textures/techage_boiler_top_ta3.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
textures/techage_cooler.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/techage_end_wrench.png
Normal file
After Width: | Height: | Size: 819 B |
BIN
textures/techage_firebox_ta3.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
textures/techage_repairkit.png
Normal file
After Width: | Height: | Size: 649 B |
BIN
textures/techage_usmium_nuggets.png
Normal file
After Width: | Height: | Size: 315 B |
BIN
textures/techage_wlanchip.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
@ -1,9 +1,9 @@
|
|||||||
--[[
|
--[[
|
||||||
|
|
||||||
Tube Library
|
TexchAge
|
||||||
============
|
========
|
||||||
|
|
||||||
Copyright (C) 2017-2018 Joachim Stolberg
|
Copyright (C) 2017-2019 Joachim Stolberg
|
||||||
|
|
||||||
LGPLv2.1+
|
LGPLv2.1+
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
@ -20,7 +20,7 @@ local function destroy_node(itemstack, placer, pointed_thing)
|
|||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
if not minetest.is_protected(pos, placer:get_player_name()) then
|
if not minetest.is_protected(pos, placer:get_player_name()) then
|
||||||
M(pos):set_int("tubelib_aging", 999999)
|
M(pos):set_int("techage_aging", 999999)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -29,7 +29,7 @@ local function repair_node(itemstack, user, pointed_thing)
|
|||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
if pos then
|
if pos then
|
||||||
if tubelib.repair_node(pos) then
|
if tubelib.repair_node(pos) then
|
||||||
minetest.chat_send_player(user:get_player_name(), "[Tubelib] Node repaired")
|
minetest.chat_send_player(user:get_player_name(), "[TechAge] Node repaired")
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
@ -40,33 +40,33 @@ end
|
|||||||
local function read_state(itemstack, user, pointed_thing)
|
local function read_state(itemstack, user, pointed_thing)
|
||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
if pos then
|
if pos then
|
||||||
local number = tubelib.get_node_number(pos)
|
local number = techage.get_node_number(pos)
|
||||||
if number then
|
if number then
|
||||||
local state = tubelib.send_request(number, "state", nil)
|
local state = techage.send_request(number, "state", nil)
|
||||||
local counter = tubelib.send_request(number, "counter", nil)
|
local counter = techage.send_request(number, "counter", nil)
|
||||||
local aging = tubelib.send_request(number, "aging", nil)
|
local aging = techage.send_request(number, "aging", nil)
|
||||||
if state and counter and aging then
|
if state and counter and aging then
|
||||||
if type(counter) ~= "number" then counter = "unknown" end
|
if type(counter) ~= "number" then counter = "unknown" end
|
||||||
minetest.chat_send_player(user:get_player_name(), "[Tubelib] state ="..state..", counter = "..counter..", aging = "..aging)
|
minetest.chat_send_player(user:get_player_name(), "[TechAge] state ="..state..", counter = "..counter..", aging = "..aging)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("tubelib:repairkit", {
|
minetest.register_craftitem("techage:repairkit", {
|
||||||
description = "Tubelib Repair Kit",
|
description = "TechAge Repair Kit",
|
||||||
inventory_image = "tubelib_repairkit.png",
|
inventory_image = "techage_repairkit.png",
|
||||||
wield_image = "tubelib_repairkit.png^[transformR270",
|
wield_image = "techage_repairkit.png^[transformR270",
|
||||||
groups = {cracky=1, book=1},
|
groups = {cracky=1, book=1},
|
||||||
on_use = repair_node,
|
on_use = repair_node,
|
||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:end_wrench", {
|
minetest.register_node("techage:end_wrench", {
|
||||||
description = "Tubelib End Wrench (use = read status, place = destroy)",
|
description = "TechAge End Wrench (use = read status, place = destroy)",
|
||||||
inventory_image = "tubelib_end_wrench.png",
|
inventory_image = "techage_end_wrench.png",
|
||||||
wield_image = "tubelib_end_wrench.png",
|
wield_image = "techage_end_wrench.png",
|
||||||
groups = {cracky=1, book=1},
|
groups = {cracky=1, book=1},
|
||||||
on_use = read_state,
|
on_use = read_state,
|
||||||
on_place = destroy_node,
|
on_place = destroy_node,
|
||||||
@ -74,16 +74,16 @@ minetest.register_node("tubelib:end_wrench", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "tubelib:repairkit",
|
output = "techage:repairkit",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "basic_materials:gear_steel", ""},
|
{"", "basic_materials:gear_steel", ""},
|
||||||
{"", "tubelib:end_wrench", ""},
|
{"", "techage:end_wrench", ""},
|
||||||
{"", "basic_materials:oil_extract", ""},
|
{"", "basic_materials:oil_extract", ""},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "tubelib:end_wrench 4",
|
output = "techage:end_wrench 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "", "default:steel_ingot"},
|
{"", "", "default:steel_ingot"},
|
||||||
{"", "default:tin_ingot", ""},
|
{"", "default:tin_ingot", ""},
|
||||||
|
@ -72,6 +72,10 @@ local function replace_node(itemstack, placer, pointed_thing)
|
|||||||
elseif meta:get_string("techage_hidden_nodename") ~= "" then
|
elseif meta:get_string("techage_hidden_nodename") ~= "" then
|
||||||
open_node(pos, node, meta, placer)
|
open_node(pos, node, meta, placer)
|
||||||
end
|
end
|
||||||
|
minetest.sound_play("default_dig_snappy", {
|
||||||
|
pos = pos,
|
||||||
|
gain = 1,
|
||||||
|
max_hear_distance = 5})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -100,3 +104,12 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
|
|||||||
techage.dug_node[digger:get_player_name()] = pos
|
techage.dug_node[digger:get_player_name()] = pos
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:trowel",
|
||||||
|
recipe = {
|
||||||
|
{"basic_materials:steel_bar", "basic_materials:steel_bar", ""},
|
||||||
|
{"basic_materials:steel_bar", "default:stick", ""},
|
||||||
|
{"", "", "default:stick"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|