built on 16/08/2021 20:22:44
@ -85,6 +85,10 @@ local function running(self)
|
||||
|
||||
if self.reenter then -- through monitoring
|
||||
cart_pos = H2P(self.reenter[1])
|
||||
-- pos correction on slopes
|
||||
if not minecart.is_rail(cart_pos) then
|
||||
cart_pos.y = cart_pos.y - 1
|
||||
end
|
||||
wayp_pos = cart_pos
|
||||
is_junction = false
|
||||
self.waypoint = {pos = H2P(self.reenter[2]), power = 0, dot = self.reenter[4]}
|
||||
@ -162,7 +166,7 @@ local function running(self)
|
||||
|
||||
-- Got stuck somewhere
|
||||
if new_speed < 0.1 or dist < 0 then
|
||||
print("Got stuck somewhere", new_speed, dist)
|
||||
minetest.log("warning", "[Minecart] Got stuck somewhere " .. new_speed .. " " .. dist)
|
||||
stop_cart(self, wayp_pos)
|
||||
return
|
||||
end
|
||||
|
@ -117,7 +117,7 @@ local function monitoring(cycle)
|
||||
cart.last_pos = vector.round(pos)
|
||||
--print("entity card " .. cart.userID .. " at " .. P2S(cart.last_pos))
|
||||
else
|
||||
print("entity card without pos!")
|
||||
minetest.log("warning", "[Minecart] entity card without pos!")
|
||||
end
|
||||
push(cycle, cart)
|
||||
elseif cart.checkpoints then
|
||||
@ -130,7 +130,7 @@ local function monitoring(cycle)
|
||||
end
|
||||
push(cycle, cart)
|
||||
else
|
||||
print("zombie got lost")
|
||||
minetest.log("warning", "[Minecart] zombie got lost")
|
||||
end
|
||||
else
|
||||
local pos = cart.last_pos or cart.pos
|
||||
|
@ -137,6 +137,10 @@ end
|
||||
|
||||
function minecart.recording_waypoints(self)
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
-- pos correction on slopes
|
||||
if not minecart.is_rail(pos) then
|
||||
pos.y = pos.y - 1
|
||||
end
|
||||
-- hier müsste überprüfung dest_pos rein
|
||||
self.sum_speed = self.sum_speed + self.curr_speed
|
||||
local wp_pos = check_waypoint(self, pos)
|
||||
|
@ -110,7 +110,7 @@ function minecart.get_route(pos)
|
||||
M(pos):set_int("time", 0)
|
||||
return
|
||||
end
|
||||
return minetest.deserialize(s)
|
||||
return route
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -30,7 +30,6 @@ dofile(MP .. "/power.lua")
|
||||
dofile(MP .. "/liquid.lua")
|
||||
dofile(MP .. "/control.lua")
|
||||
|
||||
print("networks_test_enabled", minetest.settings:get_bool("networks_test_enabled"))
|
||||
if minetest.settings:get_bool("networks_test_enabled") == true then
|
||||
-- Only for testing/demo purposes
|
||||
dofile(MP .. "/test/test_liquid.lua")
|
||||
|
@ -328,7 +328,7 @@ local function remove_outdated_networks()
|
||||
for _,item in ipairs(to_be_deleted) do
|
||||
local net_name, netID = unpack(item)
|
||||
Networks[net_name][netID] = nil
|
||||
print("Network " .. netw_num(netID) .. " timed out")
|
||||
--print("Network " .. netw_num(netID) .. " timed out")
|
||||
end
|
||||
minetest.after(60, remove_outdated_networks)
|
||||
end
|
||||
|
@ -31,6 +31,9 @@ Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Code: Licensed under the GNU AGPL version 3 or later. See LICENSE.txt
|
||||
Textures: CC BY-SA 3.0
|
||||
|
||||
The TA1 mill sound is from https://freesound.org/people/JustinBW/sounds/70200/
|
||||
The TA1 watermill sound is from https://freesound.org/people/bmoreno/sounds/164182/
|
||||
|
||||
Many thanks to Thomas-S and others for their contributions
|
||||
|
||||
|
||||
|
@ -150,21 +150,22 @@ local function washing(pos, crd, nvm, inv)
|
||||
local src = ItemStack("techage:sieved_gravel")
|
||||
local dst = ItemStack("default:sand")
|
||||
if inv:contains_item("src", src) then
|
||||
if not inv:room_for_item("dst", dst) then
|
||||
crd.State:blocked(pos, nvm)
|
||||
return
|
||||
end
|
||||
local ore = get_random_gravel_ore()
|
||||
if ore then
|
||||
add_object({x=pos.x, y=pos.y+1, z=pos.z}, ore)
|
||||
end
|
||||
inv:add_item("dst", dst)
|
||||
inv:remove_item("src", src)
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
return
|
||||
else
|
||||
crd.State:idle(pos, nvm)
|
||||
return
|
||||
end
|
||||
if not inv:room_for_item("dst", dst) then
|
||||
crd.State:idle(pos, nvm)
|
||||
return
|
||||
end
|
||||
inv:add_item("dst", dst)
|
||||
inv:remove_item("src", src)
|
||||
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
|
||||
end
|
||||
|
||||
local function keep_running(pos, elapsed)
|
||||
|
@ -23,8 +23,9 @@ local STANDBY_TICKS = 3
|
||||
local COUNTDOWN_TICKS = 4
|
||||
local CYCLE_TIME = 4
|
||||
|
||||
|
||||
-- Grinder recipes
|
||||
-- Grinder recipes TA1
|
||||
local RecipesTa1 = {}
|
||||
-- Grinder recipes TA2 - TA4
|
||||
local Recipes = {}
|
||||
|
||||
local function formspec(self, pos, nvm)
|
||||
@ -250,6 +251,79 @@ local node_name_ta2, node_name_ta3, node_name_ta4 =
|
||||
tube_sides = {L=1, R=1, U=1},
|
||||
})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- TA1 Mill (watermill)
|
||||
-------------------------------------------------------------------------------
|
||||
local formspecStr = "size[8,8]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;src;1,1;1,1;]"..
|
||||
"item_image[1,1;1,1;farming:wheat]"..
|
||||
"image[1,1;1,1;techage_form_mask.png]"..
|
||||
"image[3.5,1;1,1;techage_form_arrow.png]"..
|
||||
"list[context;dst;6,1;1,1;]"..
|
||||
"item_image[6,1;1,1;farming:flour]"..
|
||||
"image[6,1;1,1;techage_form_mask.png]"..
|
||||
"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)
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
if techage.ta1_mill_has_power(pos, 2) then
|
||||
local inv = M(pos):get_inventory()
|
||||
local stack = inv:get_stack("src", 1)
|
||||
if not stack:is_empty() then
|
||||
local name = stack:get_name()
|
||||
if RecipesTa1[name] then
|
||||
local recipe = RecipesTa1[name]
|
||||
src_to_dst(stack, 1, name, 1, recipe.inp_num, inv, recipe.output)
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta1_mill_base", {
|
||||
description = S("TA1 Mill Base"),
|
||||
tiles = {
|
||||
"techage_mill_base.png",
|
||||
"default_stone_brick.png",
|
||||
},
|
||||
after_place_node = function(pos, placer)
|
||||
M(pos):set_string("formspec", formspecStr)
|
||||
local inv = M(pos):get_inventory()
|
||||
inv:set_size('src', 1)
|
||||
inv:set_size('dst', 1)
|
||||
minetest.get_node_timer(pos):start(4)
|
||||
end,
|
||||
can_dig = can_dig,
|
||||
on_timer = node_timer,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2},
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta1_mill_base"}, {
|
||||
on_node_load = function(pos, node)
|
||||
minetest.get_node_timer(pos):start(4)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_mill_base",
|
||||
recipe = {
|
||||
{"default:stonebrick", "", "default:stonebrick"},
|
||||
{"", "techage:iron_ingot", ""},
|
||||
{"default:stonebrick", "", "default:stonebrick"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = node_name_ta2,
|
||||
recipe = {
|
||||
@ -284,16 +358,34 @@ if minetest.global_exists("unified_inventory") then
|
||||
width = 2,
|
||||
height = 2,
|
||||
})
|
||||
unified_inventory.register_craft_type("milling", {
|
||||
description = S("Milling"),
|
||||
icon = 'techage_mill_inv.png',
|
||||
width = 2,
|
||||
height = 2,
|
||||
})
|
||||
end
|
||||
|
||||
function techage.add_grinder_recipe(recipe)
|
||||
function techage.add_grinder_recipe(recipe, ta1_permitted)
|
||||
local name, num = unpack(string.split(recipe.input, " ", false, 1))
|
||||
Recipes[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output}
|
||||
if minetest.registered_items[name] then
|
||||
if ta1_permitted then
|
||||
RecipesTa1[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output}
|
||||
|
||||
if minetest.global_exists("unified_inventory") then
|
||||
recipe.items = {recipe.input}
|
||||
recipe.type = "grinding"
|
||||
unified_inventory.register_craft(recipe)
|
||||
if minetest.global_exists("unified_inventory") then
|
||||
recipe.items = {recipe.input}
|
||||
recipe.type = "milling"
|
||||
unified_inventory.register_craft(table.copy(recipe))
|
||||
end
|
||||
end
|
||||
|
||||
Recipes[name] = {input = name,inp_num = tonumber(num) or 1, output = recipe.output}
|
||||
|
||||
if minetest.global_exists("unified_inventory") then
|
||||
recipe.items = {recipe.input}
|
||||
recipe.type = "grinding"
|
||||
unified_inventory.register_craft(recipe)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -326,14 +418,14 @@ techage.add_grinder_recipe({input="default:acacia_tree", output="default:acacia_
|
||||
techage.add_grinder_recipe({input="default:aspen_tree", output="default:aspen_leaves 8"})
|
||||
|
||||
if minetest.global_exists("farming") then
|
||||
techage.add_grinder_recipe({input="farming:wheat 3", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:seed_wheat 6", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:barley 3", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:seed_barley 6", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:rye 3", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:seed_rye 6", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:rice 3", output="farming:rice_flour"})
|
||||
techage.add_grinder_recipe({input="farming:seed_rice 6", output="farming:rice_flour"})
|
||||
techage.add_grinder_recipe({input="farming:oat 3", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:seed_oat 6", output="farming:flour"})
|
||||
techage.add_grinder_recipe({input="farming:wheat 3", output="farming:flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:seed_wheat 6", output="farming:flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:barley 3", output="farming:flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:seed_barley 6", output="farming:flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:rye 3", output="farming:flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:seed_rye 6", output="farming:flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:rice 3", output="farming:rice_flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:seed_rice 6", output="farming:rice_flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:oat 3", output="farming:flour"}, true)
|
||||
techage.add_grinder_recipe({input="farming:seed_oat 6", output="farming:flour"}, true)
|
||||
end
|
||||
|
@ -15,6 +15,8 @@ techage.manual_DE.aTitel = {
|
||||
"1,TA1: Eisenzeitalter",
|
||||
"2,Köhler / Coal Pile",
|
||||
"2,Kohlebrenner / Coal Burner",
|
||||
"2,Wassermühle",
|
||||
"3,TA1 Mühle",
|
||||
"2,Erze und Werkzeuge",
|
||||
"3,Hammer",
|
||||
"3,Kiessieb / Gravel Sieve",
|
||||
@ -339,6 +341,18 @@ techage.manual_DE.aText = {
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Mit der Wassermühle können Weizen und andere Getreide zu Mehl gemahlen und dann im Ofen zu Brot gebacken werden. Die Mühle wird mit\n"..
|
||||
"Wasserkraft angetrieben. Dazu muss der Mühlbach über ein Kanal zum Wasserrad geführt werden. Für den Mühlbach muss oberhalb des Mühlerades\n"..
|
||||
"ein Teich angelegt werden. Die Abbilding rechts (auf \"Plan\" klicken) zeigt den Aufbau.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"Mit der Wassermühle können Weizen und andere Getreide zu Mehl gemahlen und dann im Ofen zu Brot gebacken werden. Die Mühle wird mit\n"..
|
||||
"Wasserkraft angetrieben. Dazu muss der Mühlbach über ein Kanal zum Wasserrad geführt werden. Für den Mühlbach muss oberhalb des Mühlerades\n"..
|
||||
"ein Teich angelegt werden. Die Abbilding rechts (auf \"Plan\" klicken) zeigt den Aufbau.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
"\n",
|
||||
"TA1 hat seine eigenen Werkzeuge wie Hammer und Kiessieb\\, aber auch der Minecart Hopper kann genutzt werden.\n"..
|
||||
"\n"..
|
||||
"\n"..
|
||||
@ -1723,6 +1737,8 @@ techage.manual_DE.aItemName = {
|
||||
"techage_ta1",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"ta1_gravelsieve",
|
||||
"hammer",
|
||||
"ta1_gravelsieve",
|
||||
@ -1930,6 +1946,8 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"coalpile",
|
||||
"coalburner",
|
||||
"watermill1",
|
||||
"watermill2",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
@ -81,6 +81,64 @@ techage.ConstructionPlans["hoppersieve"] = {
|
||||
{false, false, HOPPR, CHEST, false},
|
||||
}
|
||||
|
||||
--
|
||||
-- TA1: Watermill
|
||||
--
|
||||
local WATR1 = {"default_water.png" , "techage:water_flowing"}
|
||||
local WATR3 = {"techage_water_flowing.png" , "techage:water_flowing"}
|
||||
local WMILL = {"default_wood.png" , "techage:ta1_board1_apple"}
|
||||
local SLUC1 = {"techage_sluice2_inv.png" , "techage:ta1_sluice_closed"}
|
||||
local SLUC2 = {"techage_sluice1_inv.png" , "techage:ta1_sluice_handle_closed"}
|
||||
local MIL11 = {"techage_watermill1_inv.png" , "techage:ta1_watermill"}
|
||||
local MIL12 = {"techage_watermill1_inv.png^[transformR90" , "techage:ta1_watermill"}
|
||||
local MIL13 = {"techage_watermill1_inv.png^[transformR180" , "techage:ta1_watermill"}
|
||||
local MIL14 = {"techage_watermill1_inv.png^[transformR270" , "techage:ta1_watermill"}
|
||||
local MIL21 = {"techage_watermill2_inv.png" , "techage:ta1_watermill"}
|
||||
local MIL22 = {"techage_watermill2_inv.png^[transformR90" , "techage:ta1_watermill"}
|
||||
local MIL23 = {"techage_watermill2_inv.png^[transformR180" , "techage:ta1_watermill"}
|
||||
local MIL24 = {"techage_watermill2_inv.png^[transformR270" , "techage:ta1_watermill"}
|
||||
local MIL31 = {"techage_watermill3_inv.png" , "techage:ta1_watermill"}
|
||||
local MIL32 = {"techage_watermill3_inv.png^[transformR90" , "techage:ta1_watermill"}
|
||||
local MIL33 = {"techage_watermill3_inv.png^[transformR180" , "techage:ta1_watermill"}
|
||||
local MIL34 = {"techage_watermill3_inv.png^[transformR270" , "techage:ta1_watermill"}
|
||||
local MIL40 = {"techage_watermill4_inv.png" , "techage:ta1_watermill"}
|
||||
local BEARG = {"default_stone_brick.png^techage_axle_bearing_front.png", "techage:ta1_axle_bearing2"}
|
||||
local BRICK = {"default_stone_brick.png", "default:stonebrick"}
|
||||
|
||||
|
||||
techage.ConstructionPlans["watermill1"] = {
|
||||
{false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, SLUC2, false, false, false, false, false, false, false, false, false},
|
||||
{WATR1, SLUC1, WMILL, WMILL, WMILL, WMILL, WMILL, WATR3, false, false, false},
|
||||
{WATR1, DDIRT, false, false, MIL31, MIL21, MIL11, MIL21, MIL34, false, false},
|
||||
{WATR1, DDIRT, false, false, MIL22, MIL40, MIL40, MIL40, MIL24, false, false},
|
||||
{DDIRT, DDIRT, DDIRT, false, MIL12, MIL40, BEARG, MIL40, MIL14, false, false},
|
||||
{DDIRT, DDIRT, DDIRT, false, MIL22, MIL40, BRICK, MIL40, MIL24, false, false},
|
||||
{DDIRT, DDIRT, DDIRT, DDIRT, MIL32, MIL23, BRICK, MIL23, MIL33, false, false},
|
||||
{DDIRT, DDIRT, DDIRT, DDIRT, DDIRT, DDIRT, DDIRT, WATR1, WATR1, WATR1, WATR1},
|
||||
}
|
||||
|
||||
|
||||
local MILLF = {"default_wood.png" , "techage:ta1_watermill"}
|
||||
local AXLE1 = {"techage_axle_bearing.png", "techage:ta1_axle"}
|
||||
local MILLG = {"techage_wood50.png^techage_axle_bearing.png", "techage:ta1_mill_gear"}
|
||||
local MILL_ = {"techage_mill_side.png", "techage:ta1_mill"}
|
||||
local MILLB = {"default_stone_brick.png", "techage:ta1_mill_base"}
|
||||
local FURNE = {"default_furnace_front.png", "default:furnace"}
|
||||
local HOPER = {"techage_hopper.png", "minecart:hopper"}
|
||||
|
||||
techage.ConstructionPlans["watermill2"] = {
|
||||
{false, false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, false, false, false, false, false, false, false, false, false, false, false},
|
||||
{false, false, false, false, false, false, false, false, MILLF, false, false, false},
|
||||
{false, false, false, false, false, false, false, false, MILLF, false, false, false},
|
||||
{false, false, false, false, false, MILLG, AXLE1, BEARG, MILLF, BEARG, false, false},
|
||||
{false, false, false, false, false, MILL_, false, BRICK, MILLF, BRICK, false, false},
|
||||
{false, CHEST, HOPER, FURNE, HOPER, MILLB, false, BRICK, MILLF, BRICK, false, false},
|
||||
{DDIRT, DDIRT, DDIRT, DDIRT, DDIRT, DDIRT, DDIRT, DDIRT, WATR1, DDIRT, DDIRT, DDIRT},
|
||||
}
|
||||
|
||||
--
|
||||
-- Steam Engine
|
||||
--
|
||||
|
@ -133,8 +133,17 @@ dofile(MP.."/iron_age/meltingpot.lua")
|
||||
if techage.modified_recipes_enabled then
|
||||
dofile(MP.."/iron_age/tools.lua")
|
||||
end
|
||||
|
||||
-- TA1 Watermill
|
||||
dofile(MP.."/ta1_watermill/ta1_axle.lua")
|
||||
dofile(MP.."/ta1_watermill/watermill.lua")
|
||||
dofile(MP.."/ta1_watermill/water.lua")
|
||||
dofile(MP.."/ta1_watermill/sluice.lua")
|
||||
dofile(MP.."/ta1_watermill/millboard.lua")
|
||||
dofile(MP.."/ta1_watermill/mill.lua")
|
||||
|
||||
dofile(MP.."/iron_age/recipes.lua")
|
||||
if minetest.global_exists("wielded_light") then
|
||||
if minetest.global_exists("wielded_light") or minetest.global_exists("illumination") then
|
||||
dofile(MP.."/iron_age/meridium.lua")
|
||||
end
|
||||
|
||||
|
@ -76,3 +76,17 @@ minecart.register_inventory(
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
minecart.register_inventory(
|
||||
{
|
||||
"techage:ta1_mill_base",
|
||||
},
|
||||
{
|
||||
put = {
|
||||
listname = "src",
|
||||
},
|
||||
take = {
|
||||
listname = "dst",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
@ -119,7 +119,7 @@ local function register_liquid(source, flowing, itemname, inventory_image, name,
|
||||
|
||||
-------------------------------- Start Modification
|
||||
-- minetest.set_node(lpos, {name = source})
|
||||
if source == "default:lava_source" and lpos.y > 0 then
|
||||
if source == "default:lava_source" and lpos.y > 0 and not minetest.is_singleplayer() then
|
||||
minetest.chat_send_player(user:get_player_name(), S("[Bucket] Lava can only be placed below sea level!"))
|
||||
return
|
||||
else
|
||||
|
@ -135,6 +135,8 @@ techage.register_lamp("techage:growlight", {
|
||||
{-8/16, -8/16, -8/16, 8/16, -13/32, 8/16},
|
||||
},
|
||||
},
|
||||
on_timer = node_timer_off,
|
||||
on_switch_lamp = on_switch_lamp,
|
||||
high_power = true,
|
||||
},{
|
||||
description = S("TA4 LED Grow Light"),
|
||||
@ -156,6 +158,7 @@ techage.register_lamp("techage:growlight", {
|
||||
},
|
||||
},
|
||||
on_timer = node_timer_on,
|
||||
on_switch_lamp = on_switch_lamp,
|
||||
high_power = true,
|
||||
})
|
||||
|
||||
|
@ -109,6 +109,7 @@ TA3 Booster=TA3 Gebläse
|
||||
|
||||
### button.lua ###
|
||||
|
||||
Access:=Zugriff:
|
||||
TA3 Button/Switch=TA3 Taster/Schalter
|
||||
TA4 Button/Switch=TA4 Schalter/Taster
|
||||
|
||||
@ -446,6 +447,8 @@ TA4 Gravel Sieve=TA4 Kiessieb
|
||||
|
||||
Grinder=Mühle
|
||||
Grinding=Mahlen
|
||||
Milling=Mahlen
|
||||
TA1 Mill Base=Mühlenunterteil
|
||||
|
||||
### growlight.lua ###
|
||||
|
||||
@ -642,6 +645,24 @@ Meridium Sword=Meridium Schwert
|
||||
|
||||
TA3 Mesecons Converter=TA3 Mesecons Konverter
|
||||
|
||||
### mill.lua ###
|
||||
|
||||
TA1 Mill=TA1 Mühle
|
||||
TA1 Mill Gear=TA1 Mühlengetriebe
|
||||
|
||||
### millboard.lua ###
|
||||
|
||||
TA1 Acacia Millrace Board=TA1 Akazie Mühlbachbrett
|
||||
TA1 Acacia Wood Board=TA1 Akazienholzbrett
|
||||
TA1 Apple Millrace Board=TA1 Apfel Mühlbachbrett
|
||||
TA1 Apple Wood Board=TA1 Apfelholzbrett
|
||||
TA1 Aspen Millrace Board=TA1 Espe Mühlbachbrett
|
||||
TA1 Aspen Wood Board=TA1 Espenholzbrett
|
||||
TA1 Jungle Millrace Board=TA1 Dschungel Mühlbachbrett
|
||||
TA1 Jungle Wood Board=TA1 Dschungelholzbrett
|
||||
TA1 Pine Millrace Board=TA1 Kiefer Mühlbachbrett
|
||||
TA1 Pine Wood Board=TA1 Kiefernholzbrett
|
||||
|
||||
### minicell.lua ###
|
||||
|
||||
TA4 Streetlamp Solar Cell=TA4 Straßenlampen-Solarzelle
|
||||
@ -877,6 +898,12 @@ TA4 Silo=Silo
|
||||
|
||||
TA Lamp=TA Lampe
|
||||
|
||||
### sluice.lua ###
|
||||
|
||||
TA1 Sluice Gate=TA1 Schleusenschieber
|
||||
TA1 Sluice Handle=TA1 Schleusengriff
|
||||
Your pond is too small!=ein Teich ist zu klein!
|
||||
|
||||
### solarcell.lua ###
|
||||
|
||||
TA4 Solar Carrier Module=TA4 Solar Trägermodul
|
||||
@ -925,6 +952,11 @@ Cancel=Abbruch
|
||||
Note: You can't change any values while the block is running!=Hinweis: Während der Block läuft, kann kein Wert geändert werden!
|
||||
Refresh=Aktualisieren
|
||||
|
||||
### ta1_axle.lua ###
|
||||
|
||||
TA1 Axle=TA1 Achse
|
||||
TA1 Axle Bearing=TA1 Achsenlager
|
||||
|
||||
### ta2_weight_chest.lua ###
|
||||
|
||||
TA2 Weight Chest=TA2 Gewichtekiste
|
||||
@ -1067,13 +1099,23 @@ Usmium Powder=Usmium Pulver
|
||||
TA Valve=TA Ventil
|
||||
TA3 Valve=TA3 Ventil
|
||||
|
||||
### water.lua ###
|
||||
|
||||
Flowing Water=Fließendes Wasser
|
||||
Water Source=Wasserquelle
|
||||
|
||||
### waterinlet.lua ###
|
||||
|
||||
Error: No natural water!=Fehler: Kein natürliches Wasser!
|
||||
Error: No water available!=Fehler: Kein Wasser verfügbar!
|
||||
Error: Not on sea level!=Fehler: Nicht auf Meereshöhe!
|
||||
Operational=Betriebsbereit
|
||||
TA4 Water Inlet=TA4 Wasssereinlass
|
||||
|
||||
### watermill.lua ###
|
||||
|
||||
TA1 Watermill=TA1 Wasssermühle
|
||||
|
||||
### waterpump.lua ###
|
||||
|
||||
TA4 Water Pump=Wasserpumpe
|
||||
@ -1090,4 +1132,3 @@ This is not the surface of the ocean!=Das ist nicht die Meeresoberfläche!
|
||||
[TA4 Wind Turbine]=[TA4 Windkraftanlage]
|
||||
biome and no ocean!=Biom und keine Meer (ocean)!
|
||||
is a suitable place for a wind turbine!=ist ein geeigneter Ort für eine Windkraftanlage!
|
||||
|
||||
|
@ -109,6 +109,7 @@ TA3 Booster=
|
||||
|
||||
### button.lua ###
|
||||
|
||||
Access:=
|
||||
TA3 Button/Switch=
|
||||
TA4 Button/Switch=
|
||||
|
||||
@ -446,6 +447,8 @@ TA4 Gravel Sieve=
|
||||
|
||||
Grinder=
|
||||
Grinding=
|
||||
Milling=
|
||||
TA1 Mill Base=
|
||||
|
||||
### growlight.lua ###
|
||||
|
||||
@ -642,6 +645,24 @@ Meridium Sword=
|
||||
|
||||
TA3 Mesecons Converter=
|
||||
|
||||
### mill.lua ###
|
||||
|
||||
TA1 Mill=
|
||||
TA1 Mill Gear=
|
||||
|
||||
### millboard.lua ###
|
||||
|
||||
TA1 Acacia Millrace Board=
|
||||
TA1 Acacia Wood Board=
|
||||
TA1 Apple Millrace Board=
|
||||
TA1 Apple Wood Board=
|
||||
TA1 Aspen Millrace Board=
|
||||
TA1 Aspen Wood Board=
|
||||
TA1 Jungle Millrace Board=
|
||||
TA1 Jungle Wood Board=
|
||||
TA1 Pine Millrace Board=
|
||||
TA1 Pine Wood Board=
|
||||
|
||||
### minicell.lua ###
|
||||
|
||||
TA4 Streetlamp Solar Cell=
|
||||
@ -877,6 +898,12 @@ TA4 Silo=
|
||||
|
||||
TA Lamp=
|
||||
|
||||
### sluice.lua ###
|
||||
|
||||
TA1 Sluice Gate=
|
||||
TA1 Sluice Handle=
|
||||
Your pond is too small!=
|
||||
|
||||
### solarcell.lua ###
|
||||
|
||||
TA4 Solar Carrier Module=
|
||||
@ -925,6 +952,11 @@ Cancel=
|
||||
Note: You can't change any values while the block is running!=
|
||||
Refresh=
|
||||
|
||||
### ta1_axle.lua ###
|
||||
|
||||
TA1 Axle=
|
||||
TA1 Axle Bearing=
|
||||
|
||||
### ta2_weight_chest.lua ###
|
||||
|
||||
TA2 Weight Chest=
|
||||
@ -1067,13 +1099,23 @@ Usmium Powder=
|
||||
TA Valve=
|
||||
TA3 Valve=
|
||||
|
||||
### water.lua ###
|
||||
|
||||
Flowing Water=
|
||||
Water Source=
|
||||
|
||||
### waterinlet.lua ###
|
||||
|
||||
Error: No natural water!=
|
||||
Error: No water available!=
|
||||
Error: Not on sea level!=
|
||||
Operational=
|
||||
TA4 Water Inlet=
|
||||
|
||||
### watermill.lua ###
|
||||
|
||||
TA1 Watermill=
|
||||
|
||||
### waterpump.lua ###
|
||||
|
||||
TA4 Water Pump=
|
||||
|
@ -56,10 +56,12 @@ local function formspec(meta)
|
||||
local numbers = meta:get_string("numbers") or ""
|
||||
local idx = meta:get_int("cycle_idx") or 0
|
||||
if idx == 0 then idx = 1 end
|
||||
local access_idx = meta:get_string("public") == "true" and 3 or meta:get_string("protected") == "true" and 2 or 1
|
||||
return "size[7.5,6]"..
|
||||
"dropdown[0.2,0;3;type;switch,button 1s,button 2s,button 4s,button 8s,button 16s,button 32s;"..idx.."]"..
|
||||
"field[0.5,2;7,1;numbers;"..S("Insert destination node number(s)")..";"..numbers.."]" ..
|
||||
"checkbox[1,3;public;public;false]"..
|
||||
"label[0.2,3;"..S("Access:").."]"..
|
||||
"dropdown[3,3;4;access;private,protected,public;"..access_idx.."]"..
|
||||
"button_exit[2,4;3,1;exit;"..S("Save").."]"
|
||||
end
|
||||
|
||||
@ -72,8 +74,17 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
return
|
||||
end
|
||||
meta:set_string("numbers", fields.numbers)
|
||||
if fields.public then
|
||||
meta:set_string("public", fields.public)
|
||||
if fields.access == "protected" then
|
||||
meta:set_string("protected", "true")
|
||||
meta:set_string("public", "")
|
||||
end
|
||||
if fields.access == "public" then
|
||||
meta:set_string("public", "true")
|
||||
meta:set_string("protected", "")
|
||||
end
|
||||
if fields.access == "private" then
|
||||
meta:set_string("public", "")
|
||||
meta:set_string("protected", "")
|
||||
end
|
||||
local cycle_time = nil
|
||||
if fields.type == "switch" then
|
||||
@ -110,12 +121,20 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
end
|
||||
end
|
||||
|
||||
local function can_access(pos, player)
|
||||
local meta = M(pos)
|
||||
local public = meta:get_string("public") == "true"
|
||||
local protected = meta:get_string("protected") == "true"
|
||||
local owner = meta:get_string("owner")
|
||||
local name = player:get_player_name()
|
||||
return public or protected and not minetest.is_protected(pos, name) or owner == name
|
||||
end
|
||||
|
||||
local function on_rightclick_on(pos, node, clicker)
|
||||
local meta = M(pos)
|
||||
local fixed = meta:get_string("fixed")
|
||||
if fixed == "true" then
|
||||
if meta:get_string("public") == "true" or
|
||||
clicker:get_player_name() == meta:get_string("owner") then
|
||||
if can_access(pos, clicker) then
|
||||
switch_on(pos)
|
||||
end
|
||||
end
|
||||
@ -126,8 +145,7 @@ local function on_rightclick_off(pos, node, clicker)
|
||||
local numbers = meta:get_string("numbers")
|
||||
local cycle_time = meta:get_int("cycle_time") or 0
|
||||
if numbers ~= "" and numbers ~= nil and cycle_time == 0 then
|
||||
if meta:get_string("public") == "true" or
|
||||
clicker:get_player_name() == meta:get_string("owner") then
|
||||
if can_access(pos, clicker) then
|
||||
switch_off(pos)
|
||||
end
|
||||
end
|
||||
|
@ -106,8 +106,12 @@ end
|
||||
|
||||
local function get_inputs(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
-- old data is needed for formspec 'input' values
|
||||
nvm.old_inp_tbl = table.copy(nvm.inp_tbl or {})
|
||||
for _, num in ipairs(mem.outp_num or {}) do
|
||||
nvm.old_inp_tbl[num] = nvm.outp_tbl[num] or "off"
|
||||
end
|
||||
return nvm.old_inp_tbl
|
||||
end
|
||||
|
||||
@ -148,11 +152,12 @@ local function data(nvm)
|
||||
return table.concat(inp, ", "), table.concat(outp, ", ")
|
||||
end
|
||||
|
||||
local function get_code(pos, nvm)
|
||||
local function get_code(pos, nvm, mem)
|
||||
local meta = M(pos)
|
||||
local tbl = {"local inputs = get_inputs(pos) or {}"}
|
||||
local owner = M(pos):get_string("owner")
|
||||
nvm.own_num = nvm.own_num or M(pos):get_string("node_number")
|
||||
mem.outp_num = {}
|
||||
|
||||
for i = 1,NUM_RULES do
|
||||
local outp = meta:get_string("outp" .. i)
|
||||
@ -167,6 +172,7 @@ local function get_code(pos, nvm)
|
||||
expr = string.gsub(expr, 'on', '"on"')
|
||||
expr = string.gsub(expr, 'off', '"off"')
|
||||
tbl[#tbl + 1] = "if "..expr.." then send(pos, '"..outp.."', '"..val.."') end"
|
||||
table.insert(mem.outp_num, outp)
|
||||
else
|
||||
nvm.error = err
|
||||
return
|
||||
@ -190,7 +196,7 @@ end
|
||||
local function execute(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.code = mem.code or get_code(pos, nvm)
|
||||
mem.code = mem.code or get_code(pos, nvm, mem)
|
||||
if mem.code then
|
||||
local res, _ = pcall(mem.code)
|
||||
if not res then
|
||||
@ -304,7 +310,7 @@ minetest.register_node("techage:ta3_logic2", {
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local mem = techage.get_mem(pos)
|
||||
mem.code = nil
|
||||
get_code(pos, nvm)
|
||||
get_code(pos, nvm, mem)
|
||||
meta:set_string("formspec", formspec(pos, meta))
|
||||
end
|
||||
end,
|
||||
|
@ -268,6 +268,8 @@ techage.register_node({"techage:ta3_sequencer"}, {
|
||||
else
|
||||
nvm.endless = false
|
||||
end
|
||||
elseif topic == "pause" then
|
||||
stop_the_sequencer(pos)
|
||||
else
|
||||
return "unsupported"
|
||||
end
|
||||
|
@ -156,6 +156,23 @@ local function command(pos, command, player)
|
||||
return
|
||||
end
|
||||
|
||||
local cmnd, payload = command:match('^axle%s+([%w_]+)%s*(.*)$')
|
||||
if cmnd then
|
||||
if not minetest.check_player_privs(player, "server") then
|
||||
output(pos, "server privs missing")
|
||||
return
|
||||
end
|
||||
local resp = techage.transfer(
|
||||
pos,
|
||||
"B", -- outdir
|
||||
cmnd, -- topic
|
||||
payload, -- payload
|
||||
techage.TA1Axle, -- network
|
||||
nil) -- valid nodes
|
||||
output(pos, dump(resp))
|
||||
return
|
||||
end
|
||||
|
||||
if command ~= "" then
|
||||
output(pos, CMNDS_TA3)
|
||||
end
|
||||
|
@ -53,6 +53,23 @@ Der Schmelztiegel hat ein eigenes Menü mit Rezepten und ein Inventar, wo du die
|
||||
[coalburner|plan]
|
||||
|
||||
|
||||
## Wassermühle
|
||||
|
||||
Mit der Wassermühle können Weizen und andere Getreide zu Mehl gemahlen und dann im Ofen zu Brot gebacken werden. Die Mühle wird mit
|
||||
Wasserkraft angetrieben. Dazu muss der Mühlbach über ein Kanal zum Wasserrad geführt werden. Für den Mühlbach muss oberhalb des Mühlerades
|
||||
ein Teich angelegt werden. Die Abbilding rechts (auf "Plan" klicken) zeigt den Aufbau.
|
||||
|
||||
[watermill1|plan]
|
||||
|
||||
### TA1 Mühle
|
||||
|
||||
Mit der Wassermühle können Weizen und andere Getreide zu Mehl gemahlen und dann im Ofen zu Brot gebacken werden. Die Mühle wird mit
|
||||
Wasserkraft angetrieben. Dazu muss der Mühlbach über ein Kanal zum Wasserrad geführt werden. Für den Mühlbach muss oberhalb des Mühlerades
|
||||
ein Teich angelegt werden. Die Abbilding rechts (auf "Plan" klicken) zeigt den Aufbau.
|
||||
|
||||
[watermill2|plan]
|
||||
|
||||
|
||||
## Erze und Werkzeuge
|
||||
|
||||
TA1 hat seine eigenen Werkzeuge wie Hammer und Kiessieb, aber auch der Minecart Hopper kann genutzt werden.
|
||||
|
@ -14,6 +14,8 @@
|
||||
- [TA1: Eisenzeitalter](./manual_ta1_DE.md#ta1:-eisenzeitalter)
|
||||
- [Köhler / Coal Pile](./manual_ta1_DE.md#köhler--coal-pile)
|
||||
- [Kohlebrenner / Coal Burner](./manual_ta1_DE.md#kohlebrenner--coal-burner)
|
||||
- [Wassermühle](./manual_ta1_DE.md#wassermühle)
|
||||
- [TA1 Mühle](./manual_ta1_DE.md#ta1-mühle)
|
||||
- [Erze und Werkzeuge](./manual_ta1_DE.md#erze-und-werkzeuge)
|
||||
- [Hammer](./manual_ta1_DE.md#hammer)
|
||||
- [Kiessieb / Gravel Sieve](./manual_ta1_DE.md#kiessieb--gravel-sieve)
|
||||
|
BIN
techage/sounds/techage_mill.ogg
Normal file
BIN
techage/sounds/techage_watermill.ogg
Normal file
178
techage/ta1_watermill/mill.lua
Normal file
@ -0,0 +1,178 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2021 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA1 Mill
|
||||
|
||||
]]--
|
||||
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local function start_mill(pos)
|
||||
local obj = minetest.add_entity(pos, "techage:ta1_mill_entity")
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
|
||||
local function stop_mill(pos, self)
|
||||
minetest.swap_node(pos, {name = "techage:ta1_mill", param2 = 0})
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
local function has_power(pos, y_offs)
|
||||
local pos1 = {x = pos.x, y = pos.y + y_offs, z = pos.z}
|
||||
local nvm = techage.get_nvm(pos1)
|
||||
nvm.watermill_trigger = (nvm.watermill_trigger or 1) - 1
|
||||
return nvm.watermill_trigger > 0
|
||||
end
|
||||
|
||||
techage.ta1_mill_has_power = has_power
|
||||
|
||||
minetest.register_node("techage:ta1_mill_gear", {
|
||||
description = S("TA1 Mill Gear"),
|
||||
tiles = {
|
||||
"default_wood.png^techage_axle_bearing.png^[transformR90",
|
||||
"default_wood.png^techage_axle_bearing.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/2, -1/2, -1/2, 1/2, -1/8, 1/2},
|
||||
{-1/8, -1/8, -1/2, 1/8, 1/8, 1/2},
|
||||
},
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
techage.TA1Axle:after_place_node(pos)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.TA1Axle:after_dig_node(pos)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2},
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta1_mill_gear"}, {
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if topic == "trigger" then
|
||||
nvm.watermill_trigger = 4
|
||||
return true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta1_mill", {
|
||||
description = S("TA1 Mill"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_mill_side.png",
|
||||
"techage_mill_side.png",
|
||||
"techage_mill_side.png",
|
||||
"techage_mill_side.png",
|
||||
"techage_mill_front.png",
|
||||
"techage_mill_front.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/8, -1/8, -1/8, 1/8, 4/8, 1/8},
|
||||
{-3/8, -3/8, -4/8, -1/8, 3/8, 4/8},
|
||||
{-3/8, -4/8, -3/8, -1/8, 4/8, 3/8},
|
||||
{ 1/8, -3/8, -4/8, 3/8, 3/8, 4/8},
|
||||
{ 1/8, -4/8, -3/8, 3/8, 4/8, 3/8},
|
||||
},
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
start_mill(pos)
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
if has_power(pos, 1) then
|
||||
start_mill(pos)
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2},
|
||||
})
|
||||
|
||||
minetest.register_entity("techage:ta1_mill_entity", {
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
visual = "wielditem",
|
||||
wield_item = "techage:ta1_mill",
|
||||
visual_size = {x=0.67, y=0.67, z=0.67},
|
||||
static_save = true,
|
||||
automatic_rotate = -math.pi * 0.2,
|
||||
pointable = false,
|
||||
},
|
||||
|
||||
on_step = function(self, dtime)
|
||||
self.dtime = (self.dtime or 0) + dtime
|
||||
|
||||
if self.dtime > 2 then
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
if not has_power(pos, 1) then
|
||||
stop_mill(pos, self)
|
||||
end
|
||||
self.dtime = 0
|
||||
minetest.sound_play("techage_mill", {gain = 0.3, pos = pos,
|
||||
max_hear_distance = 10}, true)
|
||||
end
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
stop_mill(pos, self)
|
||||
end,
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta1_mill"}, {
|
||||
on_node_load = function(pos, node)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_mill_gear",
|
||||
recipe = {
|
||||
{"default:wood", "", "default:wood"},
|
||||
{"techage:ta1_axle", "default:wood", "techage:ta1_axle"},
|
||||
{"default:wood", "techage:ta1_axle", "default:wood"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_mill",
|
||||
recipe = {
|
||||
{"", "techage:iron_ingot", ""},
|
||||
{"stairs:slab_stone", "techage:iron_ingot", "stairs:slab_stone"},
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
91
techage/ta1_watermill/millboard.lua
Normal file
@ -0,0 +1,91 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2021 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA1 mill boards
|
||||
|
||||
]]--
|
||||
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local function register_board1(output, description, tiles, input)
|
||||
minetest.register_node(output, {
|
||||
description = description,
|
||||
tiles = tiles,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/2, -4/8, -1/2, 1/2, -3/8, 1/2},
|
||||
},
|
||||
},
|
||||
paramtype2 = "wallmounted",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = output .. " 3",
|
||||
recipe = {
|
||||
{"", "", input},
|
||||
{"", "", input},
|
||||
{"", "", input},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local function register_board2(output, description, tiles, input1, input2)
|
||||
minetest.register_node(output, {
|
||||
description = description,
|
||||
tiles = tiles,
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/2, 3/8, -1/2, 1/2, 4/8, 1/2},
|
||||
{-1/2, 3/16, -2/16, 1/2, 6/16, 2/16},
|
||||
{-1/2, -5/16, -1/16, 1/2, -3/16, 1/16},
|
||||
},
|
||||
},
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = output,
|
||||
recipe = {
|
||||
{"", input1, ""},
|
||||
{"", input2, ""},
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
register_board1("techage:ta1_board1_apple", S("TA1 Apple Wood Board"), {"default_wood.png"}, "stairs:slab_wood")
|
||||
register_board1("techage:ta1_board1_jungle", S("TA1 Jungle Wood Board"), {"default_junglewood.png"}, "stairs:slab_junglewood")
|
||||
register_board1("techage:ta1_board1_pine", S("TA1 Pine Wood Board"), {"default_pine_wood.png"}, "stairs:slab_pine_wood")
|
||||
register_board1("techage:ta1_board1_acacia", S("TA1 Acacia Wood Board"), {"default_acacia_wood.png"}, "stairs:slab_acacia_wood")
|
||||
register_board1("techage:ta1_board1_aspen", S("TA1 Aspen Wood Board"), {"default_aspen_wood.png"}, "stairs:slab_aspen_wood")
|
||||
|
||||
register_board2("techage:ta1_board2_apple", S("TA1 Apple Millrace Board"), {"default_wood.png"}, "techage:ta1_board1_apple", "default:fence_rail_wood")
|
||||
register_board2("techage:ta1_board2_jungle", S("TA1 Jungle Millrace Board"), {"default_junglewood.png"}, "techage:ta1_board1_jungle", "default:fence_rail_junglewood")
|
||||
register_board2("techage:ta1_board2_pine", S("TA1 Pine Millrace Board"), {"default_pine_wood.png"}, "techage:ta1_board1_pine", "default:fence_rail_pine_wood")
|
||||
register_board2("techage:ta1_board2_acacia", S("TA1 Acacia Millrace Board"), {"default_acacia_wood.png"}, "techage:ta1_board1_acacia", "default:fence_rail_acacia_wood")
|
||||
register_board2("techage:ta1_board2_aspen", S("TA1 Aspen Millrace Board"), {"default_aspen_wood.png"}, "techage:ta1_board1_aspen", "default:fence_rail_aspen_wood")
|
227
techage/ta1_watermill/sluice.lua
Normal file
@ -0,0 +1,227 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2021 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA1 Sluice Gate
|
||||
|
||||
]]--
|
||||
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local RADIUS = 8
|
||||
local DEPTH = 2
|
||||
local AMOUNT = RADIUS * RADIUS * 1.5
|
||||
|
||||
local function check_position(pos, facedir)
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
local pos_ = vector.add(pos, dir)
|
||||
local node = minetest.get_node(pos_)
|
||||
|
||||
if node.name ~= "default:water_source" then
|
||||
return
|
||||
end
|
||||
|
||||
dir = vector.multiply(dir, RADIUS)
|
||||
local center = vector.add(pos, dir)
|
||||
local pos1 = {x = center.x - RADIUS, y = center.y - DEPTH, z = center.z - RADIUS}
|
||||
local pos2 = {x = center.x + RADIUS, y = center.y + 0, z = center.z + RADIUS}
|
||||
local _, nodes = minetest.find_nodes_in_area(pos1, pos2, {"default:water_source"})
|
||||
return (nodes["default:water_source"] and nodes["default:water_source"] > AMOUNT) or false
|
||||
end
|
||||
|
||||
-- Function checks if a millpond is avaliable and
|
||||
-- returns the pos for the new water block, and the type of block.
|
||||
local function has_water(pos, facedir, player)
|
||||
local facedir2, res, dir, pos2
|
||||
|
||||
-- check left side
|
||||
facedir2 = (facedir + 3) % 4
|
||||
res = check_position(pos, facedir2)
|
||||
facedir2 = (facedir + 1) % 4
|
||||
dir = minetest.facedir_to_dir(facedir2)
|
||||
pos2 = vector.add(pos, dir)
|
||||
|
||||
if res == nil then
|
||||
return pos2, "air"
|
||||
elseif res == true then
|
||||
return pos2, "water"
|
||||
else
|
||||
minetest.chat_send_player(player:get_player_name(), S("Your pond is too small!"))
|
||||
return pos2, "air"
|
||||
end
|
||||
|
||||
-- check right side
|
||||
facedir2 = (facedir + 1) % 4
|
||||
res = check_position(pos, facedir2)
|
||||
facedir2 = (facedir + 3) % 4
|
||||
dir = minetest.facedir_to_dir(facedir2)
|
||||
pos2 = vector.add(pos, dir)
|
||||
|
||||
if res == nil then
|
||||
return pos2, "air"
|
||||
elseif res == true then
|
||||
return pos2, "water"
|
||||
else
|
||||
minetest.chat_send_player(player:get_player_name(), S("Your pond is too small!"))
|
||||
return pos2, "air"
|
||||
end
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker, itemstack, pointed_thing)
|
||||
local pos2 = vector.add(pos, {x = 0, y = -1, z = 0})
|
||||
local node2 = minetest.get_node(pos2)
|
||||
local pos3, res = has_water(pos2, node2.param2, clicker)
|
||||
local node3 = minetest.get_node(pos3)
|
||||
|
||||
if node2.name == "techage:ta1_sluice_closed" then
|
||||
minetest.swap_node(pos, {name = "techage:ta1_sluice_handle_open", param2 = node.param2})
|
||||
minetest.swap_node(pos2, {name = "techage:ta1_sluice_open", param2 = node.param2})
|
||||
if res == "water" then
|
||||
if node3.name == "air" or node3.name == "techage:water_flowing" then
|
||||
minetest.add_node(pos3, {name = "techage:water_source"})
|
||||
minetest.get_node_timer(pos3):start(2)
|
||||
end
|
||||
else
|
||||
minetest.add_node(pos3, {name = "air"})
|
||||
end
|
||||
minetest.sound_play("doors_door_open", {gain = 0.5, pos = pos,
|
||||
max_hear_distance = 10}, true)
|
||||
elseif node2.name == "techage:ta1_sluice_open" then
|
||||
minetest.swap_node(pos, {name = "techage:ta1_sluice_handle_closed", param2 = node.param2})
|
||||
minetest.swap_node(pos2, {name = "techage:ta1_sluice_closed", param2 = node.param2})
|
||||
if res == "water" then
|
||||
if node3.name == "techage:water_source" then
|
||||
minetest.add_node(pos3, {name = "techage:water_flowing"})
|
||||
end
|
||||
else
|
||||
if node3.name == "techage:water_flowing" then
|
||||
minetest.add_node(pos3, {name = "air"})
|
||||
end
|
||||
end
|
||||
minetest.sound_play("doors_door_close", {gain = 0.5, pos = pos,
|
||||
max_hear_distance = 10}, true)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta1_sluice_closed", {
|
||||
description = S("TA1 Sluice Gate"),
|
||||
tiles = {
|
||||
"default_wood.png^techage_junglewood_top.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png^techage_junglewood.png",
|
||||
"default_wood.png^techage_junglewood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-8/16, -8/16, 5/16, 8/16, 8/16, 8/16},
|
||||
{-8/16, -8/16, -8/16, 8/16, 8/16, -5/16},
|
||||
{-8/16, -8/16, -8/16, 8/16, -5/16, 8/16},
|
||||
{-1/16, -5/16, -7/16, 1/16, 8/16, 7/16},
|
||||
},
|
||||
},
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta1_sluice_open", {
|
||||
description = S("TA1 Sluice Gate"),
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-8/16, -8/16, 5/16, 8/16, 8/16, 8/16},
|
||||
{-8/16, -8/16, -8/16, 8/16, 8/16, -5/16},
|
||||
{-8/16, -8/16, -8/16, 8/16, -5/16, 8/16},
|
||||
},
|
||||
},
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "techage:sluice_closed",
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta1_sluice_handle_closed", {
|
||||
description = S("TA1 Sluice Handle"),
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-8/16, -8/16, -8/16, 8/16, 0/16, 8/16},
|
||||
{-1/16, 0/16, -1/16, 1/16, 4/16, 1/16},
|
||||
{-1/16, 2/16, -4/16, 1/16, 4/16, 4/16},
|
||||
},
|
||||
},
|
||||
on_rightclick = on_rightclick,
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta1_sluice_handle_open", {
|
||||
description = S("TA1 Sluice Handle"),
|
||||
tiles = {"default_wood.png"},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-8/16, -8/16, -8/16, 8/16, 0/16, 8/16},
|
||||
{-1/16, 0/16, -1/16, 1/16, 14/16, 1/16},
|
||||
{-1/16, 14/16, -4/16, 1/16, 16/16, 4/16},
|
||||
},
|
||||
},
|
||||
on_rightclick = on_rightclick,
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = "techage:sluice_handle_closed",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_sluice_closed",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"techage:ta1_board1_apple", "techage:ta1_board1_jungle", "techage:ta1_board1_apple"},
|
||||
{"", "techage:ta1_board1_apple", ""},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_sluice_handle_closed",
|
||||
recipe = {
|
||||
{"default:stick", "default:stick", "default:stick"},
|
||||
{"", "default:stick", ""},
|
||||
{"", "stairs:slab_wood", ""},
|
||||
},
|
||||
})
|
176
techage/ta1_watermill/ta1_axle.lua
Normal file
@ -0,0 +1,176 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA1 Axles for the Watermill
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local Axle = tubelib2.Tube:new({
|
||||
dirs_to_check = {1,2,3,4,5,6},
|
||||
max_tube_length = 5,
|
||||
show_infotext = false,
|
||||
tube_type = "axle1",
|
||||
primary_node_names = {"techage:ta1_axle"},
|
||||
secondary_node_names = {"techage:ta1_mill_gear", "techage:ta1_axle_bearing1", "techage:ta1_axle_bearing2"},
|
||||
after_place_tube = function(pos, param2, tube_type, num_tubes, state)
|
||||
minetest.swap_node(pos, {name = "techage:ta1_axle", param2 = param2})
|
||||
end,
|
||||
})
|
||||
|
||||
Axle:set_valid_sides("techage:ta1_mill_gear", {"F", "B"})
|
||||
Axle:set_valid_sides("techage:ta1_axle_bearing1", {"F", "B"})
|
||||
Axle:set_valid_sides("techage:ta1_axle_bearing2", {"F", "B"})
|
||||
|
||||
minetest.register_node("techage:ta1_axle", {
|
||||
description = S("TA1 Axle"),
|
||||
tiles = {
|
||||
"techage_axle_bearing.png^[transformR90",
|
||||
"techage_axle_bearing.png^[transformR90",
|
||||
"techage_axle_bearing.png",
|
||||
"techage_axle_bearing.png",
|
||||
"techage_axle_bearing.png",
|
||||
"techage_axle_bearing.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/8, -1/8, -4/8, 1/8, 1/8, 4/8},
|
||||
},
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
if not Axle:after_place_tube(pos, placer, pointed_thing) then
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Axle:after_dig_tube(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir", -- important!
|
||||
on_rotate = screwdriver.disallow, -- important!
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {crumbly = 3, cracky = 3, snappy = 3},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
-- Bearings are defined as secondary nodes which forward received 'on_transfer' commands
|
||||
minetest.register_node("techage:ta1_axle_bearing1", {
|
||||
description = S("TA1 Axle Bearing"),
|
||||
tiles = {
|
||||
"default_stone_brick.png^techage_axle_bearing.png^[transformR90",
|
||||
"default_stone_brick.png^techage_axle_bearing.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/2, -1/2, -1/2, 1/2, -1/8, 1/2},
|
||||
{-1/8, -1/8, -1/2, 1/8, 1/8, 1/2},
|
||||
},
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
Axle:after_place_node(pos)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Axle:after_dig_node(pos)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2},
|
||||
})
|
||||
|
||||
minetest.register_node("techage:ta1_axle_bearing2", {
|
||||
description = S("TA1 Axle Bearing"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"default_stone_brick.png",
|
||||
"default_stone_brick.png",
|
||||
"default_stone_brick.png",
|
||||
"default_stone_brick.png",
|
||||
"default_stone_brick.png^techage_axle_bearing_front.png",
|
||||
"default_stone_brick.png^techage_axle_bearing_front.png",
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
Axle:after_place_node(pos)
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Axle:after_dig_node(pos)
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2},
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta1_axle_bearing1", "techage:ta1_axle_bearing2"}, {
|
||||
on_transfer = function(pos, in_dir, topic, payload)
|
||||
return techage.transfer(
|
||||
pos,
|
||||
in_dir, -- outdir
|
||||
topic,
|
||||
payload,
|
||||
Axle, -- network
|
||||
nil) -- valid nodes
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_axle",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"techage:iron_ingot", "dye:black", "techage:iron_ingot"},
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_axle_bearing1",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"", "techage:ta1_axle", ""},
|
||||
{"", "stairs:slab_stonebrick", ""},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_axle_bearing2",
|
||||
recipe = {
|
||||
{"", "", ""},
|
||||
{"", "techage:ta1_axle", ""},
|
||||
{"", "default:stonebrick", ""},
|
||||
},
|
||||
})
|
||||
|
||||
techage.TA1Axle = Axle
|
117
techage/ta1_watermill/water.lua
Normal file
@ -0,0 +1,117 @@
|
||||
-- Based on and derived from minetest_game.default
|
||||
-- License: LGPL v2.1
|
||||
|
||||
-- support for MT game translation.
|
||||
local S = default.get_translator
|
||||
|
||||
minetest.register_node("techage:water_flowing", {
|
||||
description = S("Flowing Water"),
|
||||
drawtype = "flowingliquid",
|
||||
waving = 0,
|
||||
tiles = {"default_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.5,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.5,
|
||||
},
|
||||
},
|
||||
},
|
||||
use_texture_alpha = "blend",
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "flowing",
|
||||
liquid_alternative_flowing = "techage:water_flowing",
|
||||
liquid_alternative_source = "techage:water_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, cools_lava = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_water_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:water_source", {
|
||||
description = S("Water Source"),
|
||||
drawtype = "flowingliquid",
|
||||
waving = 0,
|
||||
tiles = {"default_water.png"},
|
||||
special_tiles = {
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = false,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.5,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "default_water_flowing_animated.png",
|
||||
backface_culling = true,
|
||||
animation = {
|
||||
type = "vertical_frames",
|
||||
aspect_w = 16,
|
||||
aspect_h = 16,
|
||||
length = 0.5,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
use_texture_alpha = "blend",
|
||||
paramtype = "light",
|
||||
paramtype2 = "flowingliquid",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = false,
|
||||
drop = "",
|
||||
drowning = 1,
|
||||
liquidtype = "source",
|
||||
liquid_alternative_flowing = "techage:water_flowing",
|
||||
liquid_alternative_source = "techage:water_source",
|
||||
liquid_viscosity = 1,
|
||||
post_effect_color = {a = 103, r = 30, g = 60, b = 90},
|
||||
groups = {water = 3, liquid = 3, cools_lava = 1, not_in_creative_inventory = 1},
|
||||
sounds = default.node_sound_water_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("techage:water_stop", {
|
||||
description = "Water Stop",
|
||||
drawtype = "glasslike_framed_optional",
|
||||
tiles = {"techage_invisible.png"},
|
||||
inventory_image = 'techage_invisible_inv.png',
|
||||
|
||||
use_texture_alpha = "blend",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
drop = "",
|
||||
})
|
300
techage/ta1_watermill/watermill.lua
Normal file
@ -0,0 +1,300 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2021 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA1 Watermill
|
||||
|
||||
]]--
|
||||
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local function calc_dir(dir, facedir)
|
||||
if facedir == 1 then
|
||||
return {x = dir.z, y = dir.y, z = -dir.x}
|
||||
elseif facedir == 2 then
|
||||
return {x = -dir.x, y = dir.y, z = -dir.z}
|
||||
elseif facedir == 3 then
|
||||
return {x = -dir.z, y = dir.y, z = dir.x}
|
||||
end
|
||||
return {x = dir.x, y = dir.y, z = dir.z}
|
||||
end
|
||||
|
||||
local function add_node(pos, dir, facedir, node_name)
|
||||
local pos2 = vector.add(pos, calc_dir(dir, facedir))
|
||||
local node = minetest.get_node(pos2)
|
||||
if techage.is_air_like(node.name) then
|
||||
minetest.swap_node(pos2, {name = node_name})
|
||||
end
|
||||
end
|
||||
|
||||
local function remove_node(pos, dir, facedir, node_name)
|
||||
local pos2 = vector.add(pos, calc_dir(dir, facedir))
|
||||
local node = minetest.get_node(pos2)
|
||||
if node.name == node_name then
|
||||
minetest.swap_node(pos2, {name = "air"})
|
||||
end
|
||||
end
|
||||
|
||||
local function water_flowing(pos, facedir, tRes)
|
||||
facedir = ((facedir or 0) + 1) % 4
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
|
||||
local pos2 = vector.add(pos, dir)
|
||||
pos2.y = pos2.y + 1
|
||||
local node = minetest.get_node(pos2)
|
||||
if node.name == "techage:water_flowing" then
|
||||
tRes.backward = false
|
||||
return true
|
||||
end
|
||||
|
||||
pos2 = vector.subtract(pos, dir)
|
||||
pos2.y = pos2.y + 1
|
||||
node = minetest.get_node(pos2)
|
||||
if node.name == "techage:water_flowing" then
|
||||
tRes.backward = true
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
local function enough_space(pos, facedir)
|
||||
local pos1 = vector.add(pos, calc_dir({x =-1, y =-1, z = 0}, facedir))
|
||||
local pos2 = vector.add(pos, calc_dir({x = 1, y = 1, z = 0}, facedir))
|
||||
local _, nodes = minetest.find_nodes_in_area(pos1, pos2, {"air"})
|
||||
return nodes["air"] and nodes["air"] == 8
|
||||
end
|
||||
|
||||
local function remove_nodes(pos, facedir)
|
||||
remove_node(pos, {x = 0, y = 1, z = 0}, facedir, "techage:water_stop")
|
||||
remove_node(pos, {x =-1, y = 0, z = 0}, facedir, "techage:water_stop")
|
||||
remove_node(pos, {x = 1, y = 0, z = 0}, facedir, "techage:water_stop")
|
||||
remove_node(pos, {x =-1, y = 1, z =-1}, facedir, "techage:water_stop")
|
||||
remove_node(pos, {x = 1, y = 1, z =-1}, facedir, "techage:water_stop")
|
||||
remove_node(pos, {x =-1, y = 1, z = 1}, facedir, "techage:water_stop")
|
||||
remove_node(pos, {x = 1, y = 1, z = 1}, facedir, "techage:water_stop")
|
||||
end
|
||||
|
||||
local function start_wheel(pos, facedir, backward)
|
||||
local obj = minetest.add_entity(pos, "techage:ta1_watermill_entity")
|
||||
local dir = minetest.facedir_to_dir(facedir)
|
||||
local yaw = minetest.dir_to_yaw(dir)
|
||||
if backward then
|
||||
obj:set_rotation({x=-math.pi/2, y=yaw, z=0})
|
||||
else
|
||||
obj:set_rotation({x=math.pi/2, y=yaw, z=0})
|
||||
end
|
||||
local self = obj:get_luaentity()
|
||||
self.facedir = facedir
|
||||
|
||||
add_node(pos, {x = 0, y = 1, z = 0}, facedir, "techage:water_stop")
|
||||
add_node(pos, {x =-1, y = 0, z = 0}, facedir, "techage:water_stop")
|
||||
add_node(pos, {x = 1, y = 0, z = 0}, facedir, "techage:water_stop")
|
||||
add_node(pos, {x =-1, y = 1, z =-1}, facedir, "techage:water_stop")
|
||||
add_node(pos, {x = 1, y = 1, z =-1}, facedir, "techage:water_stop")
|
||||
add_node(pos, {x =-1, y = 1, z = 1}, facedir, "techage:water_stop")
|
||||
add_node(pos, {x = 1, y = 1, z = 1}, facedir, "techage:water_stop")
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
|
||||
local function stop_wheel(pos, self)
|
||||
self.facedir = self.facedir or 0
|
||||
if self.facedir == 0 or self.facedir == 2 then
|
||||
minetest.swap_node(pos, {name = "techage:ta1_watermill", param2 = 4})
|
||||
M(pos):set_int("facedir", self.facedir)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
elseif self.facedir == 1 or self.facedir == 3 then
|
||||
minetest.swap_node(pos, {name = "techage:ta1_watermill", param2 = 13})
|
||||
M(pos):set_int("facedir", self.facedir)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end
|
||||
|
||||
remove_nodes(pos, self.facedir)
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
local function trigger_consumer(pos, facedir)
|
||||
local outdir = facedir + 1
|
||||
local resp = techage.transfer(
|
||||
pos,
|
||||
outdir, -- outdir
|
||||
"trigger", -- topic
|
||||
nil, -- payload
|
||||
techage.TA1Axle, -- network
|
||||
nil) -- valid nodes
|
||||
if not resp then
|
||||
outdir = tubelib2.Turn180Deg[outdir]
|
||||
resp = techage.transfer(
|
||||
pos,
|
||||
outdir, -- outdir
|
||||
"trigger", -- topic
|
||||
nil, -- payload
|
||||
techage.TA1Axle, -- network
|
||||
nil) -- valid nodes
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("techage:ta1_watermill", {
|
||||
description = S("TA1 Watermill"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
|
||||
|
||||
{-4.5/2, -1/2, 0.8/2, 4.5/2, 1/2, 1.0/2},
|
||||
{-4.5/2, -1/2, -1.0/2, 4.5/2, 1/2, -0.8/2},
|
||||
{-3.8/2, -1/2, 2.1/2, 3.8/2, 1/2, 2.3/2},
|
||||
{-3.8/2, -1/2, -2.3/2, 3.8/2, 1/2, -2.1/2},
|
||||
|
||||
{ 0.8/2, -1/2, -4.5/2, 1.0/2, 1/2, 4.5/2},
|
||||
{-1.0/2, -1/2, -4.5/2, -0.8/2, 1/2, 4.5/2},
|
||||
{ 2.1/2, -1/2, -3.8/2, 2.3/2, 1/2, 3.8/2},
|
||||
{-2.3/2, -1/2, -3.8/2, -2.1/2, 1/2, 3.8/2},
|
||||
},
|
||||
},
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
start_wheel(pos, M(pos):get_int("facedir"))
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
local tRes = {}
|
||||
if water_flowing(pos, M(pos):get_int("facedir"), tRes) then
|
||||
start_wheel(pos, M(pos):get_int("facedir"), tRes.backward)
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
paramtype = "light",
|
||||
use_texture_alpha = techage.CLIP,
|
||||
sunlight_propagates = true,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2, crumbly = 2, choppy = 2, not_in_creative_inventory = 1},
|
||||
node_placement_prediction = "",
|
||||
drop = "techage:ta1_watermill_inv",
|
||||
})
|
||||
|
||||
-- A smaller one for the inventory
|
||||
minetest.register_node("techage:ta1_watermill_inv", {
|
||||
description = S("TA1 Watermill"),
|
||||
--inventory_image = "techage_waterwheel_inv.png",
|
||||
--wield_image = "techage_waterwheel_inv.png",
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/4, -1/4, -1/4, 1/4, 1/4, 1/4},
|
||||
|
||||
{-4.5/4, 0.8/4, -1/4, 4.5/4, 1.0/4, 1/4},
|
||||
{-4.5/4, -1.0/4, -1/4, 4.5/4, -0.8/4, 1/4},
|
||||
{-3.8/4, 2.1/4, -1/4, 3.8/4, 2.3/4, 1/4},
|
||||
{-3.8/4, -2.3/4, -1/4, 3.8/4, -2.1/4, 1/4},
|
||||
|
||||
{ 0.8/4, -4.5/4, -1/4, 1.0/4, 4.5/4, 1/4},
|
||||
{-1.0/4, -4.5/4, -1/4, -0.8/4, 4.5/4, 1/4},
|
||||
{ 2.1/4, -3.8/4, -1/4, 2.3/4, 3.8/4, 1/4},
|
||||
{-2.3/4, -3.8/4, -1/4, -2.1/4, 3.8/4, 1/4},
|
||||
},
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local node = minetest.get_node(pos)
|
||||
M(pos):set_int("facedir", node.param2)
|
||||
remove_nodes(pos, node.param2)
|
||||
if (node.param2 == 0 or node.param2 == 2) and enough_space(pos, node.param2) then
|
||||
minetest.swap_node(pos, {name = "techage:ta1_watermill", param2 = 4})
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
elseif (node.param2 == 1 or node.param2 == 3) and enough_space(pos, node.param2) then
|
||||
minetest.swap_node(pos, {name = "techage:ta1_watermill", param2 = 13})
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
else
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
node_placement_prediction = "",
|
||||
diggable = false,
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta1_watermill"}, {
|
||||
on_node_load = function(pos, node)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_entity("techage:ta1_watermill_entity", {
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collisionbox = {-0.5, -1.5, -1.5, 0.5, 1.5, 1.5},
|
||||
visual = "wielditem",
|
||||
wield_item = "techage:ta1_watermill",
|
||||
visual_size = {x=0.67, y=0.67, z=0.67},
|
||||
static_save = true,
|
||||
automatic_rotate = -math.pi * 0.2,
|
||||
pointable = false,
|
||||
},
|
||||
|
||||
on_step = function(self, dtime)
|
||||
self.dtime = (self.dtime or 0) + dtime
|
||||
|
||||
if self.dtime > 2 then
|
||||
self.dtime = 0
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
if not water_flowing(pos, self.facedir, {}) then
|
||||
stop_wheel(pos, self)
|
||||
end
|
||||
trigger_consumer(pos, self.facedir)
|
||||
minetest.sound_play("techage_watermill", {gain = 0.3, pos = pos,
|
||||
max_hear_distance = 10}, true)
|
||||
end
|
||||
end,
|
||||
|
||||
on_rightclick = function(self, clicker)
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
stop_wheel(pos, self)
|
||||
end,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
self.facedir = tonumber(staticdata) or 0
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
return self.facedir
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta1_watermill_inv",
|
||||
recipe = {
|
||||
{"techage:ta1_board1_apple", "techage:ta1_board1_apple", "techage:ta1_board1_apple"},
|
||||
{"techage:ta1_board1_apple", "default:wood", "techage:ta1_board1_apple"},
|
||||
{"techage:ta1_board1_apple", "techage:ta1_board1_apple", "techage:ta1_board1_apple"},
|
||||
},
|
||||
})
|
@ -187,11 +187,24 @@ minetest.register_node("techage:tiny_generator", {
|
||||
on_rotate = screwdriver.disallow,
|
||||
is_ground_content = false,
|
||||
|
||||
after_place_node = function(pos)
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local number = techage.add_node(pos, "techage:tiny_generator")
|
||||
nvm.running = false
|
||||
nvm.burn_cycles = 0
|
||||
if itemstack then
|
||||
local stack_meta = itemstack:get_meta()
|
||||
if stack_meta then
|
||||
local liquid_name = stack_meta:get_string("liquid_name")
|
||||
local liquid_amount = stack_meta:get_int("liquid_amount")
|
||||
if liquid_name ~= "" and fuel.burntime(liquid.name) and
|
||||
liquid_amount >= 0 and liquid_amount <= fuel.CAPACITY then
|
||||
nvm.liquid = nvm.liquid or {}
|
||||
nvm.liquid.name = liquid_name
|
||||
nvm.liquid.amount = liquid_amount
|
||||
end
|
||||
end
|
||||
end
|
||||
State:node_init(pos, nvm, number)
|
||||
M(pos):set_string("formspec", formspec(State, pos, nvm))
|
||||
M(pos):set_int("outdir", networks.side_to_outdir(pos, "R"))
|
||||
@ -205,13 +218,25 @@ minetest.register_node("techage:tiny_generator", {
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
|
||||
preserve_metadata = function(pos, oldnode, oldmetadata, drops)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if nvm.liquid and nvm.liquid.name and nvm.liquid.amount > 0 then
|
||||
-- generator tank is not empty
|
||||
local meta = drops[1]:get_meta()
|
||||
meta:set_string("liquid_name", nvm.liquid.name)
|
||||
meta:set_int("liquid_amount", nvm.liquid.amount)
|
||||
meta:set_string("description", S("TA3 Tiny Power Generator") .. " (fuel: " ..
|
||||
tostring(nvm.liquid and nvm.liquid.amount or 0) .. "/" ..
|
||||
tostring(fuel.CAPACITY) .. ")")
|
||||
end
|
||||
end,
|
||||
|
||||
get_generator_data = get_generator_data,
|
||||
ta3_formspec = techage.generator_settings("ta3", PWR_PERF),
|
||||
on_receive_fields = on_receive_fields,
|
||||
on_rightclick = on_rightclick,
|
||||
on_punch = fuel.on_punch,
|
||||
on_timer = node_timer,
|
||||
can_dig = fuel.can_dig,
|
||||
})
|
||||
|
||||
minetest.register_node("techage:tiny_generator_on", {
|
||||
|
BIN
techage/textures/techage_axle_bearing.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
techage/textures/techage_axle_bearing_front.png
Normal file
After Width: | Height: | Size: 127 B |
BIN
techage/textures/techage_invisible.png
Normal file
After Width: | Height: | Size: 126 B |
BIN
techage/textures/techage_invisible_inv.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
techage/textures/techage_junglewood.png
Normal file
After Width: | Height: | Size: 151 B |
BIN
techage/textures/techage_junglewood_top.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
techage/textures/techage_mill_base.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
techage/textures/techage_mill_front.png
Normal file
After Width: | Height: | Size: 146 B |
BIN
techage/textures/techage_mill_inv.png
Normal file
After Width: | Height: | Size: 737 B |
BIN
techage/textures/techage_mill_side.png
Normal file
After Width: | Height: | Size: 305 B |
BIN
techage/textures/techage_sluice1_inv.png
Normal file
After Width: | Height: | Size: 607 B |
BIN
techage/textures/techage_sluice2_inv.png
Normal file
After Width: | Height: | Size: 835 B |
BIN
techage/textures/techage_water_flowing.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
techage/textures/techage_watermill1_inv.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
techage/textures/techage_watermill2_inv.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
techage/textures/techage_watermill3_inv.png
Normal file
After Width: | Height: | Size: 120 B |
BIN
techage/textures/techage_watermill4_inv.png
Normal file
After Width: | Height: | Size: 165 B |
BIN
techage/textures/techage_wood50.png
Normal file
After Width: | Height: | Size: 163 B |