rinser added, bugfixes
This commit is contained in:
parent
ebccc240ae
commit
6e9849f7d0
@ -36,38 +36,49 @@ local ValidInput = {
|
|||||||
["basic_materials:plastic_sheet"] = true,
|
["basic_materials:plastic_sheet"] = true,
|
||||||
["techage:usmium_nuggets"] = true,
|
["techage:usmium_nuggets"] = true,
|
||||||
},
|
},
|
||||||
{}, -- 3
|
{ -- 3
|
||||||
|
["default:mese_crystal"] = true,
|
||||||
|
["default:copper_ingot"] = true,
|
||||||
|
["default:gold_ingot"] = true,
|
||||||
|
["basic_materials:silicon"] = true,
|
||||||
|
},
|
||||||
{}, -- 4
|
{}, -- 4
|
||||||
}
|
}
|
||||||
|
|
||||||
local Input = {
|
local Input = {
|
||||||
{}, -- 1
|
{}, -- 1
|
||||||
{"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet", "techage:usmium_nuggets"}, --2
|
{"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet", "techage:usmium_nuggets"}, --2
|
||||||
{}, -- 3
|
{"default:mese_crystal", "default:copper_ingot", "default:gold_ingot", "basic_materials:silicon"}, -- 3
|
||||||
{}, -- 4
|
{}, -- 4
|
||||||
}
|
}
|
||||||
|
|
||||||
local Output = {
|
local Output = {
|
||||||
"", -- 1
|
"", -- 1
|
||||||
"techage:vacuum_tube", -- 2
|
"techage:vacuum_tube 2", -- 2
|
||||||
"", -- 3
|
"techage:wlanchip 8", -- 3
|
||||||
"", -- 4
|
"", -- 4
|
||||||
}
|
}
|
||||||
|
|
||||||
local function formspec(self, pos, mem)
|
local function formspec(self, pos, mem)
|
||||||
|
local icon
|
||||||
|
local trd = TRD(pos)
|
||||||
|
if trd.stage == 2 then
|
||||||
|
icon = "techage:vacuum_tube"
|
||||||
|
elseif trd.stage == 3 then
|
||||||
|
icon = "techage:wlanchip"
|
||||||
|
else
|
||||||
|
icon = ""
|
||||||
|
end
|
||||||
return "size[8,8]"..
|
return "size[8,8]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"list[context;src;0,0;3,3;]"..
|
"list[context;src;0,0;3,3;]"..
|
||||||
"item_image[0,0;1,1;default:glass]"..
|
|
||||||
"item_image[0,1;1,1;basic_materials:copper_wire]"..
|
|
||||||
"item_image[0,2;1,1;basic_materials:plastic_sheet]"..
|
|
||||||
"image[3.5,0;1,1;"..techage.get_power_image(pos, mem).."]"..
|
"image[3.5,0;1,1;"..techage.get_power_image(pos, mem).."]"..
|
||||||
"image[3.5,1;1,1;techage_form_arrow.png]"..
|
"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;]"..
|
"image_button[3.5,2;1,1;".. self:get_state_button_image(mem) ..";state_button;]"..
|
||||||
"list[context;dst;5,0;3,3;]"..
|
"list[context;dst;5,0;3,3;]"..
|
||||||
"item_image[5,0;1,1;techage:vacuum_tube]"..
|
"item_image[5,0;1,1;"..icon.."]"..
|
||||||
"list[current_player;main;0,4;8,4;]"..
|
"list[current_player;main;0,4;8,4;]"..
|
||||||
"listring[context;dst]"..
|
"listring[context;dst]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
@ -269,6 +280,15 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = node_name_ta3,
|
||||||
|
recipe = {
|
||||||
|
{"", "default:diamond", ""},
|
||||||
|
{"", node_name_ta2, ""},
|
||||||
|
{"", "techage:vacuum_tube", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("techage:vacuum_tube", {
|
minetest.register_craftitem("techage:vacuum_tube", {
|
||||||
description = I("TA3 Vacuum Tubes"),
|
description = I("TA3 Vacuum Tubes"),
|
||||||
inventory_image = "techage_vacuum_tube.png",
|
inventory_image = "techage_vacuum_tube.png",
|
||||||
@ -288,12 +308,18 @@ if minetest.global_exists("unified_inventory") then
|
|||||||
height = 2,
|
height = 2,
|
||||||
})
|
})
|
||||||
unified_inventory.register_craft({
|
unified_inventory.register_craft({
|
||||||
output = "techage:vacuum_tube",
|
output = "techage:vacuum_tube 2",
|
||||||
items = {"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet", "techage:usmium_nuggets"},
|
items = {"default:glass", "basic_materials:copper_wire", "basic_materials:plastic_sheet", "techage:usmium_nuggets"},
|
||||||
type = "electronic_fab",
|
type = "electronic_fab",
|
||||||
})
|
})
|
||||||
|
unified_inventory.register_craft({
|
||||||
|
output = "techage:wlanchip 8",
|
||||||
|
items = {"default:mese_crystal", "default:copper_ingot", "default:gold_ingot", "basic_materials:silicon"},
|
||||||
|
type = "electronic_fab",
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
techage.register_help_page(I("TA2 Electronic Fab"),
|
techage.register_help_page(I("TA2 Electronic Fab"),
|
||||||
I([[Used to produce Vacuum Pipes,
|
I([[Used to produce Vacuum Pipes,
|
||||||
needed for TA3 machines.]]), "techage:ta2_electronic_fab_pas")
|
needed for TA3 machines.]]), "techage:ta2_electronic_fab_pas")
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ local STANDBY_TICKS = 10
|
|||||||
local COUNTDOWN_TICKS = 10
|
local COUNTDOWN_TICKS = 10
|
||||||
local CYCLE_TIME = 4
|
local CYCLE_TIME = 4
|
||||||
|
|
||||||
|
local Probability = {}
|
||||||
|
|
||||||
local function formspec(self, pos, mem)
|
local function formspec(self, pos, mem)
|
||||||
return "size[8,8]"..
|
return "size[8,8]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
@ -79,6 +81,7 @@ local function determine_water_dir(pos)
|
|||||||
local pos2 = {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 pos3 = {x=pos.x, y=pos.y, z=pos.z+1}
|
||||||
local pos4 = {x=pos.x, y=pos.y, z=pos.z-1}
|
local pos4 = {x=pos.x, y=pos.y, z=pos.z-1}
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
local node1 = minetest.get_node(pos1)
|
local node1 = minetest.get_node(pos1)
|
||||||
local node2 = minetest.get_node(pos2)
|
local node2 = minetest.get_node(pos2)
|
||||||
local node3 = minetest.get_node(pos3)
|
local node3 = minetest.get_node(pos3)
|
||||||
@ -88,18 +91,21 @@ local function determine_water_dir(pos)
|
|||||||
local ndef3 = minetest.registered_nodes[node3.name]
|
local ndef3 = minetest.registered_nodes[node3.name]
|
||||||
local ndef4 = minetest.registered_nodes[node4.name]
|
local ndef4 = minetest.registered_nodes[node4.name]
|
||||||
|
|
||||||
if ndef1 and ndef1.liquidtype == "flowing" and ndef2 and ndef2.liquidtype == "flowing" then
|
if minetest.get_item_group(node.name, "water") > 0 then
|
||||||
if node1.param2 > node2.param2 then
|
if ndef1 and ndef1.liquidtype == "flowing" and ndef2 and ndef2.liquidtype == "flowing" then
|
||||||
return 4
|
if node1.param2 > node2.param2 then
|
||||||
elseif node1.param2 < node2.param2 then
|
return 4
|
||||||
return 2
|
elseif node1.param2 < node2.param2 then
|
||||||
end
|
return 2
|
||||||
elseif ndef3 and ndef3.liquidtype == "flowing" and ndef4 and ndef4.liquidtype == "flowing" then
|
end
|
||||||
if node3.param2 > node4.param2 then
|
elseif ndef3 and ndef3.liquidtype == "flowing" and ndef4 and ndef4.liquidtype == "flowing" then
|
||||||
return 3
|
if node3.param2 > node4.param2 then
|
||||||
elseif node3.param2 < node4.param2 then
|
return 3
|
||||||
return 1
|
elseif node3.param2 < node4.param2 then
|
||||||
|
return 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -110,7 +116,7 @@ local function remove_obj(obj)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function set_velocity(obj, pos, vel)
|
local function set_velocity(obj, pos, vel)
|
||||||
if obj then
|
if obj and vel then
|
||||||
obj:set_velocity(vel)
|
obj:set_velocity(vel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -125,12 +131,21 @@ local function add_object(pos, name)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_random_gravel_ore()
|
||||||
|
for ore, probability in pairs(Probability) do
|
||||||
|
if math.random(probability) == 1 then
|
||||||
|
return ore
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function washing(pos, trd, mem, inv)
|
local function washing(pos, trd, mem, inv)
|
||||||
local src = ItemStack("techage:sieved_gravel")
|
local src = ItemStack("techage:sieved_gravel")
|
||||||
local dst = ItemStack("default:sand")
|
local dst = ItemStack("default:sand")
|
||||||
if inv:contains_item("src", src) then
|
if inv:contains_item("src", src) then
|
||||||
if math.random(40) == 1 then
|
local ore = get_random_gravel_ore()
|
||||||
add_object({x=pos.x, y=pos.y+1, z=pos.z}, "techage:usmium_nuggets")
|
if ore then
|
||||||
|
add_object({x=pos.x, y=pos.y+1, z=pos.z}, ore)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
trd.State:idle(pos, mem)
|
trd.State:idle(pos, mem)
|
||||||
@ -310,6 +325,7 @@ if minetest.global_exists("unified_inventory") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
function techage.add_rinser_recipe(recipe)
|
function techage.add_rinser_recipe(recipe)
|
||||||
|
Probability[recipe.output] = recipe.probability
|
||||||
if minetest.global_exists("unified_inventory") then
|
if minetest.global_exists("unified_inventory") then
|
||||||
recipe.items = {recipe.input}
|
recipe.items = {recipe.input}
|
||||||
recipe.type = "rinsing"
|
recipe.type = "rinsing"
|
||||||
@ -317,8 +333,28 @@ function techage.add_rinser_recipe(recipe)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
techage.add_rinser_recipe({input="techage:sieved_gravel", output="techage:usmium_nuggets"})
|
minetest.register_lbm({
|
||||||
|
label = "[techage] Rinser update",
|
||||||
|
name = "techage:update",
|
||||||
|
nodenames = {"techage:ta2_rinser_act"},
|
||||||
|
run_at_every_load = true,
|
||||||
|
action = function(pos, node)
|
||||||
|
remove_objects({x=pos.x, y=pos.y+1, z=pos.z})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
techage.add_rinser_recipe({input="techage:sieved_gravel", output="techage:usmium_nuggets", probability=40})
|
||||||
|
techage.add_rinser_recipe({input="techage:sieved_gravel", output="default:copper_lump", probability=20})
|
||||||
|
|
||||||
techage.register_help_page(I("TA2 Gravel Rinser"),
|
techage.register_help_page(I("TA2 Gravel Rinser"),
|
||||||
I([[Used to wash Sieved Gravel to get Usmium Nuggets.
|
I([[Used to wash Sieved Gravel to get Usmium Nuggets.
|
||||||
|
248
basic_machines/source.lua
Normal file
248
basic_machines/source.lua
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
LGPLv2.1+
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
TA2/TA3/TA4 Power Source
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- 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 TA2_Power = techage.Axle
|
||||||
|
local TA3_Power = techage.SteamPipe
|
||||||
|
local TA4_Power = techage.ElectricCable
|
||||||
|
local generator = techage.generator
|
||||||
|
|
||||||
|
local STANDBY_TICKS = 4
|
||||||
|
local COUNTDOWN_TICKS = 4
|
||||||
|
local CYCLE_TIME = 16
|
||||||
|
local POWER_CAPACITY = 50
|
||||||
|
|
||||||
|
local function formspec(self, pos, mem)
|
||||||
|
return "size[8,7]"..
|
||||||
|
default.gui_bg..
|
||||||
|
default.gui_bg_img..
|
||||||
|
default.gui_slots..
|
||||||
|
"image[6,0.5;1,2;"..generator.formspec_level(mem, mem.power_result)..
|
||||||
|
"image_button[5,1;1,1;".. self:get_state_button_image(mem) ..";state_button;]"..
|
||||||
|
"button[2.5,1;1.8,1;update;"..I("Update").."]"..
|
||||||
|
"list[current_player;main;0,3;8,4;]"..
|
||||||
|
default.get_hotbar_bg(0, 3)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function start_node(pos, mem, state)
|
||||||
|
generator.turn_power_on(pos, POWER_CAPACITY)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function stop_node(pos, mem, state)
|
||||||
|
generator.turn_power_on(pos, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
local State2 = techage.NodeStates:new({
|
||||||
|
node_name_passive = "techage:t2_source",
|
||||||
|
cycle_time = CYCLE_TIME,
|
||||||
|
standby_ticks = STANDBY_TICKS,
|
||||||
|
formspec_func = formspec,
|
||||||
|
start_node = start_node,
|
||||||
|
stop_node = stop_node,
|
||||||
|
})
|
||||||
|
|
||||||
|
local State3 = techage.NodeStates:new({
|
||||||
|
node_name_passive = "techage:t3_source",
|
||||||
|
cycle_time = CYCLE_TIME,
|
||||||
|
standby_ticks = STANDBY_TICKS,
|
||||||
|
formspec_func = formspec,
|
||||||
|
start_node = start_node,
|
||||||
|
stop_node = stop_node,
|
||||||
|
})
|
||||||
|
|
||||||
|
local State4 = techage.NodeStates:new({
|
||||||
|
node_name_passive = "techage:t4_source",
|
||||||
|
cycle_time = CYCLE_TIME,
|
||||||
|
standby_ticks = STANDBY_TICKS,
|
||||||
|
formspec_func = formspec,
|
||||||
|
start_node = start_node,
|
||||||
|
stop_node = stop_node,
|
||||||
|
})
|
||||||
|
|
||||||
|
local tStates = {0, State2, State3, State4}
|
||||||
|
|
||||||
|
local function node_timer(pos, elapsed)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
local state = tStates[mem.state_num or 2]
|
||||||
|
return state:is_active(mem)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function turn_power_on(pos, in_dir, sum)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
local state = tStates[mem.state_num or 2]
|
||||||
|
-- store result for formspec
|
||||||
|
mem.power_result = sum
|
||||||
|
if state:is_active(mem) and sum <= 0 then
|
||||||
|
state:fault(pos, mem)
|
||||||
|
-- No automatic turn on
|
||||||
|
mem.power_capacity = 0
|
||||||
|
end
|
||||||
|
M(pos):set_string("formspec", formspec(state, pos, 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)
|
||||||
|
local state = tStates[mem.state_num or 2]
|
||||||
|
state:state_button_event(pos, mem, fields)
|
||||||
|
|
||||||
|
if fields.update then
|
||||||
|
local state = tStates[mem.state_num or 2]
|
||||||
|
M(pos):set_string("formspec", formspec(state, pos, mem))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_rightclick(pos)
|
||||||
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
local state = tStates[mem.state_num or 2]
|
||||||
|
M(pos):set_string("formspec", formspec(state, pos, mem))
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("techage:t2_source", {
|
||||||
|
description = "Axle Power Source",
|
||||||
|
tiles = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
"techage_filling_ta2.png^techage_frame_ta2_top.png",
|
||||||
|
"techage_filling_ta2.png^techage_frame_ta2.png",
|
||||||
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_source.png^techage_axle_clutch.png",
|
||||||
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_source.png",
|
||||||
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_source.png",
|
||||||
|
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_source.png",
|
||||||
|
},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
|
on_rotate = screwdriver.disallow,
|
||||||
|
is_ground_content = false,
|
||||||
|
|
||||||
|
techage = {
|
||||||
|
turn_on = turn_power_on,
|
||||||
|
read_power_consumption = generator.read_power_consumption,
|
||||||
|
power_network = TA2_Power,
|
||||||
|
power_side = "R",
|
||||||
|
animated_power_network = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local mem = generator.after_place_node(pos)
|
||||||
|
State2:node_init(pos, mem, "")
|
||||||
|
mem.state_num = 2
|
||||||
|
on_rightclick(pos)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
State2:after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
generator.after_dig_node(pos, oldnode)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_tube_update = generator.after_tube_update,
|
||||||
|
on_receive_fields = on_receive_fields,
|
||||||
|
on_rightclick = on_rightclick,
|
||||||
|
on_timer = node_timer,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techage:t3_source", {
|
||||||
|
description = "Steam Power Source",
|
||||||
|
tiles = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3_top.png",
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3.png",
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_source.png^techage_steam_hole.png",
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_source.png",
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_source.png",
|
||||||
|
"techage_filling_ta3.png^techage_frame_ta3.png^techage_appl_source.png",
|
||||||
|
},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
|
on_rotate = screwdriver.disallow,
|
||||||
|
is_ground_content = false,
|
||||||
|
|
||||||
|
techage = {
|
||||||
|
turn_on = turn_power_on,
|
||||||
|
read_power_consumption = generator.read_power_consumption,
|
||||||
|
power_network = TA3_Power,
|
||||||
|
power_side = "R",
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local mem = generator.after_place_node(pos)
|
||||||
|
State3:node_init(pos, mem, "")
|
||||||
|
mem.state_num = 3
|
||||||
|
on_rightclick(pos)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
State3:after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
generator.after_dig_node(pos, oldnode)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_tube_update = generator.after_tube_update,
|
||||||
|
on_receive_fields = on_receive_fields,
|
||||||
|
on_rightclick = on_rightclick,
|
||||||
|
on_timer = node_timer,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techage:t4_source", {
|
||||||
|
description = "Ele Power Source",
|
||||||
|
tiles = {
|
||||||
|
-- up, down, right, left, back, front
|
||||||
|
"techage_filling_ta4.png^techage_frame_ta4_top.png",
|
||||||
|
"techage_filling_ta4.png^techage_frame_ta4.png",
|
||||||
|
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_source.png^techage_appl_hole_electric.png",
|
||||||
|
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_source.png",
|
||||||
|
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_source.png",
|
||||||
|
"techage_filling_ta4.png^techage_frame_ta4.png^techage_appl_source.png",
|
||||||
|
},
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
|
on_rotate = screwdriver.disallow,
|
||||||
|
is_ground_content = false,
|
||||||
|
|
||||||
|
techage = {
|
||||||
|
turn_on = turn_power_on,
|
||||||
|
read_power_consumption = generator.read_power_consumption,
|
||||||
|
power_network = TA4_Power,
|
||||||
|
power_side = "R",
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer)
|
||||||
|
local mem = generator.after_place_node(pos)
|
||||||
|
State4:node_init(pos, mem, "")
|
||||||
|
mem.state_num = 4
|
||||||
|
on_rightclick(pos)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
State4:after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||||
|
generator.after_dig_node(pos, oldnode)
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_tube_update = generator.after_tube_update,
|
||||||
|
on_receive_fields = on_receive_fields,
|
||||||
|
on_rightclick = on_rightclick,
|
||||||
|
on_timer = node_timer,
|
||||||
|
})
|
||||||
|
|
||||||
|
TA2_Power:add_secondary_node_names({"techage:t2_source"})
|
||||||
|
TA3_Power:add_secondary_node_names({"techage:t3_source"})
|
||||||
|
TA4_Power:add_secondary_node_names({"techage:t4_source"})
|
@ -50,32 +50,30 @@ 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
|
||||||
local node1 = table.copy(node)
|
local ndef = table.copy(node)
|
||||||
node1.groups.techage_trowel = 1
|
|
||||||
if idx == 0 then
|
if idx == 0 then
|
||||||
node1.groups.not_in_creative_inventory = 0
|
ndef.groups.not_in_creative_inventory = 0
|
||||||
else
|
else
|
||||||
node1.groups.not_in_creative_inventory = 1
|
ndef.groups.not_in_creative_inventory = 1
|
||||||
end
|
end
|
||||||
node1.drawtype = "nodebox"
|
ndef.groups.techage_trowel = 1
|
||||||
node1.node_box = get_node_box(idx, size, boxes)
|
ndef.drawtype = "nodebox"
|
||||||
node1.paramtype2 = "facedir"
|
ndef.node_box = get_node_box(idx, size, boxes)
|
||||||
node1.on_rotate = screwdriver.disallow
|
ndef.paramtype2 = "facedir"
|
||||||
node1.paramtype = "light"
|
ndef.on_rotate = screwdriver.disallow
|
||||||
node1.sunlight_propagates = true
|
ndef.paramtype = "light"
|
||||||
node1.is_ground_content = false
|
ndef.sunlight_propagates = true
|
||||||
node1.drop = name.."0"
|
ndef.is_ground_content = false
|
||||||
--node.techage = techage
|
ndef.drop = name.."0"
|
||||||
minetest.register_node(name..idx, node1)
|
-- use the original techage table!!!
|
||||||
|
ndef.techage = node.techage
|
||||||
|
minetest.register_node(name..idx, ndef)
|
||||||
network:add_secondary_node_names({name..idx})
|
network:add_secondary_node_names({name..idx})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function techage.junction_type(conn)
|
function techage.junction_type(conn)
|
||||||
local val = 0
|
local val = 0
|
||||||
for idx = 1,6 do
|
for idx = 1,6 do
|
||||||
|
@ -54,7 +54,6 @@ end
|
|||||||
local function matching_nodes(pos, peer_pos)
|
local function matching_nodes(pos, peer_pos)
|
||||||
local tube_type1 = pos and TRD(pos) and TRD(pos).power_network.tube_type
|
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
|
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
|
return not tube_type1 or not tube_type2 or tube_type1 == tube_type2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -137,16 +137,21 @@ minetest.register_node("techage:cooler_on", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:cooler",
|
||||||
|
recipe = {
|
||||||
|
{"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
|
||||||
|
{"techage:steam_pipeS", "basic_materials:gear_steel", "techage:steam_pipeS"},
|
||||||
|
{"basic_materials:steel_bar", "default:wood", "basic_materials:steel_bar"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
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"),
|
techage.register_help_page(I("TA3 Cooler"),
|
||||||
I([[Part of the steam engine.
|
I([[Part of the Coal Power Station.
|
||||||
Has to be placed on top of the Firebox
|
Has to be placed in the steam circulation
|
||||||
and filled with water.
|
after the Turbine.
|
||||||
(see TA2 Steam Engine)]]), "techage:boiler1")
|
(see TA3 Coal Power Station)]]), "techage:cooler")
|
||||||
|
|
||||||
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")
|
|
@ -199,7 +199,7 @@ techage.register_node("techage:coalfirebox", {}, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
label = "[techage] Steam engine firebox",
|
label = "[techage] Power Station firebox",
|
||||||
name = "techage:steam_engine",
|
name = "techage:steam_engine",
|
||||||
nodenames = {"techage:coalfirebox"},
|
nodenames = {"techage:coalfirebox"},
|
||||||
run_at_every_load = true,
|
run_at_every_load = true,
|
||||||
|
@ -222,8 +222,8 @@ minetest.register_node("techage:generator_on", {
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "techage:generator",
|
output = "techage:generator",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"basic_materials:steel_bar", "dye:red", "default:wood"},
|
{"basic_materials:steel_bar", "dye:green", "default:wood"},
|
||||||
{"", "basic_materials:gear_steel", "techage:axle"},
|
{"", "basic_materials:gear_steel", "techage:electric_cableS"},
|
||||||
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -17,18 +17,18 @@ local MP = minetest.get_modpath("techage")
|
|||||||
local S, NS = dofile(MP.."/intllib.lua")
|
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.
|
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
|
The goal of TA3 is to build a Coal Power Station and machines
|
||||||
to produce ores and chips for smart devices and machines in TA4.]]), "techage:wlanchip")
|
to produce ores and chips for smart TA4 devices and machines.]]), "techage:wlanchip")
|
||||||
|
|
||||||
local HelpText = S([[1. Build a Coal Power Station according
|
local HelpText = S([[1. Build a Coal Power Station according
|
||||||
to the plan with TA3 Firebox, TA3 Boiler,
|
to the plan with TA3 Firebox, TA3 Boiler,
|
||||||
Steam Pipes, TA3 Cooler, Turbine and Generator.
|
Steam Pipes, Cooler, Turbine and Generator.
|
||||||
2. Heat the Firebox with coal/charcoal
|
2. Heat the Firebox with coal/charcoal
|
||||||
3. Fill the boiler with water (more than one bucket is needed)
|
3. Fill the boiler with water (more than one bucket is needed)
|
||||||
4. Wait until the water is heated
|
4. Wait until the water is heated
|
||||||
5. Open the steam ventil
|
5. Open the steam ventil
|
||||||
6. Start the Generator
|
6. Connect the Generator with your machines by means of cables and junction boxes
|
||||||
7. Connect the Generator with your machines by means of cables and junction boxes]])
|
7. Start the Generator]])
|
||||||
|
|
||||||
local Images = {
|
local Images = {
|
||||||
|
|
||||||
@ -52,3 +52,4 @@ techage.register_help_page("Coal Power Station", HelpText, nil, Images)
|
|||||||
techage.register_help_page(S("TA3 Electronic Fab"),
|
techage.register_help_page(S("TA3 Electronic Fab"),
|
||||||
S([[Used to produce WLAN Chips,
|
S([[Used to produce WLAN Chips,
|
||||||
needed for TA4 machines.]]), "techage:ta3_electronic_fab_pas")
|
needed for TA4 machines.]]), "techage:ta3_electronic_fab_pas")
|
||||||
|
|
||||||
|
6
init.lua
6
init.lua
@ -45,7 +45,7 @@ else
|
|||||||
-- 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
|
||||||
@ -74,6 +74,7 @@ else
|
|||||||
dofile(MP.."/steam_engine/gearbox.lua")
|
dofile(MP.."/steam_engine/gearbox.lua")
|
||||||
|
|
||||||
-- Basic Machines
|
-- Basic Machines
|
||||||
|
dofile(MP.."/basic_machines/source.lua")
|
||||||
dofile(MP.."/basic_machines/pusher.lua")
|
dofile(MP.."/basic_machines/pusher.lua")
|
||||||
dofile(MP.."/basic_machines/blackhole.lua")
|
dofile(MP.."/basic_machines/blackhole.lua")
|
||||||
dofile(MP.."/basic_machines/legacy_nodes.lua")
|
dofile(MP.."/basic_machines/legacy_nodes.lua")
|
||||||
@ -100,12 +101,11 @@ else
|
|||||||
dofile(MP.."/coal_power_station/cooler.lua")
|
dofile(MP.."/coal_power_station/cooler.lua")
|
||||||
|
|
||||||
|
|
||||||
|
--dofile(MP.."/test/generator.lua")
|
||||||
dofile(MP.."/test/lamp.lua")
|
dofile(MP.."/test/lamp.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/test.lua")
|
||||||
--dofile(MP.."/test/battery.lua")
|
|
||||||
|
|
||||||
|
|
||||||
--dofile(MP.."/fermenter/gasflare.lua")
|
--dofile(MP.."/fermenter/gasflare.lua")
|
||||||
|
@ -196,14 +196,12 @@ function techage.keep_running_burner(pos)
|
|||||||
meta:set_int("handle", 0)
|
meta:set_int("handle", 0)
|
||||||
end
|
end
|
||||||
local burn_time = meta:get_int("burn_time")
|
local burn_time = meta:get_int("burn_time")
|
||||||
print("keep_running_burner", burn_time)
|
|
||||||
-- burner hole is open
|
-- burner hole is open
|
||||||
if num_air(pos) == 1 then
|
if num_air(pos) == 1 then
|
||||||
meta:set_int("burn_time", burn_time - CYCLE_TIME)
|
meta:set_int("burn_time", burn_time - CYCLE_TIME)
|
||||||
-- tower intact
|
-- tower intact
|
||||||
if num_cobble(pos, height) == height * 8 then
|
if num_cobble(pos, height) == height * 8 then
|
||||||
local num_coal = calc_num_coal(height, burn_time)
|
local num_coal = calc_num_coal(height, burn_time)
|
||||||
print("num_coal", num_coal)
|
|
||||||
if num_coal > 0 then
|
if num_coal > 0 then
|
||||||
if meta:get_int("paused") == 1 then
|
if meta:get_int("paused") == 1 then
|
||||||
flame(pos, height, num_coal, true)
|
flame(pos, height, num_coal, true)
|
||||||
|
@ -173,34 +173,34 @@ local Boxes = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
techage.register_junction("techage:biogas_junction", 1/8, Boxes, Pipe, {
|
--techage.register_junction("techage:biogas_junction", 1/8, Boxes, Pipe, {
|
||||||
description = "TA3 Biogas Junction",
|
-- description = "TA3 Biogas Junction",
|
||||||
tiles = {"techage_gaspipe_junction.png"},
|
-- tiles = {"techage_gaspipe_junction.png"},
|
||||||
groups = {crumbly = 3, cracky = 3, snappy = 3, techage_trowel = 1},
|
-- groups = {crumbly = 3, cracky = 3, snappy = 3, techage_trowel = 1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
-- sounds = default.node_sound_metal_defaults(),
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
-- after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
local meta = minetest.get_meta(pos)
|
-- local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Position "..S(pos))
|
-- meta:set_string("infotext", "Position "..S(pos))
|
||||||
Pipe:after_place_node(pos)
|
-- Pipe:after_place_node(pos)
|
||||||
techage.sink_power_consumption(pos, 0)
|
-- techage.sink_power_consumption(pos, 0)
|
||||||
end,
|
-- end,
|
||||||
|
|
||||||
after_tube_update = function(node, pos, out_dir, peer_pos, peer_in_dir)
|
-- after_tube_update = function(node, pos, out_dir, peer_pos, peer_in_dir)
|
||||||
local conn = minetest.deserialize(M(pos):get_string("connections")) or {}
|
-- local conn = minetest.deserialize(M(pos):get_string("connections")) or {}
|
||||||
conn[out_dir] = peer_pos
|
-- conn[out_dir] = peer_pos
|
||||||
M(pos):set_string("connections", minetest.serialize(conn))
|
-- M(pos):set_string("connections", minetest.serialize(conn))
|
||||||
local name = "techage:biogas_junction"..techage.junction_type(conn)
|
-- local name = "techage:biogas_junction"..techage.junction_type(conn)
|
||||||
minetest.swap_node(pos, {name = name, param2 = 0})
|
-- minetest.swap_node(pos, {name = name, param2 = 0})
|
||||||
techage.sink_power_consumption(pos, 0)
|
-- techage.sink_power_consumption(pos, 0)
|
||||||
end,
|
-- end,
|
||||||
|
|
||||||
on_destruct = function(pos)
|
-- on_destruct = function(pos)
|
||||||
techage.sink_power_consumption(pos, 0)
|
-- techage.sink_power_consumption(pos, 0)
|
||||||
end,
|
-- end,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
-- after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
Pipe:after_dig_node(pos)
|
-- Pipe:after_dig_node(pos)
|
||||||
end,
|
-- end,
|
||||||
})
|
--})
|
||||||
|
|
||||||
|
@ -156,3 +156,15 @@ 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:firebox_on"},
|
||||||
|
run_at_every_load = true,
|
||||||
|
action = function(pos, node)
|
||||||
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
BIN
textures/techage_appl_source.png
Normal file
BIN
textures/techage_appl_source.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 299 B |
Loading…
Reference in New Issue
Block a user