rotor distance reduced

power distribution bugfix
powerswitch bugfix
This commit is contained in:
Joachim Stolberg 2019-09-17 22:28:39 +02:00
parent a9151bfd3e
commit 821e80fe88
3 changed files with 7 additions and 7 deletions

View File

@ -363,7 +363,7 @@ local function trigger_nodes(mst_pos, mst_mem, dec)
mem.pwr_node_alive_cnt = (mem.pwr_node_alive_cnt or 1) - dec
mem.pwr_power_provided_cnt = 2
if D.pwr then D.dbg("trigger_nodes", minetest.get_node(pos).name, mem.pwr_node_alive_cnt, mem.pwr_available2 or mem.pwr_available or mem.pwr_needed) end
if mem.pwr_node_alive_cnt >= 0 then
if mem.pwr_node_alive_cnt >= 0 or mem.pwr_state == NOPOWER then
if mem.pwr_available then
handle_generator(mst_mem, mem, pos, mem.pwr_available)
elseif mem.pwr_needed then

View File

@ -266,16 +266,16 @@ techage.register_node({"techage:powerswitch", "techage:powerswitch_on"}, {
on_recv_message = function(pos, src, topic, payload)
local node = minetest.get_node(pos)
if topic == "on" and node.name == "techage:powerswitch" then
switch_on(pos, node, "techage:powerswitch_on")
switch_on(pos, node, nil, "techage:powerswitch_on")
return true
elseif topic == "on" and node.name == "techage:powerswitchsmall" then
switch_on(pos, node, "techage:powerswitchsmall_on")
switch_on(pos, node, nil, "techage:powerswitchsmall_on")
return true
elseif topic == "off" and node.name == "techage:powerswitch_on" then
switch_off(pos, node, "techage:powerswitch")
switch_off(pos, node, nil, "techage:powerswitch")
return true
elseif topic == "off" and node.name == "techage:powerswitchsmall_on" then
switch_off(pos, node, "techage:powerswitchsmall")
switch_off(pos, node, nil, "techage:powerswitchsmall")
return true
elseif topic == "state" then
if node.name == "techage:powerswitch_on" or node.name == "techage:powerswitchsmall_on"then

View File

@ -52,8 +52,8 @@ local function add_rotor(pos, mem, player_name)
mem.error = false
-- Check for next wind turbine
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 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