ocean detection changed
This commit is contained in:
parent
13e8b17f62
commit
ec76d94ee3
@ -47,8 +47,8 @@ techage.register_category_page("ta4wt",
|
|||||||
"a pillar by means of TA4 Pillar nodes (power cables have to be inside).@n"..
|
"a pillar by means of TA4 Pillar nodes (power cables have to be inside).@n"..
|
||||||
"Please note the following limitations:@n"..
|
"Please note the following limitations:@n"..
|
||||||
"- pillar height between 10 and 19 m@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"..
|
"- can only be built offshore (20 m in all 4 directions is water)@n"..
|
||||||
"- 14 m free space in all 4 directions (e.g. to the next wind turbine)@n"..
|
"- more than 14 m to the next wind turbine@n"..
|
||||||
"- the wind blows only between 5 and 9 o'clock and between 17 and 21 o'clock"),
|
"- the wind blows only between 5 and 9 o'clock and between 17 and 21 o'clock"),
|
||||||
nil,
|
nil,
|
||||||
{},
|
{},
|
||||||
|
@ -29,6 +29,8 @@ local power = techage.power
|
|||||||
|
|
||||||
local Rotors = {}
|
local Rotors = {}
|
||||||
|
|
||||||
|
local MAX_NUM_FOREIGN_NODES = 50
|
||||||
|
|
||||||
local Face2Dir = {[0]=
|
local Face2Dir = {[0]=
|
||||||
{x=0, y=0, z=1},
|
{x=0, y=0, z=1},
|
||||||
{x=1, y=0, z=0},
|
{x=1, y=0, z=0},
|
||||||
@ -48,6 +50,8 @@ end
|
|||||||
|
|
||||||
local function add_rotor(pos, mem, player_name)
|
local function add_rotor(pos, mem, player_name)
|
||||||
mem.error = false
|
mem.error = false
|
||||||
|
|
||||||
|
-- Check for next wind turbine
|
||||||
local pos1 = {x=pos.x-14, y=pos.y-9, z=pos.z-14}
|
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 = #minetest.find_nodes_in_area(pos1, pos2, {"techage:ta4_wind_turbine"})
|
local num = #minetest.find_nodes_in_area(pos1, pos2, {"techage:ta4_wind_turbine"})
|
||||||
@ -61,8 +65,11 @@ local function add_rotor(pos, mem, player_name)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local data = minetest.get_biome_data({x=pos.x, y=-1, z=pos.z})
|
-- Check for water surface (occean)
|
||||||
if not techage.OceanIdTbl[data.biome] then
|
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
|
if player_name then
|
||||||
minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]")..
|
minetest.chat_send_player(player_name, S("[TA4 Wind Turbine]")..
|
||||||
" "..S("Wrong place for wind turbines!"))
|
" "..S("Wrong place for wind turbines!"))
|
||||||
@ -91,6 +98,9 @@ local function add_rotor(pos, mem, player_name)
|
|||||||
obj:set_rotation(yaw)
|
obj:set_rotation(yaw)
|
||||||
Rotors[hash] = obj
|
Rotors[hash] = obj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local own_num = M(pos):get_string("node_number") or ""
|
||||||
|
M(pos):set_string("infotext", S("TA4 Wind Turbine").." "..own_num)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function start_rotor(pos, mem)
|
local function start_rotor(pos, mem)
|
||||||
|
Loading…
Reference in New Issue
Block a user