diff --git a/basic_machines/ta4_chest.lua b/basic_machines/ta4_chest.lua index 5aa24bd..3eacd0e 100644 --- a/basic_machines/ta4_chest.lua +++ b/basic_machines/ta4_chest.lua @@ -96,7 +96,7 @@ local function max_stacksize(item_name) -- It is sufficient to use minetest.registered_items as all registration -- functions (node, craftitems, tools) add the definitions there. local ndef = minetest.registered_items[item_name] - -- Return 1 as fallback so that slots with unknown item scan be emptied. + -- Return 1 as fallback so that slots with unknown items can be emptied. return ndef and ndef.stack_max or 1 end diff --git a/basis/mark.lua b/basis/mark.lua index 4b76773..20f2980 100644 --- a/basis/mark.lua +++ b/basis/mark.lua @@ -26,6 +26,8 @@ end function techage.mark_region(name, pos1, pos2, owner, secs) + if not name or not pos1 or not pos2 then return end + techage.unmark_region(name) local thickness = 0.2 diff --git a/basis/windturbine_lib.lua b/basis/windturbine_lib.lua index 506be5c..31a30b6 100644 --- a/basis/windturbine_lib.lua +++ b/basis/windturbine_lib.lua @@ -60,7 +60,7 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines) pos2 = {x=pos.x+20, y=1, z=pos.z+20} num = #minetest.find_nodes_in_area(pos1, pos2, {"default:water_source", "default:water_flowing", "ignore"}) - print(num, (41 * 41 * 0.9)) + if num < (41*41 * 0.8) then techage.mark_region(player_name, pos1, pos2, "") chat_message(player_name, S("Here is not enough water (41x41 m)!")) @@ -69,6 +69,7 @@ function techage.valid_place_for_windturbine(pos, player_name, num_turbines) -- Check for next wind turbine pos1 = {x=pos.x-13, y=2, z=pos.z-13} pos2 = {x=pos.x+13, y=22, z=pos.z+13} + num = #minetest.find_nodes_in_area(pos1, pos2, {"techage:ta4_wind_turbine"}) if num > num_turbines then techage.mark_region(player_name, pos1, pos2, "") diff --git a/manuals/manual_ta4_DE.md b/manuals/manual_ta4_DE.md index 1eadb54..8fae311 100644 --- a/manuals/manual_ta4_DE.md +++ b/manuals/manual_ta4_DE.md @@ -7,10 +7,11 @@ Regenerative Energiequellen wie Wind, Sonne und Biokraft helfen dir, das Ölzeit ## Windkraftanlage -Eine Windkraftanlagen liefern immer dann Strom, wenn Wind vorhanden ist. Im Spiel gibt es keinen Wind, aber die Mod simuliert dies dadurch, dass sich nur morgens (5:00 - 9:00) und abends (17:00 - 21:00) die Windräder drehen und damit Strom liefern, sofern diese an geeigneten Stellen errichtet werden. +Eine Windkraftanlage liefern immer dann Strom, wenn Wind vorhanden ist. Im Spiel gibt es keinen Wind, aber die Mod simuliert dies dadurch, dass sich nur morgens (5:00 - 9:00) und abends (17:00 - 21:00) die Windräder drehen. Eine Windkraftanlage liefert nur dann Strom, wenn sie an einer geeigneten Stelle aufgestellt ist. -Die TA Windkraftanlagen sind reine Offshore Anlagen, das heißt, die müssen im Meer (Wasser) errichtet werden. Dies bedeutet, dass um den Mast herum mit einem Abstand von 20 Blöcken nur Wasser sein darf und das mindestens 2 Blöcke tief. -Der Rotor muss in einer Höhe (Y-Koordinate) von 12 bis maximal 20 m platziert werden. Der Abstand zu weiteren Windkraftanlagen muss mindestens 14 m betragen. +Die TA Windkraftanlagen sind reine Offshore Anlagen, das heißt, die müssen im Meer errichtet werden. Dies bedeutet, dass Windkraftanlagen nur in einem Meer (occean) Biom errichtet werden können und dass um den Mast herum ausreichend Wasser und freie Sicht vorhanden sein müssen. + +Um eine geeignete Stelle zu finden, musst du mit dem Schraubenschlüssel (TechAge Info Werkzeug) auf das Wasser klicken. Ob diese Stelle für den Mast der Windkraftanlage geeignet ist, wird dir als Chat Nachricht angezeigt. Der Strom muss vom Rotor-Block durch den Mast nach unten geführt werden. Dazu zuerst die Stromleitung nach oben ziehen und das Stromkabel dann mit TA4 Säulenblöcke "verputzen". Unten kann eine Arbeitsplattform errichtet werden. Der Plan rechts zeigt den Aufbau im oberen Teil. diff --git a/manuals/manual_ta4_EN.md b/manuals/manual_ta4_EN.md index 381e257..1eeeb37 100644 --- a/manuals/manual_ta4_EN.md +++ b/manuals/manual_ta4_EN.md @@ -7,10 +7,11 @@ Renewable energy sources such as wind, sun and biofuels help you to leave the oi ## Wind Turbine -A wind turbine always delivers electricity when there is wind. There is no wind in the game, but the mod simulates this by only turning the wind turbines in the morning (5:00 a.m. - 9:00 a.m.) and in the evening (5:00 p.m. - 9:00 p.m.) and thus supplying electricity, provided they are positioned appropriately. +A wind turbine always supplies electricity when there is wind. There is no wind in the game, but the mod simulates this by turning the wind turbines only in the morning (5:00 - 9:00) and in the evening (17:00 - 21:00). A wind turbine only supplies electricity if it is set up in a suitable location. -The TA wind turbines are pure offshore plants, which means that they have to be installed in the sea (water). This means that there must be in the minimum 20 blocks of water around the mast and at least 2 blocks deep. -The rotor must be placed at a height (Y coordinate) of 12 to a maximum of 20 m. The distance to other wind turbines must be at least 14 m. +The TA wind power plants are pure offshore plants, which means that they have to be built in the sea. This means that wind turbines can only be build in a sea (occean) biome and that there must be sufficient water and a clear view around the mast. + +To find a suitable spot, click on the water with the wrench (TechAge Info Tool). A chat message will show you whether this position is suitable for the mast of the wind turbine. The current must be led from the rotor block down through the mast. First pull the power line up and then "plaster" the power cable with TA4 pillar blocks. A work platform can be built below. The plan on the right shows the structure in the upper part. diff --git a/wind_turbine/rotor.lua b/wind_turbine/rotor.lua index d608779..077a707 100644 --- a/wind_turbine/rotor.lua +++ b/wind_turbine/rotor.lua @@ -51,46 +51,9 @@ end local function add_rotor(pos, nvm, player_name) nvm.error = false - -- Check for next wind turbine - local pos1 = {x=pos.x-13, y=pos.y-9, z=pos.z-13} - local pos2 = {x=pos.x+13, y=pos.y+10, z=pos.z+13} - local num = #minetest.find_nodes_in_area(pos1, pos2, {"techage:ta4_wind_turbine"}) - if num > 1 then - if player_name then - techage.mark_region(player_name, pos1, pos2, "") - minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]").. - " "..S("The wind turbines are too close together!")) - end - M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error")) - nvm.error = true - return - end - - -- Check for water surface (occean) - pos1 = {x=pos.x-20, y=0, z=pos.z-20} - pos2 = {x=pos.x+20, y=1, z=pos.z+20} - local num = #minetest.find_nodes_in_area(pos1, pos2, {"default:water_source", "default:water_flowing", "ignore"}) - if num < (41*41*2-MAX_NUM_FOREIGN_NODES) then - if player_name then - techage.mark_region(player_name, pos1, pos2, "") - minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]").. - " "..S("More water expected (2 m deep)!")) - end - M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error")) - nvm.error = true - return - end - - if pos.y < 12 or pos.y > 20 then - if player_name then - pos1 = {x=pos.x-13, y=12, z=pos.z-13} - pos2 = {x=pos.x+13, y=20, z=pos.z+13} - techage.mark_region(player_name, pos1, pos2, "") - minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]").. - " "..S("No wind at this altitude!")) - end - M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..S("Error")) + if not techage.valid_place_for_windturbine(pos, nil, 1) then nvm.error = true + M(pos):set_string("infotext", S("TA4 Wind Turbine")..": "..S("Invalid position!")) return end