bugfixes
parent
c037ac6613
commit
74b62368ba
|
@ -104,10 +104,13 @@ local turn_on = nil
|
|||
|
||||
local function call_turn_on(pos, in_dir, sum)
|
||||
if not pos_already_reached(pos) then
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
local this = TP(pos)
|
||||
if this and this.turn_on then
|
||||
if this and (not this.valid_power_dir or this.valid_power_dir(pos, mem, in_dir)) then
|
||||
if this.turn_on then
|
||||
this.turn_on(pos, in_dir, sum)
|
||||
end
|
||||
end
|
||||
if this and this.animated_power_network then
|
||||
turn_tube_on(pos, in_dir, this.power_network, sum > 0)
|
||||
end
|
||||
|
|
|
@ -17,8 +17,10 @@ local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
|
||||
local POWER_CONSUME = 4
|
||||
local POWER_CONSUMPTION = 4
|
||||
|
||||
local Axle = techage.Axle
|
||||
local consumer = techage.consumer
|
||||
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
|
@ -35,13 +37,13 @@ local function valid_power_dir(pos, mem, in_dir)
|
|||
return mem.power_dir == in_dir
|
||||
end
|
||||
|
||||
local function turn_on(pos, in_dir, on)
|
||||
if on then
|
||||
local function turn_on_clbk(pos, in_dir, sum)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
if sum > 0 then
|
||||
swap_node(pos, "techage:consumer_on")
|
||||
else
|
||||
swap_node(pos, "techage:consumer")
|
||||
end
|
||||
-- end
|
||||
end
|
||||
|
||||
minetest.register_node("techage:consumer", {
|
||||
|
@ -56,23 +58,21 @@ minetest.register_node("techage:consumer", {
|
|||
'techage_filling_ta2.png^techage_frame_ta2.png',
|
||||
},
|
||||
techage = {
|
||||
turn_on = turn_on,
|
||||
power_consumption = techage.consumer_power_consumption,
|
||||
power_network = techage.Axle,
|
||||
power_consume = POWER_CONSUME,
|
||||
animated_power_network = true,
|
||||
turn_on = turn_on_clbk,
|
||||
read_power_consumption = consumer.read_power_consumption,
|
||||
power_network = Axle,
|
||||
power_side = "L",
|
||||
valid_power_dir = valid_power_dir,
|
||||
|
||||
animated_power_network = true,
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local mem = techage.consumer_after_place_node(pos, placer)
|
||||
mem.power_consume = POWER_CONSUME
|
||||
local mem = consumer.after_place_node(pos, placer)
|
||||
mem.power_consumption = POWER_CONSUMPTION
|
||||
end,
|
||||
|
||||
after_tube_update = techage.consumer_after_tube_update,
|
||||
after_dig_node = techage.consumer_after_dig_node,
|
||||
after_tube_update = consumer.after_tube_update,
|
||||
after_dig_node = consumer.after_dig_node,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2, cracky=2, crumbly=2},
|
||||
|
@ -119,17 +119,16 @@ minetest.register_node("techage:consumer_on", {
|
|||
},
|
||||
},
|
||||
techage = {
|
||||
turn_on = turn_on,
|
||||
power_consumption = techage.consumer_power_consumption,
|
||||
power_network = techage.Axle,
|
||||
power_consume = POWER_CONSUME,
|
||||
animated_power_network = true,
|
||||
turn_on = turn_on_clbk,
|
||||
read_power_consumption = consumer.read_power_consumption,
|
||||
power_network = Axle,
|
||||
power_side = "L",
|
||||
valid_power_dir = valid_power_dir,
|
||||
animated_power_network = true,
|
||||
},
|
||||
|
||||
after_place_node = techage.consumer_after_place_node,
|
||||
after_tube_update = techage.consumer_after_tube_update,
|
||||
after_dig_node = techage.consumer_after_dig_node,
|
||||
after_tube_update = consumer.after_tube_update,
|
||||
after_dig_node = consumer.after_dig_node,
|
||||
|
||||
paramtype2 = "facedir",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
|
|
Loading…
Reference in New Issue