wind turbine finished and recipes added
@ -101,6 +101,7 @@ minetest.register_node("techage:ta3_funnel", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -250,6 +250,7 @@ local tubing = {
|
|||||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||||
techage.register_consumer("rinser", S("Gravel Rinser"), tiles, {
|
techage.register_consumer("rinser", S("Gravel Rinser"), tiles, {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -187,6 +187,7 @@ local tubing = {
|
|||||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||||
techage.register_consumer("gravelsieve", S("Gravel Sieve"), tiles, {
|
techage.register_consumer("gravelsieve", S("Gravel Sieve"), tiles, {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
@ -193,6 +193,7 @@ local tubing = {
|
|||||||
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||||
techage.register_consumer("grinder", S("Grinder"), tiles, {
|
techage.register_consumer("grinder", S("Grinder"), tiles, {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
|
56
doc/ta4_doc.lua
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
GPL v3
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
Main module for the in-game TA4documentation
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
local S = techage.S
|
||||||
|
|
||||||
|
techage.register_category_page("ta4",
|
||||||
|
S("Future Age (TA4)"),
|
||||||
|
S("The Future Age is the forth level of the available technic stages.@n"..
|
||||||
|
"The goal of TA4 is to operate your machines only with renewable energy.@n"..
|
||||||
|
"Build wind turbines, solar panel plants and biogas plants and use@n"..
|
||||||
|
"future technologies."),
|
||||||
|
"techage:ta4_wlanchip",
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
local ROTOR = "techage_wind_turbine_inv.png"
|
||||||
|
local CANELLE = "techage_rotor.png"
|
||||||
|
local PILLAR = "techage_pillar_inv.png"
|
||||||
|
|
||||||
|
local Images = {
|
||||||
|
{false, false, false, ROTOR, CANELLE, false, false},
|
||||||
|
{false, false, false, PILLAR, false, false, false},
|
||||||
|
{false, false, false, PILLAR, false, false, false},
|
||||||
|
{false, false, false, PILLAR, false, false, false},
|
||||||
|
{false, false, false, PILLAR, false, false, false},
|
||||||
|
{false, false, false, PILLAR, false, false, false},
|
||||||
|
{false, false, false, PILLAR, false, false, false},
|
||||||
|
{false, false, false, PILLAR, false, false, false},
|
||||||
|
}
|
||||||
|
|
||||||
|
--techage.register_entry_page("ta3", "power_station",
|
||||||
|
techage.register_category_page("ta4wt",
|
||||||
|
S("TA4: Wind Turbine"),
|
||||||
|
S("Build a Wind Turbine according to the plan with TA4 Wind Turbine, TA4 Wind Turbine Nacelle and@n"..
|
||||||
|
"a pillar by means of TA4 Pillar nodes (power cables have to be inside).@n"..
|
||||||
|
"Please note the following limitations:@n"..
|
||||||
|
"- pillar height between 10 and 19 m@n"..
|
||||||
|
"- can only be built offshore (the info tool indicates where a wind turbine can be built)@n"..
|
||||||
|
"- 14 m free space in all 4 directions (e.g. to the next wind turbine)@n"..
|
||||||
|
"- the wind blows only between 5 and 9 o'clock and between 17 and 21 o'clock"),
|
||||||
|
nil,
|
||||||
|
{},
|
||||||
|
Images)
|
||||||
|
|
2
init.lua
@ -47,6 +47,7 @@ else
|
|||||||
dofile(MP.."/doc/ta1_doc.lua")
|
dofile(MP.."/doc/ta1_doc.lua")
|
||||||
dofile(MP.."/doc/ta2_doc.lua")
|
dofile(MP.."/doc/ta2_doc.lua")
|
||||||
dofile(MP.."/doc/ta3_doc.lua")
|
dofile(MP.."/doc/ta3_doc.lua")
|
||||||
|
dofile(MP.."/doc/ta4_doc.lua")
|
||||||
|
|
||||||
-- Nodes1
|
-- Nodes1
|
||||||
dofile(MP.."/nodes/baborium.lua")
|
dofile(MP.."/nodes/baborium.lua")
|
||||||
@ -181,4 +182,5 @@ else
|
|||||||
-- Wind
|
-- Wind
|
||||||
dofile(MP.."/wind_turbine/rotor.lua")
|
dofile(MP.."/wind_turbine/rotor.lua")
|
||||||
dofile(MP.."/nodes/pillar.lua")
|
dofile(MP.."/nodes/pillar.lua")
|
||||||
|
dofile(MP.."/wind_turbine/signallamp.lua")
|
||||||
end
|
end
|
@ -23,9 +23,17 @@ minetest.register_node("techage:pillar", {
|
|||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32},
|
fixed = {-8/32, -16/32, -8/32, 8/32, 16/32, 8/32},
|
||||||
},
|
},
|
||||||
|
backface_culling = true,
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "techage:pillar",
|
||||||
|
recipe = {"basic_materials:concrete_block"},
|
||||||
|
})
|
||||||
|
BIN
textures/techage_carbon_fiber.png
Normal file
After Width: | Height: | Size: 858 B |
BIN
textures/techage_epoxy.png
Normal file
After Width: | Height: | Size: 300 B |
BIN
textures/techage_pillar_inv.png
Normal file
After Width: | Height: | Size: 616 B |
Before Width: | Height: | Size: 468 B After Width: | Height: | Size: 219 B |
BIN
textures/techage_rotor_blade.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 737 B |
BIN
textures/techage_rotor_lamp_off.png
Normal file
After Width: | Height: | Size: 347 B |
BIN
textures/techage_rotor_lamp_on.png
Normal file
After Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 251 B |
@ -46,30 +46,40 @@ local function pos_and_yaw(pos, param2)
|
|||||||
return pos, {x=0, y=yaw, z=0}
|
return pos, {x=0, y=yaw, z=0}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function add_rotor(pos, player_name)
|
local function add_rotor(pos, mem, player_name)
|
||||||
local pos1 = {x=pos.x-14, y=pos.y-10, z=pos.z-14}
|
mem.error = false
|
||||||
|
local pos1 = {x=pos.x-14, y=pos.y-9, z=pos.z-14}
|
||||||
local pos2 = {x=pos.x+14, y=pos.y+10, z=pos.z+14}
|
local pos2 = {x=pos.x+14, y=pos.y+10, z=pos.z+14}
|
||||||
local num_node = 29*29*21 - 12
|
local num_node = 29*29*20 - 12
|
||||||
local num = #minetest.find_nodes_in_area(pos1, pos2, {"air", "ignore"})
|
local num = #minetest.find_nodes_in_area(pos1, pos2, {"air", "ignore"})
|
||||||
if num < num_node then
|
if num < num_node then
|
||||||
if player_name then
|
if player_name then
|
||||||
minetest.chat_send_player(player_name, "[TA4 Wind Turbine] Not enough space!")
|
minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]")..
|
||||||
|
" "..S("Not enough space!"))
|
||||||
end
|
end
|
||||||
|
M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error"))
|
||||||
|
mem.error = true
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local data = minetest.get_biome_data({x=pos.x, y=0, z=pos.z})
|
local data = minetest.get_biome_data({x=pos.x, y=0, z=pos.z})
|
||||||
if not techage.OceanIdTbl[data.biome] then
|
if not techage.OceanIdTbl[data.biome] then
|
||||||
if player_name then
|
if player_name then
|
||||||
minetest.chat_send_player(player_name, "[TA4 Wind Turbine] Wrong place for wind turbines!")
|
minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]")..
|
||||||
|
" "..S("Wrong place for wind turbines!"))
|
||||||
end
|
end
|
||||||
|
M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error"))
|
||||||
|
mem.error = true
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if pos.y < 12 or pos.y > 20 then
|
if pos.y < 12 or pos.y > 20 then
|
||||||
if player_name then
|
if player_name then
|
||||||
minetest.chat_send_player(player_name, "[TA4 Wind Turbine] No wind at this altitude!")
|
minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]")..
|
||||||
|
" "..S("No wind at this altitude!"))
|
||||||
end
|
end
|
||||||
|
M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error"))
|
||||||
|
mem.error = true
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -85,6 +95,14 @@ local function add_rotor(pos, player_name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function start_rotor(pos, mem)
|
local function start_rotor(pos, mem)
|
||||||
|
local npos = techage.get_pos(pos, "F")
|
||||||
|
local node = minetest.get_node(npos)
|
||||||
|
if node.name ~= "techage:ta4_wind_turbine_nacelle" then
|
||||||
|
M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error"))
|
||||||
|
mem.error = true
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
mem.providing = true
|
mem.providing = true
|
||||||
power.generator_start(pos, mem, PWR_PERF)
|
power.generator_start(pos, mem, PWR_PERF)
|
||||||
local hash = minetest.hash_node_position(pos)
|
local hash = minetest.hash_node_position(pos)
|
||||||
@ -105,7 +123,6 @@ 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)
|
||||||
|
|
||||||
print("node_timer", mem.running, mem.providing)
|
|
||||||
if not mem.running then
|
if not mem.running then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -148,7 +165,7 @@ minetest.register_node("techage:ta4_wind_turbine", {
|
|||||||
meta:set_string("infotext", S("TA4 Wind Turbine").." "..own_num)
|
meta:set_string("infotext", S("TA4 Wind Turbine").." "..own_num)
|
||||||
mem.providing = false
|
mem.providing = false
|
||||||
mem.running = true
|
mem.running = true
|
||||||
add_rotor(pos, placer:get_player_name())
|
add_rotor(pos, mem, placer:get_player_name())
|
||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -206,7 +223,9 @@ techage.register_node({"techage:ta4_wind_turbine"}, {
|
|||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
print("on_recv_message", topic)
|
print("on_recv_message", topic)
|
||||||
if topic == "state" then
|
if topic == "state" then
|
||||||
if mem.running and mem.providing then
|
if mem.error then
|
||||||
|
return "error"
|
||||||
|
elseif mem.running and mem.providing then
|
||||||
return "running"
|
return "running"
|
||||||
else
|
else
|
||||||
return "stopped"
|
return "stopped"
|
||||||
@ -220,19 +239,67 @@ techage.register_node({"techage:ta4_wind_turbine"}, {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_node_load = function(pos)
|
on_node_load = function(pos)
|
||||||
add_rotor(pos)
|
|
||||||
local mem = tubelib2.get_mem(pos)
|
local mem = tubelib2.get_mem(pos)
|
||||||
|
add_rotor(pos, mem)
|
||||||
mem.providing = false -- to force the rotor start
|
mem.providing = false -- to force the rotor start
|
||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("techage:ta4_epoxy", {
|
||||||
|
description = S("TA4 Epoxide Resin"),
|
||||||
|
inventory_image = "techage_epoxy.png",
|
||||||
|
})
|
||||||
|
|
||||||
--minetest.register_craft({
|
minetest.register_craftitem("techage:ta4_carbon_fiber", {
|
||||||
-- output = "techage:ta4_wind_turbine",
|
description = S("TA4 Carbon Fiber"),
|
||||||
-- recipe = {
|
inventory_image = "techage_carbon_fiber.png",
|
||||||
-- {"", "techage:ta4_wlanchip", ""},
|
})
|
||||||
-- {"techage:ta4_silicon_wafer", "techage:ta4_silicon_wafer", "techage:ta4_silicon_wafer"},
|
|
||||||
-- {"default:tin_ingot", "techage:iron_ingot", "default:copper_ingot"},
|
minetest.register_craftitem("techage:ta4_rotor_blade", {
|
||||||
-- },
|
description = S("TA4 Rotor Blade"),
|
||||||
--})
|
inventory_image = "techage_rotor_blade.png",
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:ta4_wind_turbine",
|
||||||
|
recipe = {
|
||||||
|
{"dye:white", "techage:ta4_rotor_blade", "dye:red"},
|
||||||
|
{"basic_materials:gear_steel", "techage:generator", "basic_materials:gear_steel"},
|
||||||
|
{"techage:ta4_rotor_blade", "techage:electric_cableS", "techage:ta4_rotor_blade"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:ta4_wind_turbine_nacelle",
|
||||||
|
recipe = {
|
||||||
|
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||||
|
{"dye:white", "techage:ta4_wlanchip", "dye:red"},
|
||||||
|
{"", "default:copper_ingot", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:ta4_rotor_blade",
|
||||||
|
recipe = {
|
||||||
|
{"techage:ta4_carbon_fiber", "dye:white", "techage:ta4_carbon_fiber"},
|
||||||
|
{"techage:ta4_epoxy", "techage:ta4_carbon_fiber", "techage:ta4_epoxy"},
|
||||||
|
{"techage:ta4_carbon_fiber", "dye:red", "techage:ta4_carbon_fiber"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.furnace.register_recipe({
|
||||||
|
output = "techage:ta4_carbon_fiber",
|
||||||
|
recipe = {"default:papyrus", "default:stick", "default:papyrus", "default:stick"},
|
||||||
|
heat = 4,
|
||||||
|
time = 3,
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.furnace.register_recipe({
|
||||||
|
output = "techage:ta4_epoxy",
|
||||||
|
recipe = {"basic_materials:oil_extract", "techage:oil_source",
|
||||||
|
"basic_materials:oil_extract", "techage:oil_source"},
|
||||||
|
heat = 4,
|
||||||
|
time = 3,
|
||||||
|
})
|
||||||
|
108
wind_turbine/signallamp.lua
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
GPL v3
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
Colored Signal Lamp (requires unifieddyes)
|
||||||
|
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- for lazy programmers
|
||||||
|
local M = minetest.get_meta
|
||||||
|
local S = techage.S
|
||||||
|
|
||||||
|
local logic = techage.logic
|
||||||
|
|
||||||
|
local COLORED = minetest.get_modpath("unifieddyes") and minetest.global_exists("unifieddyes")
|
||||||
|
|
||||||
|
|
||||||
|
local function switch_on(pos, node)
|
||||||
|
node.name = "techage:signal_lamp_on"
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function switch_off(pos, node)
|
||||||
|
node.name = "techage:signal_lamp_off"
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("techage:rotor_signal_lamp_off", {
|
||||||
|
description = S("TA4 Wind Turbine Signal Lamp"),
|
||||||
|
tiles = {"techage_rotor_lamp_off.png"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-2/16, -8/16, -2/16, 2/16, -3/16, 2/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
|
end,
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
minetest.swap_node(pos, {name = "techage:rotor_signal_lamp_on"})
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "glasslikeliquidlevel",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = "techage:rotor_signal_lamp_off"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techage:rotor_signal_lamp_on", {
|
||||||
|
description = S("TA4 Wind Turbine Signal Lamp"),
|
||||||
|
tiles = {"techage_rotor_lamp_on.png"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-2/16, -8/16, -2/16, 2/16, -3/16, 2/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
minetest.swap_node(pos, {name = "techage:rotor_signal_lamp_off"})
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 8,
|
||||||
|
paramtype2 = "glasslikeliquidlevel",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
groups = {cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory=1},
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = "techage:rotor_signal_lamp_off"
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_lbm({
|
||||||
|
label = "Restart Lamp",
|
||||||
|
name = "techage:rotor_signal_lamp",
|
||||||
|
nodenames = {"techage:rotor_signal_lamp_on", "techage:rotor_signal_lamp_off"},
|
||||||
|
run_at_every_load = true,
|
||||||
|
action = function(pos, node)
|
||||||
|
minetest.get_node_timer(pos):start(2)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:rotor_signal_lamp_off",
|
||||||
|
recipe = {
|
||||||
|
{"", "dye:red", ""},
|
||||||
|
{"", "default:torch", ""},
|
||||||
|
{"", "default:glass", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|